Skip to content

Commit d8b0b80

Browse files
committed
feat: jpms support
- feat: add `module-info.java` descriptor - fix!: update annotation package path to `o.a.v.annotations.*` - chore: upgrade jvm target → `11` - chore: upgrade all maven plugins to latest - chore: centralize maven plugin versions - chore: centralize dependency versions - chore: refactor build to fix dependency on old plugin version This changeset introduces support for the Java Platform Module System, or JPMS, within the ANTLR v4 runtime and annotations packages. The runtime package can now be depended on in downstream modules with a `requires antlr.runtime` directive. To facilitate this functionality, a breaking change had to be made with regard to packages used for annotations. The following package changes were made: - `o.a.v.misc.NotNull` → `org.antlr.v4.annotations.NotNull` - `o.a.v.misc.Nullable` → `org.antlr.v4.annotations.Nullable` - `o.a.v.r.NullUsageProcessor` → `...processors.NullUsageProcessor` Code generators, service definitions, and other references to these classes were updated accordingly. This change was made to fix split package issues between the ANTLR runtime and annotations modules, which is banned under JPMS. The JVM target was updated to JVM 11, which allows cleanup of older JDK 1.6 and JDK 1.8 related build wiring. Reasoning: users of 1.6 and 1.8 do not need libs that support JPMS; building multi-release JARs in Maven is hard and error-prone. There isn't much sense in setting a JVM target of 9 or 10, so 11 is the new standard. Additionally, the codebase now uses a bootstrap JAR to facilitate code-gen in `antlr4-runtime`; this bootstrap JAR is located in the `lib/` folder and automatically installed for the developer if they use either `./mvnw` (also added) or `./bootstrap.sh`. This bootstrap JAR will allow iteration on the code generator without needing to release a new plugin version. Signed-off-by: Sam Gammon <[email protected]>
1 parent 1de7b24 commit d8b0b80

File tree

162 files changed

+1373
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+1373
-365
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ nbactions*.xml
2929
# Playground
3030
#/tool/playground/
3131

32-
.vscode/
32+
.vscode/
33+
.boot

.mvn/wrapper/maven-wrapper.jar

61.1 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://maven.pkg.st/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
18+
wrapperUrl=https://maven.pkg.st/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

antlr4-maven-plugin/pom.xml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
<parent>
1414
<groupId>com.tunnelvisionlabs</groupId>
1515
<artifactId>antlr4-master</artifactId>
16-
<version>4.9.1-SNAPSHOT</version>
16+
<version>4.10.0-SNAPSHOT</version>
1717
</parent>
1818

1919
<artifactId>antlr4-maven-plugin</artifactId>
2020
<packaging>maven-plugin</packaging>
2121

2222
<name>ANTLR 4 Maven plugin</name>
2323
<description>Maven plugin for ANTLR 4 grammars</description>
24-
<url>http://www.antlr.org</url>
24+
<url>https://www.antlr.org</url>
2525

2626
<prerequisites>
2727
<maven>3.0</maven>
2828
</prerequisites>
2929

30-
<!-- Ancilliary information for completeness
30+
<!-- Ancillary information for completeness
3131
-->
3232
<inceptionYear>2009</inceptionYear>
3333

@@ -48,20 +48,17 @@
4848
<dependency>
4949
<groupId>org.apache.maven</groupId>
5050
<artifactId>maven-plugin-api</artifactId>
51-
<version>3.0.5</version>
52-
<scope>compile</scope>
51+
<scope>provided</scope>
5352
</dependency>
5453

5554
<dependency>
5655
<groupId>org.codehaus.plexus</groupId>
5756
<artifactId>plexus-compiler-api</artifactId>
58-
<version>2.2</version>
5957
</dependency>
6058

6159
<dependency>
6260
<groupId>org.sonatype.plexus</groupId>
6361
<artifactId>plexus-build-api</artifactId>
64-
<version>0.0.7</version>
6562
</dependency>
6663

6764
<!--
@@ -79,73 +76,60 @@
7976
Testing requirements...
8077
-->
8178
<dependency>
82-
8379
<groupId>junit</groupId>
8480
<artifactId>junit</artifactId>
85-
<version>4.13.1</version>
8681
<scope>test</scope>
87-
8882
</dependency>
8983

9084
<dependency>
9185
<groupId>io.takari.maven.plugins</groupId>
9286
<artifactId>takari-plugin-testing</artifactId>
93-
<version>2.9.0</version>
9487
<scope>test</scope>
9588
</dependency>
9689

9790
<dependency>
9891
<groupId>org.apache.maven.plugin-tools</groupId>
9992
<artifactId>maven-plugin-annotations</artifactId>
100-
<version>3.2</version>
10193
<scope>provided</scope>
10294
</dependency>
10395

10496
<dependency>
10597
<groupId>org.apache.maven</groupId>
10698
<artifactId>maven-compat</artifactId>
107-
<version>3.0.5</version>
10899
<scope>test</scope>
109100
</dependency>
110101

