mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
GITHUB-216: Source directories were leaking across projects.
Fixes https://github.com/cbeust/kobalt/issues/216
This commit is contained in:
parent
c71195e31d
commit
b1b9c0472c
1 changed files with 7 additions and 11 deletions
|
@ -146,7 +146,6 @@ open class JvmCompilerPlugin @Inject constructor(
|
||||||
@IncrementalTask(name = TASK_COMPILE_TEST, description = "Compile the tests", group = GROUP_BUILD,
|
@IncrementalTask(name = TASK_COMPILE_TEST, description = "Compile the tests", group = GROUP_BUILD,
|
||||||
dependsOn = arrayOf(TASK_COMPILE))
|
dependsOn = arrayOf(TASK_COMPILE))
|
||||||
fun taskCompileTest(project: Project): IncrementalTaskInfo {
|
fun taskCompileTest(project: Project): IncrementalTaskInfo {
|
||||||
sourceTestDirectories.addAll(context.variant.sourceDirectories(project, context, SourceSet.of(isTest = true)))
|
|
||||||
return IncrementalTaskInfo(
|
return IncrementalTaskInfo(
|
||||||
inputChecksum = {
|
inputChecksum = {
|
||||||
Md5.toMd5Directories(context.testSourceDirectories(project).map { File(project.directory, it.path)})
|
Md5.toMd5Directories(context.testSourceDirectories(project).map { File(project.directory, it.path)})
|
||||||
|
@ -159,12 +158,12 @@ open class JvmCompilerPlugin @Inject constructor(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun sourceDirectories(project: Project, context: KobaltContext)
|
||||||
|
= context.variant.sourceDirectories(project, context, SourceSet.of(isTest = false))
|
||||||
|
|
||||||
@IncrementalTask(name = JvmCompilerPlugin.TASK_COMPILE, description = "Compile the project", group = GROUP_BUILD,
|
@IncrementalTask(name = JvmCompilerPlugin.TASK_COMPILE, description = "Compile the project", group = GROUP_BUILD,
|
||||||
runAfter = arrayOf(TASK_CLEAN))
|
runAfter = arrayOf(TASK_CLEAN))
|
||||||
fun taskCompile(project: Project): IncrementalTaskInfo {
|
fun taskCompile(project: Project): IncrementalTaskInfo {
|
||||||
// Set up the source files now that we have the variant
|
|
||||||
sourceDirectories.addAll(context.variant.sourceDirectories(project, context, SourceSet.of(isTest = false)))
|
|
||||||
|
|
||||||
return IncrementalTaskInfo(
|
return IncrementalTaskInfo(
|
||||||
inputChecksum = {
|
inputChecksum = {
|
||||||
Md5.toMd5Directories(context.sourceDirectories(project).map { File(project.directory, it.path) })
|
Md5.toMd5Directories(context.sourceDirectories(project).map { File(project.directory, it.path) })
|
||||||
|
@ -205,8 +204,8 @@ open class JvmCompilerPlugin @Inject constructor(
|
||||||
if (sourceFiles.size > 0) {
|
if (sourceFiles.size > 0) {
|
||||||
// TODO: createCompilerActionInfo recalculates the source files, only compute them
|
// TODO: createCompilerActionInfo recalculates the source files, only compute them
|
||||||
// once and pass them
|
// once and pass them
|
||||||
val info = createCompilerActionInfo(project, context, compiler, isTest, sourceDirectories,
|
val info = createCompilerActionInfo(project, context, compiler, isTest,
|
||||||
sourceSuffixes = compiler.sourceSuffixes)
|
sourceDirectories(project, context), sourceSuffixes = compiler.sourceSuffixes)
|
||||||
val thisResult = compiler.compile(project, context, info)
|
val thisResult = compiler.compile(project, context, info)
|
||||||
results.add(thisResult)
|
results.add(thisResult)
|
||||||
if (!thisResult.success && failedResult == null) {
|
if (!thisResult.success && failedResult == null) {
|
||||||
|
@ -251,7 +250,7 @@ open class JvmCompilerPlugin @Inject constructor(
|
||||||
it.compilersFor(project, context).forEach { compiler ->
|
it.compilersFor(project, context).forEach { compiler ->
|
||||||
result = docGenerator.generateDoc(project, context, createCompilerActionInfo(project, context,
|
result = docGenerator.generateDoc(project, context, createCompilerActionInfo(project, context,
|
||||||
compiler,
|
compiler,
|
||||||
isTest = false, sourceDirectories = sourceDirectories,
|
isTest = false, sourceDirectories = sourceDirectories(project, context),
|
||||||
sourceSuffixes = compiler.sourceSuffixes))
|
sourceSuffixes = compiler.sourceSuffixes))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,13 +358,10 @@ open class JvmCompilerPlugin @Inject constructor(
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
val sourceDirectories = arrayListOf<File>()
|
|
||||||
val sourceTestDirectories = arrayListOf<File>()
|
|
||||||
|
|
||||||
// ISourceDirectoryContributor
|
// ISourceDirectoryContributor
|
||||||
override fun sourceDirectoriesFor(project: Project, context: KobaltContext)
|
override fun sourceDirectoriesFor(project: Project, context: KobaltContext)
|
||||||
= if (accept(project)) {
|
= if (accept(project)) {
|
||||||
sourceDirectories.toList()
|
sourceDirectories(project, context)
|
||||||
} else {
|
} else {
|
||||||
arrayListOf()
|
arrayListOf()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue