mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FEATURE] API создания модулей до старта LauncherEngine(Wrapper Phase)
This commit is contained in:
parent
e2d3e3068f
commit
0e2c19f79c
3 changed files with 23 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
import java.util.List;
|
||||
|
||||
import pro.gravit.launcher.client.ClientLauncher;
|
||||
import pro.gravit.launcher.client.ClientModuleManager;
|
||||
import pro.gravit.launcher.client.DirBridge;
|
||||
import pro.gravit.utils.helper.EnvHelper;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
@ -26,6 +27,9 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
|
|||
JVMHelper.verifySystemProperties(Launcher.class, true);
|
||||
EnvHelper.checkDangerousParams();
|
||||
LauncherConfig config = Launcher.getConfig();
|
||||
LauncherEngine.modulesManager = new ClientModuleManager();
|
||||
LauncherConfig.getAutogenConfig().initModules();
|
||||
|
||||
LogHelper.info("Launcher for project %s", config.projectname);
|
||||
if (config.environment.equals(LauncherConfig.LauncherEnvironment.PROD)) {
|
||||
if (System.getProperty(LogHelper.DEBUG_PROPERTY) != null) {
|
||||
|
@ -59,6 +63,7 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
|
|||
Collections.addAll(args, "-cp");
|
||||
Collections.addAll(args, pathLauncher);
|
||||
Collections.addAll(args, LauncherEngine.class.getName());
|
||||
LauncherEngine.modulesManager.callWrapper(processBuilder, args);
|
||||
EnvHelper.addEnv(processBuilder);
|
||||
LogHelper.debug("Commandline: " + args);
|
||||
processBuilder.command(args);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
|
||||
import pro.gravit.launcher.modules.LauncherModule;
|
||||
import pro.gravit.launcher.modules.impl.SimpleModuleManager;
|
||||
|
@ -25,4 +26,14 @@ public void autoload(Path dir) throws IOException {
|
|||
public LauncherModule loadModule(Path file) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public void callWrapper(ProcessBuilder processBuilder, Collection<String> jvmArgs)
|
||||
{
|
||||
for(LauncherModule module : modules)
|
||||
{
|
||||
if(module instanceof ClientWrapperModule)
|
||||
{
|
||||
((ClientWrapperModule) module).wrapperPhase(processBuilder, jvmArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package pro.gravit.launcher.client;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface ClientWrapperModule {
|
||||
void wrapperPhase(ProcessBuilder processBuilder, Collection<String> jvmArgs);
|
||||
}
|
Loading…
Reference in a new issue