mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 08:38:13 -07:00
Mixed language projects.
This commit is contained in:
parent
93415868b0
commit
b474c2de37
11 changed files with 73 additions and 66 deletions
|
@ -52,12 +52,15 @@ class JavaPlugin @Inject constructor(
|
|||
|
||||
override fun doTaskCompileTest(project: Project): TaskResult {
|
||||
copyResources(project, JvmCompilerPlugin.SOURCE_SET_TEST)
|
||||
val compilerActionInfo = createCompilerActionInfo(project, context, isTest = true)
|
||||
val compilerActionInfo = createCompilerActionInfo(project, context, isTest = true,
|
||||
sourceSuffixes = sourceSuffixes)
|
||||
val result = javaCompiler.compile(project, context, compilerActionInfo)
|
||||
return result
|
||||
}
|
||||
|
||||
// ICompilerContributor
|
||||
override val sourceSuffixes = listOf("java")
|
||||
|
||||
override fun compile(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult {
|
||||
val result =
|
||||
if (info.sourceFiles.size > 0) {
|
||||
|
|
|
@ -6,11 +6,10 @@ 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(listOf(LanguageInfo("java", "java"))) {
|
||||
class JavaProjectInfo : BaseProjectInfo() {
|
||||
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")
|
||||
|
||||
|
|
|
@ -76,8 +76,9 @@ class KotlinPlugin @Inject constructor(
|
|||
copyResources(project, JvmCompilerPlugin.SOURCE_SET_TEST)
|
||||
val projectDir = File(project.directory)
|
||||
|
||||
|
||||
val sourceFiles = files.findRecursively(projectDir, project.sourceDirectoriesTest.map { File(it) })
|
||||
{ it: String -> it.endsWith(project.sourceSuffix) }
|
||||
{ file: String -> sourceSuffixes.any { file.endsWith(it) } }
|
||||
.map { File(projectDir, it).absolutePath }
|
||||
|
||||
val result =
|
||||
|
@ -124,6 +125,8 @@ class KotlinPlugin @Inject constructor(
|
|||
|
||||
// ICompilerContributor
|
||||
|
||||
override val sourceSuffixes = listOf("kt")
|
||||
|
||||
override fun affinity(project: Project, context: KobaltContext) =
|
||||
if (project.sourceDirectories.any { it.contains("kotlin") }) 2 else 0
|
||||
|
||||
|
|
|
@ -6,11 +6,10 @@ 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(listOf(LanguageInfo("kotlin", "kt"))) {
|
||||
class KotlinProjectInfo : BaseProjectInfo() {
|
||||
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")
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ class PackageConfig(val project: Project) : AttributeHolder {
|
|||
jar {
|
||||
name = "${project.name}-${project.version}-sources.jar"
|
||||
project.sourceDirectories.forEach {
|
||||
include(from(it), to(""), glob("**${project.sourceSuffix}"))
|
||||
include(from(it), to(""), glob("src/**"))
|
||||
}
|
||||
}
|
||||
jar {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue