Is there a way I can configure `compose.resources`...
# multiplatform
a
Is there a way I can configure
compose.resources
so that I can include drawables from different build flavors? This is a shared module, not an Android module. Currently I'm doing this
Copy code
tasks.withType<KotlinCompile>().all {
    compose.resources {
        publicResClass = true
        generateResClass = always

        val flavorName = if (name.contains("Flavor1")) {
            "flavor1"
        } else {
            "flavor2"
        }

        customDirectory(
            sourceSetName = "commonMain",
            directoryProvider = provider { layout.projectDirectory.dir("src/$flavorName/resources") }
        )
    }
}
And this seems to find the correct file, but it completely replaces the
commonMain/composeResources
folder, its no longer used. Is there a way to have the commonMain/composeResources and my build flavor directory used for the creation of drawables?
j
I doubt
compose.resources
belongs to
KotlinCompile
task. It allows to setup the output directory from another task
Copy code
directoryProvider = tasks.register<DownloadRemoteFiles>
 {...}
abstract class DownloadRemoteFiles : DefaultTask() {

    @get:OutputDirectory
    val outputDir = layout.buildDirectory.dir("downloadedRemoteFiles")

    @TaskAction
    fun run() { /* your code for downloading files */ }
}

compose.resources {
    customDirectory(
        sourceSetName = "iosMain",
        directoryProvider = tasks.register<DownloadRemoteFiles>("downloadedRemoteFiles").map { it.outputDir.get() }
    )
}
But it has no mentions about supporting multiple directories