Skip to content

Commit 9371783

Browse files
authored
attempt to upgrade builds to gradle 7 (#1764)
* update gradle to latest * update protobuf plugin * can't do afterEvaluate with gradle 7, it maybe didn't do anything anyway * pull changes from #1760 (override previous changes) * remove implicit dependency warnings * address PR comments and make fdb-extensions an implementation dependency for: examples, icu, lucene, and spatial
1 parent 527b799 commit 9371783

File tree

15 files changed

+252
-199
lines changed

15 files changed

+252
-199
lines changed

Diff for: build.gradle

+3-11
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ buildscript {
3434
}
3535

3636
plugins {
37-
id 'com.google.protobuf' version '0.8.15'
37+
id 'com.google.protobuf' version '0.8.19'
3838
id 'com.github.ben-manes.versions' version '0.38.0'
3939
id 'com.github.spotbugs' version '4.6.1'
4040
id 'com.jfrog.artifactory' version '4.21.0'
@@ -53,7 +53,7 @@ apply from: 'gradle/sonar.gradle'
5353

5454
allprojects {
5555
apply plugin: 'base'
56-
apply plugin: 'java'
56+
apply plugin: 'java-library'
5757
apply plugin: 'maven-publish'
5858
apply plugin: 'project-reports'
5959
apply plugin: 'com.github.ben-manes.versions'
@@ -114,20 +114,12 @@ allprojects {
114114
}
115115

116116
// Create the sources jar
117-
task sourcesJar(type: Jar) {
117+
task sourcesJar(type: Jar, dependsOn: 'compileJava') {
118118
description = "Assembles a Jar archive containing the main sources."
119119
group = JavaBasePlugin.DOCUMENTATION_GROUP
120120
appendix = null
121121
classifier = "sources"
122122
from sourceSets.main.allSource
123-
124-
// gradle doesn't currently support autowiring for (generated) sources dirs, so we wire manually
125-
// we do this here so that we can keep codegen plugins generic/replaceable
126-
dependsOn {
127-
afterEvaluate {
128-
tasks.compileProtobuf
129-
}
130-
}
131123
}
132124

133125
// Create the Javadoc jar

Diff for: examples/examples.gradle

+7-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ apply plugin: 'application'
2626

2727
def coreProject = ":${ext.coreProjectName}"
2828
dependencies {
29-
compile project(coreProject)
30-
compile "com.google.protobuf:protobuf-java:${protobufVersion}"
31-
compile "org.slf4j:slf4j-api:${slf4jVersion}"
32-
runtime "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}" // binding
33-
runtime "org.apache.logging.log4j:log4j-core:${log4jVersion}" // library
29+
implementation project(coreProject)
30+
implementation project(':fdb-extensions')
31+
implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
32+
implementation "com.google.protobuf:protobuf-java:${protobufVersion}"
33+
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
34+
runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}" // binding
35+
runtimeOnly "org.apache.logging.log4j:log4j-core:${log4jVersion}" // library
3436
}
3537

3638
mainClassName = 'com.apple.foundationdb.record.sample.Main'

Diff for: fdb-extensions/fdb-extensions.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ apply from: rootProject.file('gradle/strict.gradle')
2222
apply from: rootProject.file('gradle/publishing.gradle')
2323

2424
dependencies {
25-
compile "org.foundationdb:fdb-java:${fdbVersion}"
26-
compile "com.google.guava:guava:${guavaVersion}"
27-
compile "org.slf4j:slf4j-api:${slf4jVersion}"
28-
compile "com.squareup:javapoet:${javaPoetVersion}"
25+
api "org.foundationdb:fdb-java:${fdbVersion}"
26+
implementation "com.google.guava:guava:${guavaVersion}"
27+
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
28+
implementation "com.squareup:javapoet:${javaPoetVersion}"
2929
compileOnly "com.google.code.findbugs:jsr305:${jsr305Version}"
3030
compileOnly "com.google.auto.service:auto-service:${autoServiceVersion}"
3131
annotationProcessor "com.google.auto.service:auto-service:${autoServiceVersion}"
@@ -34,8 +34,8 @@ dependencies {
3434
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
3535
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
3636
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
37-
testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}" // binding
38-
testCompile "org.apache.logging.log4j:log4j-core:${log4jVersion}" // library
37+
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}" // binding
38+
testImplementation "org.apache.logging.log4j:log4j-core:${log4jVersion}" // library
3939
}
4040

4141
test {

Diff for: fdb-record-layer-core-shaded/fdb-record-layer-core-shaded.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ apply plugin: 'com.github.johnrengelman.shadow'
2323
def coreProject = ":${ext.coreProjectName}"
2424

2525
dependencies {
26-
compile project(coreProject)
26+
implementation project(coreProject)
2727
}
2828

2929
shadowJar {
@@ -41,6 +41,8 @@ build.dependsOn {
4141
shadowJar
4242
}
4343

44+
createDistribution {dependsOn('shadowJar')}
45+
4446
task shadedSourcesJar(type: Jar) {
4547
description = "Assembles a Jar archive containing the main sources."
4648
group = JavaBasePlugin.DOCUMENTATION_GROUP

Diff for: fdb-record-layer-core/fdb-record-layer-core.gradle

+18-18
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,37 @@ if (!hasProperty('coreNotStrict')) {
2828
}
2929

3030
configurations {
31-
repl.extendsFrom testRuntime
31+
repl.extendsFrom testRuntimeOnly
3232
}
3333

3434
dependencies {
35-
compile project(':fdb-extensions')
35+
implementation project(':fdb-extensions')
3636
annotationProcessor project(':fdb-extensions')
3737

38-
compile "com.google.protobuf:protobuf-java:${protobufVersion}"
39-
compile "org.slf4j:slf4j-api:${slf4jVersion}"
40-
compile "org.apache.commons:commons-lang3:${commonsLang3Version}"
41-
compile "com.google.guava:guava:${guavaVersion}"
38+
api "com.google.protobuf:protobuf-java:${protobufVersion}"
39+
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
40+
implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
41+
implementation "com.google.guava:guava:${guavaVersion}"
4242
compileOnly "com.google.code.findbugs:jsr305:${jsr305Version}"
4343
compileOnly "com.google.auto.service:auto-service:${autoServiceVersion}"
4444
annotationProcessor "com.google.auto.service:auto-service:${autoServiceVersion}"
4545

46-
testCompile project(path: ':fdb-extensions', configuration: 'tests')
47-
testCompile "org.hamcrest:hamcrest:${hamcrestVersion}"
48-
testCompile "com.beust:jcommander:${jcommanderVersion}"
49-
testCompile "org.apache.commons:commons-math3:${commonsMath3Version}"
50-
testCompile "org.apache.commons:commons-lang3:${commonsLang3Version}"
46+
testImplementation project(path: ':fdb-extensions', configuration: 'tests')
47+
testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
48+
testImplementation "com.beust:jcommander:${jcommanderVersion}"
49+
testImplementation "org.apache.commons:commons-math3:${commonsMath3Version}"
50+
testImplementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
5151
testCompileOnly "com.google.code.findbugs:jsr305:${jsr305Version}"
5252
testCompileOnly "com.google.auto.service:auto-service:${autoServiceVersion}"
53-
testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}" // binding
54-
testCompile "org.apache.logging.log4j:log4j-core:${log4jVersion}" // library
53+
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}" // binding
54+
testImplementation "org.apache.logging.log4j:log4j-core:${log4jVersion}" // library
5555

56-
testCompile "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
57-
testCompile "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
56+
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
57+
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
5858
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
5959
testAnnotationProcessor "com.google.auto.service:auto-service:${autoServiceVersion}"
60-
testCompile "org.jline:jline:${jlineVersion}"
61-
testCompile "org.junit.platform:junit-platform-launcher:${junitPlatformVersion}"
60+
testImplementation "org.jline:jline:${jlineVersion}"
61+
testImplementation "org.junit.platform:junit-platform-launcher:${junitPlatformVersion}"
6262
repl "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
6363
}
6464

@@ -118,7 +118,7 @@ task testShadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.Shadow
118118
classifier = 'standalone-tests'
119119
from sourceSets.main.output
120120
from sourceSets.test.output
121-
configurations = [ project.configurations.testRuntime ]
121+
configurations = [ project.configurations.testRuntimeOnly ]
122122
manifest {
123123
inheritFrom project.tasks.jar.manifest
124124
attributes 'Main-Class': 'com.apple.foundationdb.record.provider.foundationdb.FDBRecordStorePerformanceTest',

Diff for: fdb-record-layer-icu/fdb-record-layer-icu.gradle

+11-8
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,25 @@ apply from: rootProject.file('gradle/strict.gradle')
2222

2323
def coreProject = ":${ext.coreProjectName}"
2424
dependencies {
25-
compile project(coreProject)
26-
compile "com.ibm.icu:icu4j:${icuVersion}"
27-
compile "com.google.protobuf:protobuf-java:${protobufVersion}"
28-
compile "org.slf4j:slf4j-api:${slf4jVersion}"
25+
api project(coreProject)
26+
implementation project(':fdb-extensions')
27+
implementation "com.ibm.icu:icu4j:${icuVersion}"
28+
implementation "com.google.protobuf:protobuf-java:${protobufVersion}"
29+
implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
30+
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
2931
compileOnly "com.google.code.findbugs:jsr305:${jsr305Version}"
3032
compileOnly "com.google.auto.service:auto-service:${autoServiceVersion}"
3133
annotationProcessor "com.google.auto.service:auto-service:${autoServiceVersion}"
3234

33-
testCompile project(path: coreProject, configuration: 'tests')
35+
testImplementation project(path: coreProject, configuration: 'tests')
36+
testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
3437
testCompileOnly "com.google.code.findbugs:jsr305:${jsr305Version}"
3538
testCompileOnly "com.google.auto.service:auto-service:${autoServiceVersion}"
36-
testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
37-
testRuntime "org.apache.logging.log4j:log4j-core:${log4jVersion}"
39+
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
40+
testRuntimeOnly "org.apache.logging.log4j:log4j-core:${log4jVersion}"
3841

3942
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
40-
testCompile "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
43+
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
4144
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
4245
}
4346

Diff for: fdb-record-layer-lucene/fdb-record-layer-lucene.gradle

+16-11
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,26 @@ if (!hasProperty('coreNotStrict')) {
2626

2727
def coreProject = ":${ext.coreProjectName}"
2828
dependencies {
29-
compile project(coreProject)
30-
compile "org.apache.lucene:lucene-core:${luceneVersion}"
31-
compile "org.apache.lucene:lucene-queryparser:${luceneVersion}"
32-
compile "org.apache.lucene:lucene-analyzers-common:${luceneVersion}"
33-
compile "org.apache.lucene:lucene-suggest:${luceneVersion}"
34-
compile "org.apache.lucene:lucene-highlighter:${luceneVersion}"
35-
testCompile project(path: coreProject, configuration: 'tests')
29+
api project(coreProject)
30+
implementation project(':fdb-extensions')
31+
implementation "org.apache.lucene:lucene-core:${luceneVersion}"
32+
implementation "org.apache.lucene:lucene-queryparser:${luceneVersion}"
33+
implementation "org.apache.lucene:lucene-analyzers-common:${luceneVersion}"
34+
implementation "org.apache.lucene:lucene-suggest:${luceneVersion}"
35+
implementation "org.apache.lucene:lucene-highlighter:${luceneVersion}"
36+
implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
37+
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
38+
testImplementation project(path: coreProject, configuration: 'tests')
3639
testCompileOnly "com.google.code.findbugs:jsr305:${jsr305Version}"
3740
compileOnly "com.google.auto.service:auto-service:${autoServiceVersion}"
3841
annotationProcessor "com.google.auto.service:auto-service:${autoServiceVersion}"
39-
testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
40-
testRuntime "org.apache.logging.log4j:log4j-core:${log4jVersion}"
42+
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
43+
testRuntimeOnly "org.apache.logging.log4j:log4j-core:${log4jVersion}"
4144

4245
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
43-
testCompile "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
46+
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
47+
testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
48+
testImplementation project(path: ':fdb-extensions', configuration: 'tests')
4449
testCompileOnly "com.google.auto.service:auto-service:${autoServiceVersion}"
4550
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
4651
testAnnotationProcessor "com.google.auto.service:auto-service:${autoServiceVersion}"
@@ -67,4 +72,4 @@ publishing {
6772
}
6873
}
6974
}
70-
}
75+
}

Diff for: fdb-record-layer-spatial/fdb-record-layer-spatial.gradle

+14-10
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,28 @@ if (!hasProperty('coreNotStrict')) {
2626

2727
def coreProject = ":${ext.coreProjectName}"
2828
dependencies {
29-
compile project(coreProject)
30-
compile "org.locationtech.jts.io:jts-io-common:${jtsVersion}"
31-
compile "com.geophile:geophile:${geophileVersion}"
32-
compile "com.google.protobuf:protobuf-java:${protobufVersion}"
33-
compile "org.slf4j:slf4j-api:${slf4jVersion}"
34-
compile "org.slf4j:jul-to-slf4j:${slf4jVersion}"
29+
api project(coreProject)
30+
implementation project(':fdb-extensions')
31+
implementation "org.locationtech.jts.io:jts-io-common:${jtsVersion}"
32+
implementation "com.geophile:geophile:${geophileVersion}"
33+
implementation "com.google.protobuf:protobuf-java:${protobufVersion}"
34+
implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
35+
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
36+
implementation "org.slf4j:jul-to-slf4j:${slf4jVersion}"
3537
compileOnly "com.google.code.findbugs:jsr305:${jsr305Version}"
3638
compileOnly "com.google.auto.service:auto-service:${autoServiceVersion}"
3739
annotationProcessor "com.google.auto.service:auto-service:${autoServiceVersion}"
3840

39-
testCompile project(path: coreProject, configuration: 'tests')
41+
testImplementation project(path: ':fdb-extensions', configuration: 'tests')
42+
testImplementation project(path: coreProject, configuration: 'tests')
4043
testCompileOnly "com.google.code.findbugs:jsr305:${jsr305Version}"
4144
testCompileOnly "com.google.auto.service:auto-service:${autoServiceVersion}"
42-
testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
43-
testRuntime "org.apache.logging.log4j:log4j-core:${log4jVersion}"
45+
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
46+
testRuntimeOnly "org.apache.logging.log4j:log4j-core:${log4jVersion}"
4447

4548
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
46-
testCompile "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
49+
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
50+
testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
4751
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
4852
}
4953

Diff for: gradle/coverage.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ subprojects {
107107
}
108108
}
109109

110-
p.task('copyCoverageSources', type: Copy) {
110+
p.task('copyCoverageSources', type: Copy, dependsOn: ['compileJava']) {
111111
into coverageSrcDir
112112
from(sourceSets.main.java) {
113113
if (excludeFiles != null) {

Diff for: gradle/proto.gradle

+10
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ sourceSets {
3636
}
3737
}
3838

39+
configurations {
40+
compileProtoPath {
41+
// The default generated by com.google.protobuf.gradle.ProtobufPlugin.createCompileProtoPathConfiguration
42+
// forgets api.
43+
extendsFrom api, compileOnly, implementation
44+
}
45+
}
46+
3947
protobuf {
4048
generatedFilesBaseDir = "${projectDir}/protogen"
4149
clean {
@@ -57,7 +65,9 @@ protobuf {
5765
task.addIncludeDir(files("${projectDir}/src/main/proto/include"))
5866
task.addIncludeDir(files("${projectDir}/src/main/proto${protoMajorVersion}/include"))
5967
if (task.name != 'generateProto') {
68+
// test protos likely include both main protos and their dependencies.
6069
task.addIncludeDir(files("${projectDir}/src/main/proto"))
70+
task.addIncludeDir(files("${projectDir}/.out/extracted-include-protos/main"))
6171
}
6272
}
6373
}

Diff for: gradle/testing.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ task testJar(type: Jar, dependsOn: testClasses) {
122122

123123
configurations {
124124
tests {
125-
extendsFrom testRuntime
125+
extendsFrom testRuntimeOnly
126126
}
127127
}
128128

Diff for: gradle/wrapper/gradle-wrapper.jar

4.11 KB
Binary file not shown.

Diff for: gradle/wrapper/gradle-wrapper.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=9af5c8e7e2cd1a3b0f694a4ac262b9f38c75262e74a9e8b5101af302a6beadd7
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
3+
distributionSha256Sum=e6d864e3b5bc05cc62041842b306383fc1fefcec359e70cebb1d470a6094ca82
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)