[MPP] Use SetProperty in CInteropCommonizerTask for configuration avoidance
^KT-58712
This commit is contained in:
committed by
Space Team
parent
57cbab7d8e
commit
a1db10c5fe
+1
-1
@@ -150,7 +150,7 @@ open class KotlinNativeTargetConfigurator<T : KotlinNativeTarget> : AbstractKotl
|
||||
}
|
||||
|
||||
project.commonizeCInteropTask?.configure { commonizeCInteropTask ->
|
||||
commonizeCInteropTask.from((interopTask.get()))
|
||||
commonizeCInteropTask.from(interopTask)
|
||||
}
|
||||
|
||||
val interopOutput = project.files(interopTask.map { it.outputFileProvider })
|
||||
|
||||
+7
-15
@@ -12,6 +12,7 @@ import org.gradle.api.model.ObjectFactory
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.provider.SetProperty
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.process.ExecOperations
|
||||
import org.jetbrains.kotlin.commonizer.*
|
||||
@@ -136,7 +137,7 @@ internal open class CInteropCommonizerTask
|
||||
(group.targets + group.targets.allLeaves()).map { target ->
|
||||
val externalDependencyFiles: List<FileCollection> = when (target) {
|
||||
is LeafCommonizerTarget -> {
|
||||
cinterops
|
||||
cinterops.get()
|
||||
.filter { cinterop -> cinterop.identifier in group.interops && cinterop.konanTarget == target.konanTarget }
|
||||
.map { cinterop -> cinterop.dependencies }
|
||||
}
|
||||
@@ -170,25 +171,16 @@ internal open class CInteropCommonizerTask
|
||||
}
|
||||
|
||||
@get:Nested
|
||||
internal var cinterops = setOf<CInteropGist>()
|
||||
private set
|
||||
internal val cinterops: SetProperty<CInteropGist> = objectFactory.setProperty<CInteropGist>()
|
||||
|
||||
@get:OutputDirectories
|
||||
val allOutputDirectories: Set<File>
|
||||
get() = allInteropGroups.getOrThrow().map { outputDirectory(it) }.toSet()
|
||||
|
||||
fun from(vararg tasks: CInteropProcess) = from(
|
||||
tasks.toList()
|
||||
.onEach { task -> this.dependsOn(task) }
|
||||
.map { task -> task.toGist() }
|
||||
)
|
||||
internal fun from(task: TaskProvider<CInteropProcess>) {
|
||||
dependsOn(task)
|
||||
cinterops.add(task.map { it.toGist() })
|
||||
|
||||
internal fun from(vararg cinterop: CInteropGist) {
|
||||
from(cinterop.toList())
|
||||
}
|
||||
|
||||
internal fun from(cinterops: List<CInteropGist>) {
|
||||
this.cinterops += cinterops
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
@@ -197,7 +189,7 @@ internal open class CInteropCommonizerTask
|
||||
}
|
||||
|
||||
private fun commonize(group: CInteropCommonizerGroup) {
|
||||
val cinteropsForTarget = cinterops.filter { cinterop -> cinterop.identifier in group.interops }
|
||||
val cinteropsForTarget = cinterops.get().filter { cinterop -> cinterop.identifier in group.interops }
|
||||
outputDirectory(group).deleteRecursively()
|
||||
if (cinteropsForTarget.isEmpty()) return
|
||||
|
||||
|
||||
-1
@@ -21,7 +21,6 @@ internal class CompilerPluginData(
|
||||
|
||||
internal class SharedCompilationData(
|
||||
val manifestFile: File,
|
||||
val isAllowCommonizer: Boolean,
|
||||
val refinesPaths: FileCollection,
|
||||
)
|
||||
|
||||
|
||||
+1
-2
@@ -419,7 +419,6 @@ internal constructor(
|
||||
.map { it + (languageSettings as DefaultLanguageSettingsBuilder).freeCompilerArgsForNonImport }
|
||||
|
||||
private val runnerSettings = KotlinNativeCompilerRunner.Settings.fromProject(project)
|
||||
private val isAllowCommonizer: Boolean by lazy { project.isAllowCommonizer() }
|
||||
// endregion.
|
||||
|
||||
@Suppress("DeprecatedCallableAddReplaceWith")
|
||||
@@ -507,7 +506,7 @@ internal constructor(
|
||||
properties[KLIB_PROPERTY_NATIVE_TARGETS] = konanTargetsForManifest
|
||||
properties.saveToFile(org.jetbrains.kotlin.konan.file.File(manifestFile.toPath()))
|
||||
|
||||
return SharedCompilationData(manifestFile, isAllowCommonizer, refinesModule)
|
||||
return SharedCompilationData(manifestFile, refinesModule)
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
|
||||
Reference in New Issue
Block a user