|
|
@ -11,9 +11,13 @@ import java.io.File |
|
|
|
|
|
|
|
|
|
|
|
internal const val COMPOSE_RESOURCES_DIR = "composeResources" |
|
|
|
internal const val COMPOSE_RESOURCES_DIR = "composeResources" |
|
|
|
private const val RES_GEN_DIR = "generated/compose/resourceGenerator" |
|
|
|
private const val RES_GEN_DIR = "generated/compose/resourceGenerator" |
|
|
|
|
|
|
|
private val androidPluginIds = listOf( |
|
|
|
|
|
|
|
"com.android.application", |
|
|
|
|
|
|
|
"com.android.library" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
internal fun Project.configureComposeResources() { |
|
|
|
internal fun Project.configureComposeResources() { |
|
|
|
pluginManager.withPlugin(KOTLIN_MPP_PLUGIN_ID) { |
|
|
|
plugins.withId(KOTLIN_MPP_PLUGIN_ID) { |
|
|
|
val kotlinExtension = project.extensions.getByType(KotlinMultiplatformExtension::class.java) |
|
|
|
val kotlinExtension = project.extensions.getByType(KotlinMultiplatformExtension::class.java) |
|
|
|
kotlinExtension.sourceSets.all { sourceSet -> |
|
|
|
kotlinExtension.sourceSets.all { sourceSet -> |
|
|
|
val sourceSetName = sourceSet.name |
|
|
|
val sourceSetName = sourceSet.name |
|
|
@ -76,8 +80,9 @@ private fun Project.configureResourceGenerator(commonComposeResourcesDir: File, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val androidExtension = project.extensions.findByName("android") |
|
|
|
//when applied AGP then configure android resources |
|
|
|
if (androidExtension != null) { |
|
|
|
androidPluginIds.forEach { pluginId -> |
|
|
|
|
|
|
|
plugins.withId(pluginId) { |
|
|
|
configureAndroidResources( |
|
|
|
configureAndroidResources( |
|
|
|
commonComposeResources, |
|
|
|
commonComposeResources, |
|
|
|
buildDir("$RES_GEN_DIR/androidFonts").map { it.asFile }, |
|
|
|
buildDir("$RES_GEN_DIR/androidFonts").map { it.asFile }, |
|
|
@ -85,3 +90,4 @@ private fun Project.configureResourceGenerator(commonComposeResourcesDir: File, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|