Skip to content

Commit 3212d2c

Browse files
authored
Merge pull request #119 from salesforce/feature/jprotoc-use-canteen
Use Canteen for dump plugin packaging
2 parents 496cb08 + b784988 commit 3212d2c

File tree

4 files changed

+85
-24
lines changed

4 files changed

+85
-24
lines changed

jprotoc/jprotoc-test/pom.xml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,29 @@
9898
<version>0.5.0</version>
9999
<configuration>
100100
<protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}</protocArtifact>
101-
<pluginId>grpc-java</pluginId>
102-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
103101
</configuration>
104102
<executions>
105103
<execution>
104+
<id>protoc-proto</id>
106105
<goals>
107106
<goal>test-compile</goal>
107+
</goals>
108+
</execution>
109+
<execution>
110+
<id>protoc-grpc</id>
111+
<goals>
108112
<goal>test-compile-custom</goal>
109113
</goals>
114+
<configuration>
115+
<pluginId>grpc-java</pluginId>
116+
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
117+
</configuration>
118+
</execution>
119+
<execution>
120+
<id>protoc-java8</id>
121+
<goals>
122+
<goal>test-compile</goal>
123+
</goals>
110124
<configuration>
111125
<protocPlugins>
112126
<protocPlugin>
@@ -116,16 +130,19 @@
116130
<version>${project.version}</version>
117131
<mainClass>com.salesforce.jprotoc.jdk8.Jdk8Generator</mainClass>
118132
</protocPlugin>
119-
<protocPlugin>
120-
<id>dump</id>
121-
<groupId>com.salesforce.servicelibs</groupId>
122-
<artifactId>jprotoc</artifactId>
123-
<version>${project.version}</version>
124-
<mainClass>com.salesforce.jprotoc.dump.DumpGenerator</mainClass>
125-
</protocPlugin>
126133
</protocPlugins>
127134
</configuration>
128135
</execution>
136+
<execution>
137+
<id>protoc-dump</id>
138+
<goals>
139+
<goal>test-compile-custom</goal>
140+
</goals>
141+
<configuration>
142+
<pluginId>dump</pluginId>
143+
<pluginArtifact>com.salesforce.servicelibs:jprotoc:${project.version}:exe:${os.detected.classifier}</pluginArtifact>
144+
</configuration>
145+
</execution>
129146
</executions>
130147
</plugin>
131148
</plugins>

jprotoc/jprotoc-test/src/test/java/com/salesforce/jprotoc/ProtoTypeMapTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class ProtoTypeMapTest {
2626
@BeforeClass
2727
public static void buildProtoTypeMap() throws IOException {
2828
// Dump file generated during the maven generate-test-sources phase
29-
final String dumpPath = "target/generated-test-sources/protobuf/java/descriptor_dump";
29+
final String dumpPath = "target/generated-test-sources/protobuf/dump/descriptor_dump";
3030

3131
byte[] generatorRequestBytes = ByteStreams.toByteArray(new FileInputStream(new File(dumpPath)));
3232
PluginProtos.CodeGeneratorRequest request = PluginProtos.CodeGeneratorRequest.parseFrom(

jprotoc/jprotoc/pom.xml

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
<groupId>com.github.spullara.mustache.java</groupId>
2828
<artifactId>compiler</artifactId>
2929
</dependency>
30+
<dependency>
31+
<groupId>com.google.code.gson</groupId>
32+
<artifactId>gson</artifactId>
33+
</dependency>
3034
<!-- Test dependencies -->
3135
<dependency>
3236
<groupId>junit</groupId>
@@ -47,24 +51,65 @@
4751

4852
<build>
4953
<plugins>
54+
<!-- <plugin>-->
55+
<!-- <groupId>org.springframework.boot</groupId>-->
56+
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
57+
<!-- <version>1.5.8.RELEASE</version>-->
58+
<!-- <executions>-->
59+
<!-- <execution>-->
60+
<!-- <goals>-->
61+
<!-- <goal>repackage</goal>-->
62+
<!-- </goals>-->
63+
<!-- </execution>-->
64+
<!-- </executions>-->
65+
<!-- <configuration>-->
66+
<!-- <mainClass>com.salesforce.jprotoc.dump.DumpGenerator</mainClass>-->
67+
<!-- <layout>JAR</layout>-->
68+
<!-- <classifier>jdk8</classifier>-->
69+
<!-- <executable>true</executable>-->
70+
<!-- </configuration>-->
71+
<!-- </plugin>-->
72+
5073
<plugin>
51-
<groupId>org.springframework.boot</groupId>
52-
<artifactId>spring-boot-maven-plugin</artifactId>
53-
<version>1.5.8.RELEASE</version>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-shade-plugin</artifactId>
76+
<version>3.2.1</version>
5477
<executions>
5578
<execution>
79+
<phase>package</phase>
5680
<goals>
57-
<goal>repackage</goal>
81+
<goal>shade</goal>
5882
</goals>
5983
</execution>
6084
</executions>
85+
</plugin>
86+
87+
<plugin>
88+
<groupId>org.apache.maven.plugins</groupId>
89+
<artifactId>maven-jar-plugin</artifactId>
90+
<version>2.4</version>
6191
<configuration>
62-
<mainClass>com.salesforce.jprotoc.dump.DumpGenerator</mainClass>
63-
<layout>JAR</layout>
64-
<classifier>jdk8</classifier>
65-
<executable>true</executable>
92+
<archive>
93+
<manifest>
94+
<addClasspath>true</addClasspath>
95+
<mainClass>com.salesforce.jprotoc.dump.DumpGenerator</mainClass>
96+
</manifest>
97+
</archive>
6698
</configuration>
6799
</plugin>
100+
101+
<plugin>
102+
<groupId>com.salesforce.servicelibs</groupId>
103+
<artifactId>canteen-maven-plugin</artifactId>
104+
<version>1.0.0</version>
105+
<executions>
106+
<execution>
107+
<goals>
108+
<goal>bootstrap</goal>
109+
</goals>
110+
</execution>
111+
</executions>
112+
</plugin>
68113
</plugins>
69114
</build>
70115
</project>

jprotoc/pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,18 @@
138138
<artifactId>compiler</artifactId>
139139
<version>${mustache-java.version}</version>
140140
</dependency>
141+
<dependency>
142+
<groupId>com.google.code.gson</groupId>
143+
<artifactId>gson</artifactId>
144+
<version>${gson.version}</version>
145+
</dependency>
141146
<!-- Provided dependencies -->
142147
<dependency>
143148
<groupId>org.slf4j</groupId>
144149
<artifactId>slf4j-api</artifactId>
145150
<version>${slf4j.version}</version>
146151
<scope>provided</scope>
147152
</dependency>
148-
<dependency>
149-
<groupId>com.google.code.gson</groupId>
150-
<artifactId>gson</artifactId>
151-
<version>${gson.version}</version>
152-
<scope>provided</scope>
153-
</dependency>
154153
<!-- Test dependencies -->
155154
<dependency>
156155
<groupId>junit</groupId>

0 commit comments

Comments
 (0)