mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
GITHUB-240: Fix mixed compilation.
Fixes https://github.com/cbeust/kobalt/issues/240
This commit is contained in:
parent
25629e4cf7
commit
3ed10c90e6
1 changed files with 14 additions and 7 deletions
|
@ -3,6 +3,7 @@ package com.beust.kobalt.internal
|
|||
import com.beust.kobalt.TaskResult
|
||||
import com.beust.kobalt.api.*
|
||||
import com.beust.kobalt.maven.DependencyManager
|
||||
import com.beust.kobalt.maven.dependency.FileDependency
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
import com.beust.kobalt.misc.log
|
||||
import com.google.inject.Inject
|
||||
|
@ -69,15 +70,18 @@ class CompilerUtils @Inject constructor(val files: KFiles,
|
|||
val fullClasspath = if (isTest) dependencyManager.testDependencies(project, context)
|
||||
else dependencyManager.dependencies(project, context)
|
||||
|
||||
// Remove all the excluded dependencies from the classpath
|
||||
val classpath = fullClasspath.filter {
|
||||
! isDependencyExcluded(it, project.excludedDependencies)
|
||||
}
|
||||
|
||||
// The directory where the classes get compiled
|
||||
val buildDirectory = if (isTest) File(project.buildDirectory, KFiles.TEST_CLASSES_DIR)
|
||||
else File(project.classesDir(context))
|
||||
else File(project.classesDir(context))
|
||||
File(project.directory, buildDirectory.path).mkdirs()
|
||||
|
||||
// The classpath needs to contain $buildDirectory/classes as well so that projects that contain
|
||||
// multiple languages can use classes compiled by the compiler run before them.
|
||||
// We also need to remove all the excluded dependencies from the classpath
|
||||
val classpath = fullClasspath.filter {
|
||||
! isDependencyExcluded(it, project.excludedDependencies)
|
||||
} + FileDependency(buildDirectory.path)
|
||||
|
||||
val initialSourceDirectories = ArrayList<File>(sourceDirectories)
|
||||
// Source directories from the contributors
|
||||
val contributedSourceDirs =
|
||||
|
@ -137,7 +141,10 @@ class CompilerUtils @Inject constructor(val files: KFiles,
|
|||
}
|
||||
}
|
||||
|
||||
val allSources = (sourceFiles + extraSourceFiles).distinct().filter { File(it).exists() }
|
||||
val allSources = (sourceFiles + extraSourceFiles)
|
||||
.map { File(it).canonicalPath }
|
||||
.distinct()
|
||||
.filter { File(it).exists() }
|
||||
|
||||
// Finally, alter the info with the compiler interceptors before returning it
|
||||
val initialActionInfo = CompilerActionInfo(projectDirectory.path, classpath, allSources,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue