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

Code before:
    "com.android.library"
)

internal fun Project.configureComposeResources(extension: ResourcesExtension) {
    val config = provider { extension }
    plugins.withId(KOTLIN_MPP_PLUGIN_ID) { onKgpApplied(config, it as KotlinBasePlugin) }
    plugins.withId(KOTLIN_JVM_PLUGIN_ID) { onKotlinJvmApplied(config) }
}

private fun Project.onKgpApplied(config: Provider<ResourcesExtension>, kgp: KotlinBasePlugin) {
    val kotlinExtension = project.extensions.getByType(KotlinMultiplatformExtension::class.java)

    val hasKmpResources = extraProperties.has(KMP_RES_EXT)
    val currentGradleVersion = GradleVersion.current()
    val minGradleVersion = GradleVersion.version(MIN_GRADLE_VERSION_FOR_KMP_RESOURCES)
    val enableMultimoduleResources = ComposeProperties.enableMultimoduleResources(providers).get()
    val kmpResourcesAreAvailable = enableMultimoduleResources && hasKmpResources && currentGradleVersion >= minGradleVersion

    if (kmpResourcesAreAvailable) {
        configureKmpResources(kotlinExtension, extraProperties.get(KMP_RES_EXT)!!, config)
    } else {
        if (!enableMultimoduleResources) {
            logger.info(
                """
                    Multimodule Compose Resources are disabled by default.
                    To enable it add 'compose.resources.multimodule.enable=true' int the root gradle.properties file.
                """.trimIndent()
            )
        } else {
            if (!hasKmpResources) logger.info(
                """
                    Compose resources publication requires Kotlin Gradle Plugin >= 2.0
                    Current Kotlin Gradle Plugin is ${kgp.pluginVersion}
                """.trimIndent()
            )
            if (currentGradleVersion < minGradleVersion) logger.info(
                """
                    Compose resources publication requires Gradle >= $MIN_GRADLE_VERSION_FOR_KMP_RESOURCES
                    Current Gradle is ${currentGradleVersion.version}
                """.trimIndent()
            )
        }

        val commonMain = KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME
        configureComposeResources(kotlinExtension, commonMain, config)

        //when applied AGP then configure android resources
        androidPluginIds.forEach { pluginId ->
            plugins.withId(pluginId) {
                val androidExtension = project.extensions.getByType(BaseExtension::class.java)
                configureAndroidComposeResources(kotlinExtension, androidExtension)

Review comment (suggestion):
Small suggestion:
```suggestion
                    To enable it, add 'compose.resources.multimodule.enable=true' to the root gradle.properties file.
```

Code after:
    "com.android.library"
)

internal fun Project.configureComposeResources(extension: ResourcesExtension) {
    val config = provider { extension }
    plugins.withId(KOTLIN_MPP_PLUGIN_ID) { onKgpApplied(config, it as KotlinBasePlugin) }
    plugins.withId(KOTLIN_JVM_PLUGIN_ID) { onKotlinJvmApplied(config) }
}

private fun Project.onKgpApplied(config: Provider<ResourcesExtension>, kgp: KotlinBasePlugin) {
    val kotlinExtension = project.extensions.getByType(KotlinMultiplatformExtension::class.java)

    val hasKmpResources = extraProperties.has(KMP_RES_EXT)
    val currentGradleVersion = GradleVersion.current()
    val minGradleVersion = GradleVersion.version(MIN_GRADLE_VERSION_FOR_KMP_RESOURCES)
    val disableMultimoduleResources = ComposeProperties.disableMultimoduleResources(providers).get()
    val kmpResourcesAreAvailable = !disableMultimoduleResources && hasKmpResources && currentGradleVersion >= minGradleVersion

    if (kmpResourcesAreAvailable) {
        configureKmpResources(kotlinExtension, extraProperties.get(KMP_RES_EXT)!!, config)
    } else {
        if (!disableMultimoduleResources) {
            if (!hasKmpResources) logger.info(
                """
                    Compose resources publication requires Kotlin Gradle Plugin >= 2.0
                    Current Kotlin Gradle Plugin is ${kgp.pluginVersion}
                """.trimIndent()
            )
            if (currentGradleVersion < minGradleVersion) logger.info(
                """
                    Compose resources publication requires Gradle >= $MIN_GRADLE_VERSION_FOR_KMP_RESOURCES
                    Current Gradle is ${currentGradleVersion.version}
                """.trimIndent()
            )
        }

        val commonMain = KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME
        configureComposeResources(kotlinExtension, commonMain, config)

        //when applied AGP then configure android resources
        androidPluginIds.forEach { pluginId ->
            plugins.withId(pluginId) {
                val androidExtension = project.extensions.getByType(BaseExtension::class.java)
                configureAndroidComposeResources(kotlinExtension, androidExtension)


                /*
                  There is a dirty fix for the problem:

                  Reason: Task ':generateDemoDebugUnitTestLintModel' uses this output of task ':generateResourceAccessorsForAndroidUnitTest' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.