From 90a0b671ec266a90c73361225fe07de54a89f68d Mon Sep 17 00:00:00 2001 From: Mahdi Hosseinzadeh Date: Fri, 12 Jul 2024 16:29:38 +0330 Subject: [PATCH] Improve build script code --- library/build.gradle.kts | 6 +++++- settings.gradle.kts | 3 +++ showcase/wasmApp/build.gradle.kts | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/library/build.gradle.kts b/library/build.gradle.kts index 009490f..895ef32 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -2,7 +2,7 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurr import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.DokkaBaseConfiguration import org.jetbrains.dokka.gradle.DokkaTask -import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl import java.io.File import java.util.* @@ -30,6 +30,9 @@ version = "2.0.0-alpha" // See https://central.sonatype.com/namespace/org.jetbrains.compose.material // for the targets that Compose Multiplatform supports kotlin { + // Publishes source files; for javadoc/kdoc/dokka see the publications block + withSourcesJar(publish = true) + androidTarget { publishLibraryVariants("release") } // Windows, Linux, macOS (with Java runtime) jvm(name = "desktop") @@ -213,6 +216,7 @@ publishing { } } publications.withType { + // Publishes javadoc/kdoc/dokka; for sources see the kotlin block artifact(javadocJar) // Required a workaround. See below pom { url = "https://mahozad.ir/${project.name}" diff --git a/settings.gradle.kts b/settings.gradle.kts index a99c01d..4a1c101 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,6 +3,9 @@ rootProject.name = "wavy-slider-project" enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") include(":library") +// We want the project name to be "wavy-slider" but its directory/folder name to be "library". +// If the project name were not set here, it would be published with its directory/folder name ("library") +// (suffixed with proper platform type added by Kotlin Multiplatform). project(":library").name = "wavy-slider" include(":showcase:shared") include(":showcase:androidApp") diff --git a/showcase/wasmApp/build.gradle.kts b/showcase/wasmApp/build.gradle.kts index 8bdbc96..aa50eb4 100644 --- a/showcase/wasmApp/build.gradle.kts +++ b/showcase/wasmApp/build.gradle.kts @@ -1,4 +1,4 @@ -import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl plugins { alias(libs.plugins.kotlin.multiplatform)