forked from ben-manes/caffeine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
163 lines (131 loc) · 4.53 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
apply plugin: 'com.gradle.build-scan'
apply plugin: me.champeau.gradle.buildscans.RecipesPlugin
apply plugin: 'com.github.mjdetullio.gradle.coverity'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'jacoco'
buildscript {
apply from: "${rootDir}/gradle/dependencies.gradle"
repositories {
maven { url 'https://plugins.gradle.org/m2' }
mavenCentral()
jcenter()
}
dependencies {
classpath gradle_plugins.values()
}
}
buildScan {
licenseAgree = 'yes'
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
}
buildScanRecipes {
recipes 'git-status', 'travis-ci', 'disk-usage', 'gc-stats'
recipe 'git-commit', baseUrl: 'https://github.com/ben-manes/caffeine/tree'
}
task testReport(type: TestReport, group: 'Build') {
description = 'Generates an aggregate test report'
destinationDir = file("${buildDir}/reports/allTests")
}
allprojects {
apply from: "${rootDir}/gradle/eclipse.gradle"
repositories {
maven { url 'https://jitpack.io' }
mavenCentral()
jcenter()
}
}
subprojects {
apply plugin: 'com.github.ethankhall.semantic-versioning'
apply plugin: 'nebula.provided-base'
apply plugin: 'java'
apply plugin: 'osgi'
apply from: "${rootDir}/gradle/publish.gradle"
apply from: "${rootDir}/gradle/code_quality.gradle"
apply from: "${rootDir}/gradle/dependencies.gradle"
apply from: "${rootDir}/gradle/object_layout.gradle"
if (JavaVersion.current().isJava9Compatible()) {
tasks.uploadArchives.enabled = false
} else {
apply plugin: 'net.ltgt.errorprone'
}
sourceCompatibility = JavaVersion.VERSION_1_8
group = 'com.github.ben-manes.caffeine'
version.with {
major = 2 // incompatible API changes
minor = 4 // backwards-compatible additions
patch = 1 // backwards-compatible bug fixes
releaseBuild = rootProject.hasProperty('release')
}
archivesBaseName = path[1..-1].replaceAll(':', '-').toLowerCase()
dependencies {
provided libraries.jsr305
provided libraries.error_prone_annotations
testCompile libraries.guava
testCompile test_libraries.mockito
testCompile test_libraries.hamcrest
testCompile test_libraries.awaitility
testCompile test_libraries.osgi_compile
testRuntime test_libraries.osgi_runtime
}
configurations {
testArtifacts
}
tasks.withType(Test) {
if (!it.name.startsWith('slow')) {
rootProject.testReport.reportOn it
}
it.dependsOn('jar')
// ensure tasks don't overwrite the default report directories used by the 'test' task
reports.html.destination = "${buildDir}/reports/${name}"
reports.junitXml.destination = "${buildDir}/reports/${name}/results"
binResultsDir = file("${buildDir}/reports/${name}/results/binary/${name}")
}
task testJar(type: Jar, group: 'Build') {
description = 'Assembles a jar archive containing the test classes.'
baseName = "${archivesBaseName}-test"
from sourceSets.test.output
}
artifacts {
testArtifacts testJar
}
if (project != project(':caffeine')) {
javadoc.options.linksOffline(
"http://static.javadoc.io/${group}/caffeine/${version}/",
"${project(':caffeine').buildDir}/docs/javadoc/",
)
javadoc.dependsOn(project(':caffeine').javadoc)
}
}
// Only report code coverage for projects that are distributed
def publishedProjects = subprojects.findAll { it.path != ':simulator' }
task jacocoMerge(type: JacocoMerge) {
publishedProjects.each { subproject ->
executionData subproject.tasks.withType(Test)
}
}
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn publishedProjects.test, jacocoMerge
additionalSourceDirs = files(publishedProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(publishedProjects.sourceSets.main.allSource.srcDirs)
classDirectories = files(publishedProjects.sourceSets.main.output)
executionData jacocoMerge.destinationFile
reports {
html.enabled = true // human readable
xml.enabled = true // required by coveralls
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}
coveralls {
sourceDirs = publishedProjects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}
tasks.coveralls {
group = 'Coverage reports'
description = 'Uploads the aggregated coverage report to Coveralls'
dependsOn jacocoRootReport
onlyIf { System.env.'CI' && !JavaVersion.current().isJava9Compatible() }
}