diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 50ee947..d51a050 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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/**' @@ -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 @@ -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 diff --git a/README.md b/README.md index 572ed8c..d08b455 100644 --- a/README.md +++ b/README.md @@ -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 -[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 [badge-platform-android]: http://img.shields.io/badge/-android%20[minSdk%2021]-6EDB8D.svg?style=flat diff --git a/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt b/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt index 8290535..41e8f87 100644 --- a/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt +++ b/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt @@ -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)? = null, @@ -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 } @@ -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)? = null, @@ -91,7 +74,7 @@ fun KmpConfigurationContainerDsl.androidLibrary( this.minSdk = minSdk testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - testInstrumentationRunnerArguments["disableAnalytics"] = "true" + testInstrumentationRunnerArguments["disableAnalytics"] = true.toString() } buildTypes { diff --git a/build.gradle.kts b/build.gradle.kts index fb5df1b..c350d0c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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/") } } } diff --git a/gradle.properties b/gradle.properties index e1e3501..d56ecdf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 @@ -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 @@ -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 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 346a296..6e72d00 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c47a56d..46f66f0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/library/android-unit-test/build.gradle.kts b/library/android-unit-test/build.gradle.kts index c9f0191..20fa088 100644 --- a/library/android-unit-test/build.gradle.kts +++ b/library/android-unit-test/build.gradle.kts @@ -32,7 +32,8 @@ tasks.withType { } } -tasks.getByName("clean") { +tasks.all { + if (name != "clean") return@all doLast { projectDir .resolve("src") diff --git a/library/driver-test/build.gradle.kts b/library/driver-test/build.gradle.kts index 449b90c..c15820e 100644 --- a/library/driver-test/build.gradle.kts +++ b/library/driver-test/build.gradle.kts @@ -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 { diff --git a/library/driver/build.gradle.kts b/library/driver/build.gradle.kts index 0de9d1c..aec8052 100644 --- a/library/driver/build.gradle.kts +++ b/library/driver/build.gradle.kts @@ -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 @@ -37,7 +44,6 @@ private val jdbcRepack = JdbcRepack() kmpConfiguration { configureShared { - androidLibrary(namespace = "io.toxicity.sqlite.mc.driver") { target { publishLibraryVariants("release") } @@ -65,6 +71,12 @@ kmpConfiguration { implementation(files(jdbcRepack.jarSQLiteJDBCAndroid)) } } + sourceSetTestInstrumented { + dependencies { + implementation(libs.androidx.test.core) + implementation(libs.androidx.test.runner) + } + } } jvm { @@ -126,7 +138,7 @@ kmpConfiguration { } project.extensions.configure("cklib") { - config.kotlinVersion = libs.versions.gradle.kotlin.get() + config.configure(libs) create("sqlite3mc") { language = C @@ -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") @@ -257,7 +270,8 @@ kmpConfiguration { } } -tasks.getByName("clean") { +tasks.all { + if (name != "clean") return@all doLast { projectDir .resolve("src") @@ -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() +} diff --git a/tools/check-publication/build.gradle.kts b/tools/check-publication/build.gradle.kts index bcb18b5..7520038 100644 --- a/tools/check-publication/build.gradle.kts +++ b/tools/check-publication/build.gradle.kts @@ -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()