Trying to configure `org.jetbrains.compose.resourc...
# compose
s
Trying to configure
org.jetbrains.compose.resources.ResourcesExtension
from my gradle convention plugin, but I can't seem to find the way to do this at the right time. When doing:
Copy code
project.pluginManager.apply("org.jetbrains.compose")
project.pluginManager.withPlugin("org.jetbrains.compose") {
  // 1
  project.configure<org.jetbrains.compose.resources.ResourcesExtension> {
    // 2
  }
}
I can see that I can get in //1 but not in //2. I see that the resources extension is created after the ComposePlugin is applied https://github.com/JetBrains/compose-multiplatform/blob/1b40a6db80c9f97859ac56c088[…]/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt so I figured it should be available. When using the generated DSL and doing this outside of my convention plugin (
compose.resources { ... }
) this works fine, so I am sure there is something I am doing wrong regarding the ordering of things. Or it's something else I don't understand.
1
Copy code
val composeExtension = project.extensions.create("compose", ComposeExtension::class.java, project)
val resourcesExtension = composeExtension.extensions.create("resources", ResourcesExtension::class.java)
Ah just realized it's added on top of the ComposeExtension as it itself is also ExtensionAware. So doing this instead works
Copy code
project.configure<ComposeExtension> {
  extensions.configure<ResourcesExtension> {
    ...