Makes the software build Spigot and CraftBukkit jars if the latest version is chosen
This commit is contained in:
parent
f1eead3807
commit
0018816d90
@ -1,5 +1,10 @@
|
|||||||
package net.knarcraft.minecraftserverlauncher.server.servertypes;
|
package net.knarcraft.minecraftserverlauncher.server.servertypes;
|
||||||
|
|
||||||
|
import net.knarcraft.minecraftserverlauncher.Main;
|
||||||
|
import net.knarcraft.minecraftserverlauncher.profile.ServerLauncherController;
|
||||||
|
import net.knarcraft.minecraftserverlauncher.userinterface.GUI;
|
||||||
|
import net.knarcraft.minecraftserverlauncher.utility.JarBuilder;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
@ -31,7 +36,31 @@ public class CraftBukkit extends AbstractServerType {
|
|||||||
String targetFile = this.getName() + version + ".jar";
|
String targetFile = this.getName() + version + ".jar";
|
||||||
String file = downloadURLPart + version + ".jar";
|
String file = downloadURLPart + version + ".jar";
|
||||||
File filePath = new File(folder + targetFile);
|
File filePath = new File(folder + targetFile);
|
||||||
return filePath.isFile() || downloadFile(downloadURL + file, Paths.get(filePath.toURI()));
|
|
||||||
|
if (version.equals("Latest")) {
|
||||||
|
return filePath.isFile() || buildJar(folder);
|
||||||
|
} else {
|
||||||
|
return filePath.isFile() || downloadFile(downloadURL + file, Paths.get(filePath.toURI()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the necessary .jar file
|
||||||
|
*
|
||||||
|
* @param folder <p>The folder the build file should be moved to</p>
|
||||||
|
* @return <p>True if the build was successful</p>
|
||||||
|
*/
|
||||||
|
private boolean buildJar(String folder) {
|
||||||
|
String buildToolsDirectory = Main.getApplicationWorkDirectory() + File.separator + "files" + File.separator +
|
||||||
|
"BuildTools" + File.separator;
|
||||||
|
|
||||||
|
GUI gui = ServerLauncherController.getInstance().getGUI();
|
||||||
|
JarBuilder jarBuilder = new JarBuilder(buildToolsDirectory, folder, gui);
|
||||||
|
if (this instanceof Spigot) {
|
||||||
|
return jarBuilder.buildSpigotJar();
|
||||||
|
} else {
|
||||||
|
return jarBuilder.buildBukkitJar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,24 +42,32 @@ public class JarBuilder {
|
|||||||
/**
|
/**
|
||||||
* Builds the latest version of the spigot .jar file
|
* Builds the latest version of the spigot .jar file
|
||||||
*/
|
*/
|
||||||
public void buildSpigotJar() {
|
public boolean buildSpigotJar() {
|
||||||
|
gui.setStatus("Building Spigot jar ...");
|
||||||
downloadBuildTools();
|
downloadBuildTools();
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(javaCommand, "-jar", "BuildTools.jar", "--rev",
|
ProcessBuilder processBuilder = new ProcessBuilder(javaCommand, "-jar", "BuildTools.jar", "--rev",
|
||||||
"latest", "--output-dir", jarDirectory);
|
"latest", "--output-dir", jarDirectory);
|
||||||
if (executeBuildProcess(processBuilder) && moveBuiltJar("spigot-", "SpigotLatest.jar")) {
|
if (executeBuildProcess(processBuilder) && moveBuiltJar("spigot-", "SpigotLatest.jar")) {
|
||||||
gui.setStatus("Finished moving spigot.jar");
|
gui.setStatus("Finished moving spigot.jar");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the latest version of the craftbukkit .jar file
|
* Builds the latest version of the craftbukkit .jar file
|
||||||
*/
|
*/
|
||||||
public void buildBukkitJar() {
|
public boolean buildBukkitJar() {
|
||||||
|
gui.setStatus("Building Bukkit jar ...");
|
||||||
downloadBuildTools();
|
downloadBuildTools();
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(javaCommand, "-jar", "BuildTools.jar", "--compile",
|
ProcessBuilder processBuilder = new ProcessBuilder(javaCommand, "-jar", "BuildTools.jar", "--compile",
|
||||||
"craftbukkit", "--rev", "latest", "--output-dir", jarDirectory);
|
"craftbukkit", "--rev", "latest", "--output-dir", jarDirectory);
|
||||||
if (executeBuildProcess(processBuilder) && moveBuiltJar("craftbukkit-", "BukkitLatest.jar")) {
|
if (executeBuildProcess(processBuilder) && moveBuiltJar("craftbukkit-", "BukkitLatest.jar")) {
|
||||||
gui.setStatus("Finished moving craftbukkit.jar");
|
gui.setStatus("Finished moving craftbukkit.jar");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +141,7 @@ public class JarBuilder {
|
|||||||
writer.flush();
|
writer.flush();
|
||||||
|
|
||||||
if (process.exitValue() == 0) {
|
if (process.exitValue() == 0) {
|
||||||
gui.showMessage("Jar building process finished successfully.");
|
gui.setStatus("Jar building process finished successfully.");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
gui.showError("Jar building process failed with exit code " + process.exitValue() +
|
gui.showError("Jar building process failed with exit code " + process.exitValue() +
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
Vanilla;Latest,Snapshot,1.17.1,1.16.5,1.15.2,1.14.4,1.13.2,1.12.2,1.11.2,1.10.2,1.9.4,1.8.9,1.7.10,1.6.4,1.5.2,1.4.7,1.3.2,1.2.5;https://launchermeta.mojang.com/mc/game/version_manifest.json;"release":";";https://s3.amazonaws.com/Minecraft.Download/versions/
|
Vanilla;Latest,Snapshot,1.17.1,1.16.5,1.15.2,1.14.4,1.13.2,1.12.2,1.11.2,1.10.2,1.9.4,1.8.9,1.7.10,1.6.4,1.5.2,1.4.7,1.3.2,1.2.5;https://launchermeta.mojang.com/mc/game/version_manifest.json;"release":";";https://s3.amazonaws.com/Minecraft.Download/versions/
|
||||||
Spigot;1.17.1,1.16.5,1.15.2,1.14.4,1.13.2,1.12.2,1.11.2,1.10.2,1.9.4,1.9.4,1.8.8,1.7.10,1.6.4-R2.1,1.5.2-R1.1,1.4.7-R1.1;https://static.knarcraft.net/archive/downloads/minecraftserverjars/Spigot/;spigot-
|
Spigot;Latest,1.17.1,1.16.5,1.15.2,1.14.4,1.13.2,1.12.2,1.11.2,1.10.2,1.9.4,1.9.4,1.8.8,1.7.10,1.6.4-R2.1,1.5.2-R1.1,1.4.7-R1.1;https://static.knarcraft.net/archive/downloads/minecraftserverjars/Spigot/;spigot-
|
||||||
Paper;1.17.1,1.16.5,1.15.2,1.14.4,1.13.2,1.12.2,1.11.2,1.10.2,1.9.4,1.8.8;https://static.knarcraft.net/archive/downloads/minecraftserverjars/Paper/;Paper-
|
Paper;1.17.1,1.16.5,1.15.2,1.14.4,1.13.2,1.12.2,1.11.2,1.10.2,1.9.4,1.8.8;https://static.knarcraft.net/archive/downloads/minecraftserverjars/Paper/;Paper-
|
||||||
SpongeVanilla;1.12.2,1.11.2,1.10.2,1.8.9;https://dl-api.spongepowered.org/v1/org.spongepowered/spongevanilla/downloads?type=stable&minecraft=;"version":";",;https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/;/spongevanilla-
|
SpongeVanilla;1.12.2,1.11.2,1.10.2,1.8.9;https://dl-api.spongepowered.org/v1/org.spongepowered/spongevanilla/downloads?type=stable&minecraft=;"version":";",;https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/;/spongevanilla-
|
||||||
Craftbukkit;1.17.1,1.16.5,1.15.2,1.14.4,1.13.2,1.12.2,1.11.2,1.10.2,1.9.4,1.8.8,1.7.10-R0.1,1.6.4-R2.0,1.5.2-R1.0,1.4.6-R0.3,1.3.2-R3.0,1.2.5-R2.0,1.1-R6,1.0.1-R1,b1.8.1,b1.7.3;https://static.knarcraft.net/archive/downloads/minecraftserverjars/Bukkit/;craftbukkit-
|
Craftbukkit;Latest,1.17.1,1.16.5,1.15.2,1.14.4,1.13.2,1.12.2,1.11.2,1.10.2,1.9.4,1.8.8,1.7.10-R0.1,1.6.4-R2.0,1.5.2-R1.0,1.4.6-R0.3,1.3.2-R3.0,1.2.5-R2.0,1.1-R6,1.0.1-R1,b1.8.1,b1.7.3;https://static.knarcraft.net/archive/downloads/minecraftserverjars/Bukkit/;craftbukkit-
|
||||||
SpongeForge;1.12.2,1.11.2,1.10.2;https://dl-api.spongepowered.org/v1/org.spongepowered/spongeforge/downloads?type=stable&minecraft=;"version":";",;https://repo.spongepowered.org/maven/org/spongepowered/spongeforge/;/spongeforge-
|
SpongeForge;1.12.2,1.11.2,1.10.2;https://dl-api.spongepowered.org/v1/org.spongepowered/spongeforge/downloads?type=stable&minecraft=;"version":";",;https://repo.spongepowered.org/maven/org/spongepowered/spongeforge/;/spongeforge-
|
||||||
MCPCplus;1.6.4,1.6.2,1.5.2,1.4.7;https://static.knarcraft.net/archive/downloads/minecraftserverjars/MCPC+/;mcpcplus
|
MCPCplus;1.6.4,1.6.2,1.5.2,1.4.7;https://static.knarcraft.net/archive/downloads/minecraftserverjars/MCPC+/;mcpcplus
|
||||||
Bungee;Latest,1.7.10,1.6.4,1.5.2,1.4.7;https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/;Artifacts of BungeeCord #; ;http://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar;https://static.knarcraft.net/archive/downloads/minecraftserverjars/BungeeCord/;BungeeCord-
|
Bungee;Latest,1.7.10,1.6.4,1.5.2,1.4.7;https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/;Artifacts of BungeeCord #; ;http://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar;https://static.knarcraft.net/archive/downloads/minecraftserverjars/BungeeCord/;BungeeCord-
|
||||||
|
Can't render this file because it contains an unexpected character in line 1 and column 200.
|
Loading…
Reference in New Issue
Block a user