From a37fe7d865d57761cd781d514f090d216e998996 Mon Sep 17 00:00:00 2001 From: Zeruth Date: Tue, 23 Jul 2019 16:38:31 -0400 Subject: [PATCH] bootstrapper: update for gradle / add staging configuration --- .gitignore | 3 +- .../client/util/bootstrap/Bootstrap.java | 26 +++++------ .../client/util/bootstrap/Bootstrapper.java | 45 ++++++++++++++----- 3 files changed, 49 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index edce24837c..8d06d7383a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ classes/artifacts/client_jar/client.jar */build/ */out/ .gradle/ -runelite-client/src/main/resources/runelite/* \ No newline at end of file +runelite-client/src/main/resources/runelite/* +.staging/ \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java index f0c756804e..ccbc6dc57e 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java +++ b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java @@ -318,29 +318,29 @@ public class Bootstrap //Dynamic artifacts artifacts[3] = new Artifact(); artifacts[3].name = "client-" + RuneLiteAPI.getVersion() + ".jar"; - artifacts[3].hash = getChecksumFile("./runelite-client/target/" + artifacts[3].name); - artifacts[3].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/" + artifacts[3].name; + artifacts[3].hash = getChecksumFile("./runelite-client/build/libs/" + artifacts[3].name); + artifacts[3].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master" + Bootstrapper.remoteLocation + artifacts[3].name; artifacts[3].size = Long.toString(getFileSize("./runelite-client/target/" + artifacts[3].name)); - copyTodir("./runelite-client/target/" + artifacts[3].name, "./live/"); + copyTodir("./runelite-client/build/libs/" + artifacts[3].name, Bootstrapper.localLocation); artifacts[35] = new Artifact(); artifacts[35].name = "runelite-api-" + RuneLiteAPI.getVersion() + ".jar"; - artifacts[35].hash = getChecksumFile("./runelite-api/target/" + artifacts[35].name); - artifacts[35].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/" + artifacts[35].name; + artifacts[35].hash = getChecksumFile("./runelite-api/build/libs/" + artifacts[35].name); + artifacts[35].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/" + Bootstrapper.remoteLocation + artifacts[35].name; artifacts[35].size = Long.toString(getFileSize("./runelite-api/target/" + artifacts[35].name)); - copyTodir("./runelite-api/target/" + artifacts[35].name, "./live/"); + copyTodir("./runelite-api/build/libs/" + artifacts[35].name, Bootstrapper.localLocation); artifacts[36] = new Artifact(); artifacts[36].name = "runescape-api-" + RuneLiteAPI.getVersion() + ".jar"; - artifacts[36].hash = getChecksumFile("./runescape-api/target/" + artifacts[36].name); - artifacts[36].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/" + artifacts[36].name; + artifacts[36].hash = getChecksumFile("./runescape-api/build/libs/" + artifacts[36].name); + artifacts[36].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/" + Bootstrapper.remoteLocation + artifacts[36].name; artifacts[36].size = Long.toString(getFileSize("./runescape-api/target/" + artifacts[36].name)); - copyTodir("./runescape-api/target/" + artifacts[36].name, "./live/"); + copyTodir("./runescape-api/build/libs/" + artifacts[36].name, Bootstrapper.localLocation); artifacts[37] = new Artifact(); artifacts[37].name = "http-api-" + RuneLiteAPI.getVersion() + ".jar"; - artifacts[37].hash = getChecksumFile("./http-api/target/" + artifacts[37].name); - artifacts[37].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/" + artifacts[37].name; + artifacts[37].hash = getChecksumFile("./http-api/build/libs/" + artifacts[37].name); + artifacts[37].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/" + Bootstrapper.remoteLocation + artifacts[37].name; artifacts[37].size = Long.toString(getFileSize("./http-api/target/" + artifacts[37].name)); - copyTodir("./http-api/target/" + artifacts[37].name, "./live/"); - copyTodir("./injected-client/target/injected-client-" + RuneLiteAPI.getVersion() + ".jar", "./live/"); + copyTodir("./http-api/build/libs/" + artifacts[37].name, Bootstrapper.localLocation); + copyTodir("./injected-client/build/libs/injected-client-" + RuneLiteAPI.getVersion() + ".jar", Bootstrapper.localLocation); } catch (IOException | NoSuchAlgorithmException e) { diff --git a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrapper.java b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrapper.java index 7e21bed246..1c436f5ab4 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrapper.java +++ b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrapper.java @@ -9,19 +9,42 @@ import java.io.FileWriter; public class Bootstrapper { + public static String remoteLocation; + public static String localLocation; + public static void main(String[] args) { - Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); - File dir = new File("./live/"); - dir.mkdir(); - try (FileWriter fw = new FileWriter("./live/bootstrap.json")) - { - gson.toJson(new Bootstrap(), fw); - } - catch (Exception e) - { - e.printStackTrace(); - } + if (args.length>0) + { + remoteLocation = "/staging/"; + localLocation = "./staging/"; + Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); + File dir = new File("./staging/"); + dir.mkdir(); + try (FileWriter fw = new FileWriter("./staging/bootstrap-staging.json")) + { + gson.toJson(new Bootstrap(), fw); + } + catch (Exception e) + { + e.printStackTrace(); + } + } else + { + remoteLocation = "/live/"; + localLocation = "./live/"; + Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); + File dir = new File("./live/"); + dir.mkdir(); + try (FileWriter fw = new FileWriter("./live/bootstrap.json")) + { + gson.toJson(new Bootstrap(), fw); + } + catch (Exception e) + { + e.printStackTrace(); + } + } } }