diff --git a/.github/workflows/KaMPKit-Android.yml b/.github/workflows/KaMPKit-Android.yml index a843c714..170be2dc 100644 --- a/.github/workflows/KaMPKit-Android.yml +++ b/.github/workflows/KaMPKit-Android.yml @@ -17,13 +17,15 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: corretto java-version: 17 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Build run: ./gradlew build diff --git a/.github/workflows/KaMPKit-iOS.yml b/.github/workflows/KaMPKit-iOS.yml index 5c71add0..6de61769 100644 --- a/.github/workflows/KaMPKit-iOS.yml +++ b/.github/workflows/KaMPKit-iOS.yml @@ -17,13 +17,15 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: corretto java-version: 17 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Run tests run: ./gradlew :shared:iosX64Test diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 26aa2bc5..5201d28a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -13,7 +13,6 @@ android { targetSdk = libs.versions.targetSdk.get().toInt() versionCode = 1 versionName = "1.0" - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -27,11 +26,6 @@ android { } compileOptions { isCoreLibraryDesugaringEnabled = true - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" } lint { warningsAsErrors = false @@ -44,12 +38,15 @@ android { } } +kotlin { + jvmToolchain(11) +} + dependencies { - implementation(project(":shared")) + implementation(projects.shared) implementation(libs.bundles.app.ui) implementation(libs.multiplatformSettings.common) implementation(libs.kotlinx.dateTime) coreLibraryDesugaring(libs.android.desugaring) implementation(libs.koin.android) - testImplementation(libs.junit) } diff --git a/build.gradle.kts b/build.gradle.kts index f6533dfc..c3b217fe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,21 +14,9 @@ subprojects { apply(plugin = rootProject.libs.plugins.ktlint.get().pluginId) configure { - version.set("1.1.1") - enableExperimentalRules.set(true) verbose.set(true) filter { exclude { it.file.path.contains("build/") } } } - - afterEvaluate { - tasks.named("check").configure { - dependsOn(tasks.getByName("ktlintCheck")) - } - } -} - -tasks.register("clean") { - delete(rootProject.layout.buildDirectory) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2e4d221c..a202906a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,39 +1,30 @@ [versions] ## SDK Versions minSdk = "21" -targetSdk = "34" -compileSdk = "34" +targetSdk = "35" +compileSdk = "35" # Dependencies -kotlin = "2.0.0" - -android-gradle-plugin = "8.2.0" -ktlint-gradle = "12.1.0" - -compose = "1.6.7" - -android-desugaring = "2.0.4" -androidx-core = "1.13.1" -androidx-test-junit = "1.1.5" -androidx-activity-compose = "1.9.0" -# TODO: Update to 2.8.+ when updating to Compose 1.7.+ -androidx-lifecycle = "2.7.0" - +kotlin = "2.0.21" +android-gradle-plugin = "8.5.2" +ktlint-gradle = "12.1.1" +compose = "1.7.5" +android-desugaring = "2.1.3" +androidx-core = "1.15.0" +androidx-test-junit = "1.2.1" +androidx-activity-compose = "1.9.3" +androidx-lifecycle = "2.8.7" junit = "4.13.2" - -coroutines = "1.8.1" -kotlinx-datetime = "0.6.0" -ktor = "2.3.11" - -robolectric = "4.10.3" - -kermit = "2.0.3" -skie = "0.8.0" - +coroutines = "1.9.0" +kotlinx-datetime = "0.6.1" +ktor = "3.0.1" +robolectric = "4.13" +kermit = "2.0.4" +skie = "0.9.3" koin = "3.5.3" -multiplatformSettings = "1.1.1" -turbine = "1.0.0" -sqlDelight = "2.0.1" +multiplatformSettings = "1.2.0" +turbine = "1.2.0" +sqlDelight = "2.0.2" [libraries] android-desugaring = { module = "com.android.tools:desugar_jdk_libs", version.ref = "android-desugaring" } @@ -52,8 +43,6 @@ compose-activity = { module = "androidx.activity:activity-compose", version.ref coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } -junit = { module = "junit:junit", version.ref = "junit" } - koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" } koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 033e24c4..e6441136 100644 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 b82aa23a..a4413138 100644 --- 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.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index fcb6fca1..1aa94a42 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ 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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +145,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 +153,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 +202,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 6689b85b..7101f8e4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,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 +57,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 diff --git a/settings.gradle.kts b/settings.gradle.kts index 8439efe9..9e3b243a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,18 +1,36 @@ +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + pluginManagement { repositories { - gradlePluginPortal() - google() + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } mavenCentral() + gradlePluginPortal() } } dependencyResolutionManagement { @Suppress("UnstableApiUsage") repositories { - google() + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } mavenCentral() } } +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version("0.8.0") +} + include(":app", ":shared") rootProject.name = "KaMPKit" diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index d3142196..6cea0706 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,6 +1,5 @@ import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { alias(libs.plugins.kotlin.multiplatform) @@ -15,7 +14,6 @@ android { compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { minSdk = libs.versions.minSdk.get().toInt() - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @Suppress("UnstableApiUsage") testOptions { @@ -28,19 +26,12 @@ android { warningsAsErrors = true abortOnError = true } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } -} - -tasks.withType { - kotlinOptions.jvmTarget = "1.8" } version = "1.2" kotlin { + jvmToolchain(11) // https://kotlinlang.org/docs/multiplatform-expect-actual.html#expected-and-actual-classes // To suppress this warning about usage of expected and actual classes @OptIn(ExperimentalKotlinGradlePluginApi::class) diff --git a/shared/src/commonTest/kotlin/co/touchlab/kampkit/SqlDelightTest.kt b/shared/src/commonTest/kotlin/co/touchlab/kampkit/SqlDelightTest.kt index 609a8f8e..09c59581 100644 --- a/shared/src/commonTest/kotlin/co/touchlab/kampkit/SqlDelightTest.kt +++ b/shared/src/commonTest/kotlin/co/touchlab/kampkit/SqlDelightTest.kt @@ -72,7 +72,7 @@ class SqlDelightTest { dbHelper.deleteAll() assertTrue( - dbHelper.selectAllItems().first().count() == 0, + dbHelper.selectAllItems().first().isEmpty(), "Delete All did not work" ) }