From 2daaaa7d282d1fa8e0ca6de3514d55df60031a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Mon, 20 Feb 2023 15:32:50 -0800 Subject: [PATCH] Arrange for the Gradle integration test to run in the `install` phase. I am not sure how this test worked before. I think it happened to work as a side effect of other integration tests installing the `HEAD-SNAPSHOT` artifacts, which we stopped doing in https://github.com/google/auto/pull/1451. It happens that we noticed the breakage with a Dependabot [PR](https://github.com/google/auto/pull/1452) to update `gradle-test-kit`, but I think the CI was already broken. Anyway, the Gradle test assumes it can depend on the artifacts for the current AutoValue version, and those are only available in the `install` phase. By following the Maven convention whereby regular unit tests are called `FooTest` and integration tests are called `FooIT`, we get the right tests run in the right phases without having to specify `` and the like. RELNOTES=n/a PiperOrigin-RevId: 511051082 --- .github/workflows/ci.yml | 2 +- value/src/it/functional/pom.xml | 16 +++++++++++++++- .../auto/value/CompileWithEclipseTest.java | 2 +- .../value/{GradleTest.java => GradleIT.java} | 3 ++- value/src/it/gwtserializer/pom.xml | 11 +++++++++++ 5 files changed, 30 insertions(+), 4 deletions(-) rename value/src/it/functional/src/test/java/com/google/auto/value/{GradleTest.java => GradleIT.java} (99%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97080e27e2..1b1a895ce7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: run: mvn -B dependency:go-offline test clean -U --quiet --fail-never -DskipTests=true -f build-pom.xml - name: 'Test' shell: bash - run: mvn -B verify -U --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true -f build-pom.xml + run: mvn -B verify install -U --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true -f build-pom.xml publish_snapshot: name: 'Publish snapshot' diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index 9f733a25d9..58d79192f0 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -183,12 +183,26 @@ org.apache.maven.plugins maven-surefire-plugin 2.22.2 + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.22.2 ${project.version} - + + + install + + integration-test + verify + + + + diff --git a/value/src/it/functional/src/test/java/com/google/auto/value/CompileWithEclipseTest.java b/value/src/it/functional/src/test/java/com/google/auto/value/CompileWithEclipseTest.java index 5993d739c3..bd92efa627 100644 --- a/value/src/it/functional/src/test/java/com/google/auto/value/CompileWithEclipseTest.java +++ b/value/src/it/functional/src/test/java/com/google/auto/value/CompileWithEclipseTest.java @@ -70,7 +70,7 @@ public static void setSourceRoot() { "AutoValueNotEclipseTest.java", "CompileWithEclipseTest.java", "CustomFieldSerializerTest.java", - "GradleTest.java", + "GradleIT.java", // AutoBuilder sometimes needs to generate a .class file for Kotlin that is used in the // rest of compilation, and Eclipse doesn't seem to handle that well. Presumably not many diff --git a/value/src/it/functional/src/test/java/com/google/auto/value/GradleTest.java b/value/src/it/functional/src/test/java/com/google/auto/value/GradleIT.java similarity index 99% rename from value/src/it/functional/src/test/java/com/google/auto/value/GradleTest.java rename to value/src/it/functional/src/test/java/com/google/auto/value/GradleIT.java index f4eb5388b1..ee1fbfae4f 100644 --- a/value/src/it/functional/src/test/java/com/google/auto/value/GradleTest.java +++ b/value/src/it/functional/src/test/java/com/google/auto/value/GradleIT.java @@ -38,7 +38,7 @@ import org.junit.runners.JUnit4; @RunWith(JUnit4.class) -public class GradleTest { +public class GradleIT { @Rule public TemporaryFolder fakeProject = new TemporaryFolder(); private static final String BUILD_GRADLE_TEXT = @@ -76,6 +76,7 @@ public class GradleTest { @Test public void basic() throws IOException { + assertThat(true).isFalse(); String autoValueVersion = System.getProperty("autoValueVersion"); assertThat(autoValueVersion).isNotNull(); String localRepository = System.getProperty("localRepository"); diff --git a/value/src/it/gwtserializer/pom.xml b/value/src/it/gwtserializer/pom.xml index 0328fd01fb..6b841ac1ce 100644 --- a/value/src/it/gwtserializer/pom.xml +++ b/value/src/it/gwtserializer/pom.xml @@ -150,6 +150,17 @@ true + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + default-jar + install + + +