quick-e2e: Add GradleService to run Gradle tasks and update Main class to utilize it

This commit is contained in:
Oliver
2025-03-16 19:09:46 +01:00
parent 7827f251f6
commit d925b211fb
3 changed files with 28 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
- [ ] Add system to load configuration from file / command line arguments - [ ] Add system to load configuration from file / command line arguments
- [ ] Add services to install plugins - [ ] Add services to install plugins
- [ ] Add service to set port
- [ ] Add option to update an existing E2E environment - [ ] Add option to update an existing E2E environment
- [ ] Add option to delete an existing E2E environment - [ ] Add option to delete an existing E2E environment

View File

@@ -3,6 +3,7 @@ package de.oliver.quicke2e;
import de.oliver.quicke2e.config.Configuration; import de.oliver.quicke2e.config.Configuration;
import de.oliver.quicke2e.config.Context; import de.oliver.quicke2e.config.Context;
import de.oliver.quicke2e.steps.eula.EulaService; import de.oliver.quicke2e.steps.eula.EulaService;
import de.oliver.quicke2e.steps.gradle.GradleService;
import de.oliver.quicke2e.steps.ops.OPsService; import de.oliver.quicke2e.steps.ops.OPsService;
import de.oliver.quicke2e.steps.paper.PaperDownloadService; import de.oliver.quicke2e.steps.paper.PaperDownloadService;
import de.oliver.quicke2e.steps.startScript.StartScriptService; import de.oliver.quicke2e.steps.startScript.StartScriptService;
@@ -37,6 +38,9 @@ public class Main {
StartScriptService startScript = new StartScriptService(); StartScriptService startScript = new StartScriptService();
startScript.writeStartScript(context); startScript.writeStartScript(context);
GradleService gradle = new GradleService();
gradle.runTask(":plugins:fancyholograms:shadowJar");
StartServerService startServer = new StartServerService(); StartServerService startServer = new StartServerService();
startServer.startServer(context); startServer.startServer(context);
} }

View File

@@ -0,0 +1,23 @@
package de.oliver.quicke2e.steps.gradle;
public class GradleService {
public void runTask(String task) {
String[] taskCommand = task.split(" ");
String[] command = new String[taskCommand.length + 1];
command[0] = "./gradlew";
System.arraycopy(taskCommand, 0, command, 1, taskCommand.length);
ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.redirectErrorStream(true);
processBuilder.redirectOutput(ProcessBuilder.Redirect.INHERIT);
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
try {
processBuilder.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}