Skip to content

Commit

Permalink
Arrange for the Gradle integration test to run in the install phase.
Browse files Browse the repository at this point in the history
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 #1451. It happens that we noticed the breakage with a Dependabot [PR](#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 `<include>` and the like.

RELNOTES=n/a
PiperOrigin-RevId: 511051082
  • Loading branch information
eamonnmcmanus authored and Google Java Core Libraries committed Feb 20, 2023
1 parent 56764c4 commit b1dc313
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion value/src/it/functional/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,26 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<systemPropertyVariables>
<autoValueVersion>${project.version}</autoValueVersion>
</systemPropertyVariables>
</configuration>
</plugin>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit b1dc313

Please sign in to comment.