From a3b51888c2456350ab11694c28d7a72173f3b897 Mon Sep 17 00:00:00 2001 From: cpovirk Date: Mon, 23 Sep 2024 10:13:03 -0700 Subject: [PATCH] Include `j2objc-annotations` in the Gradle runtime classpath. While that artifact contains no runtime-retention annotations, it does contain class-retention annotations (which could drive a runtime bytecode-rewriting agent). And, more practically, the Android Gradle Plugin has started reporting errors for `compileOnly` dependencies. Fixes https://github.com/google/guava/issues/7397 Relevant to https://github.com/firebase/firebase-android-sdk/issues/6232 and https://github.com/androidx/media/issues/1700 RELNOTES=Added `j2objc-annotations` to the Gradle runtime classpath to avoid [an Android Gradle Plugin error](https://github.com/google/guava/issues/7397). PiperOrigin-RevId: 677842769 --- guava/module.json | 14 ++++++++++++++ integration-tests/gradle/build.gradle.kts | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/guava/module.json b/guava/module.json index 0e7e5d85d087..c125a282dedf 100644 --- a/guava/module.json +++ b/guava/module.json @@ -133,6 +133,13 @@ "version": { "requires": "${errorprone.version}" } + }, + { + "group": "com.google.j2objc", + "module": "j2objc-annotations", + "version": { + "requires": "${j2objc.version}" + } } ], "files": [ @@ -272,6 +279,13 @@ "version": { "requires": "${errorprone.version}" } + }, + { + "group": "com.google.j2objc", + "module": "j2objc-annotations", + "version": { + "requires": "${j2objc.version}" + } } ], "files": [ diff --git a/integration-tests/gradle/build.gradle.kts b/integration-tests/gradle/build.gradle.kts index 46e37a047da7..f2830db76f36 100644 --- a/integration-tests/gradle/build.gradle.kts +++ b/integration-tests/gradle/build.gradle.kts @@ -8,6 +8,7 @@ val expectedReducedRuntimeClasspathAndroidVersion = setOf( "guava-${guavaVersionJre.replace("jre", "android")}.jar", "failureaccess-1.0.2.jar", + "j2objc-annotations-3.0.0.jar", "jsr305-3.0.2.jar", "checker-qual-3.43.0.jar", "error_prone_annotations-2.28.0.jar", @@ -17,15 +18,14 @@ val expectedReducedRuntimeClasspathJreVersion = setOf( "guava-$guavaVersionJre.jar", "failureaccess-1.0.2.jar", + "j2objc-annotations-3.0.0.jar", "jsr305-3.0.2.jar", "checker-qual-3.43.0.jar", "error_prone_annotations-2.28.0.jar", "listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar" ) -val expectedCompileClasspathAndroidVersion = - expectedReducedRuntimeClasspathAndroidVersion + setOf("j2objc-annotations-3.0.0.jar") -val expectedCompileClasspathJreVersion = - expectedReducedRuntimeClasspathJreVersion + setOf("j2objc-annotations-3.0.0.jar") +val expectedCompileClasspathAndroidVersion = expectedReducedRuntimeClasspathAndroidVersion +val expectedCompileClasspathJreVersion = expectedReducedRuntimeClasspathJreVersion val extraLegacyDependencies = setOf("google-collections-1.0.jar")