Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[resources] Fix Res class generation if the library is declared as 'api' #4406

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ private fun Project.configureResourceGenerator(commonComposeResourcesDir: File,
if (ComposeProperties.alwaysGenerateResourceAccessors(project).get()) {
true
} else {
configurations
.getByName(commonSourceSet.implementationConfigurationName)
.allDependencies.any { dep ->
val depStringNotation = dep.let { "${it.group}:${it.name}:${it.version}" }
depStringNotation == ComposePlugin.CommonComponentsDependencies.resources
}
configurations.run {
//because the implementation configuration doesn't extend the api in the KGP ¯\_(ツ)_/¯
getByName(commonSourceSet.implementationConfigurationName).allDependencies +
getByName(commonSourceSet.apiConfigurationName).allDependencies
}.any { dep ->
val depStringNotation = dep.let { "${it.group}:${it.name}:${it.version}" }
depStringNotation == ComposePlugin.CommonComponentsDependencies.resources
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ class ResourcesTest : GradlePluginTestBase() {

modifyText("build.gradle.kts") { str ->
str.replace(
"implementation(compose.components.resources)",
"//implementation(compose.components.resources)"
"api(compose.components.resources)",
"//api(compose.components.resources)"
)
}
gradle("prepareKotlinIdeaImport").checks {
Expand All @@ -253,8 +253,8 @@ class ResourcesTest : GradlePluginTestBase() {

modifyText("build.gradle.kts") { str ->
str.replace(
"//implementation(compose.components.resources)",
"implementation(compose.components.resources)"
"//api(compose.components.resources)",
"api(compose.components.resources)"
)
}
gradle("prepareKotlinIdeaImport").checks {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ kotlin {
dependencies {
implementation(compose.runtime)
implementation(compose.material)
implementation(compose.components.resources)
//there is the api to check correctness of the api configuration
//https://github.com/JetBrains/compose-multiplatform/issues/4405
api(compose.components.resources)
}
}
}
Expand Down
Loading