Skip to content

Commit b257151

Browse files
committed
Rework Java template generation for Maven build
This uses the JRuby rake-maven-plugin to generate the templates as part of the Maven build. The generated output for the Java templates will be under java/api/target/generated-sources/java.
1 parent 03358d5 commit b257151

File tree

8 files changed

+67
-13945
lines changed

8 files changed

+67
-13945
lines changed

java/api/pom.xml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,84 @@
99
</parent>
1010

1111
<artifactId>prism-parser-api</artifactId>
12-
<name>Java Prism</name>
12+
<name>Java Prism API</name>
1313
<description>Java API for the Prism Ruby language parser</description>
1414
<url>https://github.com/ruby/prism</url>
1515

16+
<repositories>
17+
<repository>
18+
<id>mavengems</id>
19+
<url>mavengem:https://rubygems.org</url>
20+
</repository>
21+
</repositories>
22+
1623
<dependencies>
1724
<dependency>
1825
<groupId>org.ruby-lang</groupId>
1926
<artifactId>prism-parser-native</artifactId>
2027
<version>0.0.2-SNAPSHOT</version>
2128
<scope>provided</scope>
2229
</dependency>
30+
<dependency>
31+
<groupId>rubygems</groupId>
32+
<artifactId>rake</artifactId>
33+
<version>13.0.3</version>
34+
<type>gem</type>
35+
</dependency>
36+
<dependency>
37+
<groupId>rubygems</groupId>
38+
<artifactId>rake-compiler</artifactId>
39+
<version>1.3.1</version>
40+
<type>gem</type>
41+
</dependency>
2342
</dependencies>
2443

2544
<build>
45+
<extensions>
46+
<extension>
47+
<groupId>org.jruby.maven</groupId>
48+
<artifactId>mavengem-wagon</artifactId>
49+
<version>2.0.2</version>
50+
</extension>
51+
</extensions>
2652
<plugins>
53+
<plugin>
54+
<groupId>org.codehaus.mojo</groupId>
55+
<artifactId>build-helper-maven-plugin</artifactId>
56+
<version>3.6.1</version>
57+
<executions>
58+
<execution>
59+
<id>add-source</id>
60+
<phase>generate-sources</phase>
61+
<goals>
62+
<goal>add-source</goal>
63+
</goals>
64+
<configuration>
65+
<sources>
66+
<source>target/generated-sources/java</source>
67+
</sources>
68+
</configuration>
69+
</execution>
70+
</executions>
71+
</plugin>
72+
<plugin>
73+
<groupId>org.jruby.maven</groupId>
74+
<artifactId>rake-maven-plugin</artifactId>
75+
<version>3.0.6</version>
76+
<executions>
77+
<execution>
78+
<id>generate templated Java sources</id>
79+
<phase>generate-sources</phase>
80+
<goals>
81+
<goal>rake</goal>
82+
</goals>
83+
<configuration>
84+
<launchDirectory>${project.basedir}/../..</launchDirectory>
85+
<rakeArgs>PRISM_EXCLUDE_PRETTYPRINT=1 PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS=1 templates</rakeArgs>
86+
</configuration>
87+
</execution>
88+
</executions>
89+
</plugin>
2790
<plugin>
2891
<groupId>org.codehaus.mojo</groupId>
2992
<artifactId>templating-maven-plugin</artifactId>

0 commit comments

Comments
 (0)