This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 677d3068f10b55ccb8064abb57ed9c53cf1ec3c2 Author: James Netherton <[email protected]> AuthorDate: Thu Feb 9 15:17:23 2023 +0000 Fix compilation of gRPC service stubs Fixes #4503 --- integration-tests/grpc/pom.xml | 81 ++++++++++++++++++++++++++++++++++-- integration-tests/pom.xml | 2 +- tooling/scripts/test-categories.yaml | 1 + 3 files changed, 79 insertions(+), 5 deletions(-) diff --git a/integration-tests/grpc/pom.xml b/integration-tests/grpc/pom.xml index 88c9ece6b2..05098100e7 100644 --- a/integration-tests/grpc/pom.xml +++ b/integration-tests/grpc/pom.xml @@ -59,10 +59,6 @@ <groupId>io.quarkus</groupId> <artifactId>quarkus-resteasy-jsonb</artifactId> </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-grpc</artifactId> - </dependency> <!-- test dependencies --> <dependency> @@ -116,11 +112,88 @@ <source> String platformUnsupported = project.properties['os.detected.classifier'].matches('^.*?(linux|windows|osx)-x86.*$') ? 'false' : 'true' project.properties['skipTests'] = platformUnsupported + project.properties['cq.skip.protobuf'] = platformUnsupported || project.properties.containsKey('quickly') + </source> + </configuration> + </execution> + <execution> + <!-- + Hack around grpc-java protobuf generator tagging generated classes with javax.annotation.Generated. + + This avoids implementing the recommendation to add a dependency on org.apache.tomcat:annotations-api: + + https://github.com/grpc/grpc-java#download + + Hopefully this will eventually get fixed for the Jakarta 10+ world: + + https://github.com/grpc/grpc-java/issues/9179 + --> + <id>strip-javax-generated-annotation</id> + <phase>process-sources</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <source> + def buildDir = project.build.directory + new File("${buildDir}/generated-sources").eachFileRecurse { file -> + if (file.name.endsWith(".java") && file.text.contains("javax.annotation.Generated")) { + def modifiedContent = file.text.replace("javax", "jakarta") + file.write(modifiedContent) + } + } </source> </configuration> </execution> </executions> </plugin> + <plugin> + <groupId>org.xolstice.maven.plugins</groupId> + <artifactId>protobuf-maven-plugin</artifactId> + <extensions>true</extensions> + <executions> + <execution> + <goals> + <goal>compile</goal> + <goal>compile-custom</goal> + </goals> + <phase>generate-sources</phase> + <configuration> + <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact> + <pluginId>grpc-java</pluginId> + <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact> + <checkStaleness>true</checkStaleness> + <skip>${cq.skip.protobuf}</skip> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <executions> + <execution> + <id>default-compile</id> + <phase>compile</phase> + <goals> + <goal>compile</goal> + </goals> + <configuration> + <skipMain>${cq.skip.protobuf}</skipMain> + </configuration> + </execution> + <execution> + <id>default-testCompile</id> + <phase>test-compile</phase> + <goals> + <goal>testCompile</goal> + </goals> + <configuration> + <skip>${cq.skip.protobuf}</skip> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 23f093cfbe..b97e7d0930 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -105,7 +105,7 @@ <module>graphql</module> <module>grok</module> <module>groovy-dsl</module> - <!--<module>grpc</module> https://github.com/apache/camel-quarkus/issues/4503 --> + <module>grpc</module> <!--<module>hazelcast</module> https://github.com/apache/camel-quarkus/issues/4498 --> <module>headersmap</module> <module>hl7</module> diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml index df8b4d4b3a..b5871c44d5 100644 --- a/tooling/scripts/test-categories.yaml +++ b/tooling/scripts/test-categories.yaml @@ -29,6 +29,7 @@ group-01: - mllp group-02: - aws2 + - grpc - jackson-avro - jackson-protobuf - jfr
