From c53cf1a23c3fb5bb1deb889e7e544920868d5091 Mon Sep 17 00:00:00 2001 From: "Kenneth J. Shackleton" Date: Sun, 4 Feb 2024 13:36:55 +0000 Subject: [PATCH 1/3] Separate sqlite3 Java classes subproject. Signed-off-by: Kenneth J. Shackleton --- selekt-android/build.gradle.kts | 2 +- selekt-java/build.gradle.kts | 2 +- selekt-sqlite3-classes/build.gradle.kts | 42 +++++++++++++++++++ .../META-INF/proguard/consumer-rules.pro | 0 .../com/bloomberg/selekt/ExternalSQLite3.kt | 0 .../kotlin/com/bloomberg/selekt/SQLCodes.kt | 0 selekt-sqlite3/build.gradle.kts | 25 +---------- settings.gradle.kts | 1 + 8 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 selekt-sqlite3-classes/build.gradle.kts rename {selekt-sqlite3/src/main => selekt-sqlite3-classes}/resources/META-INF/proguard/consumer-rules.pro (100%) rename {selekt-sqlite3 => selekt-sqlite3-classes}/src/main/kotlin/com/bloomberg/selekt/ExternalSQLite3.kt (100%) rename {selekt-sqlite3 => selekt-sqlite3-classes}/src/main/kotlin/com/bloomberg/selekt/SQLCodes.kt (100%) diff --git a/selekt-android/build.gradle.kts b/selekt-android/build.gradle.kts index d1fc4670ff..1fc899e039 100644 --- a/selekt-android/build.gradle.kts +++ b/selekt-android/build.gradle.kts @@ -66,7 +66,7 @@ dependencies { compileOnly(androidX("room", "runtime", Versions.ANDROIDX_ROOM.version)) implementation(projects.selektAndroidSqlcipher) implementation(projects.selektJava) - implementation(projects.selektSqlite3) + implementation(projects.selektSqlite3Classes) kaptTest(androidX("room", "compiler", Versions.ANDROIDX_ROOM.version)) testImplementation(androidX("lifecycle", "livedata-ktx", Versions.ANDROIDX_LIVE_DATA.version)) testImplementation(androidX("room", "runtime", Versions.ANDROIDX_ROOM.version)) diff --git a/selekt-java/build.gradle.kts b/selekt-java/build.gradle.kts index 2bc1773228..cd06931462 100644 --- a/selekt-java/build.gradle.kts +++ b/selekt-java/build.gradle.kts @@ -57,7 +57,7 @@ val integrationTestRuntimeOnly: Configuration by configurations.getting { dependencies { implementation(projects.selektApi) - implementation(projects.selektSqlite3) + implementation(projects.selektSqlite3Classes) jmhImplementation(kotlinX("coroutines-core", version = Versions.KOTLINX_COROUTINES.version)) } diff --git a/selekt-sqlite3-classes/build.gradle.kts b/selekt-sqlite3-classes/build.gradle.kts new file mode 100644 index 0000000000..0ec748eafc --- /dev/null +++ b/selekt-sqlite3-classes/build.gradle.kts @@ -0,0 +1,42 @@ +/* + * Copyright 2024 Bloomberg Finance L.P. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +repositories { + mavenCentral() +} + +plugins { + kotlin("jvm") + `maven-publish` + signing +} + +disableKotlinCompilerAssertions() + +java { + withJavadocJar() + withSourcesJar() +} + +publishing { + publications.register("main") { + from(components.getByName("java")) + pom { + commonInitialisation(project) + description.set("Selekt Java SQLite interface library.") + } + } +} diff --git a/selekt-sqlite3/src/main/resources/META-INF/proguard/consumer-rules.pro b/selekt-sqlite3-classes/resources/META-INF/proguard/consumer-rules.pro similarity index 100% rename from selekt-sqlite3/src/main/resources/META-INF/proguard/consumer-rules.pro rename to selekt-sqlite3-classes/resources/META-INF/proguard/consumer-rules.pro diff --git a/selekt-sqlite3/src/main/kotlin/com/bloomberg/selekt/ExternalSQLite3.kt b/selekt-sqlite3-classes/src/main/kotlin/com/bloomberg/selekt/ExternalSQLite3.kt similarity index 100% rename from selekt-sqlite3/src/main/kotlin/com/bloomberg/selekt/ExternalSQLite3.kt rename to selekt-sqlite3-classes/src/main/kotlin/com/bloomberg/selekt/ExternalSQLite3.kt diff --git a/selekt-sqlite3/src/main/kotlin/com/bloomberg/selekt/SQLCodes.kt b/selekt-sqlite3-classes/src/main/kotlin/com/bloomberg/selekt/SQLCodes.kt similarity index 100% rename from selekt-sqlite3/src/main/kotlin/com/bloomberg/selekt/SQLCodes.kt rename to selekt-sqlite3-classes/src/main/kotlin/com/bloomberg/selekt/SQLCodes.kt diff --git a/selekt-sqlite3/build.gradle.kts b/selekt-sqlite3/build.gradle.kts index 695a2c371c..db486ba2d0 100644 --- a/selekt-sqlite3/build.gradle.kts +++ b/selekt-sqlite3/build.gradle.kts @@ -18,14 +18,8 @@ import java.nio.file.Files import java.nio.file.Paths import java.util.Locale -repositories { - mavenCentral() -} - plugins { - kotlin("jvm") - `maven-publish` - signing + base } val cFlags = arrayOf( @@ -64,23 +58,6 @@ val cFlags = arrayOf( "-DSQLITE_USE_URI=1" ) -disableKotlinCompilerAssertions() - -java { - withJavadocJar() - withSourcesJar() -} - -publishing { - publications.register("main") { - from(components.getByName("java")) - pom { - commonInitialisation(project) - description.set("Selekt Java SQLite interface library.") - } - } -} - tasks.register("configureSqlCipher") { workingDir = File("$projectDir/src/main/external/sqlcipher") commandLine("./configure") diff --git a/settings.gradle.kts b/settings.gradle.kts index 63fdd258ba..efd9aab967 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -26,6 +26,7 @@ include(":selekt-android-sqlcipher") include(":selekt-api") include(":selekt-java") include(":selekt-sqlite3") +include(":selekt-sqlite3-classes") pluginManagement { repositories { From 6962d8cc527cee4271a8f3f4be4f22543f933c7b Mon Sep 17 00:00:00 2001 From: "Kenneth J. Shackleton" Date: Sun, 4 Feb 2024 14:08:12 +0000 Subject: [PATCH 2/3] Move applying Detekt to each subproject. Signed-off-by: Kenneth J. Shackleton --- AndroidCLI/build.gradle.kts | 1 + AndroidLibBenchmark/build.gradle.kts | 1 + Selektric/build.gradle.kts | 4 ---- build.gradle.kts | 21 ++++++++++----------- selekt-android-lint/build.gradle.kts | 1 + selekt-android-sqlcipher/build.gradle.kts | 1 + selekt-android/build.gradle.kts | 1 + selekt-api/build.gradle.kts | 1 + selekt-java/build.gradle.kts | 1 + selekt-sqlite3-classes/build.gradle.kts | 1 + 10 files changed, 18 insertions(+), 15 deletions(-) diff --git a/AndroidCLI/build.gradle.kts b/AndroidCLI/build.gradle.kts index 2e521684ce..ce3f628aee 100644 --- a/AndroidCLI/build.gradle.kts +++ b/AndroidCLI/build.gradle.kts @@ -17,6 +17,7 @@ plugins { id("com.android.application") id("kotlin-android") + id("io.gitlab.arturbosch.detekt") } repositories { diff --git a/AndroidLibBenchmark/build.gradle.kts b/AndroidLibBenchmark/build.gradle.kts index 29f6ac6b1d..882e2bc006 100644 --- a/AndroidLibBenchmark/build.gradle.kts +++ b/AndroidLibBenchmark/build.gradle.kts @@ -18,6 +18,7 @@ plugins { id("com.android.library") id("kotlin-android") id("androidx.benchmark") version Versions.ANDROID_BENCHMARK.version + id("io.gitlab.arturbosch.detekt") } repositories { diff --git a/Selektric/build.gradle.kts b/Selektric/build.gradle.kts index 60eb659196..a203d1f273 100644 --- a/Selektric/build.gradle.kts +++ b/Selektric/build.gradle.kts @@ -18,10 +18,6 @@ import java.util.Locale import java.nio.file.Files import java.nio.file.Paths -repositories { - mavenCentral() -} - plugins { base } diff --git a/build.gradle.kts b/build.gradle.kts index 5a03d021ca..d5c59ea9bc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -71,9 +71,6 @@ dependencies { subprojects { group = rootProject.group version = rootProject.version - apply { - plugin("io.gitlab.arturbosch.detekt") - } plugins.withType().configureEach { tasks.withType().configureEach { metaInf { @@ -156,14 +153,16 @@ subprojects { systemProperty(it.key, it.value) } } - configure { - toolVersion = Versions.DETEKT.version - source = files("src") - config = files("${rootProject.projectDir}/config/detekt/config.yml") - buildUponDefaultConfig = true - parallel = false - debug = false - ignoreFailures = false + plugins.withId("io.gitlab.arturbosch.detekt") { + configure { + toolVersion = Versions.DETEKT.version + source = files("src") + config = files("${rootProject.projectDir}/config/detekt/config.yml") + buildUponDefaultConfig = true + parallel = false + debug = false + ignoreFailures = false + } } tasks.withType().configureEach { exclude("**/res/**") diff --git a/selekt-android-lint/build.gradle.kts b/selekt-android-lint/build.gradle.kts index 68845f9b68..6aae3deb1c 100644 --- a/selekt-android-lint/build.gradle.kts +++ b/selekt-android-lint/build.gradle.kts @@ -23,6 +23,7 @@ plugins { kotlin("jvm") `maven-publish` signing + id("io.gitlab.arturbosch.detekt") } java { diff --git a/selekt-android-sqlcipher/build.gradle.kts b/selekt-android-sqlcipher/build.gradle.kts index 09a92b00c6..a383af00bc 100644 --- a/selekt-android-sqlcipher/build.gradle.kts +++ b/selekt-android-sqlcipher/build.gradle.kts @@ -23,6 +23,7 @@ plugins { id("com.android.library") `maven-publish` signing + id("io.gitlab.arturbosch.detekt") } repositories { diff --git a/selekt-android/build.gradle.kts b/selekt-android/build.gradle.kts index 1fc899e039..accf227f40 100644 --- a/selekt-android/build.gradle.kts +++ b/selekt-android/build.gradle.kts @@ -23,6 +23,7 @@ plugins { `maven-publish` signing id("org.jetbrains.kotlinx.kover") + id("io.gitlab.arturbosch.detekt") } repositories { diff --git a/selekt-api/build.gradle.kts b/selekt-api/build.gradle.kts index ef095808a8..72e251073b 100644 --- a/selekt-api/build.gradle.kts +++ b/selekt-api/build.gradle.kts @@ -26,6 +26,7 @@ plugins { `maven-publish` signing id("org.jetbrains.kotlinx.kover") + id("io.gitlab.arturbosch.detekt") } java { diff --git a/selekt-java/build.gradle.kts b/selekt-java/build.gradle.kts index cd06931462..5386b00adc 100644 --- a/selekt-java/build.gradle.kts +++ b/selekt-java/build.gradle.kts @@ -31,6 +31,7 @@ plugins { `maven-publish` signing id("bb-jmh") + id("io.gitlab.arturbosch.detekt") } disableKotlinCompilerAssertions() diff --git a/selekt-sqlite3-classes/build.gradle.kts b/selekt-sqlite3-classes/build.gradle.kts index 0ec748eafc..6006408558 100644 --- a/selekt-sqlite3-classes/build.gradle.kts +++ b/selekt-sqlite3-classes/build.gradle.kts @@ -22,6 +22,7 @@ plugins { kotlin("jvm") `maven-publish` signing + id("io.gitlab.arturbosch.detekt") } disableKotlinCompilerAssertions() From 8a77ed69441c11b37a3e2c8914b3acf5c2e93204 Mon Sep 17 00:00:00 2001 From: "Kenneth J. Shackleton" Date: Sun, 4 Feb 2024 14:30:45 +0000 Subject: [PATCH 3/3] Move applying Ktlint to each subproject. Signed-off-by: Kenneth J. Shackleton --- AndroidCLI/build.gradle.kts | 1 + AndroidLibBenchmark/build.gradle.kts | 1 + build.gradle.kts | 15 +++++++-------- selekt-android-lint/build.gradle.kts | 1 + selekt-android/build.gradle.kts | 1 + selekt-api/build.gradle.kts | 1 + selekt-java/build.gradle.kts | 1 + selekt-sqlite3-classes/build.gradle.kts | 1 + 8 files changed, 14 insertions(+), 8 deletions(-) diff --git a/AndroidCLI/build.gradle.kts b/AndroidCLI/build.gradle.kts index ce3f628aee..0e705de5e7 100644 --- a/AndroidCLI/build.gradle.kts +++ b/AndroidCLI/build.gradle.kts @@ -18,6 +18,7 @@ plugins { id("com.android.application") id("kotlin-android") id("io.gitlab.arturbosch.detekt") + id("org.jlleitschuh.gradle.ktlint") } repositories { diff --git a/AndroidLibBenchmark/build.gradle.kts b/AndroidLibBenchmark/build.gradle.kts index 882e2bc006..035a70b43d 100644 --- a/AndroidLibBenchmark/build.gradle.kts +++ b/AndroidLibBenchmark/build.gradle.kts @@ -19,6 +19,7 @@ plugins { id("kotlin-android") id("androidx.benchmark") version Versions.ANDROID_BENCHMARK.version id("io.gitlab.arturbosch.detekt") + id("org.jlleitschuh.gradle.ktlint") } repositories { diff --git a/build.gradle.kts b/build.gradle.kts index d5c59ea9bc..17f7f934f6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -201,14 +201,13 @@ subprojects { } allprojects { - apply { - plugin("org.jlleitschuh.gradle.ktlint") - } - configure { - version.set(Versions.KTLINT.version) - disabledRules.set(setOf("import-ordering", "indent", "wrapping")) - reporters { - reporter(ReporterType.HTML) + plugins.withId("org.jlleitschuh.gradle.ktlint") { + configure { + version.set(Versions.KTLINT.version) + disabledRules.set(setOf("import-ordering", "indent", "wrapping")) + reporters { + reporter(ReporterType.HTML) + } } } tasks.withType().configureEach { diff --git a/selekt-android-lint/build.gradle.kts b/selekt-android-lint/build.gradle.kts index 6aae3deb1c..c82b5381c3 100644 --- a/selekt-android-lint/build.gradle.kts +++ b/selekt-android-lint/build.gradle.kts @@ -24,6 +24,7 @@ plugins { `maven-publish` signing id("io.gitlab.arturbosch.detekt") + id("org.jlleitschuh.gradle.ktlint") } java { diff --git a/selekt-android/build.gradle.kts b/selekt-android/build.gradle.kts index accf227f40..e60154253a 100644 --- a/selekt-android/build.gradle.kts +++ b/selekt-android/build.gradle.kts @@ -24,6 +24,7 @@ plugins { signing id("org.jetbrains.kotlinx.kover") id("io.gitlab.arturbosch.detekt") + id("org.jlleitschuh.gradle.ktlint") } repositories { diff --git a/selekt-api/build.gradle.kts b/selekt-api/build.gradle.kts index 72e251073b..a2fb70ffa7 100644 --- a/selekt-api/build.gradle.kts +++ b/selekt-api/build.gradle.kts @@ -27,6 +27,7 @@ plugins { signing id("org.jetbrains.kotlinx.kover") id("io.gitlab.arturbosch.detekt") + id("org.jlleitschuh.gradle.ktlint") } java { diff --git a/selekt-java/build.gradle.kts b/selekt-java/build.gradle.kts index 5386b00adc..75e0d36972 100644 --- a/selekt-java/build.gradle.kts +++ b/selekt-java/build.gradle.kts @@ -32,6 +32,7 @@ plugins { signing id("bb-jmh") id("io.gitlab.arturbosch.detekt") + id("org.jlleitschuh.gradle.ktlint") } disableKotlinCompilerAssertions() diff --git a/selekt-sqlite3-classes/build.gradle.kts b/selekt-sqlite3-classes/build.gradle.kts index 6006408558..5c9fdeee2e 100644 --- a/selekt-sqlite3-classes/build.gradle.kts +++ b/selekt-sqlite3-classes/build.gradle.kts @@ -23,6 +23,7 @@ plugins { `maven-publish` signing id("io.gitlab.arturbosch.detekt") + id("org.jlleitschuh.gradle.ktlint") } disableKotlinCompilerAssertions()