diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index de47f7e..6ee8209 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -56,7 +56,7 @@ jobs: packages: write needs: changes if: ${{ (github.event_name != 'workflow_dispatch' && needs.changes.outputs.shared == 'true') || (github.event_name == 'workflow_dispatch' && !github.event.inputs.androidOnly) }} - uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/faktorybuildautoversion.yml@v1.0 + uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/faktorybuildautoversion.yml@v1.1 with: jvmVersion: 17 versionBaseProperty: SHARED_BASE_VERSION diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 7423232..e8db9c0 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -5,10 +5,10 @@ import java.util.Date import java.util.Properties plugins { - id("com.android.application") - id("com.github.triplet.play") version "3.8.4" - kotlin("android") - id("com.google.devtools.ksp") version "1.9.20-1.0.13" + alias(libs.plugins.kotlin.android) + alias(libs.plugins.android.application) + alias(libs.plugins.play.publisher) + alias(libs.plugins.google.ksp) } private val versionProperty by lazy { @@ -23,9 +23,13 @@ val SHARED_BASE_VERSION: String by project version = versionProperty.getProperty("androidVersion") group = SHARED_GROUP +kotlin { + jvmToolchain(17) +} + android { namespace = "org.datepollsystems.waiterrobot.android" - compileSdk = Versions.androidCompileSdk + compileSdk = libs.versions.android.compileSdk.get().toInt() androidResources { generateLocaleConfig = true @@ -34,9 +38,9 @@ android { defaultConfig { applicationId = this@android.namespace - minSdk = Versions.androidMinSdk - targetSdk = Versions.androidTargetSdk - buildToolsVersion = Versions.androidBuildTools + minSdk = libs.versions.android.minSdk.get().toInt() + targetSdk = libs.versions.android.targetSdk.get().toInt() + buildToolsVersion = libs.versions.android.buildTools.get() versionName = version.toString() versionCode = run { @@ -85,7 +89,7 @@ android { } composeOptions { - kotlinCompilerExtensionVersion = Versions.composeCompiler + kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() } packaging { @@ -95,8 +99,6 @@ android { } compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 isCoreLibraryDesugaringEnabled = true } @@ -130,14 +132,14 @@ android { // Include the generated navigation sources kotlin.sourceSets { getByName(name) { - kotlin.srcDir("${project.buildDir}/generated/ksp/$name/kotlin") + kotlin.srcDir(File(project.layout.buildDirectory.asFile.get(), "/generated/ksp/$name/kotlin")) } } // Write built version to file after creating a bundle (needed for ci, to create the version tag) if (this.name.endsWith("Release")) { tasks.findByName("publish${this.name.capitalizeAsciiOnly()}Bundle")!!.doLast { - File(project.buildDir, "version.tag") + File(project.layout.buildDirectory.asFile.get(), "version.tag") .writeText(this@variant.versionName) } } @@ -179,47 +181,38 @@ dependencies { implementation(project(":shared")) } - implementation("androidx.lifecycle:lifecycle-process:${Versions.androidxLifecycle}") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:${Versions.androidxLifecycle}") - implementation("androidx.appcompat:appcompat:1.6.1") + implementation(libs.androidx.lifecycle.process) + implementation(libs.androidx.lifecycle.runtime) + implementation(libs.androidx.appcompat) - coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3") + coreLibraryDesugaring(libs.android.desugar) // Compose - runtimeOnly("androidx.compose.compiler:compiler:${Versions.composeCompiler}") - implementation("androidx.activity:activity-compose:1.7.2") - implementation("androidx.compose.foundation:foundation:${Versions.compose}") - implementation("androidx.compose.foundation:foundation-layout:${Versions.compose}") - implementation("androidx.compose.ui:ui-graphics:${Versions.compose}") - implementation("androidx.compose.ui:ui:${Versions.compose}") - implementation("androidx.compose.ui:ui-tooling:${Versions.compose}") - implementation("androidx.compose.ui:ui-tooling-preview:${Versions.compose}") - implementation("androidx.compose.material:material:${Versions.compose}") - implementation("androidx.compose.material:material-icons-core:${Versions.compose}") - implementation("androidx.compose.material:material-icons-extended:${Versions.compose}") + runtimeOnly(libs.androidx.compose.compiler) + implementation(libs.bundles.android.compose) // Compose helpers - implementation("com.google.accompanist:accompanist-permissions:0.32.0") + implementation(libs.accompanist.permissions) // Architecture (MVI) - implementation("org.orbit-mvi:orbit-compose:${Versions.orbitMvi}") + implementation(libs.orbit.compose) // Dependency injection - implementation("io.insert-koin:koin-androidx-compose:3.4.6") // Not aligned with other koin version + implementation(libs.koin.compose) // Not aligned with other koin version // SafeCompose Navigation Args - implementation("io.github.raamcosta.compose-destinations:core:${Versions.composeDestinations}") - ksp("io.github.raamcosta.compose-destinations:ksp:${Versions.composeDestinations}") + implementation(libs.compose.destinations) + ksp(libs.compose.destinations.ksp) // CameraX - implementation("androidx.camera:camera-camera2:${Versions.camera}") - implementation("androidx.camera:camera-view:${Versions.camera}") - implementation("androidx.camera:camera-lifecycle:${Versions.camera}") + implementation(libs.androidx.camera.camera2) + implementation(libs.androidx.camera.view) + implementation(libs.androidx.camera.lifecycle) // QrCode Scanning - implementation("com.google.mlkit:barcode-scanning:17.2.0") + implementation(libs.barcode.scanning) // In-App-Update support - implementation("com.google.android.play:app-update:2.1.0") - implementation("com.google.android.play:app-update-ktx:2.1.0") + implementation(libs.app.update) + implementation(libs.app.update.ktx) } diff --git a/build.gradle.kts b/build.gradle.kts index 05b0c42..f2af032 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,23 +1,13 @@ import io.gitlab.arturbosch.detekt.Detekt import io.gitlab.arturbosch.detekt.report.ReportMergeTask -buildscript { - repositories { - gradlePluginPortal() - google() - mavenCentral() - } - dependencies { - val kotlinVersion = "1.9.20" - classpath("com.android.tools.build:gradle:8.1.1") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") - classpath("org.jetbrains.kotlin:kotlin-serialization:${kotlinVersion}") - classpath("com.codingfeline.buildkonfig:buildkonfig-gradle-plugin:0.14.0") - } -} plugins { - id("io.gitlab.arturbosch.detekt") version "1.23.1" + alias(libs.plugins.kotlin.multiplatform) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.detekt) apply true } val detektReportMergeSarif by tasks.registering(ReportMergeTask::class) { @@ -31,7 +21,7 @@ allprojects { mavenCentral() } - apply(plugin = "io.gitlab.arturbosch.detekt") + apply(plugin = rootProject.libs.plugins.kotlin.detekt.get().pluginId) detekt { config.from(rootDir.resolve("detekt.yml")) @@ -42,7 +32,7 @@ allprojects { } dependencies { - detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.1") + detektPlugins(rootProject.libs.detekt.formatting) } tasks.withType().configureEach { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index 13f9ba7..0000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,6 +0,0 @@ -plugins { - `kotlin-dsl` -} -repositories { - gradlePluginPortal() -} \ No newline at end of file diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt deleted file mode 100644 index 9647ce1..0000000 --- a/buildSrc/src/main/java/Versions.kt +++ /dev/null @@ -1,22 +0,0 @@ -object Versions { - // Shared - const val kermitLogger = "1.2.2" - const val koinDi = "3.4.3" - const val orbitMvi = "6.1.0" - const val mokoMvvm = "0.16.1" - const val ktor = "2.3.3" - const val settings = "1.0.0" - const val realm = "1.10.2" // Also update belonging plugin in shared/build.gradle.kts - - // Android - const val androidMinSdk = 24 - const val androidTargetSdk = 33 - const val androidCompileSdk = 34 - const val androidBuildTools = "34.0.0" - - const val compose = "1.5.4" - const val composeCompiler = "1.5.4" - const val androidxLifecycle = "2.6.1" - const val composeDestinations = "1.9.54" - const val camera = "1.2.3" -} diff --git a/gradle.properties b/gradle.properties index 421ebd9..fbda582 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,5 +14,5 @@ kotlin.native.cacheKind.iosArm64=none kotlin.native.cacheKind.iosX64=none kotlin.native.cacheKind.iosSimulatorArm64=none -SHARED_BASE_VERSION=1.2 +SHARED_BASE_VERSION=1.3 SHARED_GROUP=org.datepollsystems.waiterrobot \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..37507c5 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,112 @@ +[versions] +# Shared +kotlin = "1.9.21" # Always check https://developer.android.com/jetpack/androidx/releases/compose-kotlin for compose version compatibility +ksp = "1.9.21-1.0.16" # First part must match the kotlin version +detektFormatting = "1.23.4" +kermit = "1.2.2" +koin = "3.5.3" +orbitMvi = "6.1.0" +mokoMvvm = "0.16.1" +ktor = "2.3.7" +settings = "1.1.1" +realm = "1.13.0" +detekt = "1.23.4" +kotlinx-serialization-json = "1.6.2" +kotlinx-datetime = "0.5.0" +buildkonfig = "0.15.1" +skie = "0.6.1" +kmmbridge = "0.5.1" +kmmresources = "1.0.0-alpha11" + +# Android +android-minSdk = "24" +android-targetSdk = "33" +android-compileSdk = "34" +android-buildTools = "34.0.0" +android-gradle = "8.2.0" +android-camera = "1.3.1" +android-desugar = "2.0.4" +androidx-lifecycle = "2.6.2" +androidx-appcompat = "1.6.1" +androidx-compose = "1.5.4" +androidx-compose-compiler = "1.5.7" +androidx-compose-activity = "1.8.2" +compose-destinations = "1.9.56" +play-publisher = "3.8.6" +accompanistPermissions = "0.32.0" +koinCompose = "3.5.3" +appUpdate = "2.1.0" +barcodeScanning = "17.2.0" + +[libraries] + +accompanist-permissions = { module = "com.google.accompanist:accompanist-permissions", version.ref = "accompanistPermissions" } +android-desugar = { module = "com.android.tools:desugar_jdk_libs", version.ref = "android-desugar" } +androidx-camera-camera2 = { module = "androidx.camera:camera-camera2", version.ref = "android-camera" } +androidx-camera-lifecycle = { module = "androidx.camera:camera-lifecycle", version.ref = "android-camera" } +androidx-camera-view = { module = "androidx.camera:camera-view", version.ref = "android-camera" } +androidx-lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "androidx-lifecycle" } +androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } +androidx-compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "androidx-compose-compiler" } +androidx-compose-activity = { module = "androidx.activity:activity-compose", version.ref = "androidx-compose-activity" } +androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidx-compose" } +androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "androidx-compose" } +androidx-compose-ui-core = { module = "androidx.compose.ui:ui", version.ref = "androidx-compose" } +androidx-compose-ui-graphics = { module = "androidx.compose.ui:ui-graphics", version.ref = "androidx-compose" } +androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "androidx-compose" } +androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "androidx-compose" } +androidx-compose-material-core = { module = "androidx.compose.material:material", version.ref = "androidx-compose" } +androidx-compose-material-icons = { module = "androidx.compose.material:material-icons-core", version.ref = "androidx-compose" } +androidx-compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "androidx-compose" } + +app-update = { module = "com.google.android.play:app-update", version.ref = "appUpdate" } +app-update-ktx = { module = "com.google.android.play:app-update-ktx", version.ref = "appUpdate" } +barcode-scanning = { module = "com.google.mlkit:barcode-scanning", version.ref = "barcodeScanning" } +compose-destinations = { module = "io.github.raamcosta.compose-destinations:core", version.ref = "compose-destinations" } +compose-destinations-ksp = { module = "io.github.raamcosta.compose-destinations:ksp", version.ref = "compose-destinations" } + +koin-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "koinCompose" } +koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } +koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" } + +detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detektFormatting" } +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" } +kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" } + +touchlab-kermit = { module = "co.touchlab:kermit", version.ref = "kermit" } +touchlab-skie-annotations = { module = "co.touchlab.skie:configuration-annotations", version.ref = "skie" } + +ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } +ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } +ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" } +ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" } +ktor-client-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" } +ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" } +ktor-client-serialization-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" } + +realm = { module = "io.realm.kotlin:library-base", version.ref = "realm" } +settings = { module = "com.russhwolf:multiplatform-settings", version.ref = "settings" } +settings-coroutines = { module = "com.russhwolf:multiplatform-settings-coroutines", version.ref = "settings" } + +orbit-compose = { module = "org.orbit-mvi:orbit-compose", version.ref = "orbitMvi" } +orbit-core = { module = "org.orbit-mvi:orbit-core", version.ref = "orbitMvi" } +moko-mvvm = { module = "dev.icerock.moko:mvvm-core", version.ref = "mokoMvvm" } + +[bundles] +android-compose = ["androidx-compose-activity", "androidx-compose-foundation", "androidx-compose-foundation-layout", "androidx-compose-ui-core", "androidx-compose-ui-graphics", "androidx-compose-ui-tooling", "androidx-compose-ui-tooling-preview", "androidx-compose-material-core", "androidx-compose-material-icons", "androidx-compose-material-icons-extended"] + +[plugins] +android-application = { id = "com.android.application", version.ref = "android-gradle" } +android-library = { id = "com.android.library", version.ref = "android-gradle" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +kotlin-detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +play-publisher = { id = "com.github.triplet.play", version.ref = "play-publisher" } +google-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +buildkonfig = { id = "com.codingfeline.buildkonfig", version.ref = "buildkonfig" } +touchlab-skie = { id = "co.touchlab.skie", version.ref = "skie" } +touchlab-kmmbridge = { id = "co.touchlab.kmmbridge", version.ref = "kmmbridge" } +kmmresources = { id = "dev.jamiecraane.plugins.kmmresources", version.ref = "kmmresources" } +realm = { id = "io.realm.kotlin", version.ref = "realm" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135..d64cd49 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 ac72c34..1af9e09 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.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 0adc8e1..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -145,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 @@ -153,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 @@ -202,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/shared/build.gradle.kts b/shared/build.gradle.kts index d75301e..0298b42 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -2,19 +2,19 @@ import com.codingfeline.buildkonfig.compiler.FieldSpec.Type import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget plugins { - kotlin("multiplatform") - kotlin("plugin.serialization") - id("com.android.library") - id("co.touchlab.kmmbridge") version "0.5.1" - id("co.touchlab.skie") version "0.5.5" + alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.android.library) `maven-publish` - id("dev.jamiecraane.plugins.kmmresources") version "1.0.0-alpha11" // Shared localization - id("io.realm.kotlin") version "1.10.2" - id("com.codingfeline.buildkonfig") + alias(libs.plugins.buildkonfig) + alias(libs.plugins.touchlab.kmmbridge) + alias(libs.plugins.touchlab.skie) + alias(libs.plugins.kmmresources) + alias(libs.plugins.realm) } val generatedLocalizationRoot: String = - File(project.buildDir, "generated/localizations").absolutePath + File(project.layout.buildDirectory.asFile.get(), "generated/localizations").absolutePath val iosFrameworkName = "shared" group = project.property("SHARED_GROUP") as String @@ -24,13 +24,12 @@ version = project.property( val sharedNamespace = "$group.shared" kotlin { - // For some reason androidTarget is recognized by IntelliJ, - // but when building it throws "Unresolved reference: androidTarget" - // -> Just keep it till it is removed - android { + androidTarget { publishAllLibraryVariants() } + jvmToolchain(17) + listOf( iosX64(), iosArm64(), @@ -47,88 +46,73 @@ kotlin { compilations["main"].kotlinOptions.freeCompilerArgs += "-Xexport-kdoc" } + applyDefaultHierarchyTemplate() + sourceSets { - val commonMain by getting { + commonMain { // Include the generated localization source kotlin.srcDir("$generatedLocalizationRoot/commonMain/kotlin") dependencies { // Logger - api("co.touchlab:kermit:${Versions.kermitLogger}") + api(libs.touchlab.kermit) // Dependency injection - implementation("io.insert-koin:koin-core:${Versions.koinDi}") + implementation(libs.koin.core) // Architecture - api("org.orbit-mvi:orbit-core:${Versions.orbitMvi}") // MVI - api("dev.icerock.moko:mvvm-core:${Versions.mokoMvvm}") // ViewModelScope - implementation("co.touchlab.skie:configuration-annotations:0.5.5") + api(libs.orbit.core) // MVI + api(libs.moko.mvvm) // ViewModelScope + implementation(libs.touchlab.skie.annotations) // Ktor (HTTP client) - implementation("io.ktor:ktor-client-core:${Versions.ktor}") - implementation("io.ktor:ktor-client-content-negotiation:${Versions.ktor}") - implementation("io.ktor:ktor-serialization-kotlinx-json:${Versions.ktor}") - implementation("io.ktor:ktor-client-auth:${Versions.ktor}") - implementation("io.ktor:ktor-client-logging:${Versions.ktor}") + implementation(libs.ktor.client.core) + implementation(libs.ktor.client.content.negotiation) + implementation(libs.ktor.client.serialization.json) + implementation(libs.ktor.client.auth) + implementation(libs.ktor.client.logging) // Realm (Database) - implementation("io.realm.kotlin:library-base:${Versions.realm}") + implementation(libs.realm) // SharedSettings - implementation("com.russhwolf:multiplatform-settings:${Versions.settings}") - implementation("com.russhwolf:multiplatform-settings-coroutines:${Versions.settings}") + implementation(libs.settings) + implementation(libs.settings.coroutines) // Helper - api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0") - api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1") // Also needed by android for ComposeDestination parameter serialization + api(libs.kotlinx.datetime) + // Also needed by android for ComposeDestination parameter serialization + api(libs.kotlinx.serialization.json) } } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test")) } } - val androidMain by getting { + androidMain { // Include the generated localization source kotlin.srcDir("$generatedLocalizationRoot/androidMain/kotlin") dependencies { // Dependency injection - api("io.insert-koin:koin-android:${Versions.koinDi}") + api(libs.koin.android) // Ktor (HTTP client) - implementation("io.ktor:ktor-client-cio:${Versions.ktor}") + implementation(libs.ktor.client.cio) } } - val androidUnitTest by getting - val iosX64Main by getting - val iosArm64Main by getting - val iosSimulatorArm64Main by getting - val iosMain by creating { + iosMain { // Include the generated localization source kotlin.srcDir("$generatedLocalizationRoot/iosMain/kotlin") - dependsOn(commonMain) - iosX64Main.dependsOn(this) - iosArm64Main.dependsOn(this) - iosSimulatorArm64Main.dependsOn(this) - dependencies { // Ktor (HTTP client) - implementation("io.ktor:ktor-client-darwin:${Versions.ktor}") + implementation(libs.ktor.client.darwin) } } - val iosX64Test by getting - val iosArm64Test by getting - val iosSimulatorArm64Test by getting - val iosTest by creating { - dependsOn(commonTest) - iosX64Test.dependsOn(this) - iosArm64Test.dependsOn(this) - iosSimulatorArm64Test.dependsOn(this) - } } sourceSets.all { @@ -138,10 +122,9 @@ kotlin { android { namespace = sharedNamespace - compileSdk = Versions.androidCompileSdk + compileSdk = libs.versions.android.compileSdk.get().toInt() defaultConfig { - minSdk = Versions.androidMinSdk - targetSdk = Versions.androidTargetSdk + minSdk = libs.versions.android.minSdk.get().toInt() } // Include the generated localization string resources @@ -197,8 +180,11 @@ tasks { copy { from("$generatedLocalizationRoot/commonMain/resources/ios") into( - "${project.buildDir}/XCFrameworks/${buildType.lowercase()}/" + - "$iosFrameworkName.xcframework/$arch/$iosFrameworkName.framework" + File( + project.layout.buildDirectory.asFile.get(), + "XCFrameworks/${buildType.lowercase()}/" + + "$iosFrameworkName.xcframework/$arch/$iosFrameworkName.framework" + ) ) } }