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
12 changes: 7 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- name: Upload Test Reports
uses: actions/upload-artifact@v4
if: ${{ always() }}
if: always()
with:
name: test-report-${{ matrix.os }}
path: '**/build/reports/tests/**'
Expand All @@ -56,7 +56,7 @@ jobs:
strategy:
fail-fast: false
matrix:
api-level: [ 21, 23, 24, 26, 29, 30, 31, 32, 33, 34 ]
api-level: [ 21, 23, 24, 26, 29, 30, 31, 32, 33, 34, 35 ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -82,12 +82,14 @@ jobs:
emulator-boot-timeout: 300 # 5 minutes
api-level: ${{ matrix.api-level }}
arch: x86_64
script: ./gradlew :library:driver-test:connectedCheck -PKMP_TARGETS="ANDROID,JVM"
script: ./gradlew connectedCheck -PKMP_TARGETS="ANDROID,JVM"

- name: Upload Test Reports
uses: actions/upload-artifact@v4
if: ${{ always() }}
if: always()
with:
name: test-report-android-${{ matrix.api-level }}
path: '**/build/reports/androidTests/**'
path: |
**/build/reports/androidTests/**
**/build/outputs/androidTest-results/connected/debug/*/logcat-*.txt
retention-days: 1
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,15 +409,15 @@ I'm guessing this is not really a factor on iOS."
[badge-license]: https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat

<!-- TAG_DEPENDENCIES -->
[badge-kotlin]: https://img.shields.io/badge/kotlin-2.0.21-blue.svg?logo=kotlin
[badge-kotlin]: https://img.shields.io/badge/kotlin-2.1.21-blue.svg?logo=kotlin
[badge-coroutines]: https://img.shields.io/badge/coroutines-1.9.0-blue.svg?logo=kotlin
[badge-encoding]: https://img.shields.io/badge/encoding-2.3.1-blue.svg?style=flat
[badge-immutable]: https://img.shields.io/badge/immutable-0.1.4-blue.svg?style=flat
[badge-encoding]: https://img.shields.io/badge/encoding-2.4.0-blue.svg?style=flat
[badge-immutable]: https://img.shields.io/badge/immutable-0.2.0-blue.svg?style=flat
[badge-sqldelight]: https://img.shields.io/badge/SQLDelight-2.1.0-blue.svg?style=flat
[badge-sqlite]: https://img.shields.io/badge/SQLite3-3.49.1-blue.svg?style=flat
[badge-sqlitemc]: https://img.shields.io/badge/SQLite3MultipleCiphers-2.1.0-blue.svg?style=flat
[badge-sqlite]: https://img.shields.io/badge/SQLite3-3.50.3-blue.svg?style=flat
[badge-sqlitemc]: https://img.shields.io/badge/SQLite3MultipleCiphers-2.2.3-blue.svg?style=flat
[badge-sqliter]: https://img.shields.io/badge/SQLiter-1.3.3-blue.svg?style=flat
[badge-sqlitejdbc]: https://img.shields.io/badge/sqlite--jdbc-3.49.1.0-blue.svg?style=flat
[badge-sqlitejdbc]: https://img.shields.io/badge/sqlite--jdbc-3.50.3.0-blue.svg?style=flat

<!-- TAG_PLATFORMS -->
[badge-platform-android]: http://img.shields.io/badge/-android%20[minSdk%2021]-6EDB8D.svg?style=flat
Expand Down
27 changes: 5 additions & 22 deletions build-logic/src/main/kotlin/-KmpConfigurationExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
@file:Suppress("UnstableApiUsage")

import io.matthewnelson.kmp.configuration.extension.KmpConfigurationExtension
import io.matthewnelson.kmp.configuration.extension.container.target.KmpConfigurationContainerDsl
import io.matthewnelson.kmp.configuration.extension.container.target.TargetAndroidContainer
import org.gradle.api.Action
import org.gradle.api.JavaVersion
import org.gradle.api.tasks.compile.AbstractCompile

fun KmpConfigurationExtension.configureShared(
action: (Action<KmpConfigurationContainerDsl>)? = null,
Expand All @@ -31,22 +28,8 @@ fun KmpConfigurationExtension.configureShared(
}

jvm {
// TODO: Remove once gradle-kmp-configuration-plugin is updated to 0.4.1+
target {
val targetName = name
project.tasks.withType(AbstractCompile::class.java) {
val task = this
if (!task.name.startsWith("compile$targetName", ignoreCase = true)) return@withType
when {
task.name.endsWith("MainJava") -> {}
task.name.endsWith("TestJava") -> {}
else -> return@withType
}
task.sourceCompatibility = JavaVersion.VERSION_1_8.toString()
task.targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
}

compileSourceCompatibility = JavaVersion.VERSION_1_8
compileTargetCompatibility = JavaVersion.VERSION_1_8
kotlinJvmTarget = JavaVersion.VERSION_1_8
}

Expand Down Expand Up @@ -75,8 +58,8 @@ fun KmpConfigurationExtension.configureShared(

fun KmpConfigurationContainerDsl.androidLibrary(
namespace: String,
buildTools: String? = "34.0.0",
compileSdk: Int = 34,
buildTools: String? = "35.0.1",
compileSdk: Int = 35,
minSdk: Int = 21,
javaVersion: JavaVersion = JavaVersion.VERSION_1_8,
action: (Action<TargetAndroidContainer.Library>)? = null,
Expand All @@ -91,7 +74,7 @@ fun KmpConfigurationContainerDsl.androidLibrary(
this.minSdk = minSdk

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments["disableAnalytics"] = "true"
testInstrumentationRunnerArguments["disableAnalytics"] = true.toString()
}

buildTypes {
Expand Down
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ allprojects {
// Only allow snapshot dependencies for non-release versions.
// This would cause a build failure if attempting to make a release
// while depending on a -SNAPSHOT version (such as core or hash).
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://central.sonatype.com/repository/maven-snapshots/")
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ kotlin.mpp.enableCInteropCommonization=true
kotlin.native.cacheKind=none
kotlin.native.ignoreDisabledTargets=true

SONATYPE_HOST=S01
SONATYPE_HOST=CENTRAL_PORTAL
RELEASE_SIGNING_ENABLED=true

GROUP=io.toxicity.sqlite-mc
Expand All @@ -32,7 +32,7 @@ POM_DEVELOPER_ID=toxicity-io
POM_DEVELOPER_NAME=Toxicity
POM_DEVELOPER_URL=https://github.com/toxicity-io/

VERSION_NAME=2.1.0-2.1.0-1-SNAPSHOT
VERSION_NAME=2.1.0-2.2.3-0-SNAPSHOT
# 2.0.0-1.6.4-0-alpha01 = (02 00 00 00) + (01 06 04 00) + 11 = 03 06 04 11
# 2.0.0-1.6.4-0-beta01 = (02 00 00 00) + (01 06 04 00) + 21 = 03 06 04 21
# 2.0.0-1.6.4-0-rc01 = (02 00 00 00) + (01 06 04 00) + 31 = 03 06 04 31
Expand All @@ -42,4 +42,4 @@ VERSION_NAME=2.1.0-2.1.0-1-SNAPSHOT
# 2.1.0-1.6.5-2 = (02 01 00 00) + (01 06 05 00) + 42 = 03 07 05 42
# 2.1.0-1.6.6-0 = (02 01 00 00) + (01 06 06 00) + 40 = 03 07 06 40
# 2.2.1-1.7.0-0 = (02 02 01 00) + (01 07 00 00) + 40 = 03 09 01 40
VERSION_CODE=04020041
VERSION_CODE=04030340
26 changes: 13 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[versions]
androidx-startup = "1.2.0"
androidx-test-core = "1.6.1"
androidx-test-runner = "1.6.2"
androidx-test-core = "1.7.0"
androidx-test-runner = "1.7.0"

encoding = "2.3.1"
encoding = "2.4.0"

gradle-android = "8.5.2"
gradle-binary-compat = "0.17.0"
gradle-build-config = "5.5.4"
gradle-cklib = "0.3.3"
gradle-kmp-configuration = "0.3.2" # TODO: Remove supplemental 0.4.1 fix from build-logic/..../-KmpConfigurationExtension.kt
gradle-kotlin = "2.0.21"
gradle-maven-publish = "0.32.0"
gradle-android = "8.9.3"
gradle-binary-compat = "0.18.1"
gradle-build-config = "5.6.7"
gradle-cklib = "0.3.4"
gradle-kmp-configuration = "0.4.1"
gradle-kotlin = "2.1.21"
gradle-maven-publish = "0.34.0"

immutable = "0.1.4"
immutable = "0.2.0"

kotlinx-coroutines = "1.9.0"
kotlinx-coroutines = "1.10.2"

okio = "3.9.1"
okio = "3.15.0"

sql-delight-dialect = "sqlite-3-38-dialect"
sql-delight = "2.1.0"
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

# https://gradle.org/release-checksums/
distributionSha256Sum=f8b4f4772d302c8ff580bc40d0f56e715de69b163546944f787c87abf209c961
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
distributionSha256Sum=296742a352f0b20ec14b143fb684965ad66086c7810b7b255dee216670716175
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip
3 changes: 2 additions & 1 deletion library/android-unit-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ tasks.withType<KotlinCompile> {
}
}

tasks.getByName("clean") {
tasks.all {
if (name != "clean") return@all
doLast {
projectDir
.resolve("src")
Expand Down
10 changes: 0 additions & 10 deletions library/driver-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,7 @@ plugins {

kmpConfiguration {
configureShared {

androidLibrary(namespace = "io.toxicity.sqlite.mc.driver.test") {
android {
defaultConfig {
// Work-around for installing test apk on 33+ devices, as
// the minimum of 21 will fail to install.
@Suppress("ExpiredTargetSdkVersion", "DEPRECATION")
targetSdk = 23
}
}

sourceSetTest {
findProject(":library:android-unit-test")?.let { androidUnitTest ->
dependencies {
Expand Down
93 changes: 90 additions & 3 deletions library/driver/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import co.touchlab.cklib.gradle.CKlibGradleExtension
import co.touchlab.cklib.gradle.CompileToBitcode.Language.C
import co.touchlab.cklib.gradle.CompileToBitcodeExtension
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.internal.ensureParentDirsCreated
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import org.jetbrains.kotlin.konan.target.Architecture.*
import org.jetbrains.kotlin.konan.target.Family.*
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.konan.target.KonanTarget
import org.jetbrains.kotlin.konan.target.TargetSupportException
import org.jetbrains.kotlin.konan.util.ArchiveType
import org.jetbrains.kotlin.konan.util.DependencyProcessor
import org.jetbrains.kotlin.konan.util.DependencySource
import java.io.IOException
import java.io.InputStream
import java.io.OutputStream
Expand All @@ -37,7 +44,6 @@ private val jdbcRepack = JdbcRepack()

kmpConfiguration {
configureShared {

androidLibrary(namespace = "io.toxicity.sqlite.mc.driver") {
target { publishLibraryVariants("release") }

Expand Down Expand Up @@ -65,6 +71,12 @@ kmpConfiguration {
implementation(files(jdbcRepack.jarSQLiteJDBCAndroid))
}
}
sourceSetTestInstrumented {
dependencies {
implementation(libs.androidx.test.core)
implementation(libs.androidx.test.runner)
}
}
}

jvm {
Expand Down Expand Up @@ -126,7 +138,7 @@ kmpConfiguration {
}

project.extensions.configure<CompileToBitcodeExtension>("cklib") {
config.kotlinVersion = libs.versions.gradle.kotlin.get()
config.configure(libs)

create("sqlite3mc") {
language = C
Expand Down Expand Up @@ -159,6 +171,7 @@ kmpConfiguration {
// Warning/Error suppression flags
buildList {
add("-Wno-sign-compare")
add("-Wno-unused-but-set-variable")
add("-Wno-unused-function")
add("-Wno-unused-parameter")
add("-Wno-unused-variable")
Expand Down Expand Up @@ -257,7 +270,8 @@ kmpConfiguration {
}
}

tasks.getByName("clean") {
tasks.all {
if (name != "clean") return@all
doLast {
projectDir
.resolve("src")
Expand Down Expand Up @@ -570,3 +584,76 @@ private class JdbcRepack {
}
}
}

// CKLib uses too old of a version of LLVM for current version of Kotlin which produces errors for android
// native due to unsupported link arguments. Below is a supplemental implementation to download and use
// the -dev llvm compiler for the current kotlin version.
//
// The following info can be found in ~/.konan/kotlin-native-prebuild-{os}-{arch}-{kotlin version}/konan/konan.properties
private object LLVM {
const val URL: String = "https://download.jetbrains.com/kotlin/native/resources/llvm"
const val VERSION: String = "16.0.0"

// llvm-{llvm version}-{arch}-{host}-dev-{id}
object DevID {
object Linux {
const val x86_64: Int = 80
}
object MacOS {
const val aarch64: Int = 65
const val x86_64: Int = 56
}
object MinGW {
const val x86_64: Int = 56
}
}
}

private fun CKlibGradleExtension.configure(libs: LibrariesForLibs) {
kotlinVersion = libs.versions.gradle.kotlin.get()
check(kotlinVersion == "2.1.21") {
"Kotlin version out of date! Download URLs for LLVM need to be updated for ${project.path}"
}

val host = HostManager.simpleOsName()
val arch = HostManager.hostArch()
val (id, archive) = when (host) {
"linux" -> when (arch) {
"x86_64" -> LLVM.DevID.Linux.x86_64 to ArchiveType.TAR_GZ
else -> null
}
"macos" -> when (arch) {
"aarch64" -> LLVM.DevID.MacOS.aarch64 to ArchiveType.TAR_GZ
"x86_64" -> LLVM.DevID.MacOS.x86_64 to ArchiveType.TAR_GZ
else -> null
}
"windows" -> when (arch) {
"x86_64" -> LLVM.DevID.MinGW.x86_64 to ArchiveType.ZIP
else -> null
}
else -> null
} ?: throw TargetSupportException("Unsupported host[$host] or arch[$arch]")

val llvmDev = "llvm-${LLVM.VERSION}-${arch}-${host}-dev-${id}"
val cklibDir = File(System.getProperty("user.home")).resolve(".cklib")
llvmHome = cklibDir.resolve(llvmDev).path

val source = DependencySource.Remote.Public(subDirectory = "${LLVM.VERSION}-${arch}-${host}")

DependencyProcessor(
dependenciesRoot = cklibDir,
dependenciesUrl = LLVM.URL,
dependencyToCandidates = mapOf(llvmDev to listOf(source)),
homeDependencyCache = cklibDir.resolve("cache"),
customProgressCallback = { _, currentBytes, totalBytes ->
val total = totalBytes.toString()
var current = currentBytes.toString()
while (current.length < 15 && current.length < total.length) {
current = " $current"
}

println("Downloading[$llvmDev] - $current / $total")
},
archiveType = archive,
).run()
}
7 changes: 2 additions & 5 deletions tools/check-publication/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ plugins {
}

repositories {
val host = "https://s01.oss.sonatype.org"

if (version.toString().endsWith("-SNAPSHOT")) {
maven("$host/content/repositories/snapshots/")
maven("https://central.sonatype.com/repository/maven-snapshots/")
} else {
maven("$host/content/groups/staging") {
maven("https://ossrh-staging-api.central.sonatype.com/service/local/") {
val p = rootProject.properties

credentials {
username = p["mavenCentralUsername"]?.toString()
password = p["mavenCentralPassword"]?.toString()
Expand Down
Loading