111102
<dependency>
112103
<groupId>org.codehaus.plexus</groupId>
113104
<artifactId>plexus-utils</artifactId>
114-
<version>3.0.15</version>
115-
<scope>provided</scope>
105+
<scope>test</scope>
116106
</dependency>
117107

118108
<!-- Must be last or tests will fail -->
119109
<dependency>
120110
<groupId>org.apache.maven</groupId>
121111
<artifactId>maven-project</artifactId>
122-
<version>2.2.1</version>
112+
<scope>provided</scope>
123113
</dependency>
124114

125115
</dependencies>
126116

127117
<profiles>
128118
<profile>
129119
<id>maven-plugin-no-tests</id>
130-
<activation>
131-
<jdk>1.6</jdk>
132-
</activation>
133120
<properties>
134121
<skipTests>true</skipTests>
135122
</properties>
136123
</profile>
137124

138125
<profile>
139126
<id>maven-plugin-tests</id>
140-
<activation>
141-
<jdk>!1.6</jdk>
142-
</activation>
143127
<build>
144128
<plugins>
145129
<plugin>
146130
<groupId>io.takari.maven.plugins</groupId>
147131
<artifactId>takari-lifecycle-plugin</artifactId>
148-
<version>1.11.12</version>
132+
<extensions>true</extensions>
149133
<executions>
150134
<execution>
151135
<id>testProperties</id>
@@ -184,7 +168,6 @@
184168
<plugin>
185169
<groupId>org.apache.maven.plugins</groupId>
186170
<artifactId>maven-plugin-plugin</artifactId>
187-
<version>3.6.0</version>
188171
<configuration>
189172
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
190173
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
@@ -208,13 +191,11 @@
208191
<plugin>
209192
<groupId>org.apache.maven.plugins</groupId>
210193
<artifactId>maven-site-plugin</artifactId>
211-
<version>3.3</version>
212194
</plugin>
213195

214196
<plugin>
215197
<groupId>org.apache.maven.plugins</groupId>
216198
<artifactId>maven-project-info-reports-plugin</artifactId>
217-
<version>2.7</version>
218199
<configuration>
219200
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
220201
</configuration>
@@ -229,13 +210,11 @@
229210
<plugin>
230211
<groupId>org.apache.maven.plugins</groupId>
231212
<artifactId>maven-plugin-plugin</artifactId>
232-
<version>3.3</version>
233213
</plugin>
234214

235215
<plugin>
236216
<groupId>org.apache.maven.plugins</groupId>
237217
<artifactId>maven-javadoc-plugin</artifactId>
238-
<version>2.9</version>
239218
<configuration>
240219
<quiet>true</quiet>
241220
</configuration>
@@ -244,7 +223,6 @@
244223
<plugin>
245224
<groupId>org.apache.maven.plugins</groupId>
246225
<artifactId>maven-jxr-plugin</artifactId>
247-
<version>2.3</version>
248226
</plugin>
249227
</plugins>
250228
</reporting>

antlr4-maven-plugin/src/main/java/org/antlr/mojo/antlr4/Antlr4ErrorLog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package org.antlr.mojo.antlr4;
77

88
import org.antlr.v4.Tool;
9-
import org.antlr.v4.runtime.misc.NotNull;
9+
import org.antlr.v4.runtime.annotations.NotNull;
1010
import org.antlr.v4.tool.ANTLRMessage;
1111
import org.antlr.v4.tool.ANTLRToolListener;
1212
import org.apache.maven.plugin.logging.Log;

antlr4-maven-plugin/src/main/java/org/antlr/mojo/antlr4/Antlr4Mojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.antlr.v4.Tool;
1010
import org.antlr.v4.codegen.CodeGenerator;
1111
import org.antlr.v4.runtime.misc.MultiMap;
12-
import org.antlr.v4.runtime.misc.NotNull;
12+
import org.antlr.v4.runtime.annotations.NotNull;
1313
import org.antlr.v4.runtime.misc.Utils;
1414
import org.antlr.v4.tool.Grammar;
1515
import org.apache.maven.plugin.AbstractMojo;

antlr4-testgen-maven-plugin/pom.xml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@
99
<parent>
1010
<groupId>com.tunnelvisionlabs</groupId>
1111
<artifactId>antlr4-master</artifactId>
12-
<version>4.9.1-SNAPSHOT</version>
12+
<version>4.10.0-SNAPSHOT</version>
1313
</parent>
1414

1515
<artifactId>antlr4-testgen-maven-plugin</artifactId>
1616
<packaging>maven-plugin</packaging>
1717

1818
<name>ANTLR 4 Test Generator Maven plugin</name>
1919
<description>Maven plugin for generating ANTLR 4 runtime tests</description>
20-
<url>http://www.antlr.org</url>
20+
<url>https://www.antlr.org</url>
2121

2222
<prerequisites>
2323
<maven>3.0</maven>
2424
</prerequisites>
2525

26-
<!-- Ancilliary information for completeness
26+
<!-- Ancillary information for completeness
2727
-->
2828
<inceptionYear>2009</inceptionYear>
2929

