diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index 1c52b263..ee96794f 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -136,7 +136,7 @@ val kobaltApp = project(kobaltPluginApi, wrapper) { } zip { val dir = "kobalt-$version" - include(from("."), to("$dir/bin"), "kobaltw") + include(from("."), to("$dir"), "kobaltw") include(from("$buildDirectory/libs"), to("$dir/kobalt/wrapper"), "$projectName-$version.jar") include(from("modules/wrapper/$buildDirectory/libs"), to("$dir/kobalt/wrapper"), diff --git a/kobalt/wrapper/kobalt-wrapper.jar b/kobalt/wrapper/kobalt-wrapper.jar index e9c0626b..4d7245e9 100644 Binary files a/kobalt/wrapper/kobalt-wrapper.jar and b/kobalt/wrapper/kobalt-wrapper.jar differ diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index f9410c23..616b4710 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.650 \ No newline at end of file +kobalt.version=0.661 \ No newline at end of file diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KFiles.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KFiles.kt index 7854d370..b3f1262b 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KFiles.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KFiles.kt @@ -26,7 +26,8 @@ class KFiles { debug("Using kobalt jar $envJar") return listOf(File(envJar).absolutePath) } else { - val jar = joinDir(distributionsDir, Kobalt.version, "kobalt/wrapper/kobalt-" + Kobalt.version + ".jar") + val jar = joinDir(distributionsDir, "kobalt-" + Kobalt.version, + "kobalt/wrapper/kobalt-" + Kobalt.version + ".jar") val jarFile = File(jar) if (jarFile.exists()) { return listOf(jarFile.absolutePath) diff --git a/modules/wrapper/src/main/java/com/beust/kobalt/wrapper/Main.java b/modules/wrapper/src/main/java/com/beust/kobalt/wrapper/Main.java index a93a6acb..cb855863 100644 --- a/modules/wrapper/src/main/java/com/beust/kobalt/wrapper/Main.java +++ b/modules/wrapper/src/main/java/com/beust/kobalt/wrapper/Main.java @@ -17,7 +17,7 @@ public class Main { } private static final boolean DEV = false; - private static final int DEV_VERSION_INT = 650; + private static final int DEV_VERSION_INT = 660; 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"; @@ -150,12 +150,12 @@ public class Main { log(2, "Wrapper version: " + wrapperVersion); - String zipOutputDir = DISTRIBUTIONS_DIR + "/" + wrapperVersion; boolean isNew = Float.parseFloat(version) * 1000 >= 650; - if (isNew) { - zipOutputDir += File.separator + "kobalt-" + version; - } - Path kobaltJarFile = Paths.get(zipOutputDir, + + String fromZipOutputDir = DISTRIBUTIONS_DIR + File.separator + "kobalt-" + version; + String toZipOutputDir = DISTRIBUTIONS_DIR; + Path kobaltJarFile = Paths.get(toZipOutputDir, + isNew ? "kobalt-" + version : "", getWrapperDir().getPath() + "/" + FILE_NAME + "-" + wrapperVersion + ".jar"); boolean downloadedZipFile = false; if (! Files.exists(localZipFile) || ! Files.exists(kobaltJarFile)) { @@ -170,7 +170,7 @@ public class Main { int retries = 0; while (retries < 2) { try { - extractZipFile(localZipFile, zipOutputDir); + extractZipFile(localZipFile, toZipOutputDir); break; } catch (ZipException e) { retries++; @@ -192,13 +192,10 @@ public class Main { Path to = Paths.get(file); to.toFile().getAbsoluteFile().getParentFile().mkdirs(); - if (Files.exists(to)) { - log(2, to + " already exists, not overwriting it"); - continue; - } else if (file.endsWith(KOBALTW)) { + if (file.endsWith(KOBALTW)) { generateKobaltW(Paths.get(KOBALTW)); } else { - Path from = Paths.get(zipOutputDir, file); + Path from = Paths.get(fromZipOutputDir, file); try { if (isWindows() && to.toFile().exists()) { log(2, " Windows detected, not overwriting " + to); @@ -232,7 +229,7 @@ public class Main { } log(2, "Generating " + KOBALTW + (envFile.exists() ? " with shebang" : "") + "."); - content += "java -jar $(dirname $0)/../kobalt/wrapper/kobalt-wrapper.jar $*\n"; + content += "java -jar $(dirname $0)/kobalt/wrapper/kobalt-wrapper.jar $*\n"; Files.write(filePath, content.getBytes()); diff --git a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt index dbcaa86c..cd66c7ff 100644 --- a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt +++ b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt @@ -41,7 +41,7 @@ class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapperPropert val latestVersionString = latestVersionFuture.get() val latestVersion = Versions.toLongVersion(latestVersionString) val current = Versions.toLongVersion(Kobalt.version) - val distFile = File(KFiles.joinDir(KFiles.distributionsDir, latestVersionString)) + val distFile = File(KFiles.distributionsDir) if (latestVersion > current) { if (distFile.exists()) { log(1, "**** Version $latestVersionString is installed, you can switch to it with " + diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index f42b3a9d..593416d8 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.650 +kobalt.version=0.661