Skip to content

Commit

Permalink
Put the versions of dependencies directly in Gradle Metadata.
Browse files Browse the repository at this point in the history
This makes the version handling in POM and Gradle Metadata more similar.
See #6654 (comment)

We expect this to fix #6657, though we don't fully understand it.

Fixes #6664

RELNOTES=Changed Gradle Metadata to include dependency versions directly. This may address ["Could not find `some-dependency`" errors](#6657) that some users have reported (which might be a result of users' excluding `guava-parent`).
PiperOrigin-RevId: 553215970
  • Loading branch information
jjohannes authored and Google Java Core Libraries committed Aug 2, 2023
1 parent 110c207 commit c6d35cf
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 64 deletions.
18 changes: 13 additions & 5 deletions android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<!-- Override this with -Dtest.include="**/SomeTest.java" on the CLI -->
<test.include>%regex[.*.class]</test.include>
<truth.version>1.1.3</truth.version>
<jsr305.version>3.0.2</jsr305.version>
<checker.version>3.33.0</checker.version>
<errorprone.version>2.18.0</errorprone.version>
<j2objc.version>2.8</j2objc.version>
<maven-javadoc-plugin.version>3.4.1</maven-javadoc-plugin.version>
<javac.version>9+181-r4173-1</javac.version>
<!-- Empty for all JDKs but 9-12 -->
Expand Down Expand Up @@ -302,24 +306,28 @@
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<version>${jsr305.version}</version>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>3.33.0</version>
<version>${checker.version}</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>2.18.0</version>
<version>${errorprone.version}</version>
</dependency>
<dependency>
<groupId>com.google.j2objc</groupId>
<artifactId>j2objc-annotations</artifactId>
<version>2.8</version>
<version>${j2objc.version}</version>
</dependency>
<!-- We avoid using dependencyManagement for test-only deps because of https://github.com/google/guava/issues/6654 -->
<!--
We moved away from using dependencyManagement for test-only deps because of https://github.com/google/guava/issues/6654.
We could probably have resumed it after https://github.com/google/guava/pull/6664.
But it's always weird that published poms reference test-only libraries at all, so I'm not in any rush to do so.
-->
</dependencies>
</dependencyManagement>
<profiles>
Expand Down
110 changes: 56 additions & 54 deletions guava/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@
"org.gradle.usage": "java-api"
},
"dependencies": [
{
"group": "com.google.guava",
"module": "guava-parent",
"version": {
"requires": "${pom.version}"
},
"attributes": {
"org.gradle.category": "platform"
}
},
{
"group": "com.google.guava",
"module": "failureaccess",
Expand All @@ -52,19 +42,31 @@
},
{
"group": "com.google.code.findbugs",
"module": "jsr305"
"module": "jsr305",
"version": {
"requires": "${jsr305.version}"
}
},
{
"group": "org.checkerframework",
"module": "checker-qual"
"module": "checker-qual",
"version": {
"requires": "${checker.version}"
}
},
{
"group": "com.google.errorprone",
"module": "error_prone_annotations"
"module": "error_prone_annotations",
"version": {
"requires": "${errorprone.version}"
}
},
{
"group": "com.google.j2objc",
"module": "j2objc-annotations"
"module": "j2objc-annotations",
"version": {
"requires": "${j2objc.version}"
}
}
],
"files": [
Expand Down Expand Up @@ -97,16 +99,6 @@
"org.gradle.usage": "java-runtime"
},
"dependencies": [
{
"group": "com.google.guava",
"module": "guava-parent",
"version": {
"requires": "${pom.version}"
},
"attributes": {
"org.gradle.category": "platform"
}
},
{
"group": "com.google.guava",
"module": "failureaccess",
Expand All @@ -123,15 +115,24 @@
},
{
"group": "com.google.code.findbugs",
"module": "jsr305"
"module": "jsr305",
"version": {
"requires": "${jsr305.version}"
}
},
{
"group": "org.checkerframework",
"module": "checker-qual"
"module": "checker-qual",
"version": {
"requires": "${checker.version}"
}
},
{
"group": "com.google.errorprone",
"module": "error_prone_annotations"
"module": "error_prone_annotations",
"version": {
"requires": "${errorprone.version}"
}
}
],
"files": [
Expand Down Expand Up @@ -164,16 +165,6 @@
"org.gradle.usage": "java-api"
},
"dependencies": [
{
"group": "com.google.guava",
"module": "guava-parent",
"version": {
"requires": "${otherVariant.version}"
},
"attributes": {
"org.gradle.category": "platform"
}
},
{
"group": "com.google.guava",
"module": "failureaccess",
Expand All @@ -190,19 +181,31 @@
},
{
"group": "com.google.code.findbugs",
"module": "jsr305"
"module": "jsr305",
"version": {
"requires": "${jsr305.version}"
}
},
{
"group": "org.checkerframework",
"module": "checker-qual"
"module": "checker-qual",
"version": {
"requires": "${checker.version}"
}
},
{
"group": "com.google.errorprone",
"module": "error_prone_annotations"
"module": "error_prone_annotations",
"version": {
"requires": "${errorprone.version}"
}
},
{
"group": "com.google.j2objc",
"module": "j2objc-annotations"
"module": "j2objc-annotations",
"version": {
"requires": "${j2objc.version}"
}
}
],
"files": [
Expand Down Expand Up @@ -235,16 +238,6 @@
"org.gradle.usage": "java-runtime"
},
"dependencies": [
{
"group": "com.google.guava",
"module": "guava-parent",
"version": {
"requires": "${otherVariant.version}"
},
"attributes": {
"org.gradle.category": "platform"
}
},
{
"group": "com.google.guava",
"module": "failureaccess",
Expand All @@ -261,15 +254,24 @@
},
{
"group": "com.google.code.findbugs",
"module": "jsr305"
"module": "jsr305",
"version": {
"requires": "${jsr305.version}"
}
},
{
"group": "org.checkerframework",
"module": "checker-qual"
"module": "checker-qual",
"version": {
"requires": "${checker.version}"
}
},
{
"group": "com.google.errorprone",
"module": "error_prone_annotations"
"module": "error_prone_annotations",
"version": {
"requires": "${errorprone.version}"
}
}
],
"files": [
Expand Down
18 changes: 13 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<!-- Override this with -Dtest.include="**/SomeTest.java" on the CLI -->
<test.include>%regex[.*.class]</test.include>
<truth.version>1.1.3</truth.version>
<jsr305.version>3.0.2</jsr305.version>
<checker.version>3.33.0</checker.version>
<errorprone.version>2.18.0</errorprone.version>
<j2objc.version>2.8</j2objc.version>
<maven-javadoc-plugin.version>3.4.1</maven-javadoc-plugin.version>
<javac.version>9+181-r4173-1</javac.version>
<!-- Empty for all JDKs but 9-12 -->
Expand Down Expand Up @@ -296,24 +300,28 @@
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<version>${jsr305.version}</version>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>3.33.0</version>
<version>${checker.version}</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>2.18.0</version>
<version>${errorprone.version}</version>
</dependency>
<dependency>
<groupId>com.google.j2objc</groupId>
<artifactId>j2objc-annotations</artifactId>
<version>2.8</version>
<version>${j2objc.version}</version>
</dependency>
<!-- We avoid using dependencyManagement for test-only deps because of https://github.com/google/guava/issues/6654 -->
<!--
We moved away from using dependencyManagement for test-only deps because of https://github.com/google/guava/issues/6654.
We could probably have resumed it after https://github.com/google/guava/pull/6664.
But it's always weird that published poms reference test-only libraries at all, so I'm not in any rush to do so.
-->
</dependencies>
</dependencyManagement>
<profiles>
Expand Down

0 comments on commit c6d35cf

Please sign in to comment.