From 3ad70409ef2812ba5e5d9643bb55654243b509f8 Mon Sep 17 00:00:00 2001 From: "Kenneth J. Shackleton" Date: Sun, 16 Jul 2023 12:32:52 +0100 Subject: [PATCH 1/4] Gradle Kotlin DSL warnings as errors. Signed-off-by: Kenneth J. Shackleton --- gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle.properties b/gradle.properties index 6703a04a7f..e5afa78ba3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,6 +11,7 @@ sqlcipher.versionName=4.5.4 org.gradle.caching=true org.gradle.configuration-cache=true org.gradle.daemon=true +org.gradle.kotlin.dsl.allWarningsAsErrors=true org.gradle.jvmargs=-Xmx2g -XX:+UseParallelGC org.gradle.parallel=true From b329bbf2853b385af2d37047fb0d0c4d91b1d7f9 Mon Sep 17 00:00:00 2001 From: "Kenneth J. Shackleton" Date: Sun, 16 Jul 2023 12:37:09 +0100 Subject: [PATCH 2/4] Address DSL deprecations in AndroidLibBenchmark. Signed-off-by: Kenneth J. Shackleton --- AndroidLibBenchmark/build.gradle.kts | 13 +++++++------ buildSrc/src/main/kotlin/Versions.kt | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/AndroidLibBenchmark/build.gradle.kts b/AndroidLibBenchmark/build.gradle.kts index 29f6ac6b1d..d3b34fe730 100644 --- a/AndroidLibBenchmark/build.gradle.kts +++ b/AndroidLibBenchmark/build.gradle.kts @@ -26,12 +26,11 @@ repositories { } android { - compileSdkVersion(Versions.ANDROID_SDK.version.toInt()) - buildToolsVersion(Versions.ANDROID_BUILD_TOOLS.version) + compileSdk = Versions.ANDROID_SDK.version.toInt() + buildToolsVersion = Versions.ANDROID_BUILD_TOOLS.version namespace = "com.bloomberg.selekt.android.benchmark" defaultConfig { - minSdkVersion(21) - targetSdkVersion(32) + minSdk = 21 testInstrumentationRunner = "androidx.benchmark.junit4.AndroidBenchmarkRunner" testInstrumentationRunnerArguments.putAll(arrayOf( "androidx.benchmark.suppressErrors" to "EMULATOR,LOW_BATTERY,UNLOCKED" @@ -40,8 +39,10 @@ android { arrayOf("androidTest").forEach { sourceSets[it].java.srcDir("src/$it/kotlin") } - lintOptions { - disable("OldTargetApi") + lint { + disable.addAll(listOf( + "OldTargetApi" + )) } } diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 86a47fd29f..f8473ddcb7 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -20,7 +20,7 @@ enum class Versions( val version: String, private val url: URL ) { - ANDROID_BENCHMARK("1.2.0-alpha13", URL("https://developer.android.com/studio/profile/benchmark")), + ANDROID_BENCHMARK("1.2.0-alpha16", URL("https://developer.android.com/studio/profile/benchmark")), ANDROID_BUILD_TOOLS("33.0.1", URL("https://developer.android.com/studio/releases/build-tools")), ANDROID_GRADLE_PLUGIN("8.0.2", URL("https://developer.android.com/tools/revisions/gradle-plugin.html")), ANDROID_LINT("30.0.2", URL("https://github.com/googlesamples/android-custom-lint-rules")), From 8dd08623484f76b68ea35e87740e5d4f9a83359c Mon Sep 17 00:00:00 2001 From: "Kenneth J. Shackleton" Date: Sun, 16 Jul 2023 14:11:25 +0100 Subject: [PATCH 3/4] Ktlint 0.50.0. Signed-off-by: Kenneth J. Shackleton --- buildSrc/src/main/kotlin/Versions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index bb5b2c4923..b83bc0ba0e 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -42,7 +42,7 @@ enum class Versions( KOTLIN_TEST(KOTLIN.version, URL("https://github.com/JetBrains/kotlin")), KOTLINX_COROUTINES("1.7.2", URL("https://github.com/Kotlin/kotlinx.coroutines")), KOTLINX_KOVER("0.7.2", URL("https://github.com/Kotlin/kotlinx-kover")), - KTLINT("0.45.2", URL("https://github.com/pinterest/ktlint")), + KTLINT("0.50.0", URL("https://github.com/pinterest/ktlint")), KTLINT_GRADLE_PLUGIN("11.5.0", URL("https://github.com/JLLeitschuh/ktlint-gradle")), MOCKITO("5.4.0", URL("https://github.com/mockito/mockito")), MOCKITO_KOTLIN("5.0.0", URL("https://github.com/mockito/mockito-kotlin")), From 96f8b644b2754c0fe4260eacfdebf96ee8e61f79 Mon Sep 17 00:00:00 2001 From: "Kenneth J. Shackleton" Date: Sun, 16 Jul 2023 14:14:31 +0100 Subject: [PATCH 4/4] Move disabled Ktlint rules to editorconfig. Signed-off-by: Kenneth J. Shackleton --- .editorconfig | 3 +++ build.gradle.kts | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 3d99a200a3..d2c3ed9fa5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,3 +7,6 @@ insert_final_newline = true max_line_length = 125 trim_trailing_whitespace = true +ktlint_standard_import-ordering = disabled +ktlint_standard_indent = disabled +ktlint_standard_wrapping = disabled diff --git a/build.gradle.kts b/build.gradle.kts index 5a03d021ca..73d22547ca 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -207,7 +207,6 @@ allprojects { } configure { version.set(Versions.KTLINT.version) - disabledRules.set(setOf("import-ordering", "indent", "wrapping")) reporters { reporter(ReporterType.HTML) }