From 9fb23e6e1c9e2a7c70db70f9a8eda9cc45d7d34a Mon Sep 17 00:00:00 2001 From: cpovirk Date: Fri, 30 Jun 2023 09:45:05 -0700 Subject: [PATCH] Modify our internal release script to run Gradle integration tests during Guava releases. And make that process a little faster and more hygienic. (I see no reason to expect us to [get the Gradle setup wrong](https://github.com/google/guava/issues/6612) again, but it would be quite embarrassing if we did....) RELNOTES=n/a PiperOrigin-RevId: 544680176 --- util/gradle_integration_tests.sh | 37 ++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/util/gradle_integration_tests.sh b/util/gradle_integration_tests.sh index bf0dc8322db6..9378e6717b38 100755 --- a/util/gradle_integration_tests.sh +++ b/util/gradle_integration_tests.sh @@ -2,10 +2,35 @@ set -eu -mvn clean install -DskipTests -mvn clean install -DskipTests -f android +mvn clean install --projects '!guava-testlib,!guava-tests,!guava-bom,!guava-gwt' -Dmaven.test.skip=true -Dmaven.javadoc.skip=true +mvn clean install --projects '!guava-testlib,!guava-tests,!guava-bom' -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -f android -integration-tests/gradle/gradlew -p integration-tests/gradle wrapper --gradle-version=5.6.4 -integration-tests/gradle/gradlew -p integration-tests/gradle testClasspath -integration-tests/gradle/gradlew -p integration-tests/gradle wrapper --gradle-version=7.0.2 -integration-tests/gradle/gradlew -p integration-tests/gradle testClasspath +# Gradle Wrapper overwrites some files when it runs. +# To avoid modifying the Git client, we copy everything we need to another directory. +# That provides general hygiene, including avoiding release errors: +# +# Preparing to update Javadoc and JDiff for the release... +# error: Your local changes to the following files would be overwritten by checkout: +# integration-tests/gradle/gradle/wrapper/gradle-wrapper.jar +# integration-tests/gradle/gradle/wrapper/gradle-wrapper.properties +# integration-tests/gradle/gradlew +# integration-tests/gradle/gradlew.bat +# Please commit your changes or stash them before you switch branches. + +GRADLE_TEMP="$(mktemp -d)" +trap 'rm -rf "${GRADLE_TEMP}"' EXIT + +# The Gradle tests need the pom.xml only to read its version number. +# (And the file needs to be two directory levels up from the Gradle build file.) +# TODO(cpovirk): Find a better way to give them that information. +cp pom.xml "${GRADLE_TEMP}" + +for version in 5.6.4 7.0.2; do + # Enter a subshell so that we return to the current directory afterward. + ( + cp -r integration-tests "${GRADLE_TEMP}/${version}" + cd "${GRADLE_TEMP}/${version}/gradle" + ./gradlew wrapper --gradle-version="${version}" + ./gradlew testClasspath + ) +done