diff --git a/build-logic/src/main/kotlin/elmslie.kotlin-jvm-lib.gradle.kts b/build-logic/src/main/kotlin/elmslie.kotlin-jvm-lib.gradle.kts deleted file mode 100644 index a6e69bbe..00000000 --- a/build-logic/src/main/kotlin/elmslie.kotlin-jvm-lib.gradle.kts +++ /dev/null @@ -1,45 +0,0 @@ -@file:Suppress("UnstableApiUsage") - -plugins { - id("org.jetbrains.kotlin.jvm") - id("org.jetbrains.dokka") - id("com.android.lint") - id("elmslie.base-lib") - id("elmslie.detekt") - id("elmslie.tests-convention") - `maven-publish` -} - -java { - withJavadocJar() - withSourcesJar() -} - -tasks.named("javadocJar") { from(tasks.named("dokkaJavadoc")) } - -val catalog = extensions.getByType().named("libs") - -dependencies { catalog.findLibrary("dokka-kotlinAsJavaPlugin").ifPresent { dokkaHtmlPlugin(it) } } - -lint { - checkDependencies = true - ignoreTestSources = true - - abortOnError = true - warningsAsErrors = true - - htmlReport = true - xmlReport = false -} - -val libraryGroup: String by project -val libraryVersion: String by project - -afterEvaluate { - publishing.publications.create("maven") { - from(components["java"]) - artifactId = project.name - groupId = libraryGroup - version = libraryVersion - } -} diff --git a/build-logic/src/main/kotlin/elmslie.kotlin-multiplatform-lib.gradle.kts b/build-logic/src/main/kotlin/elmslie.kotlin-multiplatform-lib.gradle.kts index a85a9692..6c6c26d1 100644 --- a/build-logic/src/main/kotlin/elmslie.kotlin-multiplatform-lib.gradle.kts +++ b/build-logic/src/main/kotlin/elmslie.kotlin-multiplatform-lib.gradle.kts @@ -1,22 +1,22 @@ -@file:Suppress("UnstableApiUsage") +import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { kotlin("multiplatform") - id("com.android.library") id("elmslie.detekt") } kotlin { applyDefaultHierarchyTemplate() - androidTarget { + jvm { compilations.all { - kotlinOptions { - jvmTarget = JvmTarget.toString() + compilerOptions.configure { + jvmTarget.set(JvmTarget.JVM_11) } } } - iosX64() iosArm64() -} + iosSimulatorArm64() + iosX64() +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index b22d873a..e1358f9a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ plugins { alias(libs.plugins.androidApplication) apply false - alias(libs.plugins.kotlinJvm) apply false + alias(libs.plugins.kotlinMultiplatform) apply false } \ No newline at end of file diff --git a/elmslie-core/build.gradle.kts b/elmslie-core/build.gradle.kts index a16e6bdd..36a476e5 100644 --- a/elmslie-core/build.gradle.kts +++ b/elmslie-core/build.gradle.kts @@ -1,9 +1,19 @@ plugins { - id("elmslie.kotlin-jvm-lib") - id("elmslie.tests-convention") + id("elmslie.kotlin-multiplatform-lib") } -dependencies { - implementation(libs.kotlinx.coroutinesCore) - testImplementation(libs.kotlinx.coroutinesTest) -} +kotlin { + sourceSets { + val commonMain by getting { + dependencies { + implementation(libs.kotlinx.coroutinesCore) + } + } + val commonTest by getting { + dependencies { + implementation(libs.kotlinx.coroutinesTest) + implementation(libs.kotlin.test) + } + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index dcaa4733..03bda685 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,6 +27,11 @@ kapt.incremental.apt=true # https://kotlinlang.org/docs/reference/kapt.html?_ga=2.52861352.147014511.1570608228-996117368.1567680991#compile-avoidance-for-kapt-since-1320 kapt.include.compile.classpath=false # +# +# ----- Kotlin/Native features ----- +# +kotlin.native.distribution.downloadFromMaven=true +# # ----- AGP 4.0 build features ----- # # disable build config generation diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f7570ec3..0c1f9d04 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,5 +24,5 @@ kotlinx-coroutinesCore = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-co kotlinx-coroutinesTest = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } [plugins] -kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } androidApplication = { id = "com.android.application", version.ref = "agp" } \ No newline at end of file