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

Rename archetype name to archetypeName.

This commit is contained in:
Cedric Beust 2016-02-13 18:02:09 -08:00
parent 4b94a9c8e1
commit 2bfd7cc78e
5 changed files with 8 additions and 8 deletions

View file

@ -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

View file

@ -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>()

View file

@ -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)
}
}

View file

@ -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") }
}

View file

@ -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") }
}