mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
[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> {
|
||||
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 ->
|
||||
targetProvider.modulesProvider.loadModuleInfos().mapTo(HashSet()) { it.name }
|
||||
|
||||
@@ -82,9 +82,6 @@ private fun merge(
|
||||
/* Nothing to merge */
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
@@ -24,13 +24,6 @@ class CommonizerFacadeTest {
|
||||
emptyMap()
|
||||
)
|
||||
|
||||
@Test
|
||||
fun nothingToCommonize1() = doTestNothingToCommonize(
|
||||
mapOf(
|
||||
"target1" to listOf("foo")
|
||||
)
|
||||
)
|
||||
|
||||
@Test
|
||||
fun commonized1() = doTestSuccessfulCommonization(
|
||||
mapOf(
|
||||
@@ -47,6 +40,13 @@ class CommonizerFacadeTest {
|
||||
)
|
||||
)
|
||||
|
||||
@Test
|
||||
fun commonized3() = doTestSuccessfulCommonization(
|
||||
mapOf(
|
||||
"target1" to listOf("foo")
|
||||
)
|
||||
)
|
||||
|
||||
@Test
|
||||
fun commonizedWithDifferentModules() = doTestNothingToCommonize(
|
||||
mapOf(
|
||||
|
||||
Reference in New Issue
Block a user