Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish Gradle Module Metadata with Variants #3683

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cf4d7a1
Publish Gradle Module Metadata with additional dependency constraints
jjohannes Jun 28, 2023
31c2026
Add integration test for resolving Guava with Gradle
jjohannes Jun 28, 2023
3db90c4
Add Gradle wrapper validation for the wrapper in the test project
jjohannes Jun 28, 2023
6437197
Adjust expectations for 'checker-qual' version
jjohannes Jun 28, 2023
e643f3f
Fixed typos
jjohannes Jun 28, 2023
f9fb5c5
Read Guava version under test from pom.xml
jjohannes Jun 28, 2023
905909c
Use correct version for parents
jjohannes Jun 28, 2023
7a2f0a0
Fix typo in classpath name.
jjohannes Jun 28, 2023
8191fc3
Also fix typo when looking up configuration.
jjohannes Jun 28, 2023
179136b
Satisfy our autoformatters.
jjohannes Jun 28, 2023
41dbc97
Fail if any test run fails.
jjohannes Jun 28, 2023
c5e364f
Conservatively keep most deps on the runtime classpath.
jjohannes Jun 28, 2023
0346bc3
One more tiny bit of formatting.
jjohannes Jun 28, 2023
ad2ca91
Make Android projects always select a 'android' variant by default
jjohannes Jun 28, 2023
536a5a3
Expand integration test to test with Android projects
jjohannes Jun 28, 2023
941ff66
Add test cases for selecting a different variant via constraint
jjohannes Jun 28, 2023
9eb9996
Use 'org.gradle.jvm.environment' attribute
jjohannes Jun 28, 2023
cf7d4c1
Adjust integration test names to reflect better what they check
jjohannes Jun 28, 2023
8c5e9d3
Update expected versions to reflect latest version upgrades
jjohannes Jun 28, 2023
8e01521
Add 'Integration Test' step to GitHub Actions CI workflow
jjohannes Jun 28, 2023
e07bcf1
Upgrade test expectations: error prone is now on 2.6.0
jjohannes Jun 28, 2023
4ea61e9
Upgrade test expectations: checker qual is now on 3.12.0
jjohannes Jun 28, 2023
7300d68
Checker-qual is now also a dependency of the Android variant
jjohannes Jun 28, 2023
2180a04
Use Gradle 7.0 final
jjohannes Jun 28, 2023
4758c9c
Use 7.0.0-alpha15 of Android Gradle Plugin
jjohannes Jun 28, 2023
eae386c
Do not run Gradle integration test on Java 8
jjohannes Jun 28, 2023
4d05df4
All variants are now targeting Java 8 or higher
jjohannes Jun 28, 2023
0d00efa
Adjust expectations to versions upgrades in Guava 32
jjohannes Jun 28, 2023
c14d55a
Bump plugin versions.
cpovirk Jun 27, 2023
5f54f4d
Commit (i.e., remove backups) only after all pom edits.
cpovirk Jun 27, 2023
985d143
Update comments now that we are only about JVM/Android, not Java vers…
cpovirk Jun 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ jobs:
if: ${{ failure() }}
shell: bash
run: ./util/print_surefire_reports.sh
- name: 'Integration Test'
if: matrix.java == 11
shell: bash
run: util/gradle_integration_tests.sh

