CInteropProcess: Promote settings to constructor
This enforces that the specified c-interop settings cannot be re-set on a CInteropProcess.
This commit is contained in:
committed by
Space
parent
be84b7b419
commit
7cf8e9ec58
+1
-2
@@ -298,8 +298,7 @@ open class KotlinNativeTargetConfigurator<T : KotlinNativeTarget>(
|
|||||||
|
|
||||||
private fun Project.createCInteropTasks(compilation: KotlinNativeCompilation) {
|
private fun Project.createCInteropTasks(compilation: KotlinNativeCompilation) {
|
||||||
compilation.cinterops.all { interop ->
|
compilation.cinterops.all { interop ->
|
||||||
val interopTask = registerTask<CInteropProcess>(interop.interopProcessingTaskName) {
|
val interopTask = registerTask<CInteropProcess>(interop.interopProcessingTaskName, listOf(interop)) {
|
||||||
it.settings = interop
|
|
||||||
it.destinationDir = provider { klibOutputDirectory(compilation).resolve("cinterop") }
|
it.destinationDir = provider { klibOutputDirectory(compilation).resolve("cinterop") }
|
||||||
it.group = INTEROP_GROUP
|
it.group = INTEROP_GROUP
|
||||||
it.description = "Generates Kotlin/Native interop library '${interop.name}' " +
|
it.description = "Generates Kotlin/Native interop library '${interop.name}' " +
|
||||||
|
|||||||
+2
-4
@@ -45,6 +45,7 @@ import org.jetbrains.kotlin.library.*
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
|
import javax.inject.Inject
|
||||||
import org.jetbrains.kotlin.konan.file.File as KFile
|
import org.jetbrains.kotlin.konan.file.File as KFile
|
||||||
import org.jetbrains.kotlin.util.Logger as KLogger
|
import org.jetbrains.kotlin.util.Logger as KLogger
|
||||||
|
|
||||||
@@ -921,10 +922,7 @@ internal class CacheBuilder(val project: Project, val binary: NativeBinary, val
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class CInteropProcess : DefaultTask() {
|
open class CInteropProcess @Inject constructor(@get:Internal val settings: DefaultCInteropSettings) : DefaultTask() {
|
||||||
|
|
||||||
@Internal
|
|
||||||
lateinit var settings: DefaultCInteropSettings
|
|
||||||
|
|
||||||
@Internal // Taken into account in the outputFileProvider property
|
@Internal // Taken into account in the outputFileProvider property
|
||||||
lateinit var destinationDir: Provider<File>
|
lateinit var destinationDir: Provider<File>
|
||||||
|
|||||||
Reference in New Issue
Block a user