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

Support for --download.

This commit is contained in:
Cedric Beust 2015-11-10 13:13:23 -08:00
parent 13b87527f6
commit ae7511be25
10 changed files with 264 additions and 282 deletions

View file

@ -2,6 +2,7 @@
import com.beust.kobalt.api.License import com.beust.kobalt.api.License
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
import com.beust.kobalt.api.Scm import com.beust.kobalt.api.Scm
import com.beust.kobalt.file
import com.beust.kobalt.homeDir import com.beust.kobalt.homeDir
import com.beust.kobalt.internal.TaskResult import com.beust.kobalt.internal.TaskResult
import com.beust.kobalt.internal.test 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.kotlinCompiler
import com.beust.kobalt.plugin.kotlin.kotlinProject import com.beust.kobalt.plugin.kotlin.kotlinProject
import com.beust.kobalt.plugin.packaging.assemble import com.beust.kobalt.plugin.packaging.assemble
import com.beust.kobalt.plugin.publish.jcenter
import java.io.File import java.io.File
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
@ -71,7 +73,8 @@ val kobalt = kotlinProject(wrapper) {
"org.apache.maven:maven-model:3.3.3", "org.apache.maven:maven-model:3.3.3",
"com.github.spullara.mustache.java:compiler:0.9.1", "com.github.spullara.mustache.java:compiler:0.9.1",
"io.reactivex:rxjava:1.0.14", "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") args("-nowarn")
} }
// jcenter { jcenter {
// publish = true publish = true
// file("$buildDirectory/libs/$name-$version.zip", "$name/$version/$name-$version.zip") file("$buildDirectory/libs/$name-$version.zip", "$name/$version/$name-$version.zip")
// } }
} }
fun readVersion() : String { fun readVersion() : String {

Binary file not shown.

View file

@ -1,2 +1 @@
kobalt.version=0.238 kobalt.version=0.244
kobalt.downloadUrl=https://github.com/cbeust/kobalt/releases/download/0.238/kobalt-0.238.zip

View file

@ -34,8 +34,12 @@ public class Main {
private static int logLevel = 1; private static int logLevel = 1;
private void installAndLaunchMain(String[] argv) throws IOException, InterruptedException { private void installAndLaunchMain(String[] argv) throws IOException, InterruptedException {
boolean noLaunch = false;
for (int i = 0; i < argv.length; i++) { for (int i = 0; i < argv.length; i++) {
switch(argv[i]) { switch(argv[i]) {
case "--no-launch":
noLaunch = true;
break;
case "--log": case "--log":
logLevel = Integer.parseInt(argv[i + 1]); logLevel = Integer.parseInt(argv[i + 1]);
i++; i++;
@ -43,8 +47,10 @@ public class Main {
} }
} }
Path kobaltJarFile = installJarFile(); Path kobaltJarFile = installJarFile();
if (! noLaunch) {
launchMain(kobaltJarFile, argv); launchMain(kobaltJarFile, argv);
} }
}
private void readProperties(Properties properties, InputStream ins) throws IOException { private void readProperties(Properties properties, InputStream ins) throws IOException {
properties.load(ins); properties.load(ins);
@ -106,7 +112,6 @@ public class Main {
Path kobaltJarFile = Paths.get(zipOutputDir, Path kobaltJarFile = Paths.get(zipOutputDir,
getWrapperDir().getPath() + "/" + FILE_NAME + "-" + getWrapperVersion() + ".jar"); getWrapperDir().getPath() + "/" + FILE_NAME + "-" + getWrapperVersion() + ".jar");
if (! Files.exists(localZipFile) || ! Files.exists(kobaltJarFile)) { if (! Files.exists(localZipFile) || ! Files.exists(kobaltJarFile)) {
if (!Files.exists(localZipFile)) {
download(localZipFile.toFile()); download(localZipFile.toFile());
} }
@ -142,12 +147,11 @@ public class Main {
download(localZipFile.toFile()); download(localZipFile.toFile());
} }
} }
}
// //
// Copy the wrapper files in the current kobalt/wrapper directory // Copy the wrapper files in the current kobalt/wrapper directory
// //
if (! version.equals(getWrapperVersion())) { boolean sameVersion = equals(getWrapperVersion());
log(2, "Copying the wrapper files"); log(2, "Copying the wrapper files");
for (String file : FILES) { for (String file : FILES) {
Path from = Paths.get(zipOutputDir, file); Path from = Paths.get(zipOutputDir, file);
@ -163,9 +167,7 @@ public class Main {
} }
} }
new File(KOBALTW).setExecutable(true); new File(KOBALTW).setExecutable(true);
} else {
log(2, "Wrapper and current versions are identical");
}
return kobaltJarFile; return kobaltJarFile;
} }
@ -267,8 +269,6 @@ public class Main {
System.out.println("[Wrapper error] *** " + s); 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 { private void launchMain(Path kobaltJarFile, String[] argv) throws IOException, InterruptedException {
List<String> args = new ArrayList<>(); List<String> args = new ArrayList<>();
args.add("java"); args.add("java");

View file

@ -19,6 +19,9 @@ class Args {
@Parameter(names = arrayOf("--dev"), description = "Turn of dev mode, resulting in a more verbose log output") @Parameter(names = arrayOf("--dev"), description = "Turn of dev mode, resulting in a more verbose log output")
var dev: Boolean = false 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 " + @Parameter(names = arrayOf("--dryRun"), description = "Display all the tasks that will get run without " +
"actually running them") "actually running them")
var dryRun: Boolean = false var dryRun: Boolean = false

View file

@ -14,7 +14,6 @@ import com.beust.kobalt.maven.Http
import com.beust.kobalt.maven.KobaltException import com.beust.kobalt.maven.KobaltException
import com.beust.kobalt.maven.LocalRepo import com.beust.kobalt.maven.LocalRepo
import com.beust.kobalt.misc.* import com.beust.kobalt.misc.*
import com.beust.kobalt.wrapper.Wrapper
import com.google.inject.Guice import com.google.inject.Guice
import java.io.File import java.io.File
import java.nio.file.Paths import java.nio.file.Paths
@ -40,7 +39,7 @@ private fun parseArgs(argv: Array<String>): Main.RunInfo {
public fun mainNoExit(argv: Array<String>): Int { public fun mainNoExit(argv: Array<String>): Int {
val (jc, args) = parseArgs(argv) val (jc, args) = parseArgs(argv)
Kobalt.INJECTOR = Guice.createInjector(MainModule(args)) 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( private class Main @Inject constructor(
@ -59,8 +58,7 @@ private class Main @Inject constructor(
val server: KobaltServer, val server: KobaltServer,
val pluginInfo: PluginInfo, val pluginInfo: PluginInfo,
val projectGenerator: ProjectGenerator, val projectGenerator: ProjectGenerator,
val resolveDependency: ResolveDependency, val resolveDependency: ResolveDependency) {
val wrapper: Wrapper) {
data class RunInfo(val jc: JCommander, val args: Args) data class RunInfo(val jc: JCommander, val args: Args)
@ -71,7 +69,7 @@ private class Main @Inject constructor(
} }
} }
public fun run(jc: JCommander, args: Args) : Int { public fun run(jc: JCommander, args: Args, argv: Array<String>): Int {
// //
// Add all the repos from repo contributors (at least those that return values without a Project) // Add all the repos from repo contributors (at least those that return values without a Project)
@ -95,7 +93,7 @@ private class Main @Inject constructor(
val seconds = benchmark("build", { val seconds = benchmark("build", {
// runTest() // runTest()
try { try {
result = runWithArgs(jc, args) result = runWithArgs(jc, args, argv)
} catch(ex: KobaltException) { } catch(ex: KobaltException) {
error(ex.message ?: "", ex) error(ex.message ?: "", ex)
result = 1 result = 1
@ -124,7 +122,7 @@ private class Main @Inject constructor(
// val file = File("src\\main\\resources\\META-INF\\plugin.ml") // 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<String>): Int {
var result = 0 var result = 0
val p = if (args.buildFile != null) File(args.buildFile) else findBuildFile() val p = if (args.buildFile != null) File(args.buildFile) else findBuildFile()
args.buildFile = p.absolutePath args.buildFile = p.absolutePath
@ -137,8 +135,9 @@ private class Main @Inject constructor(
if (args.init) { if (args.init) {
// //
// --init: create a new build project and install the wrapper // --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) projectGenerator.run(args)
} else if (args.usage) { } else if (args.usage) {
jc.usage() jc.usage()
@ -177,6 +176,8 @@ private class Main @Inject constructor(
println(sb.toString()) println(sb.toString())
} else if (args.checkVersions) { } else if (args.checkVersions) {
checkVersions.run(allProjects) checkVersions.run(allProjects)
} else if (args.download) {
updateKobalt.downloadKobalt()
} else if (args.update) { } else if (args.update) {
updateKobalt.updateKobalt() updateKobalt.updateKobalt()
} else { } else {
@ -192,6 +193,7 @@ private class Main @Inject constructor(
} }
return result return result
} }
private fun findBuildFile(): File { private fun findBuildFile(): File {
val files = arrayListOf("Build.kt", "build.kobalt", KFiles.src("build.kobalt"), val files = arrayListOf("Build.kt", "build.kobalt", KFiles.src("build.kobalt"),
KFiles.src("Build.kt")) KFiles.src("Build.kt"))

View file

@ -15,12 +15,6 @@ class KobaltWrapperProperties @Inject constructor() {
private val PROPERTY_VERSION = "kobalt.version" private val PROPERTY_VERSION = "kobalt.version"
private val PROPERTY_DOWNLOAD_URL = "kobalt.downloadUrl" 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) { fun create(version: String) {
log(2, "Creating $file with $version and ${defaultUrlFor(version)}") log(2, "Creating $file with $version and ${defaultUrlFor(version)}")
KFiles.saveFile(file, listOf( KFiles.saveFile(file, listOf(
@ -29,7 +23,13 @@ class KobaltWrapperProperties @Inject constructor() {
).joinToString("\n")) ).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() { get() {
val config = file val config = file
if (!config.exists()) { if (!config.exists()) {
@ -45,20 +45,5 @@ class KobaltWrapperProperties @Inject constructor() {
get() = properties.getProperty(PROPERTY_VERSION) get() = properties.getProperty(PROPERTY_VERSION)
val downloadUrl : String val downloadUrl : String
get() { get() = properties.getProperty(PROPERTY_DOWNLOAD_URL)
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)
// }
} }

View file

@ -5,10 +5,17 @@ import javax.inject.Inject
/** /**
* Update Kobalt to the latest version. * 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() { fun updateKobalt() {
val newVersion = github.latestKobaltVersion val newVersion = github.latestKobaltVersion
kobaltWrapperProperties.maybeCreate(newVersion.get()) wrapperProperties.create(newVersion.get())
com.beust.kobalt.wrapper.main(arrayOf()) 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"))
} }
} }

View file

@ -1,187 +1,170 @@
package com.beust.kobalt.wrapper package com.beust.kobalt.wrapper
import com.beust.kobalt.JavaInfo //public fun main(argv: Array<String>) {
import com.beust.kobalt.SystemProperties // Kobalt.INJECTOR.getInstance(Wrapper::class.java).installAndLaunchMain(argv)
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<String>) {
Kobalt.INJECTOR.getInstance(Wrapper::class.java).installAndLaunchMain(argv)
}
/** /**
* Download and install a new wrapper if requested. * Download and install a new wrapper if requested.
*/ */
public class Wrapper @Inject constructor(val wrapperProperties: KobaltWrapperProperties){ //public class Wrapper @Inject constructor(val wrapperProperties: KobaltWrapperProperties){
// kobalt.properties // // kobalt.properties
private val KOBALT_PROPERTIES = "kobalt.properties" // private val KOBALT_PROPERTIES = "kobalt.properties"
private val KOBALTW = "kobaltw" // private val KOBALTW = "kobaltw"
//
val FILE_NAME = "kobalt" // val FILE_NAME = "kobalt"
//
private val properties = Properties() // private val properties = Properties()
//
public fun installAndLaunchMain(argv: Array<String>) { // public fun installAndLaunchMain(argv: Array<String>) {
val kobaltJarFile = install() // val kobaltJarFile = install()
launchMain(kobaltJarFile, argv) // 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))
// } // }
// //
// private val wrapperVersion : String // private fun readProperties(properties: Properties, ins: InputStream) {
// get() { // properties.load(ins)
// return properties.getProperty(PROPERTY_VERSION) // ins.close()
// properties.forEach { es -> System.setProperty(es.key.toString(), es.value.toString()) }
// } // }
// //
// private val wrapperDownloadUrl : String // /**
// get() { // * Attemps to read kobalt.properties (which should always exist).
// return properties.getProperty(PROPERTY_DOWNLOAD_URL) // */
// 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")
// } // }
// //
// fun urlFor(version: String) : String { // return result
// // 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 //// 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)
//// }
// //
val zipFile = ZipFile(localZipFile.toFile()) // /**
val entries = zipFile.entries() // * Install a new version if requested in .kobalt/wrapper/kobalt-wrapper.properties
val outputDirectory = File(KFiles.distributionsDir) // *
outputDirectory.mkdirs() // * @return the path to the Kobalt jar file
while (entries.hasMoreElements()) { // */
val entry = entries.nextElement() // public fun install() : Path {
val entryFile = File(entry.name) // val properties = maybeCreateKobaltProperties()
if (entry.isDirectory) { // val version = properties.getProperty("kobalt.version")
entryFile.mkdirs() // wrapperProperties.maybeCreate(version)
} else { // log(2, "Wrapper version: ${wrapperProperties.version}")
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 // 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")
// }
// //
log(2, "Copying the wrapper files...") // //
arrayListOf(KOBALTW, "kobalt/wrapper/$FILE_NAME-wrapper.jar").forEach { // // Extract all the zip files
val from = Paths.get(zipOutputDir, it) // //
val to = Paths.get(File(".").absolutePath, it) // val zipFile = ZipFile(localZipFile.toFile())
KFiles.copy(from, to, java.nio.file.StandardCopyOption.REPLACE_EXISTING) // val entries = zipFile.entries()
} // val outputDirectory = File(KFiles.distributionsDir)
File(KOBALTW).setExecutable(true) // outputDirectory.mkdirs()
// while (entries.hasMoreElements()) {
return kobaltJarFile // val entry = entries.nextElement()
} // val entryFile = File(entry.name)
// if (entry.isDirectory) {
/** // entryFile.mkdirs()
* Launch kobalt-xxx.jar // } else {
* // val dest = Paths.get(zipOutputDir, entryFile.path)
* Note: currently launching it in a separate VM because both this jar file and the wrapper contain // log(2, " Writing ${entry.name} to $dest")
* the same classes, so the old classes will be run. Once wrapper.jar contains only the // Files.createDirectories(dest.parent)
* wrapper class and nothing else from the Kobalt distribution, we can just invoke main from the same JVM here, // Files.copy(zipFile.getInputStream(entry),
* which will speed up the start up // dest,
*/ // java.nio.file.StandardCopyOption.REPLACE_EXISTING)
private fun launchMain(kobaltJarFile: Path, argv: Array<String>) { // }
val jvm = JavaInfo.create(File(SystemProperties.javaBase)) // }
val java = jvm.javaExecutable // log(2, "$localZipFile extracted")
// } else {
val args = arrayListOf( // error("Couldn't download $fullUrl")
java!!.absolutePath, // }
"-jar", kobaltJarFile.toFile().absolutePath) // }
args.addAll(argv) //
val pb = ProcessBuilder(args) // //
pb.inheritIO() // // Copy the wrapper files in the current kobalt/wrapper directory
log(2, "Launching\n ${args.joinToString(" ")}") // //
val process = pb.start() // log(2, "Copying the wrapper files...")
process.waitFor() // 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<String>) {
// 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()
// }
//}

View file

@ -1,2 +1,2 @@
kobalt.version=0.238 kobalt.version=0.244