Skip to content

Commit

Permalink
Add an option to validate ATs (#18)
Browse files Browse the repository at this point in the history
This PR adds a `--validate-access-transformers` option that, when
enabled, will make JST fatally error when ATs do not have a valid
target.
  • Loading branch information
Matyrobbrt authored Jun 26, 2024
1 parent fd76fee commit 082f062
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public class RunNeoFormCommand extends NeoFormEngineCommand {
@CommandLine.Option(names = "--access-transformer", arity = "*")
List<String> additionalAccessTransformers = new ArrayList<>();

@CommandLine.Option(names = "--validate-access-transformers", description = "Whether access transformers should be validated and fatal errors should arise if they target members that do not exist")
boolean validateAccessTransformers;

@CommandLine.Option(names = "--parchment-data", description = "Path or Maven coordinates of parchment data to use")
String parchmentData;

Expand Down Expand Up @@ -132,6 +135,9 @@ protected void runWithNeoFormEngine(NeoFormEngine engine, List<AutoCloseable> cl
if (!additionalAccessTransformers.isEmpty()) {
var transformSources = getOrAddTransformSourcesNode(engine);
transformSources.setAdditionalAccessTransformers(additionalAccessTransformers.stream().map(Paths::get).toList());
if (validateAccessTransformers) {
transformSources.addArg("--access-transformer-validation=error");
}
}

if (parchmentData != null) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/tools.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# https://projects.neoforged.net/neoforged/javasourcetransformer
JAVA_SOURCE_TRANSFORMER=net.neoforged.jst:jst-cli-bundle:1.0.43
JAVA_SOURCE_TRANSFORMER=net.neoforged.jst:jst-cli-bundle:1.0.44

DIFF_PATCH=codechicken:DiffPatch:1.5.0.29:all

0 comments on commit 082f062

Please sign in to comment.