1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Path bug.

This commit is contained in:
Cedric Beust 2016-03-10 22:32:44 +04:00
parent 7bcbaf03d0
commit 3f76878590

View file

@ -17,7 +17,7 @@ public class Main {
} }
private static final boolean DEV = false; private static final boolean DEV = false;
private static final int DEV_VERSION_INT = 660; private static final int DEV_VERSION_INT = 662;
private static final String DEV_VERSION = "0." + DEV_VERSION_INT; private static final String DEV_VERSION = "0." + DEV_VERSION_INT;
private static final String DEV_ZIP = "/Users/beust/kotlin/kobalt/kobaltBuild/libs/kobalt-" + DEV_VERSION + ".zip"; private static final String DEV_ZIP = "/Users/beust/kotlin/kobalt/kobaltBuild/libs/kobalt-" + DEV_VERSION + ".zip";
@ -35,12 +35,25 @@ public class Main {
private static int logLevel = 1; private static int logLevel = 1;
private boolean noOverwrite = false; private boolean noOverwrite = false;
private String getVersion() throws IOException {
Properties properties = maybeCreateProperties();
return properties.getProperty(PROPERTY_VERSION);
}
private int installAndLaunchMain(String[] argv) throws IOException, InterruptedException { private int installAndLaunchMain(String[] argv) throws IOException, InterruptedException {
String version = getVersion();
initWrapperFile(version);
List<String> kobaltArgv = new ArrayList<>(); List<String> kobaltArgv = new ArrayList<>();
boolean noLaunch = false; boolean noLaunch = false;
boolean exit = false;
for (int i = 0; i < argv.length; i++) { for (int i = 0; i < argv.length; i++) {
boolean passToKobalt = true; boolean passToKobalt = true;
switch(argv[i]) { switch(argv[i]) {
case "--version":
System.out.println("Kobalt " + version + ", Wrapper " + getWrapperVersion());
exit = true;
break;
case "--noOverwrite": case "--noOverwrite":
noOverwrite = true; noOverwrite = true;
passToKobalt = false; passToKobalt = false;
@ -58,11 +71,13 @@ public class Main {
kobaltArgv.add(argv[i]); kobaltArgv.add(argv[i]);
} }
} }
Path kobaltJarFile = installDistribution();
int result = 0; int result = 0;
if (! exit) {
Path kobaltJarFile = installDistribution();
if (!noLaunch) { if (!noLaunch) {
result = launchMain(kobaltJarFile, kobaltArgv.toArray(new String[kobaltArgv.size()])); result = launchMain(kobaltJarFile, kobaltArgv.toArray(new String[kobaltArgv.size()]));
} }
}
return result; return result;
} }
@ -139,9 +154,7 @@ public class Main {
wrapperVersion = DEV_VERSION; wrapperVersion = DEV_VERSION;
localZipFile = Paths.get(DEV_ZIP); localZipFile = Paths.get(DEV_ZIP);
} else { } else {
Properties properties = maybeCreateProperties(); version = getVersion();
version = properties.getProperty(PROPERTY_VERSION);
initWrapperFile(version);
wrapperVersion = getWrapperVersion(); wrapperVersion = getWrapperVersion();
String fileName = FILE_NAME + "-" + wrapperVersion + ".zip"; String fileName = FILE_NAME + "-" + wrapperVersion + ".zip";
Files.createDirectories(Paths.get(DISTRIBUTIONS_DIR)); Files.createDirectories(Paths.get(DISTRIBUTIONS_DIR));
@ -155,7 +168,7 @@ public class Main {
String fromZipOutputDir = DISTRIBUTIONS_DIR + File.separator + "kobalt-" + version; String fromZipOutputDir = DISTRIBUTIONS_DIR + File.separator + "kobalt-" + version;
String toZipOutputDir = DISTRIBUTIONS_DIR; String toZipOutputDir = DISTRIBUTIONS_DIR;
Path kobaltJarFile = Paths.get(toZipOutputDir, Path kobaltJarFile = Paths.get(toZipOutputDir,
isNew ? "kobalt-" + version : "", isNew ? "kobalt-" + wrapperVersion : "",
getWrapperDir().getPath() + "/" + FILE_NAME + "-" + wrapperVersion + ".jar"); getWrapperDir().getPath() + "/" + FILE_NAME + "-" + wrapperVersion + ".jar");
boolean downloadedZipFile = false; boolean downloadedZipFile = false;
if (! Files.exists(localZipFile) || ! Files.exists(kobaltJarFile)) { if (! Files.exists(localZipFile) || ! Files.exists(kobaltJarFile)) {