Repository: JetBrains/compose-multiplatform
File: gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/ComposeResourcesGeneration.kt (Kotlin)

Code before:
    shouldGenerateCode: Provider<Boolean>,
    packageName: Provider<String>,
    resClassName: Provider<String>,
    makeAccessorsPublic: Provider<Boolean>,
    packagingDir: Provider<File>,
    generateModulePath: Boolean
) {
    logger.info("Configure resource accessors generation for ${sourceSet.name}")

    val genTask = tasks.register(
        sourceSet.getResourceAccessorsGenerationTaskName(),
        GenerateResourceAccessorsTask::class.java
    ) { task ->
        task.packageName.set(packageName)
        task.resClassName.set(resClassName)
        task.sourceSetName.set(sourceSet.name)
        task.makeAccessorsPublic.set(makeAccessorsPublic)
        task.resDir.set(resourcesDir)
        task.codeDir.set(layout.buildDirectory.dir("$RES_GEN_DIR/kotlin/${sourceSet.name}ResourceAccessors"))

        if (generateModulePath) {
            task.packagingDir.set(packagingDir)
        }
        task.onlyIf { shouldGenerateCode.get() }
        task.generateResourceContentHashAnnotation.set(
            System.getProperty("compose.resources.generate.ResourceContentHash.annotation") == "true")
    }

    //register generated source set
    sourceSet.kotlin.srcDir(
        genTask.zip(shouldGenerateCode) { task, flag ->
            if (flag) listOf(task.codeDir) else emptyList()
        }
    )
}

private fun KotlinSourceSet.getResourceAccessorsGenerationTaskName(): String {
    return "generateResourceAccessorsFor${this.name.uppercaseFirstChar()}"
}

//we have to generate actual resource collector functions for each leaf source set
private fun Project.configureResourceCollectorsGeneration(
    kotlinExtension: KotlinProjectExtension,
    shouldGenerateCode: Provider<Boolean>,
    packageName: Provider<String>,
    resClassName: Provider<String>,
    makeAccessorsPublic: Provider<Boolean>
) {
    if (kotlinExtension is KotlinMultiplatformExtension) {
        kotlinExtension.sourceSets
            .matching { it.name == KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME }

Review comment (suggestion):
```kotlin
project.providers
  .systemProperty("compose.resources.generate.ResourceContentHash.annotation")
  .map { it.toBoolean() }
  .orElse(false)
```

Code after:
    shouldGenerateCode: Provider<Boolean>,
    packageName: Provider<String>,
    resClassName: Provider<String>,
    makeAccessorsPublic: Provider<Boolean>,
    packagingDir: Provider<File>,
    generateModulePath: Boolean
) {
    logger.info("Configure resource accessors generation for ${sourceSet.name}")

    val genTask = tasks.register(
        sourceSet.getResourceAccessorsGenerationTaskName(),
        GenerateResourceAccessorsTask::class.java
    ) { task ->
        task.packageName.set(packageName)
        task.resClassName.set(resClassName)
        task.sourceSetName.set(sourceSet.name)
        task.makeAccessorsPublic.set(makeAccessorsPublic)
        task.resDir.set(resourcesDir)
        task.codeDir.set(layout.buildDirectory.dir("$RES_GEN_DIR/kotlin/${sourceSet.name}ResourceAccessors"))

        if (generateModulePath) {
            task.packagingDir.set(packagingDir)
        }
        task.onlyIf { shouldGenerateCode.get() }
        task.generateResourceContentHashAnnotation.set(
            project.providers
                .systemProperty("compose.resources.generate.ResourceContentHash.annotation")
                .map { it.toBoolean() }
                .orElse(false)
        )
    }

    //register generated source set
    sourceSet.kotlin.srcDir(
        genTask.zip(shouldGenerateCode) { task, flag ->
            if (flag) listOf(task.codeDir) else emptyList()
        }
    )
}

private fun KotlinSourceSet.getResourceAccessorsGenerationTaskName(): String {
    return "generateResourceAccessorsFor${this.name.uppercaseFirstChar()}"
}

//we have to generate actual resource collector functions for each leaf source set
private fun Project.configureResourceCollectorsGeneration(
    kotlinExtension: KotlinProjectExtension,
    shouldGenerateCode: Provider<Boolean>,
    packageName: Provider<String>,
    resClassName: Provider<String>,
    makeAccessorsPublic: Provider<Boolean>