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

Forward slashes fix.

This commit is contained in:
Cedric Beust 2015-12-18 15:45:40 -08:00
parent d9a287f710
commit 02f9449050

View file

@ -136,7 +136,7 @@ abstract class JvmCompilerPlugin @Inject constructor(
fun isOutdated(project: Project, context: KobaltContext, actionInfo: CompilerActionInfo) : Boolean {
fun stripSourceDir(sourceFile: String) : String {
project.sourceDirectories.forEach {
val d = KFiles.joinDir(project.directory, it)
val d = listOf(project.directory, it).joinToString("/")
if (sourceFile.startsWith(d)) return sourceFile.substring(d.length + 1)
}
throw KobaltException("Couldn't strip source dir from $sourceFile")
@ -150,7 +150,7 @@ abstract class JvmCompilerPlugin @Inject constructor(
fun toClassFile(sourceFile: String) = stripSuffix(sourceFile) + ".class"
actionInfo.sourceFiles.forEach { sourceFile ->
actionInfo.sourceFiles.map { it.replace("\\", "/") }.forEach { sourceFile ->
val stripped = stripSourceDir(sourceFile)
val classFile = File(KFiles.joinDir(project.directory, project.classesDir(context), toClassFile(stripped)))
if (! classFile.exists() || File(sourceFile).lastModified() > classFile.lastModified()) {