Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cbeust/kobalt
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeust committed Jul 25, 2017
2 parents f782fa2 + aac60fa commit b109674
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ abstract class LanguageTemplateGenerator : ITemplate {

abstract val defaultSourceDirectories : HashSet<String>
abstract val defaultTestDirectories : HashSet<String>
abstract val mainDependencies : ArrayList<Pom.Dependency>
abstract val testDependencies : ArrayList<Pom.Dependency>
abstract val directive : String
abstract val fileMatch : (String) -> Boolean
abstract val fileMap: List<FileInfo>
Expand Down Expand Up @@ -131,20 +133,19 @@ abstract class LanguageTemplateGenerator : ITemplate {
put("directory", currentDir.absolutePath)
put("sourceDirectories", defaultSourceDirectories)
put("sourceDirectoriesTest", defaultTestDirectories)
put("mainDependencies", mainDependencies)
put("testDependencies", testDependencies)
put("imports", "import com.beust.kobalt.plugin.$templateName.*")
put("directive", "project")
}

var mainDeps = arrayListOf<Pom.Dependency>()
var testDeps = arrayListOf<Pom.Dependency>()
map.put("mainDependencies", mainDeps)
map.put("testDependencies", testDeps)
File("pom.xml").let {
if (it.absoluteFile.exists()) {
importPom(it, mainDeps, testDeps, map)
importPom(it, mainDependencies, testDependencies, map)
}
}


val fileInputStream = javaClass.classLoader
.getResource(ITemplateContributor.DIRECTORY_NAME + "/build.mustache").openStream()
val sw = StringWriter()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.beust.kobalt.app.java

import com.beust.kobalt.app.LanguageTemplateGenerator
import com.beust.kobalt.maven.Pom

/**
* Template for the "java" generator.
*/
class JavaTemplateGenerator : LanguageTemplateGenerator() {
override val mainDependencies = arrayListOf<Pom.Dependency>()
override val testDependencies = arrayListOf<Pom.Dependency>()
override val defaultSourceDirectories = hashSetOf("src/main/java")
override val defaultTestDirectories = hashSetOf("src/test/java")
override val directive = "project"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package com.beust.kobalt.app.kotlin

import com.beust.kobalt.Constants
import com.beust.kobalt.app.LanguageTemplateGenerator
import com.beust.kobalt.maven.Pom

class KotlinTemplateGenerator : LanguageTemplateGenerator() {
override val defaultSourceDirectories = hashSetOf("src/main/kotlin")
override val defaultTestDirectories = hashSetOf("src/test/kotlin")
override val mainDependencies = arrayListOf(
Pom.Dependency("org.jetbrains.kotlin", "kotlin-runtime", null, Constants.KOTLIN_COMPILER_VERSION),
Pom.Dependency("org.jetbrains.kotlin", "kotlin-stdlib", null, Constants.KOTLIN_COMPILER_VERSION))
override val testDependencies = arrayListOf<Pom.Dependency>()
override val directive = "project"
override val templateName = "kotlin"
override val templateDescription = "Generate a simple Kotlin project"
Expand Down

0 comments on commit b109674

Please sign in to comment.