Skip to content

Commit 1576634

Browse files
authored
Update dependencies (#151)
* Update kotlin: 2.0.21 -> 2.1.21 * Update kotlinx-coroutines: 1.9.0 -> 1.10.2 * Update immutable: 0.1.4 -> 0.2.0 * Update encoding: 2.3.1 -> 2.4.0
1 parent 0485c03 commit 1576634

File tree

11 files changed

+131
-72
lines changed

11 files changed

+131
-72
lines changed

.github/workflows/CI.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
4646
- name: Upload Test Reports
4747
uses: actions/upload-artifact@v4
48-
if: ${{ always() }}
48+
if: always()
4949
with:
5050
name: test-report-${{ matrix.os }}
5151
path: '**/build/reports/tests/**'
@@ -56,7 +56,7 @@ jobs:
5656
strategy:
5757
fail-fast: false
5858
matrix:
59-
api-level: [ 21, 23, 24, 26, 29, 30, 31, 32, 33, 34 ]
59+
api-level: [ 21, 23, 24, 26, 29, 30, 31, 32, 33, 34, 35 ]
6060
steps:
6161
- name: Checkout Repository
6262
uses: actions/checkout@v4
@@ -82,12 +82,14 @@ jobs:
8282
emulator-boot-timeout: 300 # 5 minutes
8383
api-level: ${{ matrix.api-level }}
8484
arch: x86_64
85-
script: ./gradlew :library:driver-test:connectedCheck -PKMP_TARGETS="ANDROID,JVM"
85+
script: ./gradlew connectedCheck -PKMP_TARGETS="ANDROID,JVM"
8686

8787
- name: Upload Test Reports
8888
uses: actions/upload-artifact@v4
89-
if: ${{ always() }}
89+
if: always()
9090
with:
9191
name: test-report-android-${{ matrix.api-level }}
92-
path: '**/build/reports/androidTests/**'
92+
path: |
93+
**/build/reports/androidTests/**
94+
**/build/outputs/androidTest-results/connected/debug/*/logcat-*.txt
9395
retention-days: 1

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,15 +409,15 @@ I'm guessing this is not really a factor on iOS."
409409
[badge-license]: https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat
410410

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

422422
<!-- TAG_PLATFORMS -->
423423
[badge-platform-android]: http://img.shields.io/badge/-android%20[minSdk%2021]-6EDB8D.svg?style=flat

build-logic/src/main/kotlin/-KmpConfigurationExtension.kt

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
**/
16-
@file:Suppress("UnstableApiUsage")
17-
1816
import io.matthewnelson.kmp.configuration.extension.KmpConfigurationExtension
1917
import io.matthewnelson.kmp.configuration.extension.container.target.KmpConfigurationContainerDsl
2018
import io.matthewnelson.kmp.configuration.extension.container.target.TargetAndroidContainer
2119
import org.gradle.api.Action
2220
import org.gradle.api.JavaVersion
23-
import org.gradle.api.tasks.compile.AbstractCompile
2421

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

3330
jvm {
34-
// TODO: Remove once gradle-kmp-configuration-plugin is updated to 0.4.1+
35-
target {
36-
val targetName = name
37-
project.tasks.withType(AbstractCompile::class.java) {
38-
val task = this
39-
if (!task.name.startsWith("compile$targetName", ignoreCase = true)) return@withType
40-
when {
41-
task.name.endsWith("MainJava") -> {}
42-
task.name.endsWith("TestJava") -> {}
43-
else -> return@withType
44-
}
45-
task.sourceCompatibility = JavaVersion.VERSION_1_8.toString()
46-
task.targetCompatibility = JavaVersion.VERSION_1_8.toString()
47-
}
48-
}
49-
31+
compileSourceCompatibility = JavaVersion.VERSION_1_8
32+
compileTargetCompatibility = JavaVersion.VERSION_1_8
5033
kotlinJvmTarget = JavaVersion.VERSION_1_8
5134
}
5235

@@ -75,8 +58,8 @@ fun KmpConfigurationExtension.configureShared(
7558

7659
fun KmpConfigurationContainerDsl.androidLibrary(
7760
namespace: String,
78-
buildTools: String? = "34.0.0",
79-
compileSdk: Int = 34,
61+
buildTools: String? = "35.0.1",
62+
compileSdk: Int = 35,
8063
minSdk: Int = 21,
8164
javaVersion: JavaVersion = JavaVersion.VERSION_1_8,
8265
action: (Action<TargetAndroidContainer.Library>)? = null,
@@ -91,7 +74,7 @@ fun KmpConfigurationContainerDsl.androidLibrary(
9174
this.minSdk = minSdk
9275

9376
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
94-
testInstrumentationRunnerArguments["disableAnalytics"] = "true"
77+
testInstrumentationRunnerArguments["disableAnalytics"] = true.toString()
9578
}
9679

9780
buildTypes {

build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ allprojects {
3737
// Only allow snapshot dependencies for non-release versions.
3838
// This would cause a build failure if attempting to make a release
3939
// while depending on a -SNAPSHOT version (such as core or hash).
40-
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
41-
maven("https://oss.sonatype.org/content/repositories/snapshots/")
40+
maven("https://central.sonatype.com/repository/maven-snapshots/")
4241
}
4342
}
4443
}

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ kotlin.mpp.enableCInteropCommonization=true
1212
kotlin.native.cacheKind=none
1313
kotlin.native.ignoreDisabledTargets=true
1414

15-
SONATYPE_HOST=S01
15+
SONATYPE_HOST=CENTRAL_PORTAL
1616
RELEASE_SIGNING_ENABLED=true
1717

1818
GROUP=io.toxicity.sqlite-mc
@@ -32,7 +32,7 @@ POM_DEVELOPER_ID=toxicity-io
3232
POM_DEVELOPER_NAME=Toxicity
3333
POM_DEVELOPER_URL=https://github.com/toxicity-io/
3434

35-
VERSION_NAME=2.1.0-2.1.0-1-SNAPSHOT
35+
VERSION_NAME=2.1.0-2.2.3-0-SNAPSHOT
3636
# 2.0.0-1.6.4-0-alpha01 = (02 00 00 00) + (01 06 04 00) + 11 = 03 06 04 11
3737
# 2.0.0-1.6.4-0-beta01 = (02 00 00 00) + (01 06 04 00) + 21 = 03 06 04 21
3838
# 2.0.0-1.6.4-0-rc01 = (02 00 00 00) + (01 06 04 00) + 31 = 03 06 04 31
@@ -42,4 +42,4 @@ VERSION_NAME=2.1.0-2.1.0-1-SNAPSHOT
4242
# 2.1.0-1.6.5-2 = (02 01 00 00) + (01 06 05 00) + 42 = 03 07 05 42
4343
# 2.1.0-1.6.6-0 = (02 01 00 00) + (01 06 06 00) + 40 = 03 07 06 40
4444
# 2.2.1-1.7.0-0 = (02 02 01 00) + (01 07 00 00) + 40 = 03 09 01 40
45-
VERSION_CODE=04020041
45+
VERSION_CODE=04030340

gradle/libs.versions.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
[versions]
22
androidx-startup = "1.2.0"
3-
androidx-test-core = "1.6.1"
4-
androidx-test-runner = "1.6.2"
3+
androidx-test-core = "1.7.0"
4+
androidx-test-runner = "1.7.0"
55

6-
encoding = "2.3.1"
6+
encoding = "2.4.0"
77

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

16-
immutable = "0.1.4"
16+
immutable = "0.2.0"
1717

18-
kotlinx-coroutines = "1.9.0"
18+
kotlinx-coroutines = "1.10.2"
1919

20-
okio = "3.9.1"
20+
okio = "3.15.0"
2121

2222
sql-delight-dialect = "sqlite-3-38-dialect"
2323
sql-delight = "2.1.0"

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ zipStorePath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55

66
# https://gradle.org/release-checksums/
7-
distributionSha256Sum=f8b4f4772d302c8ff580bc40d0f56e715de69b163546944f787c87abf209c961
8-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
7+
distributionSha256Sum=296742a352f0b20ec14b143fb684965ad66086c7810b7b255dee216670716175
8+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip

library/android-unit-test/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ tasks.withType<KotlinCompile> {
3232
}
3333
}
3434

35-
tasks.getByName("clean") {
35+
tasks.all {
36+
if (name != "clean") return@all
3637
doLast {
3738
projectDir
3839
.resolve("src")

library/driver-test/build.gradle.kts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,7 @@ plugins {
2121

2222
kmpConfiguration {
2323
configureShared {
24-
2524
androidLibrary(namespace = "io.toxicity.sqlite.mc.driver.test") {
26-
android {
27-
defaultConfig {
28-
// Work-around for installing test apk on 33+ devices, as
29-
// the minimum of 21 will fail to install.
30-
@Suppress("ExpiredTargetSdkVersion", "DEPRECATION")
31-
targetSdk = 23
32-
}
33-
}
34-
3525
sourceSetTest {
3626
findProject(":library:android-unit-test")?.let { androidUnitTest ->
3727
dependencies {

library/driver/build.gradle.kts

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,22 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
**/
16+
import co.touchlab.cklib.gradle.CKlibGradleExtension
1617
import co.touchlab.cklib.gradle.CompileToBitcode.Language.C
1718
import co.touchlab.cklib.gradle.CompileToBitcodeExtension
19+
import org.gradle.accessors.dm.LibrariesForLibs
1820
import org.gradle.jvm.tasks.Jar
1921
import org.jetbrains.kotlin.gradle.internal.ensureParentDirsCreated
2022
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
2123
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
2224
import org.jetbrains.kotlin.konan.target.Architecture.*
2325
import org.jetbrains.kotlin.konan.target.Family.*
26+
import org.jetbrains.kotlin.konan.target.HostManager
2427
import org.jetbrains.kotlin.konan.target.KonanTarget
28+
import org.jetbrains.kotlin.konan.target.TargetSupportException
29+
import org.jetbrains.kotlin.konan.util.ArchiveType
30+
import org.jetbrains.kotlin.konan.util.DependencyProcessor
31+
import org.jetbrains.kotlin.konan.util.DependencySource
2532
import java.io.IOException
2633
import java.io.InputStream
2734
import java.io.OutputStream
@@ -37,7 +44,6 @@ private val jdbcRepack = JdbcRepack()
3744

3845
kmpConfiguration {
3946
configureShared {
40-
4147
androidLibrary(namespace = "io.toxicity.sqlite.mc.driver") {
4248
target { publishLibraryVariants("release") }
4349

@@ -65,6 +71,12 @@ kmpConfiguration {
6571
implementation(files(jdbcRepack.jarSQLiteJDBCAndroid))
6672
}
6773
}
74+
sourceSetTestInstrumented {
75+
dependencies {
76+
implementation(libs.androidx.test.core)
77+
implementation(libs.androidx.test.runner)
78+
}
79+
}
6880
}
6981

7082
jvm {
@@ -126,7 +138,7 @@ kmpConfiguration {
126138
}
127139

128140
project.extensions.configure<CompileToBitcodeExtension>("cklib") {
129-
config.kotlinVersion = libs.versions.gradle.kotlin.get()
141+
config.configure(libs)
130142

131143
create("sqlite3mc") {
132144
language = C
@@ -159,6 +171,7 @@ kmpConfiguration {
159171
// Warning/Error suppression flags
160172
buildList {
161173
add("-Wno-sign-compare")
174+
add("-Wno-unused-but-set-variable")
162175
add("-Wno-unused-function")
163176
add("-Wno-unused-parameter")
164177
add("-Wno-unused-variable")
@@ -257,7 +270,8 @@ kmpConfiguration {
257270
}
258271
}
259272

260-
tasks.getByName("clean") {
273+
tasks.all {
274+
if (name != "clean") return@all
261275
doLast {
262276
projectDir
263277
.resolve("src")
@@ -570,3 +584,76 @@ private class JdbcRepack {
570584
}
571585
}
572586
}
587+
588+
// CKLib uses too old of a version of LLVM for current version of Kotlin which produces errors for android
589+
// native due to unsupported link arguments. Below is a supplemental implementation to download and use
590+
// the -dev llvm compiler for the current kotlin version.
591+
//
592+
// The following info can be found in ~/.konan/kotlin-native-prebuild-{os}-{arch}-{kotlin version}/konan/konan.properties
593+
private object LLVM {
594+
const val URL: String = "https://download.jetbrains.com/kotlin/native/resources/llvm"
595+
const val VERSION: String = "16.0.0"
596+
597+
// llvm-{llvm version}-{arch}-{host}-dev-{id}
598+
object DevID {
599+
object Linux {
600+
const val x86_64: Int = 80
601+
}
602+
object MacOS {
603+
const val aarch64: Int = 65
604+
const val x86_64: Int = 56
605+
}
606+
object MinGW {
607+
const val x86_64: Int = 56
608+
}
609+
}
610+
}
611+
612+
private fun CKlibGradleExtension.configure(libs: LibrariesForLibs) {
613+
kotlinVersion = libs.versions.gradle.kotlin.get()
614+
check(kotlinVersion == "2.1.21") {
615+
"Kotlin version out of date! Download URLs for LLVM need to be updated for ${project.path}"
616+
}
617+
618+
val host = HostManager.simpleOsName()
619+
val arch = HostManager.hostArch()
620+
val (id, archive) = when (host) {
621+
"linux" -> when (arch) {
622+
"x86_64" -> LLVM.DevID.Linux.x86_64 to ArchiveType.TAR_GZ
623+
else -> null
624+
}
625+
"macos" -> when (arch) {
626+
"aarch64" -> LLVM.DevID.MacOS.aarch64 to ArchiveType.TAR_GZ
627+
"x86_64" -> LLVM.DevID.MacOS.x86_64 to ArchiveType.TAR_GZ
628+
else -> null
629+
}
630+
"windows" -> when (arch) {
631+
"x86_64" -> LLVM.DevID.MinGW.x86_64 to ArchiveType.ZIP
632+
else -> null
633+
}
634+
else -> null
635+
} ?: throw TargetSupportException("Unsupported host[$host] or arch[$arch]")
636+
637+
val llvmDev = "llvm-${LLVM.VERSION}-${arch}-${host}-dev-${id}"
638+
val cklibDir = File(System.getProperty("user.home")).resolve(".cklib")
639+
llvmHome = cklibDir.resolve(llvmDev).path
640+
641+
val source = DependencySource.Remote.Public(subDirectory = "${LLVM.VERSION}-${arch}-${host}")
642+
643+
DependencyProcessor(
644+
dependenciesRoot = cklibDir,
645+
dependenciesUrl = LLVM.URL,
646+
dependencyToCandidates = mapOf(llvmDev to listOf(source)),
647+
homeDependencyCache = cklibDir.resolve("cache"),
648+
customProgressCallback = { _, currentBytes, totalBytes ->
649+
val total = totalBytes.toString()
650+
var current = currentBytes.toString()
651+
while (current.length < 15 && current.length < total.length) {
652+
current = " $current"
653+
}
654+
655+
println("Downloading[$llvmDev] - $current / $total")
656+
},
657+
archiveType = archive,
658+
).run()
659+
}

0 commit comments

Comments
 (0)