Skip to content

Commit

Permalink
Update to Gradle 8.2.1 (#781)
Browse files Browse the repository at this point in the history
We had to back out a previous Gradle upgrade, but I believe now things
have been fixed up enough that we can upgrade again. One issue with the
upgrade is that publishing a build will fail if signing is not
functional and the version is not a `SNAPSHOT`. In particular, with our
default config, `LOCAL` versions must be signed. (This was the
documented behavior before this Gradle upgrade but for some reason the
build wasn't failing.) So, publishing `LOCAL` builds without signing
requires disabling a setting via a Gradle property or env var. We update
the CI config and the docs to reflect this.

I tested publishing a release to Sonatype (without pushing to Maven
Central) from my laptop and it succeeded. I have not yet validated the
actual artifacts. Will hold off on landing this until we're sure it's
thoroughly tested.

Fixes #768
  • Loading branch information
msridhar authored Jul 25, 2023
1 parent 45cc4c2 commit 9ece8b3
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ jobs:
env:
ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }}
ORG_GRADLE_PROJECT_VERSION_NAME: '0.0.0.1-LOCAL'
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: 'false'
uses: gradle/gradle-build-action@v2
with:
arguments: publishToMavenLocal -x signMavenPublication -x signShadowPublication
arguments: publishToMavenLocal
if: matrix.java == '11'
- name: Check that Git tree is clean after build and test
run: ./.buildscript/check_git_clean.sh
Expand Down
14 changes: 10 additions & 4 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
IMPORTANT: Make sure you are using a JDK 8 JVM by checking `java -version` before any
of the steps below. If you run the steps below on a JDK 11+ JVM, that will break Java
8 support, as the released jars will only run on JDK 11. We do not target Java 8 when
building on JDK 11 since Error Prone has required Java 11 since version 2.11.0.
(For testing only) Publishing an unsigned LOCAL build
=====================================================
By default, we set `RELEASE_SIGNING_ENABLED=true` in `gradle.properties`, which means
published builds must be signed unless they are for a `SNAPSHOT` version. To publish
a non-`SNAPSHOT` build locally without signing (e.g., a `LOCAL` version), use the
following command:

```bash
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED=false ./gradlew publishToMavenLocal
```

(Recommended, but optional) Update JarInfer Android SDK Models
==============================================================
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionSha256Sum=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -133,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down Expand Up @@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
22 changes: 15 additions & 7 deletions jar-infer/jar-infer-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ plugins {
}

// JarInfer requires JDK 11+, due to its dependence on WALA
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
tasks.withType(JavaCompile) {
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11
}

repositories {
mavenCentral()
Expand Down Expand Up @@ -119,17 +121,23 @@ publishing {
dependsOn 'javaSourcesJar'
dependsOn 'simpleJavadocJar'
}
project.tasks.named('signShadowPublication').configure {
dependsOn 'sourcesJar'
dependsOn 'simpleJavadocJar'
if (project.tasks.findByName('signShadowPublication')) {
project.tasks.named('signShadowPublication').configure {
dependsOn 'sourcesJar'
dependsOn 'simpleJavadocJar'
}
}
project.tasks.named('publishShadowPublicationToMavenCentralRepository').configure {
dependsOn 'signMavenPublication'
if (project.tasks.findByName('signMavenPublication')) {
dependsOn 'signMavenPublication'
}
}
project.tasks.named('publishShadowPublicationToMavenLocal').configure {
dependsOn 'sourcesJar'
dependsOn 'simpleJavadocJar'
dependsOn 'signMavenPublication'
if (project.tasks.findByName('signMavenPublication')) {
dependsOn 'signMavenPublication'
}
}
}
}
6 changes: 4 additions & 2 deletions jar-infer/jar-infer-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ plugins {
}

// JarInfer requires JDK 11+, due to its dependence on WALA
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
tasks.withType(JavaCompile) {
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11
}

repositories {
mavenCentral()
Expand Down

0 comments on commit 9ece8b3

Please sign in to comment.