Get rid of FileCollectionInternal usage that breaks with Gradle 5.0+

Remove the implementation of the `FileCollectionInternal` interface in
`KotlinCompilationOutput`. This interface may change unexpectedly (and
does between Gradle 4.10 and 5.0) so we need to get rid of its
implementation.

On the other hand, we can't just implement `FileCollection` instead
because Gradle internally assumes that all `FileCollection` instances
are also `FileCollectionInternal`. So the way to fix this is to remove
`SourceSetOutput` from superinterfaces of `KotlinCompilationOutput`
altogether.

Instead, to work with `SourceSetOutput` and `KotlinCompilationOutput`
in a uniform way, provide a wrapper for `SourceSetOutput`:
`KotlinWithJavaCompilationOutput` that is basically a proxy
class.
This commit is contained in:
Sergey Igushkin
2018-10-11 18:58:15 +03:00
parent 174fd41564
commit a0f4d5a637
9 changed files with 121 additions and 125 deletions
@@ -7,8 +7,15 @@ package org.jetbrains.kotlin.gradle.plugin
import org.gradle.api.Named
import org.gradle.api.attributes.HasAttributes
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.SourceSetOutput
interface KotlinCompilationOutput {
var resourcesDir: Any
val classesDirs: ConfigurableFileCollection
val allOutputs: FileCollection
}
interface KotlinCompilation: Named, HasAttributes, HasKotlinDependencies {
val target: KotlinTarget
@@ -21,7 +28,7 @@ interface KotlinCompilation: Named, HasAttributes, HasKotlinDependencies {
var compileDependencyFiles: FileCollection
val output: SourceSetOutput
val output: KotlinCompilationOutput
val platformType get() = target.platformType