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

Fix the default directories bug.

This commit is contained in:
Cedric Beust 2016-02-05 21:38:50 +04:00
parent faf2eeb1d8
commit 2214677d92
4 changed files with 47 additions and 16 deletions

View file

@ -4,7 +4,6 @@ import com.beust.kobalt.IncrementalTaskInfo
import com.beust.kobalt.KobaltException
import com.beust.kobalt.TaskResult
import com.beust.kobalt.api.*
import com.beust.kobalt.api.annotation.Directive
import com.beust.kobalt.api.annotation.ExportedProjectProperty
import com.beust.kobalt.api.annotation.IncrementalTask
import com.beust.kobalt.api.annotation.Task
@ -173,11 +172,15 @@ open class JvmCompilerPlugin @Inject constructor(
throw KobaltException("Couldn't find any compiler for project ${project.name}")
} else {
compilers.forEach { compiler ->
val info = createCompilerActionInfo(project, context, isTest, sourceSuffixes = compiler.sourceSuffixes)
val thisResult = compiler.compile(project, context, info)
results.add(thisResult)
if (! thisResult.success && failedResult == null) {
failedResult = thisResult
if (containsSourceFiles(project, compiler)) {
val info = createCompilerActionInfo(project, context, isTest, sourceSuffixes = compiler.sourceSuffixes)
val thisResult = compiler.compile(project, context, info)
results.add(thisResult)
if (!thisResult.success && failedResult == null) {
failedResult = thisResult
}
} else {
log(2, "Compiler $compiler not running on ${project.name} since no source files were found")
}
}
return if (failedResult != null) failedResult!!
@ -185,6 +188,13 @@ open class JvmCompilerPlugin @Inject constructor(
}
}
private fun containsSourceFiles(project: Project, compiler: ICompilerContributor): Boolean {
project.projectExtra.suffixesFound.forEach {
if (compiler.sourceSuffixes.contains(it)) return true
}
return false
}
val allProjects = arrayListOf<ProjectDescription>()
override fun projects() = allProjects