publish_snapshot:
name: 'Publish snapshot'
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
45 changes: 45 additions & 0 deletions android/guava/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- do_not_remove: published-with-gradle-metadata -->
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.google.guava</groupId>
Expand Down Expand Up @@ -209,6 +210,50 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>gradle-module-metadata</id>
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target/publish</outputDirectory>
<resources>
<resource>
<directory>../../guava</directory>
<includes>
<include>module.json</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-gradle-module-metadata</id>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/publish/module.json</file>
<type>module</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
13 changes: 13 additions & 0 deletions android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<project.build.outputTimestamp>1980-02-01T00:00:00Z</project.build.outputTimestamp>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<test.add.opens></test.add.opens>
<module.status>integration</module.status>
<variant.jvmEnvironment>android</variant.jvmEnvironment>
<otherVariant.version>HEAD-jre-SNAPSHOT</otherVariant.version>
<otherVariant.jvmEnvironment>standard-jvm</otherVariant.jvmEnvironment>
</properties>
<issueManagement>
<system>GitHub Issues</system>
Expand Down Expand Up @@ -262,6 +266,15 @@
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.4.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down
287 changes: 287 additions & 0 deletions guava/module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
{
"formatVersion": "1.1",
"component": {
"group": "${pom.groupId}",
"module": "${pom.artifactId}",
"version": "${pom.version}",
"attributes": {
"org.gradle.status": "${module.status}"
}
},
"createdBy": {
"maven": {
"version": "${maven.version}",
"buildId": "${maven.build.version}"
}
},
"variants": [
{
"name": "${variant.jvmEnvironment}ApiElements",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.jvm.version": "8",
"org.gradle.jvm.environment": "${variant.jvmEnvironment}",
"org.gradle.libraryelements": "jar",
"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",
"version": {
"requires": "1.0.1"
}
},
{
"group": "com.google.code.findbugs",
"module": "jsr305"
},
{
"group": "org.checkerframework",
"module": "checker-qual"
},
{
"group": "com.google.errorprone",
"module": "error_prone_annotations"
},
{
"group": "com.google.j2objc",
"module": "j2objc-annotations"
}
],
"files": [
{
"name": "${project.build.finalName}.jar",
"url": "${project.build.finalName}.jar"
}
],
"capabilities": [
{
"group": "com.google.guava",
"name": "guava",
"version": "${pom.version}"
},
{
"group": "com.google.collections",
"name": "google-collections",
"version": "${pom.version}"
},
{
"group": "com.google.guava",
"name": "listenablefuture",
"version": "1.0"
}
]
},
{
"name": "${variant.jvmEnvironment}RuntimeElements",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.jvm.version": "8",
"org.gradle.jvm.environment": "${variant.jvmEnvironment}",
"org.gradle.libraryelements": "jar",
"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",
"version": {
"requires": "1.0.1"
}
},
{
"group": "com.google.code.findbugs",
"module": "jsr305"
},
{
"group": "org.checkerframework",
"module": "checker-qual"
},
{
"group": "com.google.errorprone",
"module": "error_prone_annotations"
}
],
"files": [
{
"name": "${project.build.finalName}.jar",
"url": "${project.build.finalName}.jar"
}
],
"capabilities": [
{
"group": "com.google.guava",
"name": "guava",
"version": "${pom.version}"
},
{
"group": "com.google.collections",
"name": "google-collections",
"version": "${pom.version}"
},
{
"group": "com.google.guava",
"name": "listenablefuture",
"version": "1.0"
}
]
},
{
"name": "${otherVariant.jvmEnvironment}ApiElements",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.jvm.version": "8",
"org.gradle.jvm.environment": "${otherVariant.jvmEnvironment}",
"org.gradle.libraryelements": "jar",
"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",
"version": {
"requires": "1.0.1"
}
},
{
"group": "com.google.code.findbugs",
"module": "jsr305"
},
{
"group": "org.checkerframework",
"module": "checker-qual"
},
{
"group": "com.google.errorprone",
"module": "error_prone_annotations"
},
{
"group": "com.google.j2objc",
"module": "j2objc-annotations"
}
],
"files": [
{
"name": "${pom.artifactId}-${otherVariant.version}.jar",
"url": "../${otherVariant.version}/${pom.artifactId}-${otherVariant.version}.jar"
}
],
"capabilities": [
{
"group": "com.google.guava",
"name": "guava",
"version": "${pom.version}"
},
{
"group": "com.google.collections",
"name": "google-collections",
"version": "${pom.version}"
},
{
"group": "com.google.guava",
"name": "listenablefuture",
"version": "1.0"
}
]
},
{
"name": "${otherVariant.jvmEnvironment}RuntimeElements",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.jvm.version": "8",
"org.gradle.jvm.environment": "${otherVariant.jvmEnvironment}",
"org.gradle.libraryelements": "jar",
"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",
"version": {
"requires": "1.0.1"
}
},
{
"group": "com.google.code.findbugs",
"module": "jsr305"
},
{
"group": "org.checkerframework",
"module": "checker-qual"
},
{
"group": "com.google.errorprone",
"module": "error_prone_annotations"
}
],
"files": [
{
"name": "${pom.artifactId}-${otherVariant.version}.jar",
"url": "../${otherVariant.version}/${pom.artifactId}-${otherVariant.version}.jar"
}
],
"capabilities": [
{
"group": "com.google.guava",
"name": "guava",
"version": "${pom.version}"
},
{
"group": "com.google.collections",
"name": "google-collections",
"version": "${pom.version}"
},
{
"group": "com.google.guava",
"name": "listenablefuture",
"version": "1.0"
}
]
}
]
}
Loading