forked from ilkinabdullayev/api-layer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
213 lines (178 loc) · 5.96 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
import java.util.regex.Matcher
//noinspection GroovyAssignabilityCheck
group 'org.zowe.apiml'
buildscript {
ext {
licenseGradlePluginVerion = '0.13.1'
}
ext.mavenRepositories = {
maven {
url artifactoryMavenSnapshotRepo
credentials {
username mavenUser
password mavenPassword
}
}
maven {
url artifactoryMavenRepo
credentials {
username mavenUser
password mavenPassword
}
}
}
repositories mavenRepositories
dependencies {
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5'
classpath 'com.palantir:jacoco-coverage:0.4.0'
classpath 'net.researchgate:gradle-release:2.7.0'
classpath "gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:${licenseGradlePluginVerion}"
classpath 'org.owasp:dependency-check-gradle:3.3.4'
}
}
apply plugin: 'com.palantir.jacoco-full-report'
apply from: 'gradle/license.gradle'
apply from: 'gradle/publish.gradle'
apply from: 'gradle/sonar.gradle'
apply from: 'gradle/coverage.gradle'
apply from: 'gradle/versions.gradle'
apply from: 'gradle/code-quality.gradle'
apply from: 'gradle/generate-pom.gradle'
allprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'com.github.hierynomus.license'
apply plugin: 'org.owasp.dependencycheck'
apply plugin: 'eclipse'
repositories mavenRepositories
sourceCompatibility = 1.8
version = version
idea {
module {
//noinspection GroovyAssignabilityCheck
outputDir file('build/classes/main')
//noinspection GroovyAssignabilityCheck
testOutputDir file('build/classes/test')
downloadJavadoc = true
downloadSources = true
}
}
}
subprojects {
license {
header rootProject.file('.licence/EPL-2.0-licence-header.txt')
ext.year = Calendar.getInstance().get(Calendar.YEAR)
excludes(["**/*.yml", "**/*.yaml", "**/*.json", "**/static", "**/*.sh", "**/*.txt", "**/*.p12", "**/*.xml", "**/*.jsp", "**/*.html", "**/*.jks"])
mapping {
java = 'SLASHSTAR_STYLE'
}
}
tasks.withType(Test) {
maxParallelForks = 1
}
test {
useJUnitPlatform()
}
dependencies {
testImplementation libraries.junitJupiter
testImplementation libraries.mockito_jupiter
testCompileOnly libraries.junit
testRuntimeOnly libraries.junitVintage
testImplementation 'org.junit.platform:junit-platform-launcher:1.6.0'
//For Idea
testImplementation 'org.junit.platform:junit-platform-commons:1.6.0'
testImplementation 'org.junit.platform:junit-platform-engine:1.6.0'
}
}
configurations {
all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
all*.exclude group: 'com.fasterxml.jackson.module', module: 'jackson-module-kotlin'
}
task buildBackendCore(dependsOn: [':gateway-service:build', ':discovery-service:build',
':api-catalog-services:build', ':helloworld-service:build']) {
description "Build core backend components (no UI)"
group "build"
}
task runIntegrationTests(dependsOn: ":integration-tests:runIntegrationTests") {
description "Run integration tests"
group "Integration tests"
}
task runAllIntegrationTests(dependsOn: ":integration-tests:runAllIntegrationTests") {
description "Run all integration tests"
group "Integration tests"
}
task jacocoSubProjects() {
subprojects.findAll { it.name in javaProjectsWithUnitTests }.each { dependsOn("${it.name}:jacocoTestReport") }
}
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
html.enabled true
}
}
task mergeCoverage() {
dependsOn test, jacocoFullReport
}
task coverage() {
mergeCoverage.mustRunAfter jacocoSubProjects
dependsOn mergeCoverage, jacocoSubProjects, jacocoTestReport, ":api-catalog-ui:javaScriptCoverage"
}
task publishAllVersions {
group 'Zowe Publishing'
description 'Publish ZIP file and SDK libraries to Zowe Artifactory'
doLast {
println 'Published ZIP file and libraries'
}
}
publishAllVersions.dependsOn publishSdkArtifacts
//-----------Release part start
apply plugin: 'net.researchgate.release'
ext.releaseScope = project.hasProperty('release.scope') ? project.getProperty('release.scope') : 'patch'
release {
failOnCommitNeeded = true
failOnPublishNeeded = true
failOnSnapshotDependencies = true
failOnUnversionedFiles = true
failOnUpdateNeeded = true
revertOnFail = true
preCommitText = '[Gradle Release plugin]'
preTagCommitMessage = 'Before tag commit'
tagCommitMessage = 'Release:'
tagTemplate = 'v${version}'
newVersionCommitMessage = 'Create new version:'
versionPropertyFile = 'gradle.properties'
buildTasks = ['build']
if (releaseScope == 'minor') {
versionPatterns = [
/[.]*\.(\d+)\.(\d+)[.]*/: { Matcher m, Project p -> m.replaceAll(".${(m[0][1] as int) + 1}.0") }
]
} else if (releaseScope == 'major') {
versionPatterns = [
/(\d+)\.(\d+)\.(\d+)[.]*/: { Matcher m, Project p -> m.replaceAll("${(m[0][1] as int) + 1}.0.0") }
]
} else {
versionPatterns = [
/(\d+)([^\d]*$)/: { Matcher m, Project p -> m.replaceAll("${(m[0][1] as int) + 1}${m[0][2]}") }
]
}
scmAdapters = [
net.researchgate.release.GitAdapter
]
git {
requireBranch = 'master'
pushToRemote = 'origin'
pushToBranchPrefix = ''
commitVersionFileOnly = false
signTag = false
}
}
afterReleaseBuild.dependsOn publishAllVersions
//-----------Release part end
if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}