mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Fix multiple compilers.
This commit is contained in:
parent
187552500c
commit
030adfdd63
6 changed files with 62 additions and 41 deletions
|
@ -6,6 +6,7 @@ import com.beust.kobalt.api.*
|
|||
import com.beust.kobalt.api.annotation.Directive
|
||||
import com.beust.kobalt.internal.BaseJvmPlugin
|
||||
import com.beust.kobalt.internal.JvmCompilerPlugin
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
import com.beust.kobalt.misc.warn
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
|
@ -21,7 +22,14 @@ class JavaPlugin @Inject constructor(val javaCompiler: JavaCompiler)
|
|||
|
||||
override val name = PLUGIN_NAME
|
||||
|
||||
override fun accept(project: Project) = project.projectExtra.suffixesFound.contains("java")
|
||||
override fun accept(project: Project) = hasSourceFiles(project)
|
||||
|
||||
// IBuildConfigContributor
|
||||
|
||||
private fun hasSourceFiles(project: Project)
|
||||
= KFiles.findSourceFiles(project, project.sourceDirectories, listOf("java")).size > 0
|
||||
|
||||
override fun affinity(project: Project) = if (hasSourceFiles(project)) 1 else 0
|
||||
|
||||
// IDocContributor
|
||||
override fun affinity(project: Project, context: KobaltContext) =
|
||||
|
@ -66,9 +74,6 @@ class JavaPlugin @Inject constructor(val javaCompiler: JavaCompiler)
|
|||
override fun testSourceDirectoriesFor(project: Project, context: KobaltContext)
|
||||
= project.sourceDirectoriesTest.map { File(it) }.toList()
|
||||
|
||||
// IBuildConfigContributor
|
||||
override fun affinity(project: Project) = if (project.projectExtra.suffixesFound.contains("java")) 1 else 0
|
||||
|
||||
override val buildConfigSuffix = compiler.sourceSuffixes[0]
|
||||
|
||||
override fun generateBuildConfig(project: Project, context: KobaltContext, packageName: String,
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.beust.kobalt.internal.BaseJvmPlugin
|
|||
import com.beust.kobalt.internal.JvmCompilerPlugin
|
||||
import com.beust.kobalt.maven.dependency.FileDependency
|
||||
import com.beust.kobalt.maven.dependency.MavenDependency
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
import com.beust.kobalt.misc.KobaltExecutors
|
||||
import com.beust.kobalt.misc.log
|
||||
import com.beust.kobalt.misc.warn
|
||||
|
@ -26,7 +27,14 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors)
|
|||
|
||||
override val name = PLUGIN_NAME
|
||||
|
||||
override fun accept(project: Project) = project.projectExtra.suffixesFound.contains("kt")
|
||||
override fun accept(project: Project) = hasSourceFiles(project)
|
||||
|
||||
// IBuildConfigContributor
|
||||
|
||||
private fun hasSourceFiles(project: Project)
|
||||
= KFiles.findSourceFiles(project, project.sourceDirectories, listOf("kt")).size > 0
|
||||
|
||||
override fun affinity(project: Project) = if (hasSourceFiles(project)) 1 else 0
|
||||
|
||||
// IDocContributor
|
||||
override fun affinity(project: Project, context: KobaltContext) =
|
||||
|
@ -134,9 +142,6 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors)
|
|||
log(2, "${project.name}: $s")
|
||||
}
|
||||
|
||||
// IBuildConfigContributor
|
||||
override fun affinity(project: Project) = if (project.projectExtra.suffixesFound.contains("kotlin")) 2 else 0
|
||||
|
||||
override val buildConfigSuffix = "kt"
|
||||
|
||||
override fun generateBuildConfig(project: Project, context: KobaltContext, packageName: String,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue