Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,16 @@ insert_final_newline = true
max_line_length = 125
trim_trailing_whitespace = true

ktlint_experimental = disabled
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_block-wrapping = disabled
ktlint_standard_chain-wrapping = disabled
ktlint_standard_function-expression-body = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_import-ordering = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_parameter-list-wrapping = disabled
ktlint_standard_property-wrapping = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_wrapping = disabled
6 changes: 3 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
run: ./gradlew licensee --no-configuration-cache

- name: 'Analyse'
run: ./gradlew detekt ktlintCheck lint -x lintRelease ${{ env.SCAN }}
run: ./gradlew detekt lint -x lintRelease ${{ env.SCAN }}

- name: 'Archive analysis reports'
uses: actions/upload-artifact@v6
Expand All @@ -182,7 +182,7 @@ jobs:
**/build/reports/detekt

- name: 'Unit tests'
run: ./gradlew :selekt-android:testDebugUnitTest :selekt-java:test :selekt-sqlite3-classes:testJava17 :selekt-sqlite3-classes:testJava25 :selekt-common:test :koverHtmlReport -x integrationTest ${{ env.SCAN }}
run: ./gradlew :selekt-android:testDebugUnitTest :selekt-java:test :selekt-jdbc:test :selekt-sqlite3-classes:testJava17 :selekt-sqlite3-classes:testJava25 :selekt-common:test :koverHtmlReport -x integrationTest ${{ env.SCAN }}

- name: 'Archive test reports'
uses: actions/upload-artifact@v6
Expand All @@ -202,7 +202,7 @@ jobs:

- name: 'Build Selekt JVM'
run: |
./gradlew :selekt-jvm:jar ${{ env.SCAN }}
./gradlew :selekt-jdbc:jar :selekt-jvm:jar ${{ env.SCAN }}

- name: 'Verify coverage'
run:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publication.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:
echo "org.gradle.java.home=${JAVA_HOME}" >> gradle.properties

- name: 'Unit tests'
run: ./gradlew :selekt-android:testDebugUnitTest :selekt-java:test :selekt-sqlite3-classes:testJava17 :selekt-sqlite3-classes:testJava25 :selekt-common:test -x integrationTest ${{ env.SCAN }}
run: ./gradlew :selekt-android:testDebugUnitTest :selekt-java:test :selekt-jdbc:test :selekt-sqlite3-classes:testJava17 :selekt-sqlite3-classes:testJava25 :selekt-common:test -x integrationTest ${{ env.SCAN }}

- name: 'Build Selekt Android'
run: |
Expand All @@ -224,7 +224,7 @@ jobs:

- name: 'Build Selekt JVM'
run: |
./gradlew :selekt-jvm:jar ${{ env.SCAN }}
./gradlew :selekt-jdbc:jar :selekt-jvm:jar ${{ env.SCAN }}

- name: 'Publish release to OSSRH'
if: github.event_name == 'release' && github.event.action == 'published'
Expand Down
3 changes: 1 addition & 2 deletions AndroidCLI/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ plugins {
id("com.android.application")
id("kotlin-android")
alias(libs.plugins.detekt)
alias(libs.plugins.ktlint)
}

