1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28: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.KobaltException
import com.beust.kobalt.TaskResult import com.beust.kobalt.TaskResult
import com.beust.kobalt.api.* 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.ExportedProjectProperty
import com.beust.kobalt.api.annotation.IncrementalTask import com.beust.kobalt.api.annotation.IncrementalTask
import com.beust.kobalt.api.annotation.Task 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}") throw KobaltException("Couldn't find any compiler for project ${project.name}")
} else { } else {
compilers.forEach { compiler -> compilers.forEach { compiler ->
val info = createCompilerActionInfo(project, context, isTest, sourceSuffixes = compiler.sourceSuffixes) if (containsSourceFiles(project, compiler)) {
val thisResult = compiler.compile(project, context, info) val info = createCompilerActionInfo(project, context, isTest, sourceSuffixes = compiler.sourceSuffixes)
results.add(thisResult) val thisResult = compiler.compile(project, context, info)
if (! thisResult.success && failedResult == null) { results.add(thisResult)
failedResult = 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!! 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>() val allProjects = arrayListOf<ProjectDescription>()
override fun projects() = allProjects override fun projects() = allProjects

View file

@ -11,10 +11,6 @@ val javaFirst = project {
assemble { assemble {
jar { jar {
fatJar = true
manifest {
attributes("Main-Class", "example.KotlinMainKt")
}
} }
} }
} }
@ -28,10 +24,6 @@ val kotlinFirst = project {
assemble { assemble {
jar { jar {
fatJar = true
manifest {
attributes("Main-Class", "example.KotlinMainKt")
}
} }
} }
} }
@ -43,8 +35,20 @@ val mixed1 = project {
version = "0.1" version = "0.1"
directory = name directory = name
dependenciesTest { assemble {
compile("org.testng:testng:6.9.5") jar {
}
}
}
val nonStandard = project {
name = "nonStandard"
group = "com.example"
directory = name
sourceDirectories {
path("src/generated/java")
} }
assemble { assemble {

View file

@ -0,0 +1,9 @@
package example
class KotlinClass {
fun run() {
println("KotlinClass run()")
}
}

View file

@ -0,0 +1,8 @@
package example;
public class JavaMain {
public static void main(String[] argv) {
System.out.println("JavaMain calling into Kotlin");
new KotlinClass().run();
}
}