Gradle plugin: do not store generated folder for android into sourceSets, because they are reused for different buildTypes and flavors

#KT-8202 Fixed #KT-9715 Fixed
This commit is contained in:
Natalia Ukhorskaya
2015-10-26 16:37:13 +03:00
parent 10eed8f7cd
commit e83315f5bc
2 changed files with 31 additions and 25 deletions
@@ -374,18 +374,6 @@ open class KotlinAndroidPlugin @Inject constructor(val scriptHandler: ScriptHand
}
}
fun configureDefaultSourceSet() {
val defaultSourceSet = variantData.getVariantConfiguration().getDefaultSourceSet()
val kotlinSourceDirectorySet = getExtension<KotlinSourceSet>(defaultSourceSet, "kotlin").getKotlin()
// getJavaSources should return the Java sources used for compilation
// We want to collect only generated files, like R-class output dir
// Actual java sources will be collected later
val additionalSourceFiles = variantData.getJavaSources().filterIsInstance(javaClass<File>())
kotlinSourceDirectorySet.addSourceDirectories(additionalSourceFiles)
}
configureDefaultSourceSet()
val aptFiles = arrayListOf<File>()
// getSortedSourceProviders should return only actual java sources, generated sources should be collected earlier
@@ -405,6 +393,15 @@ open class KotlinAndroidPlugin @Inject constructor(val scriptHandler: ScriptHand
}
}
// getJavaSources should return the Java sources used for compilation
// We want to collect only generated files, like R-class output dir
// Actual java sources will be collected later
val additionalSourceFiles = variantData.getJavaSources().filterIsInstance(javaClass<File>())
for (file in additionalSourceFiles) {
kotlinTask.source(file)
logger.kotlinDebug("Source directory with generated files ${file.getAbsolutePath()} was added to kotlin source for $kotlinTaskName")
}
subpluginEnvironment.addSubpluginArguments(project, kotlinTask)
kotlinTask doFirst {