Skip to content

Commit f3f4ed4

Browse files
committed
Upgrade to Gradle 8.2.1 and upgrade plugins
Most changes are migrating from conventions to the equivalent extensions. JMH, AppEngine, and Jib plugins trigger future compatibility warnings with `--warning-mode all`. The movement of configurations was to allow sourceSets to create the configurations and then we just configure them. When configurations were before sourceSets, we'd implicitly create the configuration. The examples were _not_ updated to the newer Gradle, although the non-Android examples work with the newer Gradle. The Android examples use an older Android Gradle Plugin which will need to be upgraded first. grpc#10445
1 parent 6d48271 commit f3f4ed4

File tree

28 files changed

+140
-88
lines changed

28 files changed

+140
-88
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ For non-Android protobuf-based codegen integrated with the Gradle build system,
152152
you can use [protobuf-gradle-plugin][]:
153153
```gradle
154154
plugins {
155-
id 'com.google.protobuf' version '0.9.1'
155+
id 'com.google.protobuf' version '0.9.4'
156156
}
157157
158158
protobuf {
@@ -185,7 +185,7 @@ use protobuf-gradle-plugin but specify the 'lite' options:
185185

186186
```gradle
187187
plugins {
188-
id 'com.google.protobuf' version '0.9.1'
188+
id 'com.google.protobuf' version '0.9.4'
189189
}
190190
191191
protobuf {

android-interop-testing/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,16 @@ tasks.withType(JavaCompile).configureEach {
122122
"|")
123123
}
124124

125+
afterEvaluate {
126+
// Hack to workaround "Task ':grpc-android-interop-testing:extractIncludeDebugProto' uses this
127+
// output of task ':grpc-context:jar' without declaring an explicit or implicit dependency." The
128+
// issue started when grpc-context became empty.
129+
tasks.named('extractIncludeDebugProto').configure {
130+
dependsOn project(':grpc-context').tasks.named('jar')
131+
}
132+
tasks.named('extractIncludeReleaseProto').configure {
133+
dependsOn project(':grpc-context').tasks.named('jar')
134+
}
135+
}
136+
125137
configureProtoCompilation()

api/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ tasks.named("compileContextJava").configure {
2020
if (JavaVersion.current().isJava9Compatible()) {
2121
options.release = 7
2222
} else {
23-
sourceCompatibility = 1.7
24-
targetCompatibility = 1.7
23+
sourceCompatibility = JavaVersion.VERSION_1_7
24+
targetCompatibility = JavaVersion.VERSION_1_7
2525
}
2626
}
2727

benchmarks/build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ def benchmark_worker = tasks.register("benchmark_worker", CreateStartScripts) {
105105
classpath = startScripts.classpath
106106
}
107107

108-
applicationDistribution.into("bin") {
109-
from(qps_client)
110-
from(openloop_client)
111-
from(qps_server)
112-
from(benchmark_worker)
113-
fileMode = 0755
108+
application {
109+
applicationDistribution.into("bin") {
110+
from(qps_client)
111+
from(openloop_client)
112+
from(qps_server)
113+
from(benchmark_worker)
114+
fileMode = 0755
115+
}
114116
}
115117

116118
publishing {

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ subprojects {
241241
if (JavaVersion.current().isJava9Compatible()) {
242242
options.release = 8
243243
} else {
244-
sourceCompatibility = 1.8
245-
targetCompatibility = 1.8
244+
sourceCompatibility = JavaVersion.VERSION_1_8
245+
targetCompatibility = JavaVersion.VERSION_1_8
246246
}
247247
}
248248
tasks.named("compileJava").configure {

compiler/build.gradle

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ model {
136136
}
137137
}
138138

139-
configurations {
140-
testLiteImplementation
139+
sourceSets {
140+
testLite {
141+
proto { setSrcDirs(['src/test/proto']) }
142+
}
141143
}
142144

143145
dependencies {
@@ -149,12 +151,6 @@ dependencies {
149151
libraries.javax.annotation
150152
}
151153

152-
sourceSets {
153-
testLite {
154-
proto { setSrcDirs(['src/test/proto']) }
155-
}
156-
}
157-
158154
tasks.named("compileTestJava").configure {
159155
options.errorprone.excludedPaths = ".*/build/generated/source/proto/.*"
160156
}
@@ -214,7 +210,9 @@ tasks.register("buildArtifacts", Copy) {
214210
into artifactStagingPath
215211
}
216212

217-
archivesBaseName = "$protocPluginBaseName"
213+
base {
214+
archivesName = "$protocPluginBaseName"
215+
}
218216

219217
def checkArtifacts = tasks.register("checkArtifacts") {
220218
dependsOn buildArtifacts

examples/android/clientcache/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
}
88
dependencies {
99
classpath 'com.android.tools.build:gradle:4.2.0'
10-
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.1"
10+
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.4"
1111

1212
// NOTE: Do not place your application dependencies here; they belong
1313
// in the individual module build.gradle files

examples/android/helloworld/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
}
88
dependencies {
99
classpath 'com.android.tools.build:gradle:4.2.0'
10-
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.1"
10+
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.4"
1111

1212
// NOTE: Do not place your application dependencies here; they belong
1313
// in the individual module build.gradle files

examples/android/routeguide/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
}
88
dependencies {
99
classpath 'com.android.tools.build:gradle:4.2.0'
10-
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.1"
10+
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.4"
1111

1212
// NOTE: Do not place your application dependencies here; they belong
1313
// in the individual module build.gradle files

examples/android/strictmode/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
}
88
dependencies {
99
classpath 'com.android.tools.build:gradle:4.2.0'
10-
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.1"
10+
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.4"
1111

1212
// NOTE: Do not place your application dependencies here; they belong
1313
// in the individual module build.gradle files

0 commit comments

Comments
 (0)