Prepare for publish

This commit is contained in:
Christopher Schnick
2022-01-10 07:10:44 +01:00
parent b192fd5b09
commit cd93f934ff
23 changed files with 253 additions and 329 deletions
@@ -29,17 +29,6 @@ public class BeaconConfig {
private static final String IN_PROCESS_PROP = "io.xpipe.beacon.startInProcess";
public static boolean shouldStartInProcess() {
if (System.getProperty(IN_PROCESS_PROP) != null) {
return Boolean.parseBoolean(System.getProperty(IN_PROCESS_PROP));
}
return false;
}
private static final String EXEC_PROCESS_PROP = "io.xpipe.beacon.exec";
public static String getCustomExecCommand() {
@@ -1,7 +1,6 @@
package io.xpipe.beacon;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.DatagramSocket;
import java.net.ServerSocket;
@@ -21,29 +20,12 @@ public class BeaconServer {
}
public static boolean tryStart() throws Exception {
if (BeaconConfig.shouldStartInProcess()) {
startInProcess();
return true;
}
var custom = BeaconConfig.getCustomExecCommand();
if (custom != null) {
var proc = new ProcessBuilder("cmd", "/c", "CALL", "C:\\Projects\\xpipe\\xpipe\\gradlew.bat", ":app:run").inheritIO().start();
new ProcessBuilder("cmd", "/c", "CALL", custom).inheritIO().start();
return true;
}
return false;
}
private static void startInProcess() throws Exception {
var mainClass = Class.forName("io.xpipe.app.Main");
var method = mainClass.getDeclaredMethod("main", String[].class);
new Thread(() -> {
try {
method.invoke(null, (Object) new String[0]);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}).start();
}
}