3030
<!-- ============================================================================= -->
3131

3232
<!--
3333
34-
What are we depedent on for the Mojos to execute? We need the
34+
What are we dependent on for the Mojos to execute? We need the
3535
plugin API itself and of course we need the ANTLR Tool and runtime
3636
and any of their dependencies, which we inherit. The Tool itself provides
3737
us with all the dependencies, so we need only name it here.
@@ -44,32 +44,28 @@
4444
<dependency>
4545
<groupId>org.apache.maven</groupId>
4646
<artifactId>maven-plugin-api</artifactId>
47-
<version>3.0.5</version>
48-
<scope>compile</scope>
47+
<scope>provided</scope>
4948
</dependency>
5049

5150
<dependency>
5251
<groupId>org.apache.maven</groupId>
5352
<artifactId>maven-project</artifactId>
54-
<version>2.2.1</version>
53+
<scope>provided</scope>
5554
</dependency>
5655

5756
<dependency>
5857
<groupId>org.codehaus.plexus</groupId>
5958
<artifactId>plexus-compiler-api</artifactId>
60-
<version>2.2</version>
6159
</dependency>
6260

6361
<dependency>
6462
<groupId>org.sonatype.plexus</groupId>
6563
<artifactId>plexus-build-api</artifactId>
66-
<version>0.0.7</version>
6764
</dependency>
6865

6966
<dependency>
7067
<groupId>org.antlr</groupId>
7168
<artifactId>ST4</artifactId>
72-
<version>4.0.8</version>
7369
</dependency>
7470

7571
<dependency>
@@ -84,21 +80,18 @@
8480
<dependency>
8581
<groupId>junit</groupId>
8682
<artifactId>junit</artifactId>
87-
<version>4.13.1</version>
8883
<scope>test</scope>
8984
</dependency>
9085

9186
<dependency>
9287
<groupId>org.apache.maven.shared</groupId>
9388
<artifactId>maven-plugin-testing-harness</artifactId>
94-
<version>1.1</version>
9589
<scope>test</scope>
9690
</dependency>
9791

9892
<dependency>
9993
<groupId>org.apache.maven.plugin-tools</groupId>
10094
<artifactId>maven-plugin-annotations</artifactId>
101-
<version>3.2</version>
10295
<scope>provided</scope>
10396
</dependency>
10497

@@ -118,7 +111,6 @@
118111
<plugin>
119112
<groupId>org.apache.maven.plugins</groupId>
120113
<artifactId>maven-plugin-plugin</artifactId>
121-
<version>3.3</version>
122114
<configuration>
123115
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
124116
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
@@ -142,13 +134,11 @@
142134
<plugin>
143135
<groupId>org.apache.maven.plugins</groupId>
144136
<artifactId>maven-site-plugin</artifactId>
145-
<version>3.3</version>
146137
</plugin>
147138

148139
<plugin>
149140
<groupId>org.apache.maven.plugins</groupId>
150141
<artifactId>maven-project-info-reports-plugin</artifactId>
151-
<version>2.7</version>
152142
<configuration>
153143
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
154144
</configuration>
@@ -163,13 +153,11 @@
163153
<plugin>
164154
<groupId>org.apache.maven.plugins</groupId>
165155
<artifactId>maven-plugin-plugin</artifactId>
166-
<version>3.3</version>
167156
</plugin>
168157

169158
<plugin>
170159
<groupId>org.apache.maven.plugins</groupId>
171160
<artifactId>maven-javadoc-plugin</artifactId>
172-
<version>2.9</version>
173161
<configuration>
174162
<quiet>true</quiet>
175163
</configuration>
@@ -178,7 +166,6 @@
178166
<plugin>
179167
<groupId>org.apache.maven.plugins</groupId>
180168
<artifactId>maven-jxr-plugin</artifactId>
181-
<version>2.3</version>
182169
</plugin>
183170
</plugins>
184171
</reporting>

bootstrap.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
VERSION="4.10.0-BOOTSTRAP"
4+
5+
echo "Installing boostrap runtime JAR...";
6+
mvn install:install-file \
7+
-Dfile="./lib/antlr4-bootstrap.jar" \
8+
-DgroupId="com.tunnelvisionlabs" \
9+
-DartifactId="antlr4-runtime" \
10+
-Dversion="$VERSION" \
11+
-Dpackaging=jar
12+
13+
echo "Installing boostrap Maven plugin JAR...";
14+
mvn install:install-file \
15+
-Dfile="./lib/antlr4-bootstrap-maven-plugin.jar" \
16+
-DgroupId="com.tunnelvisionlabs" \
17+
-DartifactId="antlr4-maven-plugin" \
18+
-Dversion="$VERSION" \
19+
-Dpackaging=jar

lib/antlr4-bootstrap-maven-plugin.jar

31.2 KB
Binary file not shown.

lib/antlr4-bootstrap.jar

1.26 MB
Binary file not shown.

0 commit comments

Comments
 (0)