[FEATURE] Add ProGuard jvmArgs

This commit is contained in:
Gravita 2024-01-18 00:13:36 +07:00
parent efe967587c
commit f1922c52e2

View file

@ -34,6 +34,7 @@ public class ProGuardComponent extends Component implements AutoCloseable, Recon
private static final Logger logger = LogManager.getLogger(); private static final Logger logger = LogManager.getLogger();
public String modeAfter = "MainBuild"; public String modeAfter = "MainBuild";
public String dir = "proguard"; public String dir = "proguard";
public List<String> jvmArgs = new ArrayList<>();
public boolean enabled = true; public boolean enabled = true;
public boolean mappings = true; public boolean mappings = true;
public transient ProguardConf proguardConf; public transient ProguardConf proguardConf;
@ -41,6 +42,10 @@ public class ProGuardComponent extends Component implements AutoCloseable, Recon
private transient ProGuardBuildTask buildTask; private transient ProGuardBuildTask buildTask;
private transient ProGuardMultiReleaseFixer fixerTask; private transient ProGuardMultiReleaseFixer fixerTask;
public ProGuardComponent() {
this.jvmArgs.add("-Xmx512M");
}
public static boolean checkFXJMods(Path path) { public static boolean checkFXJMods(Path path) {
if (!IOHelper.exists(path.resolve("javafx.base.jmod"))) if (!IOHelper.exists(path.resolve("javafx.base.jmod")))
return false; return false;
@ -208,6 +213,7 @@ public Path process(Path inputFile) throws IOException {
try { try {
List<String> args = new ArrayList<>(); List<String> args = new ArrayList<>();
args.add(IOHelper.resolveJavaBin(IOHelper.JVM_DIR).toAbsolutePath().toString()); args.add(IOHelper.resolveJavaBin(IOHelper.JVM_DIR).toAbsolutePath().toString());
args.addAll(component.jvmArgs);
args.add("-cp"); args.add("-cp");
try(Stream<Path> files = Files.walk(Path.of("libraries"), FileVisitOption.FOLLOW_LINKS)) { try(Stream<Path> files = Files.walk(Path.of("libraries"), FileVisitOption.FOLLOW_LINKS)) {
args.add(files args.add(files