diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Args.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Args.kt index 13e9675c..5654e57e 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Args.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Args.kt @@ -16,7 +16,7 @@ class Args { @Parameter(names = arrayOf("--client")) var client: Boolean = false - @Parameter(names = arrayOf("--dev"), description = "Turn of dev mode, resulting in a more verbose log output") + @Parameter(names = arrayOf("--dev"), description = "Turn on 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") @@ -45,6 +45,9 @@ class Args { @Parameter(names = arrayOf("--plugins"), description = "Comma-separated list of plug-in Maven id's") var pluginIds: String? = null + @Parameter(names = arrayOf("--pluginJarFiles"), description = "Comma-separated list of plug-in jar files") + var pluginJarFiles: String? = null + @Parameter(names = arrayOf("--port"), description = "Port, if --server was specified") var port: Int = DEFAULT_SERVER_PORT diff --git a/src/main/kotlin/com/beust/kobalt/Main.kt b/src/main/kotlin/com/beust/kobalt/Main.kt index f270812c..9dca43d7 100644 --- a/src/main/kotlin/com/beust/kobalt/Main.kt +++ b/src/main/kotlin/com/beust/kobalt/Main.kt @@ -1,7 +1,10 @@ package com.beust.kobalt import com.beust.jcommander.JCommander -import com.beust.kobalt.api.* +import com.beust.kobalt.api.IClasspathDependency +import com.beust.kobalt.api.Kobalt +import com.beust.kobalt.api.PluginTask +import com.beust.kobalt.api.Project import com.beust.kobalt.app.* import com.beust.kobalt.app.remote.KobaltClient import com.beust.kobalt.app.remote.KobaltServer @@ -11,8 +14,8 @@ import com.beust.kobalt.internal.TaskManager import com.beust.kobalt.internal.build.BuildFile import com.beust.kobalt.maven.DepFactory import com.beust.kobalt.maven.Http +import com.beust.kobalt.maven.dependency.FileDependency import com.beust.kobalt.misc.* -import com.google.common.collect.ArrayListMultimap import com.google.common.collect.HashMultimap import com.google.inject.Guice import java.io.File @@ -66,16 +69,30 @@ private class Main @Inject constructor( data class RunInfo(val jc: JCommander, val args: Args) - public fun run(jc: JCommander, args: Args, argv: Array): Int { - // Install plug-ins requested from the command line + private fun installCommandLinePlugins(args: Args) : ClassLoader { var pluginClassLoader = javaClass.classLoader + val dependencies = arrayListOf() args.pluginIds?.let { - val dependencies = it.split(",").map { depFactory.create(it) } + dependencies.addAll(it.split(",").map { depFactory.create(it) }) + } + args.pluginJarFiles?.let { + dependencies.addAll(it.split(",").map { FileDependency(it) }) + } + if (dependencies.size > 0) { val urls = dependencies.map { it.jarFile.get().toURI().toURL() } pluginClassLoader = URLClassLoader(urls.toTypedArray()) plugins.installPlugins(dependencies, pluginClassLoader) } + return pluginClassLoader + } + + public fun run(jc: JCommander, args: Args, argv: Array): Int { + // + // Install plug-ins requested from the command line + // + val pluginClassLoader = installCommandLinePlugins(args) + // // Add all the plugins read in kobalt-plugin.xml to the Plugins singleton, so that code // in the build file that calls Plugins.findPlugin() can find them (code in the