Fix UnsupportedOperationException caused by mutation of FileCollection
This commit is contained in:
committed by
Alexey Tsvetkov
parent
a68f7d79f5
commit
dce6a4f869
+10
-8
@@ -38,15 +38,17 @@ class Android25ProjectHandler(kotlinConfigurationTools: KotlinConfigurationTools
|
||||
kotlinTask: KotlinCompile,
|
||||
kotlinAfterJavaTask: KotlinCompile?) {
|
||||
|
||||
val preJavaKotlinOutput = project.files().builtBy(kotlinTask)
|
||||
if (kotlinAfterJavaTask == null) {
|
||||
preJavaKotlinOutput.add(project.files(kotlinTask.destinationDir))
|
||||
}
|
||||
if (Kapt3GradleSubplugin.isEnabled(project)) {
|
||||
// Add Kapt3 output as well, since there's no SyncOutputTask with the new API
|
||||
val kaptClasssesDir = Kapt3KotlinGradleSubplugin.getKaptClasssesDir(project, getVariantName(variantData))
|
||||
preJavaKotlinOutput.add(project.files(kaptClasssesDir))
|
||||
val preJavaKotlinOutputFiles = mutableListOf<File>().apply {
|
||||
if (kotlinAfterJavaTask == null) {
|
||||
add(kotlinTask.destinationDir)
|
||||
}
|
||||
if (Kapt3GradleSubplugin.isEnabled(project)) {
|
||||
// Add Kapt3 output as well, since there's no SyncOutputTask with the new API
|
||||
val kaptClasssesDir = Kapt3KotlinGradleSubplugin.getKaptClasssesDir(project, getVariantName(variantData))
|
||||
add(kaptClasssesDir)
|
||||
}
|
||||
}
|
||||
val preJavaKotlinOutput = project.files(*preJavaKotlinOutputFiles.toTypedArray()).builtBy(kotlinTask)
|
||||
|
||||
val preJavaClasspathKey = variantData.registerPreJavacGeneratedBytecode(preJavaKotlinOutput)
|
||||
kotlinTask.dependsOn(variantData.getSourceFolders(SourceKind.JAVA))
|
||||
|
||||
Reference in New Issue
Block a user