Fix resourcesDir that cannot be imported due to not being a File
This commit is contained in:
+3
-1
@@ -9,9 +9,11 @@ import org.gradle.api.Named
|
|||||||
import org.gradle.api.attributes.HasAttributes
|
import org.gradle.api.attributes.HasAttributes
|
||||||
import org.gradle.api.file.ConfigurableFileCollection
|
import org.gradle.api.file.ConfigurableFileCollection
|
||||||
import org.gradle.api.file.FileCollection
|
import org.gradle.api.file.FileCollection
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
interface KotlinCompilationOutput {
|
interface KotlinCompilationOutput {
|
||||||
var resourcesDir: Any
|
var resourcesDirProvider: Any
|
||||||
|
val resourcesDir: File
|
||||||
val classesDirs: ConfigurableFileCollection
|
val classesDirs: ConfigurableFileCollection
|
||||||
|
|
||||||
val allOutputs: FileCollection
|
val allOutputs: FileCollection
|
||||||
|
|||||||
+10
-3
@@ -10,11 +10,12 @@ import org.gradle.api.file.ConfigurableFileCollection
|
|||||||
import org.gradle.api.file.FileCollection
|
import org.gradle.api.file.FileCollection
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilationOutput
|
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilationOutput
|
||||||
import org.jetbrains.kotlin.gradle.utils.isGradleVersionAtLeast
|
import org.jetbrains.kotlin.gradle.utils.isGradleVersionAtLeast
|
||||||
|
import java.io.File
|
||||||
import java.util.concurrent.Callable
|
import java.util.concurrent.Callable
|
||||||
|
|
||||||
class DefaultKotlinCompilationOutput(
|
class DefaultKotlinCompilationOutput(
|
||||||
project: Project,
|
private val project: Project,
|
||||||
override var resourcesDir: Any
|
override var resourcesDirProvider: Any
|
||||||
) : KotlinCompilationOutput, Callable<FileCollection> {
|
) : KotlinCompilationOutput, Callable<FileCollection> {
|
||||||
|
|
||||||
override val classesDirs: ConfigurableFileCollection = project.files()
|
override val classesDirs: ConfigurableFileCollection = project.files()
|
||||||
@@ -24,6 +25,9 @@ class DefaultKotlinCompilationOutput(
|
|||||||
from(Callable { resourcesDir })
|
from(Callable { resourcesDir })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val resourcesDir: File
|
||||||
|
get() = project.file(resourcesDirProvider)
|
||||||
|
|
||||||
override fun call(): FileCollection = allOutputs
|
override fun call(): FileCollection = allOutputs
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +38,10 @@ class KotlinWithJavaCompilationOutput(
|
|||||||
private val javaSourceSetOutput
|
private val javaSourceSetOutput
|
||||||
get() = compilation.javaSourceSet.output
|
get() = compilation.javaSourceSet.output
|
||||||
|
|
||||||
override var resourcesDir: Any
|
override val resourcesDir: File
|
||||||
|
get() = javaSourceSetOutput.resourcesDir
|
||||||
|
|
||||||
|
override var resourcesDirProvider: Any
|
||||||
get() = javaSourceSetOutput.resourcesDir
|
get() = javaSourceSetOutput.resourcesDir
|
||||||
set(value) { javaSourceSetOutput.setResourcesDir(value) }
|
set(value) { javaSourceSetOutput.setResourcesDir(value) }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user