mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-09-29 03:45:43 +00:00
Prepare for publish
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user