-
Notifications
You must be signed in to change notification settings - Fork 273
/
build.gradle
255 lines (225 loc) · 8.42 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
247
248
249
250
251
252
253
254
255
plugins {
// Top level plugins
id 'com.github.kt3k.coveralls' version '2.12.2'
id 'com.github.node-gradle.node' version '7.1.0'
id 'net.researchgate.release' version '3.0.2'
// Records all tasks in task graph, generates `build/reports/visteg.dot`
// dot file can be converted to an image using graphviz. `dot -Tsvg -O -v visteg.dot`
// id 'cz.malohlava.visteg' version '1.0.5'
// Sub project plugins
id 'com.github.sherter.google-java-format' version '0.9' apply false
id 'nebula.lint' version '17.8.0' apply false
id 'net.ltgt.errorprone' version '4.0.1' apply false
id 'com.github.spotbugs' version '4.8.0' apply false
}
description = "Apereo uPortal $version"
/*======== Dependency Management ========**/
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
node {
version = nodejsVersion
download = true
}
allprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'eclipse'
apply plugin: 'com.github.spotbugs'
apply plugin: 'idea'
apply plugin: 'nebula.lint'
apply plugin: 'groovy'
apply plugin: 'codenarc'
apply plugin: 'com.github.sherter.google-java-format'
apply plugin: 'net.ltgt.errorprone'
configurations {
// Banned dependencies
all*.exclude group: 'commons-logging', module: 'commons-logging'
all*.exclude group: 'commons-logging', module: 'commons-logging-api'
all*.exclude group: 'log4j', module: 'log4j'
all*.exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.3.4'
errorproneJavac "com.google.errorprone:javac:9+181-r4173-1"
}
codenarc {
toolVersion = '3.5.0'
reportFormat = 'console'
}
// Version has to be set directly here, using a variable does not set Java compatability version
sourceCompatibility = 1.8
gradleLint.criticalRules = [
'overridden-dependency-version',
'dependency-parentheses',
'dependency-tuple',
'empty-closure',
'duplicate-dependency-class'
]
/*======== Static Analysis ========*/
spotbugs {
toolVersion = '4.8.6'
// allow build to continue to other sub projects
ignoreFailures = true
}
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
enabled = gradle.startParameter.taskNames.contains(it.name)
reports {
html {
enabled = true
destination = file("$buildDir/reports/spotbugs/main/spotbugs.html")
stylesheet = 'fancy-hist.xsl'
}
}
}
googleJavaFormat {
toolVersion '1.7'
options style: 'AOSP'
exclude '**/generated-sources'
}
/*======== Aggregate Dependencies Report ========*/
task dependenciesRecursive(type: DependencyReportTask) {
group = 'Help'
description = 'Provides a complete report on project dependencies; use option (e.g.) --configuration compile to narrow'
}
}
/*======== Child Projects ========*/
subprojects {
/*======== Plugins ========*/
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'signing'
/*======== Dependency Management ========**/
repositories {
mavenLocal()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
testImplementation "junit:junit:${junitVersion}"
testImplementation "org.easymock:easymock:${easymockVersion}"
testImplementation "org.hamcrest:hamcrest-all:${hamcrestVersion}"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation "org.springframework:spring-test:${springVersion}"
testImplementation "org.xmlunit:xmlunit-legacy:${xmlunitVersion}"
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0'
}
/* Release Management
*
* Based on Sonatype's guide for publishing w/ Gradle: http://central.sonatype.org/pages/gradle.html
*/
ext {
publishingUsername = project.hasProperty('ossrhUsername') ? project.getProperty('ossrhUsername') : ""
publishingPassword = project.hasProperty('ossrhPassword') ? project.getProperty('ossrhPassword') : ""
publishingRepositoryUrl = project.hasProperty('ossrhUrl') ? project.getProperty('ossrhUrl') : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
publishingRepositoryUrlSnapshot = project.hasProperty('ossrhUrlSnapshot') ? project.getProperty('ossrhUrlSnapshot') : "https://oss.sonatype.org/content/repositories/snapshots/"
}
signing {
required { gradle.taskGraph.hasTask('uploadArchives') }
sign configurations.archives
}
tasks.withType(Javadoc).all {
// disable JavaDocs until we start using them again in our website
enabled = false
}
tasks.withType(Jar) {
from(project.projectDir) {
include "${rootDir}/LICENSE"
into 'META-INF'
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar, sourcesJar
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: publishingRepositoryUrl) {
authentication(userName: publishingUsername, password: publishingPassword)
}
snapshotRepository(url: publishingRepositoryUrlSnapshot) {
authentication(userName: publishingUsername, password: publishingPassword)
}
pom.project {
name 'uPortal'
packaging 'jar'
// optionally artifactId can be defined here
description 'Enterprise open source portal built by and for the higher education community.'
url 'https://github.com/uPortal-Project/uPortal'
scm {
connection 'scm:[email protected]:uPortal-Project/uPortal.git'
url 'https://github.com/uPortal-Project/uPortal'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
organization 'uPortal Developers'
organizationUrl 'https://github.com/uPortal-Project/uPortal/graphs/contributors'
}
}
}
}
}
}
afterReleaseBuild.dependsOn uploadArchives
def jacocoExecutionDataFiles = fileTree(buildDir).include("/jacoco/*.exec")
jacocoTestReport {
getExecutionData().setFrom(jacocoExecutionDataFiles)
}
}
/*
* Configuration for the 'gradle-release' plugin (https://github.com/researchgate/gradle-release)
*/
release {
tagTemplate = 'v${version}' // Looks like it should be a GString, but not necessary
git {
requireBranch.set('')
}
}
task jacocoAggregateReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
getAdditionalSourceDirs().setFrom(files(subprojects.sourceSets.main.allSource.srcDirs))
getSourceDirectories().setFrom(files(subprojects.sourceSets.main.allSource.srcDirs))
getClassDirectories().setFrom(files(subprojects.sourceSets.main.output))
getExecutionData().setFrom(files(subprojects.jacocoTestReport.executionData))
reports {
xml.enabled = true
html.enabled = true
}
onlyIf = {
true
}
doFirst {
getExecutionData().setFrom(files(getExecutionData().findAll {
it.exists()
}))
}
}
coveralls {
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoAggregateReport/jacocoAggregateReport.xml"
sourceDirs = files(allprojects.sourceSets.main.allSource.srcDirs).files.absolutePath
}