[Gradle] commonizeCInterop task: Require hierarchical commonization to be enabled
^KT-47133 Verification Pending
This commit is contained in:
committed by
Space
parent
d781902626
commit
1bcafd3cd0
-7
@@ -143,7 +143,6 @@ internal open class CInteropCommonizerTask : AbstractCInteropCommonizerTask() {
|
|||||||
return sharedNativeCompilations.mapNotNull(::getCommonizationParameters).toSet()
|
return sharedNativeCompilations.mapNotNull(::getCommonizationParameters).toSet()
|
||||||
.run(::removeNotRegisteredInterops)
|
.run(::removeNotRegisteredInterops)
|
||||||
.run(::removeEmptyInterops)
|
.run(::removeEmptyInterops)
|
||||||
.run(if (project.isHierarchicalCommonizationEnabled) ::identity else ::removeHierarchicalParameters)
|
|
||||||
.run(::removeRedundantParameters)
|
.run(::removeRedundantParameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,12 +206,6 @@ private fun removeEmptyInterops(parameters: Set<CInteropCommonizationParameters>
|
|||||||
return parameters.filterTo(mutableSetOf()) { it.interops.isNotEmpty() }
|
return parameters.filterTo(mutableSetOf()) { it.interops.isNotEmpty() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun identity(parameters: Set<CInteropCommonizationParameters>) = parameters
|
|
||||||
|
|
||||||
private fun removeHierarchicalParameters(parameters: Set<CInteropCommonizationParameters>): Set<CInteropCommonizationParameters> {
|
|
||||||
return parameters.filterTo(mutableSetOf()) { it.commonizerTarget.level <= 1 }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun removeRedundantParameters(parameters: Set<CInteropCommonizationParameters>): Set<CInteropCommonizationParameters> {
|
private fun removeRedundantParameters(parameters: Set<CInteropCommonizationParameters>): Set<CInteropCommonizationParameters> {
|
||||||
return parameters.filterNotTo(mutableSetOf()) { current ->
|
return parameters.filterNotTo(mutableSetOf()) { current ->
|
||||||
parameters.any { other ->
|
parameters.any { other ->
|
||||||
|
|||||||
+4
-4
@@ -47,13 +47,12 @@ internal val Project.runCommonizerTask: TaskProvider<Task>
|
|||||||
|
|
||||||
internal val Project.commonizeCInteropTask: TaskProvider<CInteropCommonizerTask>?
|
internal val Project.commonizeCInteropTask: TaskProvider<CInteropCommonizerTask>?
|
||||||
get() {
|
get() {
|
||||||
if (isCInteropCommonizationEnabled) {
|
if (isHierarchicalCommonizationEnabled && isCInteropCommonizationEnabled) {
|
||||||
return locateOrRegisterTask(
|
return locateOrRegisterTask(
|
||||||
"commonizeCInterop",
|
"commonizeCInterop",
|
||||||
invokeWhenRegistered = {
|
invokeWhenRegistered = {
|
||||||
commonizeTask.dependsOn(this)
|
commonizeTask.dependsOn(this)
|
||||||
commonizeNativeDistributionHierarchicallyTask?.let(this::dependsOn)
|
commonizeNativeDistributionHierarchicallyTask?.let(this::dependsOn)
|
||||||
commonizeNativeDistributionTask?.let(this::dependsOn)
|
|
||||||
},
|
},
|
||||||
configureTask = {
|
configureTask = {
|
||||||
group = "interop"
|
group = "interop"
|
||||||
@@ -66,13 +65,14 @@ internal val Project.commonizeCInteropTask: TaskProvider<CInteropCommonizerTask>
|
|||||||
|
|
||||||
internal val Project.copyCommonizeCInteropForIdeTask: TaskProvider<CopyCommonizeCInteropForIdeTask>?
|
internal val Project.copyCommonizeCInteropForIdeTask: TaskProvider<CopyCommonizeCInteropForIdeTask>?
|
||||||
get() {
|
get() {
|
||||||
if (isCInteropCommonizationEnabled) {
|
val commonizeCInteropTask = commonizeCInteropTask
|
||||||
|
if (commonizeCInteropTask != null) {
|
||||||
return locateOrRegisterTask(
|
return locateOrRegisterTask(
|
||||||
"copyCommonizeCInteropForIde",
|
"copyCommonizeCInteropForIde",
|
||||||
invokeWhenRegistered = { if (isInIdeaSync) commonizeTask.dependsOn(this) },
|
invokeWhenRegistered = { if (isInIdeaSync) commonizeTask.dependsOn(this) },
|
||||||
configureTask = {
|
configureTask = {
|
||||||
group = "interop"
|
group = "interop"
|
||||||
description = "Copies the output of ${commonizeCInteropTask?.get()?.name} into " +
|
description = "Copies the output of ${commonizeCInteropTask.get().name} into " +
|
||||||
"the root projects .gradle folder for the IDE"
|
"the root projects .gradle folder for the IDE"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user