-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
246 lines (205 loc) · 8.36 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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
import org.gradle.internal.jvm.Jvm
assert Jvm.current().javaVersion >= JavaVersion.VERSION_11: 'This project requires Java 11+'
buildscript {
repositories {
maven { url project.properties.repoMavenApacheOrgRepository }
maven { url project.properties.pluginsGradleOrgRepository }
maven { url project.properties.mvnrepositoryComRepository }
maven { url project.properties.mavenRepositoryRedhatComRepository }
}
dependencies {
classpath "com.netflix.nebula:gradle-ospackage-plugin:${project.properties.gradleOspackagePluginVersion}"
classpath "com.bmuschko:gradle-clover-plugin:${project.properties.gradleCloverPluginVersion}"
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:${project.properties.gradleGitPropertiesPluginVersion}"
classpath "gradle.plugin.com.webcohesion.enunciate:enunciate-gradle:${project.properties.enunciateGradlePluginVersion}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.properties.kotlinVersion}"
classpath "org.jetbrains.kotlin:kotlin-allopen:${project.properties.kotlinVersion}"
classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.properties.springBootVersion}"
classpath "org.apache.commons:commons-lang3:${project.properties.commonsLang3Version}"
classpath "gradle.plugin.com.dorongold.plugins:task-tree:${project.properties.gradleTaskTreePluginVersion}"
classpath "com.bmuschko:gradle-docker-plugin:${project.properties.gradleDockerPluginVersion}"
classpath "com.hubspot.jinjava:jinjava:${project.properties.jinJavaVersion}"
classpath "com.github.jengelman.gradle.plugins:shadow:${project.properties.gradleShadowPluginVersion}"
classpath "org.owasp:dependency-check-gradle:${project.properties.dependencyCheckVersion}"
}
}
apply plugin: 'com.bmuschko.clover'
apply plugin: 'org.owasp.dependencycheck'
description = 'ARIN Template Processor'
allprojects {
apply plugin: 'com.dorongold.task-tree'
group = 'ARIN'
project.ext.baseVersion = version
if (project.hasProperty('branch') &&
project.properties['branch'] != 'master' &&
project.properties['includeBranchInVersion'] == 'true'
) {
version = "${branch.replace('-', '.')}.$version"
}
repositories {
maven { url project.properties.repoMavenApacheOrgRepository }
maven { url project.properties.pluginsGradleOrgRepository }
maven { url project.properties.mvnrepositoryComRepository }
maven { url project.properties.mavenRepositoryRedhatComRepository }
}
configurations.all {
exclude group: 'commons-httpclient', module: 'commons-httpclient'
exclude group: 'javassist', module: 'javassist'
exclude module: 'jboss-seam-jul'
exclude group: 'org.slf4j', module: 'jcl-over-slf4j'
exclude group: 'org.slf4j', module: 'slf4j-simple'
resolutionStrategy {
force("commons-beanutils:commons-beanutils:${project.properties.commonsBeanutilsVersion}")
force("commons-codec:commons-codec:${project.properties.commonsCodecVersion}")
force("commons-collections:commons-collections:${project.properties.commonsCollectionsVersion}")
force("commons-lang:commons-lang:${project.properties.commonsLangVersion}")
force("javax.faces:jsf-impl:${project.properties.jsfImplVersion}")
force("junit:junit:${project.properties.junitVersion}")
force("org.javassist:javassist:${project.properties.javassistVersion}")
force("org.jboss.seam:jboss-seam:${project.properties.jbossSeamVersion}")
force("org.jboss.threads:jboss-threads:${project.properties.jbossThreadsVersion}")
force("org.testng:testng:${project.properties.testngVersion}")
force("xml-apis:xml-apis:${project.properties.xmlApisVersion}")
force("org.apache.velocity:velocity:${project.properties.velocityVersion}")
}
}
plugins.withType(JavaPlugin) {
def targetJavaVersion = JavaVersion.VERSION_11
sourceCompatibility = targetJavaVersion
targetCompatibility = targetJavaVersion
test {
onlyIf { project.properties.skipTests != 'true' }
def pathname = '/src/test/resources/testng.xml'
useTestNG() {
if (file("$projectDir$pathname").exists()) {
suites pathname
}
}
}
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
if (project.properties.useClover == 'true' && !file("$projectDir/src/main/kotlin").exists()) {
project.apply plugin: 'com.bmuschko.clover'
dependencies {
clover "org.openclover:clover:${project.properties.cloverVersion}"
}
clover {
def tasks = []
if (project.properties.skipTests != 'true') {
tasks.add('test')
}
testIncludes = ['**/*Test.java', '**/*Tests.java']
includes = ['**/net/arin/**/*.java']
includeTasks = tasks
report {
html = true
xml = true
}
if (project.properties.enforceCodeCoverage == 'true' &&
project.properties.skipTests != 'true' &&
project.hasProperty('codeCoveragePercentage')
) {
targetPercentage = "${project.properties.codeCoveragePercentage}%"
}
}
if (project.properties.skipTests != 'true') {
check.finalizedBy cloverGenerateReport
cloverGenerateReport.outputs.upToDateWhen { false }
}
}
compileJava {
options.compilerArgs << '-parameters'
}
}
plugins.withType(WarPlugin) {
def resourceProperties = [
projectVersion: version,
buildNumber : project.properties.buildNumber,
seamDebug : project.properties.seamDebug
]
war.inputs.properties(resourceProperties)
processResources.inputs.properties(resourceProperties)
war {
filesMatching("**/components.**") {
expand resourceProperties
}
}
processResources {
filesMatching("**/components.**") {
expand resourceProperties
}
}
test {
systemProperty 'webapp.root', webAppDir
}
}
}
if (project.properties.uploadArchivesAfterGlobalBuildSuccess == 'true') {
project.getTasksByName('pushDockerImage', true).each {
it.mustRunAfter rootProject.getTasksByName('build', true)
}
}
clover {
report {
html = true
xml = true
}
}
dependencyCheck {
formats = ['XML', 'HTML']
analyzers {
assemblyEnabled = false
bundleAuditEnabled = false
}
}
task listAllDependencies {
dependsOn allprojects.collect { "$it.path:dependencies" }
}
task aggregateTestReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
reportOn project.allprojects*.tasks*.withType(Test)
}
ext {
def imageName
if (project.hasProperty('imageName')) {
imageName = "${project.properties.imageName}"
} else {
imageName = 'arin-tp'
}
def imageTag
if (project.hasProperty('imageTag')) {
imageTag = "${project.properties.imageTag}"
} else {
if (!project.hasProperty('branch')) {
imageTag = 'latest'
} else if (project.properties.branch == 'master') {
imageTag = 'master'
} else {
imageTag = "f_${project.properties.branch}"
}
}
dockerImage = "$imageName:$imageTag"
}
task buildDockerImage() {
if (project.properties.skipTests != 'true') {
it.mustRunAfter rootProject.getTasksByName('test', true)
}
it.mustRunAfter rootProject.getTasksByName('build', true)
doFirst {
exec {
executable 'docker'
args 'build', '-t', dockerImage, '.'
}
}
}
task pushDockerImage() {
dependsOn buildDockerImage
doFirst {
exec {
executable 'docker'
args 'push', dockerImage
}
}
}