mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 08:38:13 -07:00
Better archetype error handling.
This commit is contained in:
parent
2f190edb2c
commit
3fdc7d8c5b
1 changed files with 12 additions and 8 deletions
|
@ -1,8 +1,10 @@
|
||||||
package com.beust.kobalt.app
|
package com.beust.kobalt.app
|
||||||
|
|
||||||
import com.beust.kobalt.Args
|
import com.beust.kobalt.Args
|
||||||
|
import com.beust.kobalt.api.IInitContributor
|
||||||
import com.beust.kobalt.internal.PluginInfo
|
import com.beust.kobalt.internal.PluginInfo
|
||||||
import com.beust.kobalt.misc.log
|
import com.beust.kobalt.misc.log
|
||||||
|
import com.beust.kobalt.misc.warn
|
||||||
import com.google.inject.Inject
|
import com.google.inject.Inject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
@ -12,15 +14,17 @@ import java.io.File
|
||||||
public class ProjectGenerator @Inject constructor(val pluginInfo: PluginInfo){
|
public class ProjectGenerator @Inject constructor(val pluginInfo: PluginInfo){
|
||||||
fun run(args: Args) {
|
fun run(args: Args) {
|
||||||
File(args.buildFile).parentFile.mkdirs()
|
File(args.buildFile).parentFile.mkdirs()
|
||||||
args.archetypes?.let { archetypes ->
|
val map = hashMapOf<String, IInitContributor>()
|
||||||
val contributors = pluginInfo.initContributors.filter { archetypes.contains(it.archetypeName) }
|
pluginInfo.initContributors.forEach {
|
||||||
if (contributors.size > 0) {
|
map.put(it.archetypeName, it)
|
||||||
contributors.forEach {
|
}
|
||||||
log(2, "Running archetype ${it.archetypeName}")
|
args.archetypes?.split(",")?.forEach { archetypeName ->
|
||||||
it.generateArchetype(args)
|
val contributor = map[archetypeName]
|
||||||
}
|
if (contributor != null) {
|
||||||
|
log(2, "Running archetype $archetypeName")
|
||||||
|
contributor.generateArchetype(args)
|
||||||
} else {
|
} else {
|
||||||
log(1, "Couldn't find any archetype named ${args.archetypes}")
|
warn("Couldn't find any archetype named $archetypeName")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue