Skip to content

Commit

Permalink
When building AutoValue, pick up AutoService via `<annotationProcesso…
Browse files Browse the repository at this point in the history
…rPaths>`.

The annotation dependencies for `@AutoService` and for Error Prone are now regular compile-scoped dependencies. This prevents errors from overeager consumers that can't deal with missing annotation class files.

The `<annotationProcessorPaths>` incantations are kind of clunky since we need a different path for building tests (which must include AutoValueProcessor) and for building AutoValue itself (which obviously can't).

Fixes #1032.

RELNOTES=n/a
PiperOrigin-RevId: 367002319
  • Loading branch information
eamonnmcmanus authored and Google Java Core Libraries committed Apr 6, 2021
1 parent 2b5d8b8 commit 47a7ff1
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions value/processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
</scm>

<properties>
<auto-service.version>1.0-rc7</auto-service.version>
<errorprone.version>2.6.0</errorprone.version>
</properties>

Expand All @@ -52,15 +53,13 @@
</dependency>
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>1.0-rc7</version>
<scope>provided</scope>
<artifactId>auto-service-annotations</artifactId>
<version>${auto-service.version}</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>${errorprone.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.escapevelocity</groupId>
Expand Down Expand Up @@ -169,7 +168,33 @@
META-INF/services entry for a class that the compiler has not yet generated. -->
<arg>-AallowedMissingSerializableExtensionClasses=.*TestStringSerializerFactory</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>${auto-service.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
<executions>
<execution>
<id>default-testCompile</id>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>HEAD-SNAPSHOT</version>
</path>
<path>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>${auto-service.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit 47a7ff1

Please sign in to comment.