Skip to content

Commit

Permalink
Merge branch 'main' into sqlcipher-4.5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethshackleton authored Feb 5, 2024
2 parents 5db2cc1 + bbf2524 commit 849a84f
Show file tree
Hide file tree
Showing 24 changed files with 199 additions and 73 deletions.
2 changes: 2 additions & 0 deletions AndroidCLI/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
plugins {
id("com.android.application")
id("kotlin-android")
id("io.gitlab.arturbosch.detekt")
id("org.jlleitschuh.gradle.ktlint")
}

repositories {
Expand Down
2 changes: 2 additions & 0 deletions AndroidLibBenchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ plugins {
id("com.android.library")
id("kotlin-android")
id("androidx.benchmark") version Versions.ANDROID_BENCHMARK.version
id("io.gitlab.arturbosch.detekt")
id("org.jlleitschuh.gradle.ktlint")
}

repositories {
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
Change Log
==========

## Version 0.22.0

Warning: This release decouples the choice of SQLite implementation from the main Android artifact, and requires an additional dependency declaration. Please refer to the [getting started](https://bloomberg.github.io/selekt/getting_started/#integration) guide.

### Fixes

* Use Kotlin's `Enum.entries` instead of `Enum.values()`.
* Decouple the choice of SQLite implementation from the main Android artifact.
* Publish a BOM.

### Dependencies

* Android SDK 34.
* Dokka 1.9.10.
* Gradle 8.6.
* Junit 5.10.1.
* Kotlin 1.9.22.
* Kotlin Coroutines 1.7.3.
* Mockito 5.10.0.
* Mockito-Kotlin 5.2.1.
* NDK 26.1.
* Room 2.6.1.

## Version 0.21.0

Warning: This release migrates from OpenSSL 1.1.1v to OpenSSL 3.1.2.
Expand Down
4 changes: 0 additions & 4 deletions Selektric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ import java.util.Locale
import java.nio.file.Files
import java.nio.file.Paths

repositories {
mavenCentral()
}

plugins {
base
}
Expand Down
2 changes: 1 addition & 1 deletion Selektric/native_mocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static jstring SystemProperties_get(
jstring keyJ,
jstring defJ
) {
auto key = env->GetStringUTFChars(keyJ, NULL);
auto key = env->GetStringUTFChars(keyJ, nullptr);
if (strcmp("ro.product.cpu.abilist", key)) {
env->ReleaseStringUTFChars(keyJ, key);
return env->NewStringUTF("arm64-v8a,armeabi-v7a");
Expand Down
37 changes: 18 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ dependencies {
kover(projects.selektAndroid)
kover(projects.selektApi)
kover(projects.selektJava)
kover(projects.selektSqlite3Classes)
ktlint("com.pinterest:ktlint:${Versions.KTLINT}")
}

subprojects {
group = rootProject.group
version = rootProject.version
apply {
plugin("io.gitlab.arturbosch.detekt")
}
plugins.withType<JavaPlugin>().configureEach {
tasks.withType<Jar>().configureEach {
metaInf {
Expand Down Expand Up @@ -156,14 +154,16 @@ subprojects {
systemProperty(it.key, it.value)
}
}
configure<DetektExtension> {
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<DetektExtension> {
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<Detekt>().configureEach {
exclude("**/res/**")
Expand Down Expand Up @@ -202,14 +202,13 @@ subprojects {
}

allprojects {
apply {
plugin("org.jlleitschuh.gradle.ktlint")
}
configure<KtlintExtension> {
version.set(Versions.KTLINT.version)
disabledRules.set(setOf("import-ordering", "indent", "wrapping"))
reporters {
reporter(ReporterType.HTML)
plugins.withId("org.jlleitschuh.gradle.ktlint") {
configure<KtlintExtension> {
version.set(Versions.KTLINT.version)
disabledRules.set(setOf("import-ordering", "indent", "wrapping"))
reporters {
reporter(ReporterType.HTML)
}
}
}
tasks.withType<GenerateReportsTask>().configureEach {
Expand Down
8 changes: 6 additions & 2 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
}

dependencies {
implementation("com.bloomberg:selekt-android:<version>")
implementation(platform("com.bloomberg:selekt-bom:<version>"))
implementation("com.bloomberg:selekt-android")
implementation("com.bloomberg:selekt-android-sqlcipher")
}
```

Expand All @@ -20,7 +22,9 @@
}

dependencies {
implementation 'com.bloomberg:selekt-android:<version>'
implementation platform('com.bloomberg:selekt-bom:<version>'))
implementation 'com.bloomberg:selekt-android'
implementation 'com.bloomberg:selekt-android-sqlcipher'
}
```

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
selekt.versionName=0.21.0
selekt.nextVersionName=0.22.0
selekt.versionName=0.22.0
selekt.nextVersionName=0.23.0

openssl.version=3.1.2
openssl.sha256=a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539
Expand Down
2 changes: 2 additions & 0 deletions selekt-android-lint/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ plugins {
kotlin("jvm")
`maven-publish`
signing
id("io.gitlab.arturbosch.detekt")
id("org.jlleitschuh.gradle.ktlint")
}

java {
Expand Down
32 changes: 28 additions & 4 deletions selekt-android-sqlcipher/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,39 @@ logger.quiet("SQLCipher version: {}", sqlcipherVersionName)

plugins {
id("com.android.library")
id("kotlin-android")
`maven-publish`
signing
id("io.gitlab.arturbosch.detekt")
}

repositories {
mavenCentral()
google()
}

val developmentABIs = listOf("arm64-v8a")
val allABIs = listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")

android {
compileSdk = Versions.ANDROID_SDK.version.toInt()
buildToolsVersion = Versions.ANDROID_BUILD_TOOLS.version
namespace = "com.bloomberg.selekt.android.sqlcipher"
ndkVersion = Versions.ANDROID_NDK.version
defaultConfig {
minSdk = 21
ndk {
abiFilters.addAll(listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64"))
}
buildTypes {
debug {
ndk {
abiFilters.addAll(developmentABIs)
}
}
release {
isMinifyEnabled = false
ndk {
abiFilters.addAll(allABIs)
}
}
}
externalNativeBuild {
Expand All @@ -52,8 +67,17 @@ android {
}
}

tasks.withType<ExternalNativeBuildJsonTask>().configureEach {
dependsOn(":OpenSSL:assembleAndroid", ":selekt-sqlite3:amalgamate")
dependencies {
implementation(projects.selektJava)
implementation(projects.selektSqlite3Classes)
}

allABIs.forEach { abi ->
tasks.matching {
it is ExternalNativeBuildJsonTask && it.name.contains(abi)
}.configureEach {
dependsOn(":OpenSSL:assemble${abi.replaceFirstChar(Char::uppercaseChar)}", ":selekt-sqlite3:amalgamate")
}
}

components.matching { "release" == it.name }.configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

package com.bloomberg.selekt.android

import com.bloomberg.selekt.ExternalSQLite
import com.bloomberg.selekt.SQLite
import com.bloomberg.selekt.commons.loadEmbeddedLibrary
import com.bloomberg.selekt.externalSQLiteSingleton

private const val CAN_USE_EMBEDDED_PROPERTY_KEY = "com.bloomberg.selekt.lib.can_use_embedded"

internal val sqlite = externalSQLiteSingleton {
fun loadSQLite(): ExternalSQLite = externalSQLiteSingleton {
"selekt".let {
try {
System.loadLibrary(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.bloomberg.selekt.android

import com.bloomberg.selekt.ExternalSQLite
import com.bloomberg.selekt.externalSQLiteSingleton

internal val sqlite = externalSQLiteSingleton()
fun loadSQLite(): ExternalSQLite = externalSQLiteSingleton()
14 changes: 5 additions & 9 deletions selekt-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ plugins {
`maven-publish`
signing
id("org.jetbrains.kotlinx.kover")
id("io.gitlab.arturbosch.detekt")
id("org.jlleitschuh.gradle.ktlint")
}

repositories {
Expand All @@ -40,18 +42,11 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
buildConfigField("Boolean", "USE_EMBEDDED_LIBS", "true")
}
release {
isMinifyEnabled = false
buildConfigField("Boolean", "USE_EMBEDDED_LIBS", "false")
buildConfigField("String", "gitCommitSha1", "\"${gitCommit()}\"")
}
}
arrayOf("debug", "main", "release", "test").forEach {
sourceSets[it].java.srcDir("src/$it/kotlin")
}
sourceSets["test"].resources.srcDir(layout.buildDirectory.dir("intermediates/libs"))
publishing {
singleVariant("release") {
Expand All @@ -63,15 +58,16 @@ android {

dependencies {
api(projects.selektApi)
compileOnly(projects.selektAndroidSqlcipher)
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))
testImplementation(androidX("room", "ktx", Versions.ANDROIDX_ROOM.version))
testImplementation("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT5}")
testRuntimeOnly(projects.selektAndroidSqlcipher)
testRuntimeOnly("org.robolectric:android-all:${Versions.ROBOLECTRIC_ANDROID_ALL}")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ import com.bloomberg.selekt.SQL_RANGE
import com.bloomberg.selekt.SQL_READONLY
import com.bloomberg.selekt.SQL_TOO_BIG

internal val sqlite = loadSQLite()

object Selekt {
internal const val TAG = "SLKT"

Expand Down
2 changes: 2 additions & 0 deletions selekt-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ plugins {
`maven-publish`
signing
id("org.jetbrains.kotlinx.kover")
id("io.gitlab.arturbosch.detekt")
id("org.jlleitschuh.gradle.ktlint")
}

java {
Expand Down
46 changes: 46 additions & 0 deletions selekt-bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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.
*/

plugins {
`java-platform`
`maven-publish`
signing
}

dependencies {
constraints {
projects.run {
listOf(
selektAndroid,
selektAndroidLint,
selektAndroidSqlcipher,
selektApi,
selektJava,
selektSqlite3Classes
)
}.forEach(::api)
}
}

publishing {
publications.register<MavenPublication>("main") {
from(components.getByName("javaPlatform"))
pom {
commonInitialisation(project)
description.set("Selekt BOM.")
}
}
}
Loading

0 comments on commit 849a84f

Please sign in to comment.