-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathbuild.gradle
More file actions
178 lines (147 loc) · 5.12 KB
/
build.gradle
File metadata and controls
178 lines (147 loc) · 5.12 KB
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
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'net.ltgt.errorprone' version '5.1.0' apply false
id 'org.asciidoctor.jvm.convert' version '4.0.5'
id 'org.ajoberstar.git-publish' version '4.2.2'
id 'com.github.hierynomus.license' version '0.16.1' apply false
}
gradle.rootProject {
apply plugin: 'distribution'
}
develocity {
buildScan {
publishing.onlyIf { System.getenv("CI") != null }
termsOfUseUrl = 'https://gradle.com/terms-of-service'
termsOfUseAgree = 'yes'
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'test-report-aggregation'
//apply plugin: 'findbugs'
version = consensusjVersion // set in gradle.properties
group = 'com.msgilligan'
repositories {
mavenCentral()
}
// tasks.withType(FindBugs) {
// reports {
// xml.enabled false
// html.enabled true
// }
// }
}
subprojects {
dependencies {
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
annotationProcessor "com.uber.nullaway:nullaway:${nullAwayVersion}"
}
configurations.configureEach {
resolutionStrategy {
force "org.apache.groovy:groovy:${groovyVersion}"
force "org.apache.groovy:groovy-json:${groovyVersion}"
}
// Ensure usage of Groovy 4.0 which has new Maven co-ordinates
resolutionStrategy.capabilitiesResolution.all {
if (capability.group.equals("org.codehaus.groovy")) {
selectHighestVersion()
}
}
}
java {
withJavadocJar()
withSourcesJar()
}
compileJava {
options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) {
options.compilerArgs += ["-XDaddTypeAnnotationsToSymbol=true"]
}
options.encoding = 'UTF-8'
options.release = 11
}
tasks.withType(GroovyCompile).configureEach {
options.encoding = 'UTF-8'
}
tasks.withType(AbstractArchiveTask).configureEach {
// This should result in reproducible JAR builds
// See: https://docs.gradle.org/current/userguide/working_with_files.html#sec:reproducible_archives
preserveFileTimestamps = false
reproducibleFileOrder = true
}
tasks.withType(Jar).configureEach {
// Normalize permissions for reproducible builds
dirPermissions {
unix("0755")
}
filePermissions {
unix("0644")
}
}
tasks.withType(Javadoc).configureEach {
// Support reproducible JavaDoc builds
options.noTimestamp = true
}
// To support nativeTest, we are migrating away from having all subprojects use Spock by default
def spockLess = ["consensusj-jrpc", "consensusj-jrpc-echod"]
boolean useSpock = !spockLess.contains(it.name)
testing {
suites {
configureEach {
useJUnitJupiter()
dependencies {
implementation platform("org.junit:junit-bom:${junitJupiterVersion}")
implementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
runtimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
runtimeOnly "org.slf4j:slf4j-jdk14:${slf4jVersion}"
annotationProcessor "com.uber.nullaway:nullaway:${nullAwayVersion}"
if (useSpock) {
implementation "org.apache.groovy:groovy:${groovyVersion}"
implementation("org.spockframework:spock-core:${spockVersion}") {
exclude module: "groovy-all"
}
runtimeOnly "net.bytebuddy:byte-buddy:1.18.8" // Lets Spock mock classes (in addition to interfaces)
runtimeOnly "org.objenesis:objenesis:3.4" // Lets Spock mock classes with constructor arguments
}
}
}
}
}
}
apply from: 'gradle/idea.gradle'
apply from: 'gradle/javadoc.gradle'
apply from: 'gradle/asciidoctor.gradle'
apply from: 'gradle/github-pages.gradle'
apply from: 'gradle/maven-publish.gradle'
apply from: 'gradle/licenseCheck.gradle'
dependencies {
testReportAggregation project(':').subprojects
}
tasks.named('check') {
dependsOn tasks.named('testAggregateTestReport', TestReport)
}
build.dependsOn subprojects.build
tasks.register('buildCI') { dependsOn build, javadocAll /*, asciidoctor */ }
tasks.named('installDist').configure {
destinationDir = layout.buildDirectory.dir('artifacts').get().getAsFile()
}
distributions {
main {
contents {
project.subprojects.each { sub ->
into(sub.name) {
from sub.jar
from sub.sourcesJar
from sub.javadocJar
from sub.generatePomFileForJarPublication
from sub.generateMetadataFileForJarPublication
}
}
}
}
}