repositories {
Expand All @@ -31,7 +30,7 @@ android {
namespace = "com.bloomberg.selekt.cli"
defaultConfig {
applicationId = "com.bloomberg.selekt.cli"
minSdk = 21
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "0.1"
Expand Down
3 changes: 1 addition & 2 deletions AndroidLibBenchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ plugins {
id("kotlin-android")
alias(libs.plugins.androidx.benchmark)
alias(libs.plugins.detekt)
alias(libs.plugins.ktlint)
}

repositories {
Expand All @@ -31,7 +30,7 @@ android {
compileSdkVersion(Versions.ANDROID_SDK.version.toInt())
namespace = "com.bloomberg.selekt.android.benchmark"
defaultConfig {
minSdkVersion(21)
minSdkVersion(24)
targetSdkVersion(34)
testInstrumentationRunner = "androidx.benchmark.junit4.AndroidBenchmarkRunner"
testInstrumentationRunnerArguments.putAll(arrayOf(
Expand Down
14 changes: 14 additions & 0 deletions SQLite3/sqlite3_jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ Java_com_bloomberg_selekt_ExternalSQLite_bindParameterCount(
return sqlite3_bind_parameter_count(statement);
}

extern "C" JNIEXPORT jint JNICALL
Java_com_bloomberg_selekt_ExternalSQLite_bindParameterIndex(
JNIEnv* env,
jobject obj,
jlong jstatement,
jstring jname
) {
auto statement = reinterpret_cast<sqlite3_stmt*>(jstatement);
auto name = env->GetStringUTFChars(jname, nullptr);
auto result = sqlite3_bind_parameter_index(statement, name);
env->ReleaseStringUTFChars(jname, name);
return result;
}

extern "C" JNIEXPORT jint JNICALL
Java_com_bloomberg_selekt_ExternalSQLite_bindText(
JNIEnv* env,
Expand Down
21 changes: 2 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@ import org.jetbrains.gradle.ext.copyright
import org.jetbrains.gradle.ext.settings
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
import org.jlleitschuh.gradle.ktlint.tasks.GenerateReportsTask

plugins {
base
alias(libs.plugins.dokka)
alias(libs.plugins.kover)
alias(libs.plugins.nexus)
alias(libs.plugins.detekt)
alias(libs.plugins.ktlint)
alias(libs.plugins.ideaExt)
alias(libs.plugins.qodana)
alias(libs.plugins.ksp) apply false
Expand Down Expand Up @@ -71,6 +67,7 @@ dependencies {
kover(projects.selektApi)
kover(projects.selektCommons)
kover(projects.selektJava)
kover(projects.selektJdbc)
kover(projects.selektJvm)
kover(projects.selektSqlite3Classes)
}
Expand Down Expand Up @@ -212,20 +209,6 @@ subprojects {
}
}

allprojects {
plugins.withId("org.jlleitschuh.gradle.ktlint") {
configure<KtlintExtension> {
disabledRules.set(setOf("import-ordering", "indent", "wrapping"))
reporters {
reporter(ReporterType.HTML)
}
}
}
tasks.withType<GenerateReportsTask>().configureEach {
reportsOutputDirectory.set(rootProject.layout.buildDirectory.dir("reports/ktlint/${project.name}/$name"))
}
}

koverReport {
defaults {
filters {
Expand All @@ -240,7 +223,7 @@ koverReport {
verify {
rule("Minimal coverage") {
bound {
minValue = 96
minValue = 92
aggregation = AggregationType.COVERED_PERCENTAGE
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-c
mockito-core = { module = "org.mockito:mockito-core", version = "5.21.0" }
mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version = "6.2.1" }
robolectric-android-all = { module = "org.robolectric:android-all", version = "12.1-robolectric-8229987" }
slf4j-api = { module = "org.slf4j:slf4j-api", version = "2.0.17" }
xerial-sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version = "3.51.1.0" }

[bundles]
Expand All @@ -49,7 +50,6 @@ ideaExt = { id = "org.jetbrains.gradle.plugin.idea-ext", version = "1.1.7" }
jmh = { id = "me.champeau.jmh", version = "0.7.3" }
kover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.6" }
ksp = { id = "com.google.devtools.ksp", version = "2.3.4" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "11.5.0" }
nexus = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" }
qodana = { id = "org.jetbrains.qodana", version = "0.1.12" }
undercouch-download = { id = "de.undercouch.download", version = "5.4.0" }
1 change: 0 additions & 1 deletion selekt-android-lint/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ plugins {
`maven-publish`
signing
alias(libs.plugins.detekt)
alias(libs.plugins.ktlint)
}

repositories {
Expand Down
3 changes: 1 addition & 2 deletions selekt-android-sqlcipher/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ plugins {
`maven-publish`
signing
alias(libs.plugins.detekt)
alias(libs.plugins.ktlint)
}

repositories {
Expand All @@ -43,7 +42,7 @@ android {
namespace = "com.bloomberg.selekt.android.sqlcipher"
ndkVersion = "27.3.13750724"
defaultConfig {
minSdk = 21
minSdk = 24
@Suppress("UnstableApiUsage")
externalNativeBuild {
cmake {
Expand Down
3 changes: 1 addition & 2 deletions selekt-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ plugins {
signing
alias(libs.plugins.kover)
alias(libs.plugins.detekt)
alias(libs.plugins.ktlint)
}

repositories {
Expand All @@ -41,7 +40,7 @@ android {
compileSdk = Versions.ANDROID_SDK.version.toInt()
namespace = "com.bloomberg.selekt.android"
defaultConfig {
minSdk = 21
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
1 change: 0 additions & 1 deletion selekt-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ plugins {
signing
alias(libs.plugins.detekt)
alias(libs.plugins.kover)
alias(libs.plugins.ktlint)
}

repositories {
Expand Down
66 changes: 66 additions & 0 deletions selekt-api/src/main/kotlin/com/bloomberg/selekt/ISQLProgram.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.bloomberg.selekt

import java.io.Closeable

@Suppress("Detekt.ComplexInterface", "Detekt.TooManyFunctions")
interface ISQLProgram : Closeable {
/**
* Bind a byte array value to this statement. The value remains bound until [clearBindings] is called.
Expand All @@ -27,6 +28,17 @@ interface ISQLProgram : Closeable {
*/
fun bindBlob(index: Int, value: ByteArray)

/**
* Bind a byte array value to this statement by parameter name. The value remains bound until [clearBindings] is called.
*
* Named parameters in SQLite can use the following syntax: :name, @name, or $name.
*
* @param name The name of the parameter to bind (including the prefix character like :, @, or $).
* @param value The value to bind.
* @throws IllegalArgumentException if the parameter name is not found.
*/
fun bindBlob(name: String, value: ByteArray)

/**
* Bind a double value to this statement. The value remains bound until [clearBindings] is called.
*
Expand All @@ -35,6 +47,17 @@ interface ISQLProgram : Closeable {
*/
fun bindDouble(index: Int, value: Double)

/**
* Bind a double value to this statement by parameter name. The value remains bound until [clearBindings] is called.
*
* Named parameters in SQLite can use the following syntax: :name, @name, or $name.
*
* @param name The name of the parameter to bind (including the prefix character like :, @, or $).
* @param value The value to bind.
* @throws IllegalArgumentException if the parameter name is not found.
*/
fun bindDouble(name: String, value: Double)

/**
* Bind an integer value to this statement. The value remains bound until [clearBindings] is called.
*
Expand All @@ -43,6 +66,17 @@ interface ISQLProgram : Closeable {
*/
fun bindInt(index: Int, value: Int)

/**
* Bind an integer value to this statement by parameter name. The value remains bound until [clearBindings] is called.
*
* Named parameters in SQLite can use the following syntax: :name, @name, or $name.
*
* @param name The name of the parameter to bind (including the prefix character like :, @, or $).
* @param value The value to bind.
* @throws IllegalArgumentException if the parameter name is not found.
*/
fun bindInt(name: String, value: Int)

/**
* Bind a long value to this statement. The value remains bound until [clearBindings] is called.
*
Expand All @@ -51,13 +85,34 @@ interface ISQLProgram : Closeable {
*/
fun bindLong(index: Int, value: Long)

/**
* Bind a long value to this statement by parameter name. The value remains bound until [clearBindings] is called.
*
* Named parameters in SQLite can use the following syntax: :name, @name, or $name.
*
* @param name The name of the parameter to bind (including the prefix character like :, @, or $).
* @param value The value to bind.
* @throws IllegalArgumentException if the parameter name is not found.
*/
fun bindLong(name: String, value: Long)

/**
* Bind a null value to this statement. The value remains bound until [clearBindings] is called.
*
* @param index The 1-based index to the parameter to bind.
*/
fun bindNull(index: Int)

/**
* Bind a null value to this statement by parameter name. The value remains bound until [clearBindings] is called.
*
* Named parameters in SQLite can use the following syntax: :name, @name, or $name.
*
* @param name The name of the parameter to bind (including the prefix character like :, @, or $).
* @throws IllegalArgumentException if the parameter name is not found.
*/
fun bindNull(name: String)

/**
* Bind a String value to this statement. The value remains bound until [clearBindings] is called.
*
Expand All @@ -66,6 +121,17 @@ interface ISQLProgram : Closeable {
*/
fun bindString(index: Int, value: String)

/**
* Bind a String value to this statement by parameter name. The value remains bound until [clearBindings] is called.
*
* Named parameters in SQLite can use the following syntax: :name, @name, or $name.
*
* @param name The name of the parameter to bind (including the prefix character like :, @, or $).
* @param value The value to bind.
* @throws IllegalArgumentException if the parameter name is not found.
*/
fun bindString(name: String, value: String)

/**
* Clears all existing bindings. Unset bindings are treated as null.
*/
Expand Down
1 change: 1 addition & 0 deletions selekt-bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
selektAndroidSqlcipher,
selektApi,
selektJava,
selektJdbc,
selektSqlite3Classes,
selektSqlite3Sqlcipher
)
Expand Down
1 change: 0 additions & 1 deletion selekt-commons/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ plugins {
`maven-publish`
signing
alias(libs.plugins.detekt)
alias(libs.plugins.ktlint)
}

repositories {
Expand Down
3 changes: 2 additions & 1 deletion selekt-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ plugins {
signing
alias(libs.plugins.jmh)
alias(libs.plugins.detekt)
alias(libs.plugins.ktlint)
}

repositories {
Expand Down Expand Up @@ -76,6 +75,8 @@ dependencies {
requireCapability("com.bloomberg.selekt:selekt-sqlite3-classes-java17")
}
}
jmhImplementation(projects.selektJdbc)
jmhImplementation(projects.selektSqlite3Sqlcipher)
jmhImplementation(libs.kotlinx.coroutines.core)
jmhImplementation(libs.xerial.sqlite.jdbc)
}
Expand Down
Loading