Bump Android Gradle Plugin to 8.0.0 and move Kotlin compatibility to build-plugins

This commit is contained in:
Wolf Montwé 2023-04-18 13:27:09 +02:00
parent 6910945f3f
commit 0339444dd3
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
14 changed files with 50 additions and 27 deletions

1
.java-version Normal file
View file

@ -0,0 +1 @@
17.0

View file

@ -53,3 +53,8 @@
# OkHttp platform used only on JVM and when Conscrypt dependency is available. # OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform -dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn kotlinx.serialization.KSerializer
-dontwarn kotlinx.serialization.Serializable
-dontwarn org.apache.http.client.methods.CloseableHttpResponse
-dontwarn org.slf4j.impl.StaticLoggerBinder

View file

@ -14,8 +14,8 @@ internal fun CommonExtension<*, *, *, *>.configureSharedConfig() {
} }
compileOptions { compileOptions {
sourceCompatibility = ThunderbirdProjectConfig.javaVersion sourceCompatibility = ThunderbirdProjectConfig.javaCompatibilityVersion
targetCompatibility = ThunderbirdProjectConfig.javaVersion targetCompatibility = ThunderbirdProjectConfig.javaCompatibilityVersion
} }
lint { lint {
@ -45,7 +45,7 @@ internal fun CommonExtension<*, *, *, *>.configureSharedComposeConfig(
abortOnError = true abortOnError = true
} }
packagingOptions { packaging {
resources { resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}" excludes += "/META-INF/{AL2.0,LGPL2.1}"
} }

View file

@ -0,0 +1,11 @@
import org.gradle.api.Project
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun Project.configureKotlinJavaCompatibility() {
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString()
}
}
}

View file

@ -3,10 +3,13 @@ object ThunderbirdPlugins {
object App { object App {
const val android = "thunderbird.app.android" const val android = "thunderbird.app.android"
const val androidCompose = "thunderbird.app.android.compose" const val androidCompose = "thunderbird.app.android.compose"
const val jvm = "thunderbird.app.jvm"
} }
object Library { object Library {
const val jvm = "thunderbird.library.jvm"
const val android = "thunderbird.library.android" const val android = "thunderbird.library.android"
const val androidCompose = "thunderbird.library.android.compose" const val androidCompose = "thunderbird.library.android.compose"
const val jvm = "thunderbird.library.jvm"
} }
} }

View file

@ -2,7 +2,7 @@ import org.gradle.api.JavaVersion
object ThunderbirdProjectConfig { object ThunderbirdProjectConfig {
val javaVersion = JavaVersion.VERSION_11 val javaCompatibilityVersion = JavaVersion.VERSION_11
const val androidSdkMin = 21 const val androidSdkMin = 21
const val androidSdkTarget = 31 const val androidSdkTarget = 31

View file

@ -19,7 +19,7 @@ android {
} }
kotlinOptions { kotlinOptions {
jvmTarget = ThunderbirdProjectConfig.javaVersion.toString() jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString()
} }
lint { lint {

View file

@ -0,0 +1,16 @@
plugins {
id("application")
id("org.jetbrains.kotlin.jvm")
}
java {
sourceCompatibility = ThunderbirdProjectConfig.javaCompatibilityVersion
targetCompatibility = ThunderbirdProjectConfig.javaCompatibilityVersion
}
configureKotlinJavaCompatibility()
dependencies {
implementation(libs.bundles.shared.jvm.main)
testImplementation(libs.bundles.shared.jvm.test)
}

View file

@ -11,7 +11,7 @@ android {
} }
kotlinOptions { kotlinOptions {
jvmTarget = ThunderbirdProjectConfig.javaVersion.toString() jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString()
} }
lint { lint {

View file

@ -4,10 +4,12 @@ plugins {
} }
java { java {
sourceCompatibility = ThunderbirdProjectConfig.javaVersion sourceCompatibility = ThunderbirdProjectConfig.javaCompatibilityVersion
targetCompatibility = ThunderbirdProjectConfig.javaVersion targetCompatibility = ThunderbirdProjectConfig.javaCompatibilityVersion
} }
configureKotlinJavaCompatibility()
dependencies { dependencies {
implementation(libs.bundles.shared.jvm.main) implementation(libs.bundles.shared.jvm.main)
testImplementation(libs.bundles.shared.jvm.test) testImplementation(libs.bundles.shared.jvm.test)

View file

@ -16,7 +16,7 @@ configure<DetektExtension> {
} }
tasks.withType<Detekt>().configureEach { tasks.withType<Detekt>().configureEach {
jvmTarget = ThunderbirdProjectConfig.javaVersion.toString() jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString()
exclude( exclude(
"**/.gradle/**", "**/.gradle/**",

View file

@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
@Suppress("DSL_SCOPE_VIOLATION") @Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
alias(libs.plugins.android.application) apply false alias(libs.plugins.android.application) apply false
@ -17,9 +15,6 @@ plugins {
val propertyTestCoverage: String? by extra val propertyTestCoverage: String? by extra
val javaVersion = JavaVersion.VERSION_11
val jvmTargetVersion = JvmTarget.JVM_11
allprojects { allprojects {
extra.apply { extra.apply {
set("testCoverageEnabled", propertyTestCoverage != null) set("testCoverageEnabled", propertyTestCoverage != null)
@ -72,10 +67,6 @@ allprojects {
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = jvmTargetVersion.target
}
tasks.withType<Test> { tasks.withType<Test> {
testLogging { testLogging {
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL

View file

@ -1,7 +1,6 @@
@Suppress("DSL_SCOPE_VIOLATION") @Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
alias(libs.plugins.kotlin.jvm) id(ThunderbirdPlugins.App.jvm)
id("application")
} }
version = "unspecified" version = "unspecified"
@ -16,8 +15,3 @@ dependencies {
implementation(libs.clikt) implementation(libs.clikt)
implementation(libs.okio) implementation(libs.okio)
} }
java {
sourceCompatibility = ThunderbirdProjectConfig.javaVersion
targetCompatibility = ThunderbirdProjectConfig.javaVersion
}

View file

@ -3,7 +3,7 @@
[versions] [versions]
gradle = "8.0.2" gradle = "8.0.2"
androidGradlePlugin = "7.4.2" androidGradlePlugin = "8.0.0"
ktlint = "0.48.2" ktlint = "0.48.2"
kotlin = "1.8.10" kotlin = "1.8.10"