Skip to content

Commit

Permalink
[resources] Fix Res class generation if the library is declared as 'api'
Browse files Browse the repository at this point in the history
  • Loading branch information
terrakok committed Mar 1, 2024
1 parent f833fa9 commit b318e8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
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 @@ -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

0 comments on commit b318e8d

Please sign in to comment.