Migrate to AGP KMP
This commit is contained in:
1 parent
ea9ed2dc67
commit
4ac4d3da01
8 files changed
+15
-38
No files matched your search
@@ -1,6 +1,5 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.test)
|
||||
alias(libs.plugins.android.builtInKotlin)
|
||||
alias(libs.plugins.baselineprofile)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,14 +17,13 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidExtension
|
||||
class AndroidApplicationConventionPlugin : Plugin<Project> {
|
||||
override fun apply(target: Project) = with(target) {
|
||||
apply(plugin = libs.plugins.android.application.get().pluginId)
|
||||
apply(plugin = libs.plugins.android.builtInKotlin.get().pluginId)
|
||||
apply(plugin = libs.plugins.compose.compiler.get().pluginId)
|
||||
apply(plugin = libs.plugins.composeCompilerReportGenerator.get().pluginId)
|
||||
|
||||
configure<KotlinAndroidExtension> {
|
||||
jvmToolchain(21)
|
||||
compilerOptions {
|
||||
configureKotlin()
|
||||
configureKotlin(includeKotlinX = true)
|
||||
configureKotlinCompose()
|
||||
jvmDefault = JvmDefaultMode.NO_COMPATIBILITY
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class MultiplatformLibraryConventionPlugin : Plugin<Project> {
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
jvmToolchain(21)
|
||||
compilerOptions {
|
||||
configureKotlin()
|
||||
configureKotlin(includeKotlinX = path != ":core:i18n")
|
||||
}
|
||||
|
||||
applyHierarchyTemplate {
|
||||
@@ -44,10 +44,6 @@ class MultiplatformLibraryConventionPlugin : Plugin<Project> {
|
||||
|
||||
configure<KotlinMultiplatformAndroidLibraryTarget> {
|
||||
namespace = "com.ehviewer${path.replace(':', '.')}"
|
||||
|
||||
withHostTestBuilder {
|
||||
}
|
||||
|
||||
enableCoreLibraryDesugaring = true
|
||||
|
||||
compilerOptions {
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.gradle.kotlin.dsl.assign
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions
|
||||
|
||||
// https://kotlinlang.org/docs/gradle-compiler-options.html#all-compiler-options
|
||||
internal fun KotlinCommonCompilerOptions.configureKotlin() {
|
||||
internal fun KotlinCommonCompilerOptions.configureKotlin(includeKotlinX: Boolean) {
|
||||
progressiveMode = true
|
||||
allWarningsAsErrors = true
|
||||
optIn.addAll(
|
||||
@@ -12,10 +12,14 @@ internal fun KotlinCommonCompilerOptions.configureKotlin() {
|
||||
"kotlin.concurrent.atomics.ExperimentalAtomicApi",
|
||||
"kotlin.contracts.ExperimentalContracts",
|
||||
"kotlin.time.ExperimentalTime",
|
||||
"kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"kotlinx.coroutines.FlowPreview",
|
||||
"kotlinx.serialization.ExperimentalSerializationApi",
|
||||
)
|
||||
if (includeKotlinX) {
|
||||
optIn.addAll(
|
||||
"kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"kotlinx.coroutines.FlowPreview",
|
||||
"kotlinx.serialization.ExperimentalSerializationApi",
|
||||
)
|
||||
}
|
||||
freeCompilerArgs.addAll(
|
||||
"-Xcontext-parameters",
|
||||
"-Xwhen-expressions=indy",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.application) apply false
|
||||
alias(libs.plugins.android.builtInKotlin) apply false
|
||||
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
|
||||
alias(libs.plugins.android.library) apply false
|
||||
alias(libs.plugins.android.lint) apply false
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.library)
|
||||
alias(libs.plugins.kotlin.multiplatform)
|
||||
alias(libs.plugins.ehviewer.multiplatform.library)
|
||||
alias(libs.plugins.moko.resources)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
// TODO: Migrate to AGP KMP
|
||||
// https://github.com/icerockdev/moko-resources/issues/820
|
||||
androidTarget()
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
@@ -17,16 +12,11 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
jvmToolchain(21)
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-Xexpect-actual-classes")
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.ehviewer.core.i18n"
|
||||
}
|
||||
|
||||
multiplatformResources {
|
||||
resourcesPackage = "com.ehviewer.core.i18n"
|
||||
multiplatformResources {
|
||||
resourcesPackage = android.namespace
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,3 @@ org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8 -XX:+UseParallelGC
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.configuration-cache=true
|
||||
|
||||
# https://github.com/icerockdev/moko-resources/issues/820
|
||||
android.builtInKotlin=false
|
||||
|
||||
# https://issuetracker.google.com/443268525
|
||||
android.newDsl=false
|
||||
|
||||
# https://github.com/icerockdev/moko-resources/issues/852
|
||||
android.sourceset.disallowProvider=false
|
||||
@@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
aboutlibraries = "13.2.1"
|
||||
aboutlibraries = "14.0.0-b02"
|
||||
accompanist = "0.37.3"
|
||||
agp = "9.0.0"
|
||||
androidx-activity = "1.12.3"
|
||||
@@ -144,7 +144,6 @@ splitties = ["splitties-appctx", "splitties-systemservices"]
|
||||
aboutlibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutlibraries" }
|
||||
aboutlibrariesAndroid = { id = "com.mikepenz.aboutlibraries.plugin.android", version.ref = "aboutlibraries" }
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
android-builtInKotlin = { id = "com.android.built-in-kotlin", version.ref = "agp" }
|
||||
android-kotlin-multiplatform-library = { id = "com.android.kotlin.multiplatform.library", version.ref = "agp" }
|
||||
android-library = { id = "com.android.library", version.ref = "agp" }
|
||||
android-lint = { id = "com.android.lint", version.ref = "agp" }
|
||||
|
||||
Reference in new issue
Block a user