diff --git a/.java-version b/.java-version new file mode 100644 index 000000000..03b6389f3 --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +17.0 diff --git a/app/autodiscovery/api/build.gradle.kts b/app/autodiscovery/api/build.gradle.kts index 76f72dc9a..2aa9cf93c 100644 --- a/app/autodiscovery/api/build.gradle.kts +++ b/app/autodiscovery/api/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/app/autodiscovery/srvrecords/build.gradle.kts b/app/autodiscovery/srvrecords/build.gradle.kts index e8510fc88..386e65202 100644 --- a/app/autodiscovery/srvrecords/build.gradle.kts +++ b/app/autodiscovery/srvrecords/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/app/autodiscovery/thunderbird/build.gradle.kts b/app/autodiscovery/thunderbird/build.gradle.kts index 261fe7c7c..610859b51 100644 --- a/app/autodiscovery/thunderbird/build.gradle.kts +++ b/app/autodiscovery/thunderbird/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/app/core/build.gradle.kts b/app/core/build.gradle.kts index f14fba2c2..b33a85c02 100644 --- a/app/core/build.gradle.kts +++ b/app/core/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.android) alias(libs.plugins.kotlin.parcelize) diff --git a/app/html-cleaner/build.gradle.kts b/app/html-cleaner/build.gradle.kts index 9f1351dff..976791cc0 100644 --- a/app/html-cleaner/build.gradle.kts +++ b/app/html-cleaner/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/app/k9mail/proguard-rules.pro b/app/k9mail/proguard-rules.pro index d18ccdefc..5cfa9613b 100644 --- a/app/k9mail/proguard-rules.pro +++ b/app/k9mail/proguard-rules.pro @@ -53,3 +53,8 @@ # OkHttp platform used only on JVM and when Conscrypt dependency is available. -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 diff --git a/app/ui/legacy/build.gradle.kts b/app/ui/legacy/build.gradle.kts index 1355727b1..c245aca3e 100644 --- a/app/ui/legacy/build.gradle.kts +++ b/app/ui/legacy/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.android) alias(libs.plugins.kotlin.parcelize) diff --git a/backend/api/build.gradle.kts b/backend/api/build.gradle.kts index 76f72dc9a..2aa9cf93c 100644 --- a/backend/api/build.gradle.kts +++ b/backend/api/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/backend/demo/build.gradle.kts b/backend/demo/build.gradle.kts index a226d2af7..f969cb13f 100644 --- a/backend/demo/build.gradle.kts +++ b/backend/demo/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.ksp) diff --git a/backend/imap/build.gradle.kts b/backend/imap/build.gradle.kts index 291562bda..3c342a155 100644 --- a/backend/imap/build.gradle.kts +++ b/backend/imap/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/backend/jmap/build.gradle.kts b/backend/jmap/build.gradle.kts index c71a3d7ae..112fae7fe 100644 --- a/backend/jmap/build.gradle.kts +++ b/backend/jmap/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.ksp) diff --git a/backend/pop3/build.gradle.kts b/backend/pop3/build.gradle.kts index 48292d4e3..4df78de33 100644 --- a/backend/pop3/build.gradle.kts +++ b/backend/pop3/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/backend/testing/build.gradle.kts b/backend/testing/build.gradle.kts index f72e9375b..d3bc66988 100644 --- a/backend/testing/build.gradle.kts +++ b/backend/testing/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/backend/webdav/build.gradle.kts b/backend/webdav/build.gradle.kts index 8c6bfbf34..d6306d8bb 100644 --- a/backend/webdav/build.gradle.kts +++ b/backend/webdav/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/build-plugin/src/main/kotlin/AndroidExtension.kt b/build-plugin/src/main/kotlin/AndroidExtension.kt index 056dc0adc..5db5fdcb3 100644 --- a/build-plugin/src/main/kotlin/AndroidExtension.kt +++ b/build-plugin/src/main/kotlin/AndroidExtension.kt @@ -14,8 +14,8 @@ internal fun CommonExtension<*, *, *, *>.configureSharedConfig() { } compileOptions { - sourceCompatibility = ThunderbirdProjectConfig.javaVersion - targetCompatibility = ThunderbirdProjectConfig.javaVersion + sourceCompatibility = ThunderbirdProjectConfig.javaCompatibilityVersion + targetCompatibility = ThunderbirdProjectConfig.javaCompatibilityVersion } lint { @@ -45,7 +45,7 @@ internal fun CommonExtension<*, *, *, *>.configureSharedComposeConfig( abortOnError = true } - packagingOptions { + packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" } diff --git a/build-plugin/src/main/kotlin/KotlinExtension.kt b/build-plugin/src/main/kotlin/KotlinExtension.kt new file mode 100644 index 000000000..816ba7ed5 --- /dev/null +++ b/build-plugin/src/main/kotlin/KotlinExtension.kt @@ -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 { + kotlinOptions { + jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString() + } + } +} diff --git a/build-plugin/src/main/kotlin/ThunderbirdPlugins.kt b/build-plugin/src/main/kotlin/ThunderbirdPlugins.kt index 3a4e97e93..b5d195b32 100644 --- a/build-plugin/src/main/kotlin/ThunderbirdPlugins.kt +++ b/build-plugin/src/main/kotlin/ThunderbirdPlugins.kt @@ -3,10 +3,13 @@ object ThunderbirdPlugins { object App { const val android = "thunderbird.app.android" const val androidCompose = "thunderbird.app.android.compose" + + const val jvm = "thunderbird.app.jvm" } object Library { - const val jvm = "thunderbird.library.jvm" const val android = "thunderbird.library.android" const val androidCompose = "thunderbird.library.android.compose" + + const val jvm = "thunderbird.library.jvm" } } diff --git a/build-plugin/src/main/kotlin/ThunderbirdProjectConfig.kt b/build-plugin/src/main/kotlin/ThunderbirdProjectConfig.kt index b0ff253b9..c16a74dd5 100644 --- a/build-plugin/src/main/kotlin/ThunderbirdProjectConfig.kt +++ b/build-plugin/src/main/kotlin/ThunderbirdProjectConfig.kt @@ -2,7 +2,7 @@ import org.gradle.api.JavaVersion object ThunderbirdProjectConfig { - val javaVersion = JavaVersion.VERSION_11 + val javaCompatibilityVersion = JavaVersion.VERSION_11 const val androidSdkMin = 21 const val androidSdkTarget = 31 diff --git a/build-plugin/src/main/kotlin/thunderbird.app.android.gradle.kts b/build-plugin/src/main/kotlin/thunderbird.app.android.gradle.kts index 3710b2946..aaf7067aa 100644 --- a/build-plugin/src/main/kotlin/thunderbird.app.android.gradle.kts +++ b/build-plugin/src/main/kotlin/thunderbird.app.android.gradle.kts @@ -19,7 +19,7 @@ android { } kotlinOptions { - jvmTarget = ThunderbirdProjectConfig.javaVersion.toString() + jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString() } lint { diff --git a/build-plugin/src/main/kotlin/thunderbird.app.jvm.gradle.kts b/build-plugin/src/main/kotlin/thunderbird.app.jvm.gradle.kts new file mode 100644 index 000000000..e57a54d27 --- /dev/null +++ b/build-plugin/src/main/kotlin/thunderbird.app.jvm.gradle.kts @@ -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) +} diff --git a/build-plugin/src/main/kotlin/thunderbird.dependency.check.gradle.kts b/build-plugin/src/main/kotlin/thunderbird.dependency.check.gradle.kts index 69eb656d0..4547f5d08 100644 --- a/build-plugin/src/main/kotlin/thunderbird.dependency.check.gradle.kts +++ b/build-plugin/src/main/kotlin/thunderbird.dependency.check.gradle.kts @@ -11,7 +11,7 @@ tasks.withType { } fun isNonStable(version: String): Boolean { - val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) } + val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) } val regex = "^[\\d,.v-]+(-r)?$".toRegex() val isStable = stableKeyword || regex.matches(version) return isStable.not() diff --git a/build-plugin/src/main/kotlin/thunderbird.library.android.gradle.kts b/build-plugin/src/main/kotlin/thunderbird.library.android.gradle.kts index 5c84329de..b7f0f8a54 100644 --- a/build-plugin/src/main/kotlin/thunderbird.library.android.gradle.kts +++ b/build-plugin/src/main/kotlin/thunderbird.library.android.gradle.kts @@ -11,7 +11,7 @@ android { } kotlinOptions { - jvmTarget = ThunderbirdProjectConfig.javaVersion.toString() + jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString() } lint { diff --git a/build-plugin/src/main/kotlin/thunderbird.library.jvm.gradle.kts b/build-plugin/src/main/kotlin/thunderbird.library.jvm.gradle.kts index ac2266127..82086143e 100644 --- a/build-plugin/src/main/kotlin/thunderbird.library.jvm.gradle.kts +++ b/build-plugin/src/main/kotlin/thunderbird.library.jvm.gradle.kts @@ -4,10 +4,12 @@ plugins { } java { - sourceCompatibility = ThunderbirdProjectConfig.javaVersion - targetCompatibility = ThunderbirdProjectConfig.javaVersion + sourceCompatibility = ThunderbirdProjectConfig.javaCompatibilityVersion + targetCompatibility = ThunderbirdProjectConfig.javaCompatibilityVersion } +configureKotlinJavaCompatibility() + dependencies { implementation(libs.bundles.shared.jvm.main) testImplementation(libs.bundles.shared.jvm.test) diff --git a/build-plugin/src/main/kotlin/thunderbird.quality.detekt.gradle.kts b/build-plugin/src/main/kotlin/thunderbird.quality.detekt.gradle.kts index e270ad26a..0d3a06c15 100644 --- a/build-plugin/src/main/kotlin/thunderbird.quality.detekt.gradle.kts +++ b/build-plugin/src/main/kotlin/thunderbird.quality.detekt.gradle.kts @@ -16,7 +16,7 @@ configure { } tasks.withType().configureEach { - jvmTarget = ThunderbirdProjectConfig.javaVersion.toString() + jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString() exclude( "**/.gradle/**", diff --git a/build.gradle.kts b/build.gradle.kts index 0f3fcb8dc..74688fa43 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.JvmTarget - -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.android.library) apply false @@ -17,9 +14,6 @@ plugins { val propertyTestCoverage: String? by extra -val javaVersion = JavaVersion.VERSION_11 -val jvmTargetVersion = JvmTarget.JVM_11 - allprojects { extra.apply { set("testCoverageEnabled", propertyTestCoverage != null) @@ -72,10 +66,6 @@ allprojects { } } - tasks.withType { - kotlinOptions.jvmTarget = jvmTargetVersion.target - } - tasks.withType { testLogging { exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL @@ -93,3 +83,8 @@ tasks.register("testsOnCi") { .filterNot { task -> task.name in arrayOf("testDebugUnitTest", "test") }, ) } + +tasks.named("wrapper") { + gradleVersion = libs.versions.gradle.get() + distributionType = Wrapper.DistributionType.ALL +} diff --git a/cli/html-cleaner-cli/build.gradle.kts b/cli/html-cleaner-cli/build.gradle.kts index 77ae67528..7b3f12245 100644 --- a/cli/html-cleaner-cli/build.gradle.kts +++ b/cli/html-cleaner-cli/build.gradle.kts @@ -1,7 +1,5 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { - alias(libs.plugins.kotlin.jvm) - id("application") + id(ThunderbirdPlugins.App.jvm) } version = "unspecified" @@ -16,8 +14,3 @@ dependencies { implementation(libs.clikt) implementation(libs.okio) } - -java { - sourceCompatibility = ThunderbirdProjectConfig.javaVersion - targetCompatibility = ThunderbirdProjectConfig.javaVersion -} diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.kts index 034ca0054..cdbc1e9a2 100644 --- a/core/common/build.gradle.kts +++ b/core/common/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index aa76ab0aa..6cb221bf4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,10 +2,11 @@ # Please don't open pull requests upgrading dependencies if you're a new contributor. [versions] -androidGradlePlugin = "7.4.2" +gradle = "8.1.1" +androidGradlePlugin = "8.0.0" ktlint = "0.48.2" -kotlin = "1.8.10" +kotlin = "1.8.20" kotlinxCoroutines = "1.6.4" jetbrainsAnnotations = "24.0.1" androidxAppCompat = "1.6.1" @@ -20,7 +21,7 @@ androidxCoreSplashscreen = "1.0.0" androidxPreference = "1.2.0" androidxDrawerLayout = "1.1.1" androidxTransition = "1.4.1" -androidxComposeCompiler = "1.4.4" +androidxComposeCompiler = "1.4.6" androidxComposeBom = "2023.04.00" androidxComposeMaterial = "1.3.1" accompanist = "0.30.1" @@ -39,7 +40,7 @@ mockito = "5.2.0" android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } android-lint = { id = "com.android.lint", version.ref = "androidGradlePlugin" } -ksp = "com.google.devtools.ksp:1.8.10-1.0.9" +ksp = "com.google.devtools.ksp:1.8.20-1.0.11" kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa..c1962a79e 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index adb6acbd8..8707e8b50 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=7ba68c54029790ab444b39d7e293d3236b2632631fb5f2e012bb28b4ff669e4b -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d6..aeb74cbb4 100755 --- a/gradlew +++ b/gradlew @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +141,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +149,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/mail/common/build.gradle.kts b/mail/common/build.gradle.kts index 7373bfc16..5c3e86dcb 100644 --- a/mail/common/build.gradle.kts +++ b/mail/common/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/mail/protocols/imap/build.gradle.kts b/mail/protocols/imap/build.gradle.kts index 2f568e959..1c9366ef0 100644 --- a/mail/protocols/imap/build.gradle.kts +++ b/mail/protocols/imap/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/mail/protocols/pop3/build.gradle.kts b/mail/protocols/pop3/build.gradle.kts index 5662f180d..9bb46751b 100644 --- a/mail/protocols/pop3/build.gradle.kts +++ b/mail/protocols/pop3/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/mail/protocols/smtp/build.gradle.kts b/mail/protocols/smtp/build.gradle.kts index a13958996..56f180588 100644 --- a/mail/protocols/smtp/build.gradle.kts +++ b/mail/protocols/smtp/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/mail/protocols/webdav/build.gradle.kts b/mail/protocols/webdav/build.gradle.kts index c13ea44e8..35c50579b 100644 --- a/mail/protocols/webdav/build.gradle.kts +++ b/mail/protocols/webdav/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint) diff --git a/mail/testing/build.gradle.kts b/mail/testing/build.gradle.kts index cff0cc1e5..a5253fd9c 100644 --- a/mail/testing/build.gradle.kts +++ b/mail/testing/build.gradle.kts @@ -1,4 +1,3 @@ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id(ThunderbirdPlugins.Library.jvm) alias(libs.plugins.android.lint)