[Commonizer] Allow propagation of leaf targets
^KT-46248 Verification Pending
This commit is contained in:
committed by
Space
parent
7c1520a424
commit
7b8926f85b
@@ -22,7 +22,7 @@ class CommonizerParameters(
|
|||||||
|
|
||||||
fun CommonizerParameters.getCommonModuleNames(): Set<String> {
|
fun CommonizerParameters.getCommonModuleNames(): Set<String> {
|
||||||
val supportedTargets = targetProviders.filterNonNull()
|
val supportedTargets = targetProviders.filterNonNull()
|
||||||
if (supportedTargets.size < 2) return emptySet() // too few targets
|
if (supportedTargets.size == 0) return emptySet() // Nothing to do
|
||||||
|
|
||||||
val allModuleNames: List<Set<String>> = supportedTargets.toList().map { targetProvider ->
|
val allModuleNames: List<Set<String>> = supportedTargets.toList().map { targetProvider ->
|
||||||
targetProvider.modulesProvider.loadModuleInfos().mapTo(HashSet()) { it.name }
|
targetProvider.modulesProvider.loadModuleInfos().mapTo(HashSet()) { it.name }
|
||||||
|
|||||||
@@ -82,9 +82,6 @@ private fun merge(
|
|||||||
/* Nothing to merge */
|
/* Nothing to merge */
|
||||||
if (availableTrees.size == 0) return null
|
if (availableTrees.size == 0) return null
|
||||||
|
|
||||||
/* No propagation from leaves */
|
|
||||||
if (availableTrees.size == 1 && availableTrees.targets.single() is LeafCommonizerTarget) return null
|
|
||||||
|
|
||||||
return mergeCirTree(storageManager, classifiers, availableTrees)
|
return mergeCirTree(storageManager, classifiers, availableTrees)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,6 @@ class CommonizerFacadeTest {
|
|||||||
emptyMap()
|
emptyMap()
|
||||||
)
|
)
|
||||||
|
|
||||||
@Test
|
|
||||||
fun nothingToCommonize1() = doTestNothingToCommonize(
|
|
||||||
mapOf(
|
|
||||||
"target1" to listOf("foo")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun commonized1() = doTestSuccessfulCommonization(
|
fun commonized1() = doTestSuccessfulCommonization(
|
||||||
mapOf(
|
mapOf(
|
||||||
@@ -47,6 +40,13 @@ class CommonizerFacadeTest {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun commonized3() = doTestSuccessfulCommonization(
|
||||||
|
mapOf(
|
||||||
|
"target1" to listOf("foo")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun commonizedWithDifferentModules() = doTestNothingToCommonize(
|
fun commonizedWithDifferentModules() = doTestNothingToCommonize(
|
||||||
mapOf(
|
mapOf(
|
||||||
|
|||||||
Reference in New Issue
Block a user