Skip to content

Commit 6dbe547

Browse files
committed
[gradle] Fix KMP component publication configuration
1 parent f86b9ed commit 6dbe547

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/MultimoduleResources.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,18 @@ private fun Project.configureKmpResources(
111111
//TODO temporary API misuse. will be changed on the KMP side
112112
//https://youtrack.jetbrains.com/issue/KT-70909
113113
val target = compilation.target
114-
val kmpResourceRoot = KotlinTargetResourcesPublication.ResourceRoot(
115-
allCompilationResources,
116-
emptyList(),
117-
emptyList()
118-
)
119114
val kmpEmptyPath = provider { File("") }
115+
val emptyDir = layout.buildDirectory.dir("$RES_GEN_DIR/emptyResourcesDir").map { it.asFile }
120116
logger.info("Configure KMP component publication for '${compilation.target.targetName}'")
121117
kmpResources.publishResourcesAsKotlinComponent(
122118
target,
123-
{ kmpResourceRoot },
119+
{ kotlinSourceSet ->
120+
if (kotlinSourceSet == compilation.defaultSourceSet) {
121+
KotlinTargetResourcesPublication.ResourceRoot(allCompilationResources, emptyList(), emptyList())
122+
} else {
123+
KotlinTargetResourcesPublication.ResourceRoot(emptyDir, emptyList(), emptyList())
124+
}
125+
},
124126
kmpEmptyPath
125127
)
126128

0 commit comments

Comments
 (0)