mirror of
https://github.com/ME1312/SubServers-2.git
synced 2025-02-16 19:51:26 +01:00
Allow different interpreters for SubCreator build scripts
This commit is contained in:
parent
9b01aebd87
commit
df159f72fe
@ -122,7 +122,7 @@ public class InternalSubCreator extends SubCreator {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (template.getBuildOptions().contains("Shell-Location")) {
|
if (template.getBuildOptions().contains("Executable")) {
|
||||||
File cache;
|
File cache;
|
||||||
if (template.getBuildOptions().getBoolean("Use-Cache", true)) {
|
if (template.getBuildOptions().getBoolean("Use-Cache", true)) {
|
||||||
cache = new UniversalFile(host.plugin.dir, "SubServers:Cache:Templates:" + template.getName());
|
cache = new UniversalFile(host.plugin.dir, "SubServers:Cache:Templates:" + template.getName());
|
||||||
@ -132,22 +132,9 @@ public class InternalSubCreator extends SubCreator {
|
|||||||
cache = null;
|
cache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!System.getProperty("os.name").toLowerCase().startsWith("windows") && template.getBuildOptions().contains("Permission")) {
|
|
||||||
try {
|
|
||||||
Process process = Runtime.getRuntime().exec("chmod " + template.getBuildOptions().getRawString("Permission") + ' ' + template.getBuildOptions().getRawString("Shell-Location"), null, dir);
|
|
||||||
Thread.sleep(500);
|
|
||||||
if (process.exitValue() != 0) {
|
|
||||||
System.out.println(name + File.separator + "Creator > Couldn't set " + template.getBuildOptions().getRawString("Permission") + " permissions to " + template.getBuildOptions().getRawString("Shell-Location"));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println(name + File.separator + "Creator > Couldn't set " + template.getBuildOptions().getRawString("Permission") + " permissions to " + template.getBuildOptions().getRawString("Shell-Location"));
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.out.println(name + File.separator + "Creator > Launching " + template.getBuildOptions().getRawString("Shell-Location"));
|
System.out.println(name + File.separator + "Creator > Launching Build Script...");
|
||||||
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(gitBash, "bash \"" + template.getBuildOptions().getRawString("Shell-Location") + '\"')).directory(dir);
|
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(gitBash, template.getBuildOptions().getRawString("Executable"))).directory(dir);
|
||||||
pb.environment().putAll(var);
|
pb.environment().putAll(var);
|
||||||
process = pb.start();
|
process = pb.start();
|
||||||
log.file = new File(dir, "SubCreator-" + template.getName() + "-" + version.toString() + ".log");
|
log.file = new File(dir, "SubCreator-" + template.getName() + "-" + version.toString() + ".log");
|
||||||
|
@ -5,7 +5,6 @@ Template:
|
|||||||
Build:
|
Build:
|
||||||
Server-Type: 'Forge'
|
Server-Type: 'Forge'
|
||||||
Use-Cache: false
|
Use-Cache: false
|
||||||
Shell-Location: 'build.sh'
|
Executable: 'bash build.sh'
|
||||||
Permission: '+x'
|
|
||||||
Settings:
|
Settings:
|
||||||
Executable: 'java -Xmx2048M -jar Forge.jar'
|
Executable: 'java -Xmx2048M -jar Forge.jar'
|
@ -4,7 +4,6 @@ Template:
|
|||||||
Icon: 'lava_bucket'
|
Icon: 'lava_bucket'
|
||||||
Build:
|
Build:
|
||||||
Server-Type: 'Spigot'
|
Server-Type: 'Spigot'
|
||||||
Shell-Location: 'build.sh'
|
Executable: 'bash build.sh'
|
||||||
Permission: '+x'
|
|
||||||
Settings:
|
Settings:
|
||||||
Executable: 'java -Xmx1024M -Dorg.bukkit.craftbukkit.libs.jline.terminal=unix -Djansi.passthrough=true -jar Spigot.jar -p $port$'
|
Executable: 'java -Xmx1024M -Dorg.bukkit.craftbukkit.libs.jline.terminal=unix -Djansi.passthrough=true -jar Spigot.jar -p $port$'
|
@ -5,7 +5,6 @@ Template:
|
|||||||
Build:
|
Build:
|
||||||
Server-Type: 'Sponge'
|
Server-Type: 'Sponge'
|
||||||
Use-Cache: false
|
Use-Cache: false
|
||||||
Shell-Location: 'build.sh'
|
Executable: 'bash build.sh'
|
||||||
Permission: '+x'
|
|
||||||
Settings:
|
Settings:
|
||||||
Executable: 'java -Xmx1024M -jar Sponge.jar'
|
Executable: 'java -Xmx1024M -jar Sponge.jar'
|
@ -4,7 +4,6 @@ Template:
|
|||||||
Icon: 'bukkit:grass'
|
Icon: 'bukkit:grass'
|
||||||
Build:
|
Build:
|
||||||
Server-Type: 'Vanilla'
|
Server-Type: 'Vanilla'
|
||||||
Shell-Location: 'build.sh'
|
Executable: 'bash build.sh'
|
||||||
Permission: '+x'
|
|
||||||
Settings:
|
Settings:
|
||||||
Executable: 'java -Xmx1024M -jar Vanilla.jar nogui'
|
Executable: 'java -Xmx1024M -jar Vanilla.jar nogui'
|
@ -280,25 +280,10 @@ public class SubCreator {
|
|||||||
cache = null;
|
cache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!System.getProperty("os.name").toLowerCase().startsWith("windows") && template.getBuildOptions().contains("Permission")) {
|
|
||||||
try {
|
|
||||||
Process process = Runtime.getRuntime().exec("chmod " + template.getBuildOptions().getRawString("Permission") + ' ' + template.getBuildOptions().getRawString("Shell-Location"), null, dir);
|
|
||||||
Thread.sleep(500);
|
|
||||||
if (process.exitValue() != 0) {
|
|
||||||
log.logger.info.println("Couldn't set " + template.getBuildOptions().getRawString("Permission") + " permissions to " + template.getBuildOptions().getRawString("Shell-Location"));
|
|
||||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Couldn't set " + template.getBuildOptions().getRawString("Permission") + " permissions to " + template.getBuildOptions().getRawString("Shell-Location")));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.logger.info.println("Couldn't set " + template.getBuildOptions().getRawString("Permission") + " permissions to " + template.getBuildOptions().getRawString("Shell-Location"));
|
|
||||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Couldn't set " + template.getBuildOptions().getRawString("Permission") + " permissions to " + template.getBuildOptions().getRawString("Shell-Location")));
|
|
||||||
log.logger.error.println(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
log.logger.info.println("Launching " + template.getBuildOptions().getRawString("Shell-Location"));
|
log.logger.info.println("Launching Build Script...");
|
||||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Launching " + template.getBuildOptions().getRawString("Shell-Location")));
|
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Launching Build Script..."));
|
||||||
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(host.host.getRawString("Git-Bash"), "bash \"" + template.getBuildOptions().getRawString("Shell-Location") + '\"')).directory(dir);
|
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(host.host.getRawString("Git-Bash"), template.getBuildOptions().getRawString("Executable"))).directory(dir);
|
||||||
pb.environment().putAll(var);
|
pb.environment().putAll(var);
|
||||||
process = pb.start();
|
process = pb.start();
|
||||||
log.file = new File(dir, "SubCreator-" + template.getName() + "-" + version.toString().replace(" ", "@") + ".log");
|
log.file = new File(dir, "SubCreator-" + template.getName() + "-" + version.toString().replace(" ", "@") + ".log");
|
||||||
|
Loading…
Reference in New Issue
Block a user