Skip to content

Commit 735f628

Browse files
Update to PraxisCORE v6.3.0
1 parent 92256d6 commit 735f628

File tree

4 files changed

+144
-148
lines changed

4 files changed

+144
-148
lines changed

codelerity-core-bin/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
<plugin>
3434
<groupId>org.apache.maven.plugins</groupId>
3535
<artifactId>maven-assembly-plugin</artifactId>
36-
<version>3.7.1</version>
3736
<executions>
3837
<execution>
3938
<id>make-bin</id>

codelerity-core-bin/src/main/java/com/codelerity/core/bin/Main.java

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,17 @@
1919
package com.codelerity.core.bin;
2020

2121
import java.io.File;
22+
import java.io.IOException;
23+
import java.nio.file.Files;
24+
import java.nio.file.Path;
2225
import java.util.ArrayList;
2326
import java.util.List;
27+
import java.util.Locale;
28+
import java.util.Map;
2429
import java.util.Optional;
30+
import java.util.stream.Stream;
31+
import org.praxislive.core.types.PArray;
32+
import org.praxislive.core.types.PString;
2533
import org.praxislive.launcher.Launcher;
2634

2735
public class Main {
@@ -32,35 +40,41 @@ public static void main(String[] args) {
3240

3341
private static class LauncherCtxt implements Launcher.Context {
3442

35-
private final String command;
36-
private final String modulePath;
37-
private final String classPath;
38-
3943
private LauncherCtxt() {
40-
command = ProcessHandle.current().info().command().orElse("java");
41-
modulePath = System.getProperty("jdk.module.path");
42-
classPath = System.getProperty("java.class.path");
4344
}
4445

4546
@Override
4647
public ProcessBuilder createChildProcessBuilder(List<String> javaOptions,
4748
List<String> arguments) {
48-
List<String> cmd = new ArrayList<>();
49-
cmd.add(command);
50-
cmd.addAll(javaOptions);
51-
if (modulePath == null || modulePath.isEmpty()) {
52-
cmd.add("-classpath");
53-
cmd.add(classPath);
54-
cmd.add("com.codelerity.core.bin.Main");
55-
} else {
56-
cmd.add("--add-modules=ALL-DEFAULT");
57-
cmd.add("-p");
58-
cmd.add(modulePath);
59-
cmd.add("-m");
60-
cmd.add("com.codelerity.core.bin/com.codelerity.core.bin.Main");
49+
boolean isWindows = System.getProperty("os.name", "")
50+
.toLowerCase(Locale.ROOT).contains("windows");
51+
String basedir = System.getProperty("app.home");
52+
if (basedir == null || basedir.isBlank()) {
53+
throw new IllegalStateException("Cannot find app.home");
6154
}
55+
Path bin = Path.of(basedir, "bin");
56+
Path launcher;
57+
try (Stream<Path> files = Files.list(bin)) {
58+
launcher = files.filter(f -> {
59+
boolean isCmd = f.toString().endsWith(".cmd");
60+
return isWindows ? isCmd : !isCmd && Files.isExecutable(f);
61+
}).findFirst()
62+
.orElseThrow(() -> new IllegalStateException("Cannot find launcher"));
63+
64+
} catch (IOException ex) {
65+
throw new IllegalStateException("Cannot find launcher", ex);
66+
}
67+
List<String> cmd = new ArrayList<>();
68+
cmd.add(launcher.toString());
6269
cmd.addAll(arguments);
63-
return new ProcessBuilder(cmd);
70+
ProcessBuilder pb = new ProcessBuilder(cmd);
71+
Map<String, String> env = pb.environment();
72+
env.put("JAVA_HOME", System.getProperty("java.home"));
73+
env.put("JAVA_OPTS", javaOptions.stream()
74+
.map(PString::of)
75+
.collect(PArray.collector())
76+
.toString());
77+
return pb;
6478
}
6579

6680
@Override

pom.xml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</distributionManagement>
5252

5353
<properties>
54-
<praxiscore.version>6.2.0</praxiscore.version>
54+
<praxiscore.version>6.3.0</praxiscore.version>
5555
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5656
</properties>
5757

@@ -60,7 +60,7 @@
6060
<dependency>
6161
<groupId>org.junit</groupId>
6262
<artifactId>junit-bom</artifactId>
63-
<version>5.12.1</version>
63+
<version>5.13.1</version>
6464
<type>pom</type>
6565
<scope>import</scope>
6666
</dependency>
@@ -114,8 +114,8 @@
114114
</plugin>
115115
<plugin>
116116
<groupId>org.apache.maven.plugins</groupId>
117-
<artifactId>maven-jar-plugin</artifactId>
118-
<version>3.4.2</version>
117+
<artifactId>maven-assembly-plugin</artifactId>
118+
<version>3.7.1</version>
119119
</plugin>
120120
<plugin>
121121
<groupId>org.apache.maven.plugins</groupId>
@@ -125,10 +125,15 @@
125125
<release>21</release>
126126
</configuration>
127127
</plugin>
128+
<plugin>
129+
<groupId>org.apache.maven.plugins</groupId>
130+
<artifactId>maven-jar-plugin</artifactId>
131+
<version>3.4.2</version>
132+
</plugin>
128133
<plugin>
129134
<groupId>org.apache.maven.plugins</groupId>
130135
<artifactId>maven-surefire-plugin</artifactId>
131-
<version>3.5.2</version>
136+
<version>3.5.3</version>
132137
<configuration>
133138
<systemPropertyVariables>
134139
<junit.jupiter.execution.timeout.mode>disabled_on_debug</junit.jupiter.execution.timeout.mode>

0 commit comments

Comments
 (0)