From d3af9c9d51541588bcbdf4c5979c5a77fcde7ca7 Mon Sep 17 00:00:00 2001 From: Luke Bemish Date: Thu, 10 Oct 2024 12:51:45 -0500 Subject: [PATCH] Go back to normal execution --- build.gradle | 14 +---- .../lukebemish/christen/cli/ChristenMain.java | 55 ------------------- 2 files changed, 1 insertion(+), 68 deletions(-) delete mode 100644 src/cli/java/dev/lukebemish/christen/cli/ChristenMain.java diff --git a/build.gradle b/build.gradle index c2f7653..9b5f6c9 100644 --- a/build.gradle +++ b/build.gradle @@ -83,18 +83,7 @@ managedVersioning { apply() } -sourceSets { - cli {} -} - dependencies { - cliImplementation 'net.neoforged.jst:jst-cli:1.0.63' - cliImplementation 'net.neoforged.jst:jst-api:1.0.63' - cliCompileOnly sourceSets.main.output - - cliCompileOnly cLibs.bundles.compileonly - cliAnnotationProcessor cLibs.bundles.annotationprocessor - implementation 'net.neoforged.jst:jst-cli:1.0.63' implementation 'net.neoforged.jst:jst-api:1.0.63' implementation 'net.neoforged:srgutils:1.0.9' @@ -120,11 +109,10 @@ configurations { } shadowJar { - from sourceSets.cli.output configurations = [project.configurations.include] mergeServiceFiles() manifest { - attributes 'Main-Class': 'dev.lukebemish.christen.cli.ChristenMain' + attributes 'Main-Class': 'net.neoforged.jst.cli.ChristenMain' } } diff --git a/src/cli/java/dev/lukebemish/christen/cli/ChristenMain.java b/src/cli/java/dev/lukebemish/christen/cli/ChristenMain.java deleted file mode 100644 index f671b77..0000000 --- a/src/cli/java/dev/lukebemish/christen/cli/ChristenMain.java +++ /dev/null @@ -1,55 +0,0 @@ -package dev.lukebemish.christen.cli; - -import dev.lukebemish.christen.ChristenTransformer; -import net.neoforged.jst.api.SourceTransformer; -import net.neoforged.jst.cli.Main; -import picocli.CommandLine; - -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.util.HashSet; -import java.util.List; -import java.util.concurrent.Callable; - -public class ChristenMain implements Callable { - @CommandLine.ArgGroup(exclusive = false, multiplicity = "1") - ChristenTransformer plugin; - - @CommandLine.ArgGroup(exclusive = false, multiplicity = "1..*") - List
subcommands; - - private static final MethodHandle ENABLED_TRANSFORMERS; - - static { - try { - ENABLED_TRANSFORMERS = MethodHandles.privateLookupIn(Main.class, MethodHandles.lookup()).findGetter(Main.class, "enabledTransformers", HashSet.class); - } catch (NoSuchFieldException | IllegalAccessException e) { - throw new RuntimeException(e); - } - } - - public static void main(String[] args) { - var commandLine = new CommandLine(new ChristenMain()); - commandLine.setCaseInsensitiveEnumValuesAllowed(true); - System.exit(commandLine.execute(args)); - } - - @SuppressWarnings("unchecked") - @Override - public Integer call() throws Exception { - for (var main : subcommands) { - HashSet enabledTransformers; - try { - enabledTransformers = (HashSet) ENABLED_TRANSFORMERS.invoke(main); - } catch (Throwable e) { - throw new RuntimeException(e); - } - enabledTransformers.add(plugin); - var result = main.call(); - if (!result.equals(0)) { - return result; - } - } - return 0; - } -}