mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Added "--plugins".
This commit is contained in:
parent
d23e5e186a
commit
e1ee30c0c7
3 changed files with 19 additions and 4 deletions
|
@ -39,6 +39,9 @@ class Args {
|
|||
const val DEFAULT_SERVER_PORT = 1234
|
||||
}
|
||||
|
||||
@Parameter(names = arrayOf("--plugins"), description = "Comma-separated list of plug-in Maven id's")
|
||||
var pluginIds: String? = null
|
||||
|
||||
@Parameter(names = arrayOf("--port"), description = "Port, if --server was specified")
|
||||
var port: Int = DEFAULT_SERVER_PORT
|
||||
|
||||
|
|
|
@ -15,11 +15,13 @@ import com.beust.kobalt.internal.KobaltSettings
|
|||
import com.beust.kobalt.internal.PluginInfo
|
||||
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.misc.*
|
||||
import com.google.common.collect.HashMultimap
|
||||
import com.google.inject.Guice
|
||||
import java.io.File
|
||||
import java.net.URLClassLoader
|
||||
import java.nio.file.Paths
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
@ -60,12 +62,18 @@ private class Main @Inject constructor(
|
|||
val server: KobaltServer,
|
||||
val pluginInfo: PluginInfo,
|
||||
val projectGenerator: ProjectGenerator,
|
||||
val depFactory: DepFactory,
|
||||
val resolveDependency: ResolveDependency) {
|
||||
|
||||
data class RunInfo(val jc: JCommander, val args: Args)
|
||||
|
||||
public fun run(jc: JCommander, args: Args, argv: Array<String>): Int {
|
||||
// github.uploadRelease("kobalt", "0.101", File("/Users/beust/t/a.zip"))
|
||||
// Install plug-ins requested from the command line
|
||||
args.pluginIds?.let {
|
||||
val dependencies = it.split(",").map { depFactory.create(it) }
|
||||
val urls = dependencies.map { it.jarFile.get().toURI().toURL() }
|
||||
plugins.installPlugins(dependencies, URLClassLoader(urls.toTypedArray()))
|
||||
}
|
||||
|
||||
//
|
||||
// Add all the plugins read in kobalt-plugin.xml to the Plugins singleton, so that code
|
||||
|
|
|
@ -14,9 +14,13 @@ public class ProjectGenerator @Inject constructor(val pluginInfo: PluginInfo){
|
|||
File(args.buildFile).parentFile.mkdirs()
|
||||
args.archetypes?.let { archetypes ->
|
||||
val contributors = pluginInfo.initContributors.filter { archetypes.contains(it.archetypeName) }
|
||||
contributors.forEach {
|
||||
log(2, "Running archetype ${it.archetypeName}")
|
||||
it.generateArchetype(args)
|
||||
if (contributors.size > 0) {
|
||||
contributors.forEach {
|
||||
log(2, "Running archetype ${it.archetypeName}")
|
||||
it.generateArchetype(args)
|
||||
}
|
||||
} else {
|
||||
log(1, "Couldn't find any archetype named ${args.archetypes}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue