Skip to content

Commit

Permalink
Merge pull request #119 from salesforce/feature/jprotoc-use-canteen
Browse files Browse the repository at this point in the history
Use Canteen for dump plugin packaging
  • Loading branch information
rmichela authored Aug 22, 2019
2 parents 496cb08 + b784988 commit 3212d2c
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 24 deletions.
35 changes: 26 additions & 9 deletions jprotoc/jprotoc-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,29 @@
<version>0.5.0</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<id>protoc-proto</id>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
<execution>
<id>protoc-grpc</id>
<goals>
<goal>test-compile-custom</goal>
</goals>
<configuration>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
</execution>
<execution>
<id>protoc-java8</id>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<protocPlugins>
<protocPlugin>
Expand All @@ -116,16 +130,19 @@
<version>${project.version}</version>
<mainClass>com.salesforce.jprotoc.jdk8.Jdk8Generator</mainClass>
</protocPlugin>
<protocPlugin>
<id>dump</id>
<groupId>com.salesforce.servicelibs</groupId>
<artifactId>jprotoc</artifactId>
<version>${project.version}</version>
<mainClass>com.salesforce.jprotoc.dump.DumpGenerator</mainClass>
</protocPlugin>
</protocPlugins>
</configuration>
</execution>
<execution>
<id>protoc-dump</id>
<goals>
<goal>test-compile-custom</goal>
</goals>
<configuration>
<pluginId>dump</pluginId>
<pluginArtifact>com.salesforce.servicelibs:jprotoc:${project.version}:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ProtoTypeMapTest {
@BeforeClass
public static void buildProtoTypeMap() throws IOException {
// Dump file generated during the maven generate-test-sources phase
final String dumpPath = "target/generated-test-sources/protobuf/java/descriptor_dump";
final String dumpPath = "target/generated-test-sources/protobuf/dump/descriptor_dump";

byte[] generatorRequestBytes = ByteStreams.toByteArray(new FileInputStream(new File(dumpPath)));
PluginProtos.CodeGeneratorRequest request = PluginProtos.CodeGeneratorRequest.parseFrom(
Expand Down
61 changes: 53 additions & 8 deletions jprotoc/jprotoc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
Expand All @@ -47,24 +51,65 @@

<build>
<plugins>
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <version>1.5.8.RELEASE</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>repackage</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <configuration>-->
<!-- <mainClass>com.salesforce.jprotoc.dump.DumpGenerator</mainClass>-->
<!-- <layout>JAR</layout>-->
<!-- <classifier>jdk8</classifier>-->
<!-- <executable>true</executable>-->
<!-- </configuration>-->
<!-- </plugin>-->

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.8.RELEASE</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<mainClass>com.salesforce.jprotoc.dump.DumpGenerator</mainClass>
<layout>JAR</layout>
<classifier>jdk8</classifier>
<executable>true</executable>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.salesforce.jprotoc.dump.DumpGenerator</mainClass>
</manifest>
</archive>
</configuration>
</plugin>

<plugin>
<groupId>com.salesforce.servicelibs</groupId>
<artifactId>canteen-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<goals>
<goal>bootstrap</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
11 changes: 5 additions & 6 deletions jprotoc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,18 @@
<artifactId>compiler</artifactId>
<version>${mustache-java.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<!-- Provided dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
<scope>provided</scope>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
Expand Down

0 comments on commit 3212d2c

Please sign in to comment.