zshamrock / dynosql

Run SQL queries against DynamoDB
GNU General Public License v3.0
3 stars 0 forks source link

Investigate whether it is possible to make generated ANTLR4 package scoped #1

Closed zshamrock closed 6 years ago

zshamrock commented 6 years ago

Looks like per https://github.com/antlr/antlr4/issues/972 could use maven-replacer-plugin:

Update: My current solution is to use maven-replacer-plugin to remove the public modifier from the generated classes. Worked well enough:

<plugin>
  <groupId>com.google.code.maven-replacer-plugin</groupId>
  <artifactId>maven-replacer-plugin</artifactId>
  <version>1.4.1</version>
  <executions>
    <execution>
      <phase>process-sources</phase>
      <goals>
        <goal>replace</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <includes>
      <include>target/generated-sources/antlr4/**/*.java</include>
    </includes>
    <variableTokenValueMap>
      public class=class,public interface=interface
    </variableTokenValueMap>
  </configuration>
</plugin>

The version I'm using (1.4.1) is in Maven Central, and a few people have exported the project to GitHub, so there should be no danger of sudden broken builds or lost source code.

That being said, this is still a hack smile

Although even if a hack, would be good enough for me.

zshamrock commented 6 years ago

Or is there the corresponding -D<option>=value option value ANTLR4 supports for this?