From 2b3cb81a9b87a8fc1b5eaeaa72125a025d9a14e6 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 8 Dec 2015 15:46:05 -0800 Subject: [PATCH] Set the source directories after the variant has been set. --- .../kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt b/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt index f253f02a..369f18fc 100644 --- a/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt @@ -61,7 +61,6 @@ abstract class JvmCompilerPlugin @Inject constructor( super.apply(project, context) project.projectProperties.put(DEPENDENT_PROJECTS, projects()) taskContributor.addVariantTasks(this, project, context, "compile", runTask = { taskCompile(project) }) - sourceDirectories.addAll(context.variant.sourceDirectories(project)) } @Task(name = TASK_TEST, description = "Run the tests", @@ -136,6 +135,9 @@ abstract class JvmCompilerPlugin @Inject constructor( @Task(name = JvmCompilerPlugin.TASK_COMPILE, description = "Compile the project") fun taskCompile(project: Project) : TaskResult { + // Set up the source files now that we have the variant + sourceDirectories.addAll(context.variant.sourceDirectories(project)) + val sourceDirectory = context.variant.maybeGenerateBuildConfig(project, context) if (sourceDirectory != null) { sourceDirectories.add(sourceDirectory)