@@ -84,5 +84,51 @@ public void generateLauncher() throws IOException {
8484 "-a" , "$@" );
8585
8686 }
87-
87+
88+ @ Test
89+ public void generateWindowsLauncher () throws IOException {
90+ for (File tf : new File ("target" ).listFiles ()) {
91+ if (tf .getName ().endsWith (".jar" ) && !tf .getName ().endsWith ("-sources.jar" ) && !tf .getName ().endsWith ("-javadoc.jar" )) {
92+ Files .copy (
93+ tf .toPath (),
94+ new File (new File ("target/dist-win/lib" ), tf .getName ()).toPath (),
95+ StandardCopyOption .REPLACE_EXISTING );
96+ }
97+ }
98+
99+ ModuleLayer layer = Launcher .class .getModule ().getLayer ();
100+ try (Writer writer = new FileWriter (new File ("target/dist-win/modules" ))) {
101+ for (String name : layer .modules ().stream ().map (Module ::getName ).sorted ().toList ()) {
102+ writer .write (name );
103+ writer .write (System .lineSeparator ());
104+ };
105+ }
106+
107+ CommandLine launcherCommandLine = new CommandLine (new LauncherCommand ());
108+ launcherCommandLine .execute (
109+ "-j" , "@%~dp0\\ jdk\\ bin\\ java.exe" ,
110+ "-m" , "org.nasdanika.launcher" ,
111+ "-c" , "org.nasdanika.launcher.Launcher" ,
112+ "--add-modules" , "ALL-SYSTEM" ,
113+ "-f" , "options" ,
114+ // "-r", "org.nasdanika.**,com.azure.**,io.netty.**",
115+ "-b" , "target/dist-win" ,
116+ "-M" , "target/dist-win/modules" ,
117+ "-p" , ";" ,
118+ "-o" , "nsd.bat" );
119+
120+ launcherCommandLine .execute (
121+ "-m" , "org.nasdanika.launcher" ,
122+ "-c" , "org.nasdanika.launcher.Launcher" ,
123+ "--add-modules" , "ALL-SYSTEM" ,
124+ "-j" , "@%~dp0\\ jdk\\ bin\\ java.exe -Xdebug -Xrunjdwp:transport=dt_socket,address=8998,server=y" ,
125+ "-f" , "options" ,
126+ // "-r", "org.nasdanika.**,com.azure.**,io.netty.**",
127+ "-b" , "target/dist-win" ,
128+ "-M" , "target/dist-win/modules" ,
129+ "-p" , ";" ,
130+ "-o" , "nsd-debug.bat" );
131+
132+ }
133+
88134}
0 commit comments