File tree Expand file tree Collapse file tree 2 files changed +31
-4
lines changed
src/main/java/me/adversing Expand file tree Collapse file tree 2 files changed +31
-4
lines changed Original file line number Diff line number Diff line change 11plugins {
22 java
33 application
4+ id(" com.github.johnrengelman.shadow" ) version " 8.1.1"
45}
56
67group = " me.adversing"
@@ -30,9 +31,29 @@ application {
3031 mainClass.set(" me.adversing.Main" )
3132}
3233
34+ tasks.jar {
35+ manifest {
36+ attributes(
37+ " Main-Class" to " me.adversing.Main"
38+ )
39+ }
40+ }
41+
3342tasks.withType<JavaExec > {
3443 jvmArgs(
3544 " --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED" ,
3645 " --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"
3746 )
3847}
48+
49+ tasks.shadowJar {
50+ archiveClassifier.set(" all" )
51+ manifest {
52+ attributes(
53+ " Main-Class" to " me.adversing.Main" ,
54+ " Add-Exports" to " java.base/jdk.internal.misc" ,
55+ " Add-Opens" to " java.base/jdk.internal.misc"
56+ )
57+ }
58+ }
59+
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public static void main(String[] args) {
2121
2222 DiagnosticService diagnosticService = new DiagnosticService ();
2323 Parser parser = new Parser (diagnosticService );
24- String file = validateFile (args [ 0 ] );
24+ String file = validateFile (args );
2525 File asmFile = new File (file );
2626
2727 try (ASMEvaluator evaluator = new ASMEvaluator (diagnosticService , debug )) {
@@ -55,10 +55,16 @@ private static boolean hasDebugFlag(String[] args) {
5555 return Arrays .stream (args ).anyMatch (arg -> "--debug" .equals (arg ) || "-d" .equals (arg ));
5656 }
5757
58- private static String validateFile (String file ) {
59- if (file == null ) {
60- throw new IllegalArgumentException ("No file provided." );
58+ private static String validateFile (String [] args ) {
59+ if (args == null || args . length == 0 ) {
60+ throw new IllegalArgumentException ("No arguments provided." );
6161 }
62+
63+ String file = args [0 ];
64+ if (file == null || file .trim ().isEmpty ()) {
65+ throw new IllegalArgumentException ("File path cannot be null or empty." );
66+ }
67+
6268 return file ;
6369 }
6470}
You can’t perform that action at this time.
0 commit comments