1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 08:38:13 -07:00

Refactoring toward mixed mode.

This commit is contained in:
Cedric Beust 2016-02-02 21:30:29 +04:00
parent 15efe61a74
commit 93415868b0
6 changed files with 17 additions and 11 deletions

View file

@ -37,7 +37,7 @@ class JavaPlugin @Inject constructor(
// IDocContributor
override fun affinity(project: Project, context: KobaltContext) =
if (project.sourceSuffix == ".java") 1 else 0
if (project.sourceDirectories.any { it.contains("java") }) 1 else 0
override fun generateDoc(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult {
val result =

View file

@ -6,11 +6,11 @@ import com.beust.kobalt.api.BuildConfigField
import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project
import com.beust.kobalt.internal.BaseProjectInfo
import com.beust.kobalt.internal.LanguageInfo
import com.google.inject.Singleton
@Singleton
class JavaProjectInfo : BaseProjectInfo() {
override val sourceDirectory = "java"
class JavaProjectInfo : BaseProjectInfo(listOf(LanguageInfo("java", "java"))) {
override val defaultSourceDirectories = hashSetOf("src/main/java", "src/main/resources", "src/main/res")
override val defaultTestDirectories = hashSetOf("src/test/java", "src/test/resources", "src/test/res")

View file

@ -125,7 +125,7 @@ class KotlinPlugin @Inject constructor(
// ICompilerContributor
override fun affinity(project: Project, context: KobaltContext) =
if (project.sourceSuffix == ".kt") 1 else 0
if (project.sourceDirectories.any { it.contains("kotlin") }) 2 else 0
override fun compile(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult {
val result =

View file

@ -6,11 +6,11 @@ import com.beust.kobalt.api.BuildConfigField
import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project
import com.beust.kobalt.internal.BaseProjectInfo
import com.beust.kobalt.internal.LanguageInfo
import com.google.inject.Singleton
@Singleton
class KotlinProjectInfo : BaseProjectInfo() {
override val sourceDirectory = "kotlin"
class KotlinProjectInfo : BaseProjectInfo(listOf(LanguageInfo("kotlin", "kt"))) {
override val defaultSourceDirectories = hashSetOf("src/main/kotlin", "src/main/resources", "src/main/res")
override val defaultTestDirectories = hashSetOf("src/test/kotlin", "src/test/resources", "src/test/res")