From 29a68fde19e711e663bbb1cdd4dd83325f281aa0 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sat, 5 Dec 2015 23:06:26 -0800 Subject: [PATCH] Source directories now coming from ISourceDirectoryContributor. --- .../beust/kobalt/internal/JvmCompilerPlugin.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt b/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt index 8a460f73..ec2d1a31 100644 --- a/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt @@ -26,7 +26,7 @@ abstract class JvmCompilerPlugin @Inject constructor( open val executors: KobaltExecutors, open val jvmCompiler: JvmCompiler, val taskContributor : TaskContributor = TaskContributor()) - : BasePlugin(), IProjectContributor, ITaskContributor by taskContributor { + : BasePlugin(), ISourceDirectoryContributor, IProjectContributor, ITaskContributor by taskContributor { companion object { @ExportedProjectProperty(doc = "Projects this project depends on", type = "List") @@ -154,6 +154,10 @@ abstract class JvmCompilerPlugin @Inject constructor( } } + /** + * Create a CompilerActionInfo (all the information that a compiler needs to know) for the given parameters. + * Runs all the contributors and interceptors relevant to that task. + */ protected fun createCompilerActionInfo(project: Project, context: KobaltContext, generatedSourceDir: File?, isTest: Boolean) : CompilerActionInfo { copyResources(project, JvmCompilerPlugin.SOURCE_SET_MAIN) @@ -174,11 +178,6 @@ abstract class JvmCompilerPlugin @Inject constructor( initialSourceDirectories.add(it) } - // Source directories from the project and variants - if (! isTest) { - initialSourceDirectories.addAll(context.variant.sourceDirectories(project)) - } - // Source directories from the contributors initialSourceDirectories.addAll( if (isTest) { @@ -208,5 +207,9 @@ abstract class JvmCompilerPlugin @Inject constructor( }) return result } + + // ISourceDirectoryContributor + override fun sourceDirectoriesFor(project: Project, context: KobaltContext) + = if (accept(project)) context.variant.sourceDirectories(project) else listOf() }