Skip to content

Commit

Permalink
Upgrade to Gradle 8.2.1 and upgrade plugins
Browse files Browse the repository at this point in the history
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.
#10445
  • Loading branch information
ejona86 committed Aug 2, 2023
1 parent 6d48271 commit f3f4ed4
Show file tree
Hide file tree
Showing 28 changed files with 140 additions and 88 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ For non-Android protobuf-based codegen integrated with the Gradle build system,
you can use [protobuf-gradle-plugin][]:
```gradle
plugins {
id 'com.google.protobuf' version '0.9.1'
id 'com.google.protobuf' version '0.9.4'
}
protobuf {
Expand Down Expand Up @@ -185,7 +185,7 @@ use protobuf-gradle-plugin but specify the 'lite' options:

```gradle
plugins {
id 'com.google.protobuf' version '0.9.1'
id 'com.google.protobuf' version '0.9.4'
}
protobuf {
Expand Down
12 changes: 12 additions & 0 deletions android-interop-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,16 @@ tasks.withType(JavaCompile).configureEach {
"|")
}

afterEvaluate {
// Hack to workaround "Task ':grpc-android-interop-testing:extractIncludeDebugProto' uses this
// output of task ':grpc-context:jar' without declaring an explicit or implicit dependency." The
// issue started when grpc-context became empty.
tasks.named('extractIncludeDebugProto').configure {
dependsOn project(':grpc-context').tasks.named('jar')
}
tasks.named('extractIncludeReleaseProto').configure {
dependsOn project(':grpc-context').tasks.named('jar')
}
}

configureProtoCompilation()
4 changes: 2 additions & 2 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ tasks.named("compileContextJava").configure {
if (JavaVersion.current().isJava9Compatible()) {
options.release = 7
} else {
sourceCompatibility = 1.7
targetCompatibility = 1.7
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
}

Expand Down
14 changes: 8 additions & 6 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ def benchmark_worker = tasks.register("benchmark_worker", CreateStartScripts) {
classpath = startScripts.classpath
}

applicationDistribution.into("bin") {
from(qps_client)
from(openloop_client)
from(qps_server)
from(benchmark_worker)
fileMode = 0755
application {
applicationDistribution.into("bin") {
from(qps_client)
from(openloop_client)
from(qps_server)
from(benchmark_worker)
fileMode = 0755
}
}

publishing {
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ subprojects {
if (JavaVersion.current().isJava9Compatible()) {
options.release = 8
} else {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
tasks.named("compileJava").configure {
Expand Down
16 changes: 7 additions & 9 deletions compiler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ model {
}
}

configurations {
testLiteImplementation
sourceSets {
testLite {
proto { setSrcDirs(['src/test/proto']) }
}
}

dependencies {
Expand All @@ -149,12 +151,6 @@ dependencies {
libraries.javax.annotation
}

sourceSets {
testLite {
proto { setSrcDirs(['src/test/proto']) }
}
}

tasks.named("compileTestJava").configure {
options.errorprone.excludedPaths = ".*/build/generated/source/proto/.*"
}
Expand Down Expand Up @@ -214,7 +210,9 @@ tasks.register("buildArtifacts", Copy) {
into artifactStagingPath
}

archivesBaseName = "$protocPluginBaseName"
base {
archivesName = "$protocPluginBaseName"
}

def checkArtifacts = tasks.register("checkArtifacts") {
dependsOn buildArtifacts
Expand Down
2 changes: 1 addition & 1 deletion examples/android/clientcache/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.1"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.4"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion examples/android/helloworld/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.1"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.4"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion examples/android/routeguide/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.1"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.4"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion examples/android/strictmode/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.1"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.4"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
8 changes: 5 additions & 3 deletions examples/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
// Provide convenience executables for trying out the examples.
id 'application'
id 'com.google.protobuf' version '0.9.1'
id 'com.google.protobuf' version '0.9.4'
// Generate IntelliJ IDEA's .idea & .iml project files
id 'idea'
}
Expand All @@ -13,8 +13,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
// are looking at a tagged version of the example and not "master"!
Expand Down
6 changes: 4 additions & 2 deletions examples/example-alts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
// are looking at a tagged version of the example and not "master"!
Expand Down
6 changes: 4 additions & 2 deletions examples/example-debug/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
// are looking at a tagged version of the example and not "master"!
Expand Down
6 changes: 4 additions & 2 deletions examples/example-gauth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
// are looking at a tagged version of the example and not "master"!
Expand Down
6 changes: 4 additions & 2 deletions examples/example-gcp-observability/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
// are looking at a tagged version of the example and not "master"!
Expand Down
6 changes: 4 additions & 2 deletions examples/example-hostname/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
// are looking at a tagged version of the example and not "master"!
Expand Down
6 changes: 4 additions & 2 deletions examples/example-jwt-auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
// are looking at a tagged version of the example and not "master"!
Expand Down
6 changes: 4 additions & 2 deletions examples/example-orca/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protocVersion = '3.23.4'
Expand Down
6 changes: 4 additions & 2 deletions examples/example-reflection/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protocVersion = '3.23.4'
Expand Down
6 changes: 4 additions & 2 deletions examples/example-servlet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protocVersion = '3.23.4'
Expand Down
6 changes: 4 additions & 2 deletions examples/example-tls/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
// are looking at a tagged version of the example and not "master"!
Expand Down
6 changes: 4 additions & 2 deletions examples/example-xds/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ repositories {
mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
// are looking at a tagged version of the example and not "master"!
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
34 changes: 18 additions & 16 deletions interop-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,22 +158,24 @@ def xds_federation_test_client = tasks.register("xds_federation_test_client", Cr
classpath = startScripts.classpath
}

applicationDistribution.into("bin") {
from(test_client)
from(test_server)
from(reconnect_test_client)
from(stresstest_client)
from(http2_client)
from(grpclb_long_lived_affinity_test_client)
from(grpclb_fallback_test_client)
from(xds_test_client)
from(xds_test_server)
from(xds_federation_test_client)
fileMode = 0755
}

applicationDistribution.into("lib") {
from(configurations.alpnagent)
application {
applicationDistribution.into("bin") {
from(test_client)
from(test_server)
from(reconnect_test_client)
from(stresstest_client)
from(http2_client)
from(grpclb_long_lived_affinity_test_client)
from(grpclb_fallback_test_client)
from(xds_test_client)
from(xds_test_server)
from(xds_federation_test_client)
fileMode = 0755
}

applicationDistribution.into("lib") {
from(configurations.alpnagent)
}
}

publishing {
Expand Down
4 changes: 2 additions & 2 deletions netty/shaded/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
import com.github.jengelman.gradle.plugins.shadow.transformers.CacheableTransformer
import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext
import org.apache.tools.zip.ZipOutputStream
import org.apache.tools.zip.ZipEntry
import org.gradle.api.file.FileTreeElement
import shadow.org.apache.tools.zip.ZipOutputStream
import shadow.org.apache.tools.zip.ZipEntry

plugins {
id "java"
Expand Down
Loading

0 comments on commit f3f4ed4

Please sign in to comment.