mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-28 00:58:12 -07:00
Merge branch 'master' of github.com:cbeust/kobalt
This commit is contained in:
commit
9e53359790
25 changed files with 170 additions and 64 deletions
|
@ -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 =
|
||||
|
@ -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) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import com.google.inject.Singleton
|
|||
|
||||
@Singleton
|
||||
class JavaProjectInfo : BaseProjectInfo() {
|
||||
override val sourceDirectory = "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")
|
||||
|
||||
|
|
|
@ -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,8 +125,10 @@ class KotlinPlugin @Inject constructor(
|
|||
|
||||
// ICompilerContributor
|
||||
|
||||
override val sourceSuffixes = listOf("kt")
|
||||
|
||||
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 =
|
||||
|
|
|
@ -10,7 +10,6 @@ import com.google.inject.Singleton
|
|||
|
||||
@Singleton
|
||||
class KotlinProjectInfo : BaseProjectInfo() {
|
||||
override val sourceDirectory = "kotlin"
|
||||
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