Andrew Kelly
11/13/2024, 1:53 PMcompose.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
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?Javier
11/13/2024, 2:34 PMcompose.resources
belongs to KotlinCompile
task.
It allows to setup the output directory from another task
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