Skip to content

Commit 3ed2f58

Browse files
committed
Windows distribution
1 parent b523e1c commit 3ed2f58

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,20 @@
144144
<includeScope>runtime</includeScope>
145145
</configuration>
146146
</execution>
147+
<execution>
148+
<id>copy-dependencies-win</id>
149+
<phase>prepare-package</phase>
150+
<goals>
151+
<goal>copy-dependencies</goal>
152+
</goals>
153+
<configuration>
154+
<outputDirectory>
155+
${project.build.directory}/dist-win/lib
156+
</outputDirectory>
157+
<useRepositoryLayout>true</useRepositoryLayout>
158+
<includeScope>runtime</includeScope>
159+
</configuration>
160+
</execution>
147161
</executions>
148162
</plugin>
149163
<plugin>

src/test/java/org/nasdanika/launcher/tests/BuildDistributionIT.java

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)