diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 88f059123..0ea93226e 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -19,12 +19,12 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Gradle Wrapper Validation - uses: gradle/wrapper-validation-action@v2 + uses: gradle/actions/wrapper-validation@v4 - name: Setup JDK uses: actions/setup-java@v4 with: distribution: zulu - java-version: 17 + java-version: 21 - name: Run tests run: ./gradlew check - name: Upload test results @@ -42,20 +42,17 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Gradle Wrapper Validation - uses: gradle/wrapper-validation-action@v2 + uses: gradle/actions/wrapper-validation@v4 - name: Setup JDK uses: actions/setup-java@v4 with: distribution: zulu - java-version: 17 + java-version: 21 - name: Install libicu run: | - wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu66_66.1-2ubuntu2.1_amd64.deb - sudo dpkg -i libicu66_66.1-2ubuntu2.1_amd64.deb - rm libicu66_66.1-2ubuntu2.1_amd64.deb - wget https://launchpad.net/ubuntu/+source/icu/71.1-2/+build/23579523/+files/libicu71_71.1-2_amd64.deb - sudo dpkg -i libicu71_71.1-2_amd64.deb - rm libicu71_71.1-2_amd64.deb + wget https://launchpadlibrarian.net/626467203/libicu71_71.1-3ubuntu1_amd64.deb + sudo dpkg -i libicu71_71.1-3ubuntu1_amd64.deb + rm libicu71_71.1-3ubuntu1_amd64.deb - name: Run tests run: ./gradlew check - name: Upload test results @@ -73,12 +70,12 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Gradle Wrapper Validation - uses: gradle/wrapper-validation-action@v2 + uses: gradle/actions/wrapper-validation@v4 - name: Setup JDK uses: actions/setup-java@v4 with: distribution: zulu - java-version: 17 + java-version: 21 - name: Run tests run: ./gradlew check - name: Upload test results @@ -96,12 +93,12 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Gradle Wrapper Validation - uses: gradle/wrapper-validation-action@v2 + uses: gradle/actions/wrapper-validation@v4 - name: Setup JDK uses: actions/setup-java@v4 with: distribution: zulu - java-version: 17 + java-version: 21 - name: Enable KVM group perms run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules @@ -110,7 +107,7 @@ jobs: - name: Run connected tests uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 33 + api-level: 35 arch: x86_64 script: ./gradlew connectedCheck - name: Upload test results diff --git a/README.md b/README.md index 74c079b1f..63367a1e8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Maven Central](https://img.shields.io/maven-central/v/dev.kotbase/couchbase-lite)]( https://central.sonatype.com/namespace/dev.kotbase) -[![Kotlin](https://img.shields.io/badge/kotlin-1.9.23-blue.svg?logo=kotlin)](http://kotlinlang.org) +[![Kotlin](https://img.shields.io/badge/kotlin-1.9.25-blue.svg?logo=kotlin)](http://kotlinlang.org) [![GitHub License](https://img.shields.io/github/license/jeffdgr8/kotbase)](LICENSE) [![Couchbase Community](https://img.shields.io/badge/couchbase-community-ea2328?logo=couchbase&logoColor=ea2328)]( https://www.couchbase.com/developers/community/) diff --git a/buildSrc/src/main/kotlin/base-convention.gradle.kts b/buildSrc/src/main/kotlin/base-convention.gradle.kts index 07825b5af..d344b5d47 100644 --- a/buildSrc/src/main/kotlin/base-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/base-convention.gradle.kts @@ -25,8 +25,8 @@ kotlin { targets.configureEach { compilations.configureEach { - compilerOptions.configure { - freeCompilerArgs.add("-Xexpect-actual-classes") + compileTaskProvider.configure { + compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes") } } } @@ -97,10 +97,11 @@ dependencies { } // work around native compiler and linker warnings in tests +// duplicate library name: org.jetbrains.kotlinx:kotlinx-serialization-core // https://youtrack.jetbrains.com/issue/KT-51110 // (leave off by default, enable to avoid warnings) /* -configurations.all { +configurations.configureEach { resolutionStrategy.eachDependency { if (requested.group == "org.jetbrains.kotlinx" && requested.name == "kotlinx-serialization-core") { val libs = the() diff --git a/couchbase-lite/src/commonTest/kotlin/kotbase/DocumentTest.kt b/couchbase-lite/src/commonTest/kotlin/kotbase/DocumentTest.kt index f67e30b1a..b072e7be8 100755 --- a/couchbase-lite/src/commonTest/kotlin/kotbase/DocumentTest.kt +++ b/couchbase-lite/src/commonTest/kotlin/kotbase/DocumentTest.kt @@ -770,7 +770,7 @@ class DocumentTest : BaseDbTest() { fun testSetDate() { var mDoc = MutableDocument("doc1") - val date = Clock.System.now() + val date = Clock.System.nowMillis() val dateStr = date.toStringMillis() assertTrue(dateStr.isNotEmpty()) mDoc.setValue("date", date) diff --git a/couchbase-lite/src/commonTest/kotlin/kotbase/JSONTest.kt b/couchbase-lite/src/commonTest/kotlin/kotbase/JSONTest.kt index 797042133..93cc752b6 100755 --- a/couchbase-lite/src/commonTest/kotlin/kotbase/JSONTest.kt +++ b/couchbase-lite/src/commonTest/kotlin/kotbase/JSONTest.kt @@ -15,6 +15,7 @@ */ package kotbase +import kotbase.ext.nowMillis import kotlinx.datetime.Clock import kotlin.test.Test import kotlin.test.assertEquals @@ -24,7 +25,7 @@ class JSONTest { // Verify that round trip String -> Date -> String doesn't alter the string (#1611) @Test fun testJSONDateRoundTrip() { - val now = Clock.System.now() + val now = Clock.System.nowMillis() // internally calls the relevant JSONUtils.toJSONString() and JSONUtils.toDate() val array = MutableArray() val dateStr = array.addDate(now).getString(0) diff --git a/couchbase-lite/src/commonTest/kotlin/kotbase/QueryTest.kt b/couchbase-lite/src/commonTest/kotlin/kotbase/QueryTest.kt index d65a66208..163ad328b 100755 --- a/couchbase-lite/src/commonTest/kotlin/kotbase/QueryTest.kt +++ b/couchbase-lite/src/commonTest/kotlin/kotbase/QueryTest.kt @@ -1965,6 +1965,7 @@ class QueryTest : BaseQueryTest() { // https://forums.couchbase.com/t/unicode-collation-locale-null-or-device-locale/34103 //assertEquals(expected[i], collations[i].asJSON()) val expectedCollation = expected[i] + @Suppress("UNNECESSARY_SAFE_CALL", "KotlinRedundantDiagnosticSuppress") val collation = collations[i].asJSON()?.massageJson(expectedCollation) assertEquals(expectedCollation, collation) } diff --git a/couchbase-lite/src/jvmCommonMain/kotlin/kotbase/ReplicatedDocument.jvmCommon.kt b/couchbase-lite/src/jvmCommonMain/kotlin/kotbase/ReplicatedDocument.jvmCommon.kt index 0ea8e4854..619a12b63 100644 --- a/couchbase-lite/src/jvmCommonMain/kotlin/kotbase/ReplicatedDocument.jvmCommon.kt +++ b/couchbase-lite/src/jvmCommonMain/kotlin/kotbase/ReplicatedDocument.jvmCommon.kt @@ -22,10 +22,10 @@ public actual class ReplicatedDocument internal constructor(actual: CBLReplicatedDocument) : DelegatedClass(actual) { public actual val scope: String - get() = actual.collectionScope + get() = actual.scope public actual val collection: String - get() = actual.collectionName + get() = actual.collection public actual val id: String get() = actual.id diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 380bd692e..d7c5625d7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,36 +3,36 @@ couchbase-lite-java = "3.1.9" couchbase-lite-objc = "3.1.9" couchbase-lite-c = "3.1.9" dokka = "1.9.20" -kotlinx-serialization = "1.6.3" -mockk = "1.13.10" +kotlinx-serialization = "1.7.3" +mockk = "1.13.13" [plugins] android-library = { id = "com.android.library", version = "8.2.2" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } -kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version = "1.9.23" } -kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.15.0-Beta.1" } -vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version = "0.27.0" } +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version = "1.9.25" } +kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.16.3" } +vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version = "0.30.0" } [libraries] -androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version = "2.7.0" } -androidx-startup = { module = "androidx.startup:startup-runtime", version = "1.1.1" } -androidx-test-core-ktx = { module = "androidx.test:core-ktx", version = "1.5.0" } -androidx-test-runner = { module = "androidx.test:runner", version = "1.5.2" } +androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version = "2.8.6" } +androidx-startup = { module = "androidx.startup:startup-runtime", version = "1.2.0" } +androidx-test-core-ktx = { module = "androidx.test:core-ktx", version = "1.6.1" } +androidx-test-runner = { module = "androidx.test:runner", version = "1.6.2" } couchbase-lite-android = { module = "com.couchbase.lite:couchbase-lite-android", version.ref = "couchbase-lite-java" } couchbase-lite-android-ee = { module = "com.couchbase.lite:couchbase-lite-android-ee", version.ref = "couchbase-lite-java" } couchbase-lite-java = { module = "com.couchbase.lite:couchbase-lite-java", version.ref = "couchbase-lite-java" } couchbase-lite-java-ee = { module = "com.couchbase.lite:couchbase-lite-java-ee", version.ref = "couchbase-lite-java" } dokka-versioning = { module = "org.jetbrains.dokka:versioning-plugin", version.ref = "dokka" } -kermit = { module = "co.touchlab:kermit", version = "2.0.3" } +kermit = { module = "co.touchlab:kermit", version = "2.0.4" } korlibs-korio = { module = "com.soywiz.korlibs.korio:korio", version = "4.0.10" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" } kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit" } -kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version = "0.23.2" } -kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.8.0" } -kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version = "0.5.0" } -kotlinx-io = { module = "org.jetbrains.kotlinx:kotlinx-io-core", version = "0.3.2" } +kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version = "0.26.0" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.9.0" } +kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version = "0.6.1" } +kotlinx-io = { module = "org.jetbrains.kotlinx:kotlinx-io-core", version = "0.5.4" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } mockk = { module = "io.mockk:mockk", version.ref = "mockk" } mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockk" } paging = { module = "app.cash.paging:paging-common", version = "3.3.0-alpha02-0.5.1" } -stately = { module = "co.touchlab:stately-concurrent-collections", version = "2.0.6" } +stately = { module = "co.touchlab:stately-concurrent-collections", version = "2.1.0" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 033e24c4c..a4b76b953 100755 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22ce5..09523c0e5 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index fcb6fca14..f5feea6d6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,7 +85,9 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -201,11 +205,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85be..9b42019c7 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail