mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Rename archetype name to archetypeName.
This commit is contained in:
parent
4b94a9c8e1
commit
2bfd7cc78e
5 changed files with 8 additions and 8 deletions
|
@ -11,7 +11,7 @@ interface IInitContributor {
|
|||
* The name of this archetype. This is the name that will be looked up when passed to the --init
|
||||
* argument.
|
||||
*/
|
||||
val name: String
|
||||
val archetypeName: String
|
||||
|
||||
/**
|
||||
* Generate the files for this archetype. The parameter is the arguments that were passed to the kobaltw
|
||||
|
|
|
@ -15,7 +15,7 @@ abstract class BuildGenerator : IInitContributor {
|
|||
abstract val defaultSourceDirectories : HashSet<String>
|
||||
abstract val defaultTestDirectories : HashSet<String>
|
||||
abstract val directive : String
|
||||
override abstract val name : String
|
||||
override abstract val archetypeName: String
|
||||
abstract val fileMatch : (String) -> Boolean
|
||||
|
||||
companion object {
|
||||
|
@ -88,8 +88,8 @@ abstract class BuildGenerator : IInitContributor {
|
|||
put("directory", currentDir.absolutePath)
|
||||
put("sourceDirectories", defaultSourceDirectories)
|
||||
put("sourceDirectoriesTest", defaultTestDirectories)
|
||||
put("imports", "import com.beust.kobalt.plugin.$name.*")
|
||||
put("directive", name + "Project")
|
||||
put("imports", "import com.beust.kobalt.plugin.$archetypeName.*")
|
||||
put("directive", "project")
|
||||
}
|
||||
|
||||
var mainDeps = arrayListOf<Pom.Dependency>()
|
||||
|
|
|
@ -13,9 +13,9 @@ public class ProjectGenerator @Inject constructor(val pluginInfo: PluginInfo){
|
|||
fun run(args: Args) {
|
||||
File(args.buildFile).parentFile.mkdirs()
|
||||
args.archetypes?.let { archetypes ->
|
||||
val contributors = pluginInfo.initContributors.filter { archetypes.contains(it.name) }
|
||||
val contributors = pluginInfo.initContributors.filter { archetypes.contains(it.archetypeName) }
|
||||
contributors.forEach {
|
||||
log(2, "Running archetype ${it.name}")
|
||||
log(2, "Running archetype ${it.archetypeName}")
|
||||
it.generateArchetype(args)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,6 @@ public class JavaBuildGenerator: BuildGenerator() {
|
|||
override val defaultSourceDirectories = hashSetOf("src/main/java")
|
||||
override val defaultTestDirectories = hashSetOf("src/test/java")
|
||||
override val directive = "javaProject"
|
||||
override val name = "java"
|
||||
override val archetypeName = "java"
|
||||
override val fileMatch = { f: String -> f.endsWith(".java") }
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ public class KotlinBuildGenerator : BuildGenerator() {
|
|||
override val defaultSourceDirectories = hashSetOf("src/main/kotlin")
|
||||
override val defaultTestDirectories = hashSetOf("src/test/kotlin")
|
||||
override val directive = "kotlinProject"
|
||||
override val name = "kotlin"
|
||||
override val archetypeName = "kotlin"
|
||||
override val fileMatch = { f: String -> f.endsWith(".kt") }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue