From ae7511be25b835e272511671e72b712ab26502c6 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 10 Nov 2015 13:13:23 -0800 Subject: [PATCH] Support for --download. --- kobalt/src/Build.kt | 13 +- kobalt/wrapper/kobalt-wrapper.jar | Bin 6806 -> 5804 bytes kobalt/wrapper/kobalt-wrapper.properties | 3 +- .../java/com/beust/kobalt/wrapper/Main.java | 102 +++--- src/main/kotlin/com/beust/kobalt/Args.kt | 3 + src/main/kotlin/com/beust/kobalt/Main.kt | 40 ++- .../kobalt/misc/KobaltWrapperProperties.kt | 31 +- .../com/beust/kobalt/misc/UpdateKobalt.kt | 13 +- .../com/beust/kobalt/wrapper/Wrapper.kt | 339 +++++++++--------- src/main/resources/kobalt.properties | 2 +- 10 files changed, 264 insertions(+), 282 deletions(-) diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index 06e43965..c7b6de8b 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -2,6 +2,7 @@ import com.beust.kobalt.api.License import com.beust.kobalt.api.Project import com.beust.kobalt.api.Scm +import com.beust.kobalt.file import com.beust.kobalt.homeDir import com.beust.kobalt.internal.TaskResult import com.beust.kobalt.internal.test @@ -11,6 +12,7 @@ import com.beust.kobalt.plugin.java.javaProject import com.beust.kobalt.plugin.kotlin.kotlinCompiler import com.beust.kobalt.plugin.kotlin.kotlinProject import com.beust.kobalt.plugin.packaging.assemble +import com.beust.kobalt.plugin.publish.jcenter import java.io.File import java.nio.file.Files import java.nio.file.Paths @@ -71,7 +73,8 @@ val kobalt = kotlinProject(wrapper) { "org.apache.maven:maven-model:3.3.3", "com.github.spullara.mustache.java:compiler:0.9.1", "io.reactivex:rxjava:1.0.14", - "com.google.code.gson:gson:2.4" + "com.google.code.gson:gson:2.4", + file("modules/wrapper/kobaltBuild/libs/kobalt-wrapper.jar") ) } @@ -103,10 +106,10 @@ val kobalt = kotlinProject(wrapper) { args("-nowarn") } -// jcenter { -// publish = true -// file("$buildDirectory/libs/$name-$version.zip", "$name/$version/$name-$version.zip") -// } + jcenter { + publish = true + file("$buildDirectory/libs/$name-$version.zip", "$name/$version/$name-$version.zip") + } } fun readVersion() : String { diff --git a/kobalt/wrapper/kobalt-wrapper.jar b/kobalt/wrapper/kobalt-wrapper.jar index 5ae9002f9baad7c81e4e998a0240419f25623ca1..5542de571a580705f9db53b910f30ec85c861ac7 100644 GIT binary patch delta 5495 zcmV--6^QDVHLNWRP)h>@6aWYa2mq{RkqnrVN&+Z<%S%EACNP2E z2r3~9QP8MCYy$*|27*Z-2CFzp9?9TjCeBQN*hQ_l*4DKP)T(u9YPD8DC&4JS)mm#; zZEM|^YPGg?X{#-$kp9nmZNLWN%6U2| zta!+O%`TPQI=+fD`8q9QRbx%Q9*uRK3)m2{LRl`7rdYO4(Yb`Z!fdL})7YnRsm{}R zhE56g>s-b&g>;t6e{$uuO0!Po4xL*03~4$wUa#?)qReMx<5?=7EnGIpo^w0H4U76^-+{TfF^s;E#5XndYf#8i%JoX{!4eHstS`es?*qViTT z0}vn5X)~X%@n<#uoOC}g%@?G(K;sJqpo^sWqBIvvvrXemG`>{h%S8IiHNHZKXR3Uq zPM7m>dBm6AB9{M>46kyN{nMlImo@%>ifp-B<7-5SYlXn8@pT$sFD!1*_^TR!O@#cq zG~bYByT&`@`%OXqMmhgmD&Hi!-7GwA(fHdQ81q)0Z{ypgxkKacs64FGo#Hv)E#N!( zdm7)R^4&V!!{3+Y9*ut>-+Ohwk9TUkOXK@Ben90UQ^{#9OB_!GS<~2m+TPUI z#^i0@6xEspiFLv7pvk1#8#|c%4vUV~hBe?Zfz=de z(79nwl!v&0K)q(7!v=SGC2ahI z_)$u4h*vQY6p?yJ_mXx79EUrJ8F1@-2&NvWzbLQ30NbS8yWN? z`Y}^^ceKB@%N&d+YR`>!1;dG2CthoXi$TApUl{x_?}0DX)I_2+w!jAekRO2>H8oIH za=P-(W)`EewI4a|u zU-GXE{x$zb<);jPewu%4&~NE?Omi{_G=;-vZ!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R3)a}q{D zH&t_`l*?H>wpk`t=zgrPx#hSVPQK1;tf+HwC*_ujO2B14+1b!?KYSg&@UB10VOJUq znd*eC6c5Vr`u(&pHur)ZLL!Fv<%9Udg#^!AdO5mm>t5Il7$UZK8)!uOA<7XR#R-9- z1t#otg_w7j`cZo$Vr81Ehlal;V)q!!AMF87kE8xh<|8Cxz+dHzKg$ch%NhUG{+Zmr z6*vC$^1BrAC;t8|o4+jP;r4$iO#I!+pGy8s%KtJxr2iK;|GUFKMg02!{AEzm|KT|N z{q;Z9_gm?I*uxtCxi$Zn?*H!g&usjb?q3%9r`x}T{7elM?e`$GhpXWsjicnhd;bO% C%0*HD diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index fde79fa5..64f7a285 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1,2 +1 @@ -kobalt.version=0.238 -kobalt.downloadUrl=https://github.com/cbeust/kobalt/releases/download/0.238/kobalt-0.238.zip +kobalt.version=0.244 \ No newline at end of file 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 e74ab74b..7bb703bd 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 @@ -34,8 +34,12 @@ public class Main { private static int logLevel = 1; private void installAndLaunchMain(String[] argv) throws IOException, InterruptedException { + boolean noLaunch = false; for (int i = 0; i < argv.length; i++) { switch(argv[i]) { + case "--no-launch": + noLaunch = true; + break; case "--log": logLevel = Integer.parseInt(argv[i + 1]); i++; @@ -43,7 +47,9 @@ public class Main { } } Path kobaltJarFile = installJarFile(); - launchMain(kobaltJarFile, argv); + if (! noLaunch) { + launchMain(kobaltJarFile, argv); + } } private void readProperties(Properties properties, InputStream ins) throws IOException { @@ -106,66 +112,62 @@ public class Main { Path kobaltJarFile = Paths.get(zipOutputDir, getWrapperDir().getPath() + "/" + FILE_NAME + "-" + getWrapperVersion() + ".jar"); if (! Files.exists(localZipFile) || ! Files.exists(kobaltJarFile)) { - if (!Files.exists(localZipFile)) { - download(localZipFile.toFile()); - } + download(localZipFile.toFile()); + } - // - // Extract all the zip files - // - boolean success = false; - int retries = 0; - while (! success && retries < 2) { - try { - ZipFile zipFile = new ZipFile(localZipFile.toFile()); - Enumeration entries = zipFile.entries(); - File outputDirectory = new File(DISTRIBUTIONS_DIR); - outputDirectory.mkdirs(); - while (entries.hasMoreElements()) { - ZipEntry entry = entries.nextElement(); - File entryFile = new File(entry.getName()); - if (entry.isDirectory()) { - entryFile.mkdirs(); - } else { - Path dest = Paths.get(zipOutputDir, entryFile.getPath()); - log(2, " Writing " + entry.getName() + " to " + dest); - Files.createDirectories(dest.getParent()); - Files.copy(zipFile.getInputStream(entry), dest, StandardCopyOption.REPLACE_EXISTING); - } + // + // Extract all the zip files + // + boolean success = false; + int retries = 0; + while (! success && retries < 2) { + try { + ZipFile zipFile = new ZipFile(localZipFile.toFile()); + Enumeration entries = zipFile.entries(); + File outputDirectory = new File(DISTRIBUTIONS_DIR); + outputDirectory.mkdirs(); + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); + File entryFile = new File(entry.getName()); + if (entry.isDirectory()) { + entryFile.mkdirs(); + } else { + Path dest = Paths.get(zipOutputDir, entryFile.getPath()); + log(2, " Writing " + entry.getName() + " to " + dest); + Files.createDirectories(dest.getParent()); + Files.copy(zipFile.getInputStream(entry), dest, StandardCopyOption.REPLACE_EXISTING); } - success = true; - } catch (ZipException e) { - retries++; - error("Couldn't open zip file " + localZipFile + ": " + e.getMessage()); - error("The file is probably corrupt, downloading it again"); - Files.delete(localZipFile); - download(localZipFile.toFile()); } + success = true; + } catch (ZipException e) { + retries++; + error("Couldn't open zip file " + localZipFile + ": " + e.getMessage()); + error("The file is probably corrupt, downloading it again"); + Files.delete(localZipFile); + download(localZipFile.toFile()); } } // // Copy the wrapper files in the current kobalt/wrapper directory // - if (! version.equals(getWrapperVersion())) { - log(2, "Copying the wrapper files"); - for (String file : FILES) { - Path from = Paths.get(zipOutputDir, file); - Path to = Paths.get(new File(".").getAbsolutePath(), file); - try { - if (isWindows() && to.toFile().exists()) { - log(1, "Windows detected, not overwriting " + to); - } else { - Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING); - } - } catch (IOException ex) { - log(1, "Couldn't copy " + from + " to " + to + ": " + ex.getMessage()); + boolean sameVersion = equals(getWrapperVersion()); + log(2, "Copying the wrapper files"); + for (String file : FILES) { + Path from = Paths.get(zipOutputDir, file); + Path to = Paths.get(new File(".").getAbsolutePath(), file); + try { + if (isWindows() && to.toFile().exists()) { + log(1, "Windows detected, not overwriting " + to); + } else { + Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING); } + } catch (IOException ex) { + log(1, "Couldn't copy " + from + " to " + to + ": " + ex.getMessage()); } - new File(KOBALTW).setExecutable(true); - } else { - log(2, "Wrapper and current versions are identical"); } + new File(KOBALTW).setExecutable(true); + return kobaltJarFile; } @@ -267,8 +269,6 @@ public class Main { System.out.println("[Wrapper error] *** " + s); } - private static final String KOBALT_MAIN_CLASS = "com.beust.kobalt.KobaltPackage"; - private void launchMain(Path kobaltJarFile, String[] argv) throws IOException, InterruptedException { List args = new ArrayList<>(); args.add("java"); diff --git a/src/main/kotlin/com/beust/kobalt/Args.kt b/src/main/kotlin/com/beust/kobalt/Args.kt index d910349f..cb058639 100644 --- a/src/main/kotlin/com/beust/kobalt/Args.kt +++ b/src/main/kotlin/com/beust/kobalt/Args.kt @@ -19,6 +19,9 @@ class Args { @Parameter(names = arrayOf("--dev"), description = "Turn of dev mode, resulting in a more verbose log output") var dev: Boolean = false + @Parameter(names = arrayOf("--download"), description = "Force a download from the downloadUrl in the wrapper") + var download: Boolean = false + @Parameter(names = arrayOf("--dryRun"), description = "Display all the tasks that will get run without " + "actually running them") var dryRun: Boolean = false diff --git a/src/main/kotlin/com/beust/kobalt/Main.kt b/src/main/kotlin/com/beust/kobalt/Main.kt index a16867dc..8706a767 100644 --- a/src/main/kotlin/com/beust/kobalt/Main.kt +++ b/src/main/kotlin/com/beust/kobalt/Main.kt @@ -14,7 +14,6 @@ import com.beust.kobalt.maven.Http import com.beust.kobalt.maven.KobaltException import com.beust.kobalt.maven.LocalRepo import com.beust.kobalt.misc.* -import com.beust.kobalt.wrapper.Wrapper import com.google.inject.Guice import java.io.File import java.nio.file.Paths @@ -37,10 +36,10 @@ private fun parseArgs(argv: Array): Main.RunInfo { } -public fun mainNoExit(argv: Array) : Int { +public fun mainNoExit(argv: Array): Int { val (jc, args) = parseArgs(argv) Kobalt.INJECTOR = Guice.createInjector(MainModule(args)) - return Kobalt.INJECTOR.getInstance(Main::class.java).run(jc, args) + return Kobalt.INJECTOR.getInstance(Main::class.java).run(jc, args, argv) } private class Main @Inject constructor( @@ -59,19 +58,18 @@ private class Main @Inject constructor( val server: KobaltServer, val pluginInfo: PluginInfo, val projectGenerator: ProjectGenerator, - val resolveDependency: ResolveDependency, - val wrapper: Wrapper) { + val resolveDependency: ResolveDependency) { data class RunInfo(val jc: JCommander, val args: Args) private fun addReposFromContributors(project: Project?) = - pluginInfo.repoContributors.forEach { - it.reposFor(project).forEach { - Kobalt.addRepo(it.toString()) + pluginInfo.repoContributors.forEach { + it.reposFor(project).forEach { + Kobalt.addRepo(it.toString()) + } } - } - public fun run(jc: JCommander, args: Args) : Int { + public fun run(jc: JCommander, args: Args, argv: Array): Int { // // Add all the repos from repo contributors (at least those that return values without a Project) @@ -93,9 +91,9 @@ private class Main @Inject constructor( var result = 0 val latestVersionFuture = github.latestKobaltVersion val seconds = benchmark("build", { -// runTest() + // runTest() try { - result = runWithArgs(jc, args) + result = runWithArgs(jc, args, argv) } catch(ex: KobaltException) { error(ex.message ?: "", ex) result = 1 @@ -120,32 +118,33 @@ private class Main @Inject constructor( } -// public fun runTest() { -// val file = File("src\\main\\resources\\META-INF\\plugin.ml") -// } + // public fun runTest() { + // val file = File("src\\main\\resources\\META-INF\\plugin.ml") + // } - private fun runWithArgs(jc: JCommander, args: Args) : Int { + private fun runWithArgs(jc: JCommander, args: Args, argv: Array): Int { var result = 0 val p = if (args.buildFile != null) File(args.buildFile) else findBuildFile() args.buildFile = p.absolutePath val buildFile = BuildFile(Paths.get(p.absolutePath), p.name) - if (! args.update) { + if (!args.update) { println(AsciiArt.banner + Kobalt.version + "\n") } if (args.init) { // // --init: create a new build project and install the wrapper + // Make sure the wrapper won't call us back with --no-launch // - wrapper.install() + com.beust.kobalt.wrapper.Main.main(arrayOf("--no-launch") + argv) projectGenerator.run(args) } else if (args.usage) { jc.usage() } else if (args.serverMode) { server.run() } else { - if (! buildFile.exists()) { + if (!buildFile.exists()) { error(buildFile.path.toFile().path + " does not exist") } else { val allProjects = buildFileCompilerFactory.create(listOf(buildFile), pluginInfo) @@ -177,6 +176,8 @@ private class Main @Inject constructor( println(sb.toString()) } else if (args.checkVersions) { checkVersions.run(allProjects) + } else if (args.download) { + updateKobalt.downloadKobalt() } else if (args.update) { updateKobalt.updateKobalt() } else { @@ -192,6 +193,7 @@ private class Main @Inject constructor( } return result } + private fun findBuildFile(): File { val files = arrayListOf("Build.kt", "build.kobalt", KFiles.src("build.kobalt"), KFiles.src("Build.kt")) diff --git a/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt b/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt index f18ecece..80fcc72a 100644 --- a/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt +++ b/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt @@ -15,12 +15,6 @@ class KobaltWrapperProperties @Inject constructor() { private val PROPERTY_VERSION = "kobalt.version" private val PROPERTY_DOWNLOAD_URL = "kobalt.downloadUrl" - fun defaultUrlFor(version: String) = - "bogushttps://github.com/cbeust/kobalt/releases/download/$version/kobalt-$version.zip" - - val file: File - get() = File("$WRAPPER_DIR/$KOBALT_WRAPPER_PROPERTIES") - fun create(version: String) { log(2, "Creating $file with $version and ${defaultUrlFor(version)}") KFiles.saveFile(file, listOf( @@ -29,7 +23,13 @@ class KobaltWrapperProperties @Inject constructor() { ).joinToString("\n")) } - val properties : Properties + private fun defaultUrlFor(version: String) = + "https://github.com/cbeust/kobalt/releases/download/$version/kobalt-$version.zip" + + private val file: File + get() = File("$WRAPPER_DIR/$KOBALT_WRAPPER_PROPERTIES") + + private val properties : Properties get() { val config = file if (!config.exists()) { @@ -45,20 +45,5 @@ class KobaltWrapperProperties @Inject constructor() { get() = properties.getProperty(PROPERTY_VERSION) val downloadUrl : String - get() { - return properties.getProperty(PROPERTY_DOWNLOAD_URL) - ?: defaultUrlFor(version) - } - - fun maybeCreate(version: String) { - if (! file.exists()) { - create(version) - } - } - -// fun urlFor(version: String) : String { -// // val URL = "https://dl.bintray.com/cbeust/generic/" -// // return "https://dl.bintray.com/cbeust/generic/$fileName-$version.zip" -// return downloadUrl ?: defaultUrlFor(version) -// } + get() = properties.getProperty(PROPERTY_DOWNLOAD_URL) } diff --git a/src/main/kotlin/com/beust/kobalt/misc/UpdateKobalt.kt b/src/main/kotlin/com/beust/kobalt/misc/UpdateKobalt.kt index 5040d86b..08dba92a 100644 --- a/src/main/kotlin/com/beust/kobalt/misc/UpdateKobalt.kt +++ b/src/main/kotlin/com/beust/kobalt/misc/UpdateKobalt.kt @@ -5,10 +5,17 @@ import javax.inject.Inject /** * Update Kobalt to the latest version. */ -public class UpdateKobalt @Inject constructor(val github: GithubApi, val kobaltWrapperProperties: KobaltWrapperProperties) { +public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapperProperties: KobaltWrapperProperties) { fun updateKobalt() { val newVersion = github.latestKobaltVersion - kobaltWrapperProperties.maybeCreate(newVersion.get()) - com.beust.kobalt.wrapper.main(arrayOf()) + wrapperProperties.create(newVersion.get()) + com.beust.kobalt.wrapper.Main.main(arrayOf()) + } + + /** + * Download from the URL found in the kobalt-wrapper.properties regardless of what the latest version is + */ + fun downloadKobalt() { + com.beust.kobalt.wrapper.Main.main(arrayOf("--download")) } } diff --git a/src/main/kotlin/com/beust/kobalt/wrapper/Wrapper.kt b/src/main/kotlin/com/beust/kobalt/wrapper/Wrapper.kt index 743ea432..a2e9e25e 100644 --- a/src/main/kotlin/com/beust/kobalt/wrapper/Wrapper.kt +++ b/src/main/kotlin/com/beust/kobalt/wrapper/Wrapper.kt @@ -1,187 +1,170 @@ package com.beust.kobalt.wrapper -import com.beust.kobalt.JavaInfo -import com.beust.kobalt.SystemProperties -import com.beust.kobalt.api.Kobalt -import com.beust.kobalt.maven.Http -import com.beust.kobalt.misc.KFiles -import com.beust.kobalt.misc.KobaltWrapperProperties -import com.beust.kobalt.misc.benchmark -import com.beust.kobalt.misc.log -import com.google.inject.Inject -import java.io.File -import java.io.InputStream -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.Paths -import java.util.* -import java.util.zip.ZipFile - -public fun main(argv: Array) { - Kobalt.INJECTOR.getInstance(Wrapper::class.java).installAndLaunchMain(argv) -} +//public fun main(argv: Array) { +// Kobalt.INJECTOR.getInstance(Wrapper::class.java).installAndLaunchMain(argv) +//} /** * Download and install a new wrapper if requested. */ -public class Wrapper @Inject constructor(val wrapperProperties: KobaltWrapperProperties){ - // kobalt.properties - private val KOBALT_PROPERTIES = "kobalt.properties" - private val KOBALTW = "kobaltw" - - val FILE_NAME = "kobalt" - - private val properties = Properties() - - public fun installAndLaunchMain(argv: Array) { - val kobaltJarFile = install() - launchMain(kobaltJarFile, argv) - } - - private fun readProperties(properties: Properties, ins: InputStream) { - properties.load(ins) - ins.close() - properties.forEach { es -> System.setProperty(es.key.toString(), es.value.toString()) } - } - - /** - * Attemps to read kobalt.properties (which should always exist). - */ - private fun maybeCreateKobaltProperties() : Properties { - val result = Properties() - - // kobalt.properties is internal to Kobalt - val url = javaClass.classLoader.getResource(KOBALT_PROPERTIES) - if (url != null) { - readProperties(result, url.openConnection().inputStream) - } else { - throw IllegalArgumentException("Couldn't find $KOBALT_PROPERTIES") - } - - return result - } - -// private fun initWrapperFile(version: String) { -// val config = wrapperProperties.file -// if (! config.exists()) { -// wrapperProperties.create(version) -// } -// properties.load(FileReader(config)) +//public class Wrapper @Inject constructor(val wrapperProperties: KobaltWrapperProperties){ +// // kobalt.properties +// private val KOBALT_PROPERTIES = "kobalt.properties" +// private val KOBALTW = "kobaltw" +// +// val FILE_NAME = "kobalt" +// +// private val properties = Properties() +// +// public fun installAndLaunchMain(argv: Array) { +// val kobaltJarFile = install() +// launchMain(kobaltJarFile, argv) // } // -// private val wrapperVersion : String -// get() { -// return properties.getProperty(PROPERTY_VERSION) -// } -// -// private val wrapperDownloadUrl : String -// get() { -// return properties.getProperty(PROPERTY_DOWNLOAD_URL) -// } -// -// fun urlFor(version: String) : String { -// // val URL = "https://dl.bintray.com/cbeust/generic/" -// // return "https://dl.bintray.com/cbeust/generic/$fileName-$version.zip" -// return wrapperDownloadUrl ?: defaultUrlFor(version) +// private fun readProperties(properties: Properties, ins: InputStream) { +// properties.load(ins) +// ins.close() +// properties.forEach { es -> System.setProperty(es.key.toString(), es.value.toString()) } // } - - /** - * Install a new version if requested in .kobalt/wrapper/kobalt-wrapper.properties - * - * @return the path to the Kobalt jar file - */ - public fun install() : Path { - val properties = maybeCreateKobaltProperties() - val version = properties.getProperty("kobalt.version") - wrapperProperties.maybeCreate(version) - log(2, "Wrapper version: ${wrapperProperties.version}") - - val wrapperVersion = wrapperProperties.version - val fileName = "$FILE_NAME-$wrapperVersion.zip" - File(KFiles.distributionsDir).mkdirs() - val localZipFile = Paths.get(KFiles.distributionsDir, fileName) - val zipOutputDir = KFiles.distributionsDir + "/" + wrapperVersion - val kobaltJarFile = Paths.get(zipOutputDir, "kobalt/wrapper/$FILE_NAME-$wrapperVersion.jar") - if (!Files.exists(localZipFile) || !Files.exists(kobaltJarFile)) { - log(1, "Downloading $fileName") - val fullUrl = wrapperProperties.downloadUrl - val body = Http().get(fullUrl) - if (body.code == 200) { - if (!Files.exists(localZipFile)) { - val target = localZipFile.toAbsolutePath() - val ins = body.getAsStream() - benchmark("Download .zip file") { - // This takes about eight seconds for a 21M file because of the extra copying, not good. - // Should use Okio.sink(file) to create a Sink and then call readAll(fileSink) on - // the BufferedSource returned in the ResponseBody - Files.copy(ins, target) - } - log(2, "$localZipFile downloaded, extracting it") - } else { - log(2, "$localZipFile already exists, extracting it") - } - - // - // Extract all the zip files - // - val zipFile = ZipFile(localZipFile.toFile()) - val entries = zipFile.entries() - val outputDirectory = File(KFiles.distributionsDir) - outputDirectory.mkdirs() - while (entries.hasMoreElements()) { - val entry = entries.nextElement() - val entryFile = File(entry.name) - if (entry.isDirectory) { - entryFile.mkdirs() - } else { - val dest = Paths.get(zipOutputDir, entryFile.path) - log(2, " Writing ${entry.name} to $dest") - Files.createDirectories(dest.parent) - Files.copy(zipFile.getInputStream(entry), - dest, - java.nio.file.StandardCopyOption.REPLACE_EXISTING) - } - } - log(2, "$localZipFile extracted") - } else { - error("Couldn't download $fullUrl") - } - } - - // - // Copy the wrapper files in the current kobalt/wrapper directory - // - log(2, "Copying the wrapper files...") - arrayListOf(KOBALTW, "kobalt/wrapper/$FILE_NAME-wrapper.jar").forEach { - val from = Paths.get(zipOutputDir, it) - val to = Paths.get(File(".").absolutePath, it) - KFiles.copy(from, to, java.nio.file.StandardCopyOption.REPLACE_EXISTING) - } - File(KOBALTW).setExecutable(true) - - return kobaltJarFile - } - - /** - * Launch kobalt-xxx.jar - * - * Note: currently launching it in a separate VM because both this jar file and the wrapper contain - * the same classes, so the old classes will be run. Once wrapper.jar contains only the - * wrapper class and nothing else from the Kobalt distribution, we can just invoke main from the same JVM here, - * which will speed up the start up - */ - private fun launchMain(kobaltJarFile: Path, argv: Array) { - val jvm = JavaInfo.create(File(SystemProperties.javaBase)) - val java = jvm.javaExecutable - - val args = arrayListOf( - java!!.absolutePath, - "-jar", kobaltJarFile.toFile().absolutePath) - args.addAll(argv) - val pb = ProcessBuilder(args) - pb.inheritIO() - log(2, "Launching\n ${args.joinToString(" ")}") - val process = pb.start() - process.waitFor() - } -} +// +// /** +// * Attemps to read kobalt.properties (which should always exist). +// */ +// private fun maybeCreateKobaltProperties() : Properties { +// val result = Properties() +// +// // kobalt.properties is internal to Kobalt +// val url = javaClass.classLoader.getResource(KOBALT_PROPERTIES) +// if (url != null) { +// readProperties(result, url.openConnection().inputStream) +// } else { +// throw IllegalArgumentException("Couldn't find $KOBALT_PROPERTIES") +// } +// +// return result +// } +// +//// private fun initWrapperFile(version: String) { +//// val config = wrapperProperties.file +//// if (! config.exists()) { +//// wrapperProperties.create(version) +//// } +//// properties.load(FileReader(config)) +//// } +//// +//// private val wrapperVersion : String +//// get() { +//// return properties.getProperty(PROPERTY_VERSION) +//// } +//// +//// private val wrapperDownloadUrl : String +//// get() { +//// return properties.getProperty(PROPERTY_DOWNLOAD_URL) +//// } +//// +//// fun urlFor(version: String) : String { +//// // val URL = "https://dl.bintray.com/cbeust/generic/" +//// // return "https://dl.bintray.com/cbeust/generic/$fileName-$version.zip" +//// return wrapperDownloadUrl ?: defaultUrlFor(version) +//// } +// +// /** +// * Install a new version if requested in .kobalt/wrapper/kobalt-wrapper.properties +// * +// * @return the path to the Kobalt jar file +// */ +// public fun install() : Path { +// val properties = maybeCreateKobaltProperties() +// val version = properties.getProperty("kobalt.version") +// wrapperProperties.maybeCreate(version) +// log(2, "Wrapper version: ${wrapperProperties.version}") +// +// val wrapperVersion = wrapperProperties.version +// val fileName = "$FILE_NAME-$wrapperVersion.zip" +// File(KFiles.distributionsDir).mkdirs() +// val localZipFile = Paths.get(KFiles.distributionsDir, fileName) +// val zipOutputDir = KFiles.distributionsDir + "/" + wrapperVersion +// val kobaltJarFile = Paths.get(zipOutputDir, "kobalt/wrapper/$FILE_NAME-$wrapperVersion.jar") +// if (!Files.exists(localZipFile) || !Files.exists(kobaltJarFile)) { +// log(1, "Downloading $fileName") +// val fullUrl = wrapperProperties.downloadUrl +// val body = Http().get(fullUrl) +// if (body.code == 200) { +// if (!Files.exists(localZipFile)) { +// val target = localZipFile.toAbsolutePath() +// val ins = body.getAsStream() +// benchmark("Download .zip file") { +// // This takes about eight seconds for a 21M file because of the extra copying, not good. +// // Should use Okio.sink(file) to create a Sink and then call readAll(fileSink) on +// // the BufferedSource returned in the ResponseBody +// Files.copy(ins, target) +// } +// log(2, "$localZipFile downloaded, extracting it") +// } else { +// log(2, "$localZipFile already exists, extracting it") +// } +// +// // +// // Extract all the zip files +// // +// val zipFile = ZipFile(localZipFile.toFile()) +// val entries = zipFile.entries() +// val outputDirectory = File(KFiles.distributionsDir) +// outputDirectory.mkdirs() +// while (entries.hasMoreElements()) { +// val entry = entries.nextElement() +// val entryFile = File(entry.name) +// if (entry.isDirectory) { +// entryFile.mkdirs() +// } else { +// val dest = Paths.get(zipOutputDir, entryFile.path) +// log(2, " Writing ${entry.name} to $dest") +// Files.createDirectories(dest.parent) +// Files.copy(zipFile.getInputStream(entry), +// dest, +// java.nio.file.StandardCopyOption.REPLACE_EXISTING) +// } +// } +// log(2, "$localZipFile extracted") +// } else { +// error("Couldn't download $fullUrl") +// } +// } +// +// // +// // Copy the wrapper files in the current kobalt/wrapper directory +// // +// log(2, "Copying the wrapper files...") +// arrayListOf(KOBALTW, "kobalt/wrapper/$FILE_NAME-wrapper.jar").forEach { +// val from = Paths.get(zipOutputDir, it) +// val to = Paths.get(File(".").absolutePath, it) +// KFiles.copy(from, to, java.nio.file.StandardCopyOption.REPLACE_EXISTING) +// } +// File(KOBALTW).setExecutable(true) +// +// return kobaltJarFile +// } +// +// /** +// * Launch kobalt-xxx.jar +// * +// * Note: currently launching it in a separate VM because both this jar file and the wrapper contain +// * the same classes, so the old classes will be run. Once wrapper.jar contains only the +// * wrapper class and nothing else from the Kobalt distribution, we can just invoke main from the same JVM here, +// * which will speed up the start up +// */ +// private fun launchMain(kobaltJarFile: Path, argv: Array) { +// val jvm = JavaInfo.create(File(SystemProperties.javaBase)) +// val java = jvm.javaExecutable +// +// val args = arrayListOf( +// java!!.absolutePath, +// "-jar", kobaltJarFile.toFile().absolutePath) +// args.addAll(argv) +// val pb = ProcessBuilder(args) +// pb.inheritIO() +// log(2, "Launching\n ${args.joinToString(" ")}") +// val process = pb.start() +// process.waitFor() +// } +//} diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index b27d957c..b28a10ab 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1,2 +1,2 @@ -kobalt.version=0.238 +kobalt.version=0.244