Revert "Update android.gradle to v9 (major) (#3105)"
This reverts commit 34afdabcfe.
This commit is contained in:
@@ -1,50 +1,21 @@
|
||||
import com.android.build.api.dsl.ApplicationDefaultConfig
|
||||
import com.android.build.api.dsl.CommonExtension
|
||||
import com.android.build.api.dsl.CompileOptions
|
||||
import com.android.build.api.dsl.DefaultConfig
|
||||
import mihon.gradle.configurations.configureAndroid
|
||||
import mihon.gradle.configurations.configureKotlin
|
||||
import mihon.gradle.extensions.android
|
||||
import mihon.gradle.extensions.alias
|
||||
import mihon.gradle.extensions.configureTest
|
||||
import mihon.gradle.extensions.coreLibraryDesugaring
|
||||
import mihon.gradle.extensions.libs
|
||||
import mihon.gradle.extensions.mihonx
|
||||
import mihon.gradle.extensions.plugins
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.dependencies
|
||||
|
||||
@Suppress("UNUSED")
|
||||
class PluginAndroidBase : Plugin<Project> {
|
||||
override fun apply(target: Project): Unit = with(target) {
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
configureKotlin()
|
||||
configureTest()
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
minSdk = mihonx.versions.android.sdk.min.get().toInt()
|
||||
if (this is ApplicationDefaultConfig) {
|
||||
targetSdk = mihonx.versions.android.sdk.target.get().toInt()
|
||||
}
|
||||
|
||||
ndkVersion = mihonx.versions.android.ndk.get()
|
||||
}
|
||||
|
||||
compileSdk = mihonx.versions.android.sdk.compile.get().toInt()
|
||||
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring(libs.android.desugar)
|
||||
}
|
||||
configureAndroid()
|
||||
}
|
||||
}
|
||||
|
||||
private fun CommonExtension.defaultConfig(block: DefaultConfig.() -> Unit) {
|
||||
defaultConfig.apply(block)
|
||||
}
|
||||
|
||||
private fun CommonExtension.compileOptions(block: CompileOptions.() -> Unit) {
|
||||
compileOptions.apply(block)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import com.android.build.api.dsl.BuildFeatures
|
||||
import com.android.build.api.dsl.CommonExtension
|
||||
import mihon.gradle.extensions.alias
|
||||
import mihon.gradle.extensions.android
|
||||
import mihon.gradle.extensions.api
|
||||
@@ -33,7 +31,3 @@ class PluginComposeAndroid : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun CommonExtension.buildFeatures(block: BuildFeatures.() -> Unit) {
|
||||
buildFeatures.apply(block)
|
||||
}
|
||||
|
||||
@@ -1,44 +1,32 @@
|
||||
import com.android.build.api.dsl.KotlinMultiplatformAndroidLibraryTarget
|
||||
import mihon.gradle.configurations.configureAndroid
|
||||
import mihon.gradle.configurations.configureKotlin
|
||||
import mihon.gradle.extensions.alias
|
||||
import mihon.gradle.extensions.configureTest
|
||||
import mihon.gradle.extensions.coreLibraryDesugaring
|
||||
import mihon.gradle.extensions.libs
|
||||
import mihon.gradle.extensions.mihonx
|
||||
import mihon.gradle.extensions.plugins
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.dependencies
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
import kotlin.text.toInt
|
||||
|
||||
@Suppress("UNUSED")
|
||||
class PluginKotlinMultiplatform : Plugin<Project> {
|
||||
override fun apply(target: Project): Unit = with(target) {
|
||||
plugins {
|
||||
alias(libs.plugins.android.kmp.library)
|
||||
alias(libs.plugins.android.library)
|
||||
alias(libs.plugins.kotlin.multiplatform)
|
||||
}
|
||||
|
||||
configureKotlin()
|
||||
configureTest()
|
||||
configureAndroid()
|
||||
|
||||
kotlin {
|
||||
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||
applyDefaultHierarchyTemplate()
|
||||
|
||||
android {
|
||||
minSdk = mihonx.versions.android.sdk.min.get().toInt()
|
||||
compileSdk = mihonx.versions.android.sdk.compile.get().toInt()
|
||||
enableCoreLibraryDesugaring = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring(libs.android.desugar)
|
||||
androidTarget()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +34,3 @@ class PluginKotlinMultiplatform : Plugin<Project> {
|
||||
private fun Project.kotlin(block: KotlinMultiplatformExtension.() -> Unit) {
|
||||
extensions.configure(block)
|
||||
}
|
||||
|
||||
private fun KotlinMultiplatformExtension.android(block: KotlinMultiplatformAndroidLibraryTarget.() -> Unit) {
|
||||
targets.withType<KotlinMultiplatformAndroidLibraryTarget>().configureEach(block)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package mihon.gradle.configurations
|
||||
|
||||
import com.android.build.api.dsl.ApplicationDefaultConfig
|
||||
import mihon.gradle.extensions.android
|
||||
import mihon.gradle.extensions.coreLibraryDesugaring
|
||||
import mihon.gradle.extensions.libs
|
||||
import mihon.gradle.extensions.mihonx
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.dependencies
|
||||
|
||||
fun Project.configureAndroid() {
|
||||
android {
|
||||
defaultConfig {
|
||||
minSdk = mihonx.versions.android.sdk.min.get().toInt()
|
||||
if (this is ApplicationDefaultConfig) {
|
||||
targetSdk = mihonx.versions.android.sdk.target.get().toInt()
|
||||
}
|
||||
|
||||
ndkVersion = mihonx.versions.android.ndk.get()
|
||||
}
|
||||
|
||||
compileSdk = mihonx.versions.android.sdk.compile.get().toInt()
|
||||
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring(libs.android.desugar)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package mihon.gradle.extensions
|
||||
|
||||
import com.android.build.api.dsl.CommonExtension
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
import org.gradle.accessors.dm.LibrariesForMihonx
|
||||
import org.gradle.api.Project
|
||||
@@ -18,8 +19,10 @@ internal fun Project.plugins(block: PluginManager.() -> Unit) {
|
||||
pluginManager.apply(block)
|
||||
}
|
||||
|
||||
internal fun Project.android(block: CommonExtension.() -> Unit) {
|
||||
extensions.configure(block)
|
||||
internal fun Project.android(block: CommonExtension<*, *, *, *, *, *>.() -> Unit) {
|
||||
extensions.configure<BaseExtension> {
|
||||
if (this is CommonExtension<*, *, *, *, *, *>) apply(block)
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.configureTest() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[versions]
|
||||
aboutLibraries = "14.0.0-b03"
|
||||
aboutLibraries = "13.2.1"
|
||||
android-desugar = "2.1.5"
|
||||
android-gradle = "9.1.0"
|
||||
android-gradle = "8.13.2"
|
||||
androidx-activity-compose = "1.13.0"
|
||||
androidx-annotation = "1.9.1"
|
||||
androidx-appCompat = "1.7.1"
|
||||
@@ -83,7 +83,7 @@ androidx-benchmark-macroJunit4 = { module = "androidx.benchmark:benchmark-macro-
|
||||
androidx-biometric = { module = "androidx.biometric:biometric-ktx", version.ref = "androidx-biometric" }
|
||||
androidx-compose-animation = { module = "androidx.compose.animation:animation" }
|
||||
androidx-compose-animationGraphics = { module = "androidx.compose.animation:animation-graphics" }
|
||||
androidx-compose-bom = { module = "androidx.compose:compose-bom-alpha", version.ref = "androidx-compose-bom" }
|
||||
androidx-compose-bom = { module = "androidx.compose:compose-bom-beta", version.ref = "androidx-compose-bom" }
|
||||
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" }
|
||||
androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
|
||||
androidx-compose-materialIcons = { module = "androidx.compose.material:material-icons-extended" }
|
||||
@@ -186,11 +186,11 @@ xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", v
|
||||
[plugins]
|
||||
aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin.android", version.ref = "aboutLibraries" }
|
||||
android-application = { id = "com.android.application", version.ref = "android-gradle" }
|
||||
android-test = { id = "com.android.test", version.ref = "android-gradle" }
|
||||
android-kmp-library = { id = "com.android.kotlin.multiplatform.library", version.ref = "android-gradle" }
|
||||
android-library = { id = "com.android.library", version.ref = "android-gradle" }
|
||||
android-test = { id = "com.android.test", version.ref = "android-gradle" }
|
||||
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebase-crashlytics" }
|
||||
google-services = { id = "com.google.gms.google-services", version.ref = "google-services" }
|
||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin-gradle" }
|
||||
kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin-gradle" }
|
||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-gradle" }
|
||||
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-gradle" }
|
||||
|
||||
Reference in New Issue
Block a user