From 2652065fceff3ef805581d86267ff95466ce5766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernd=20Pr=C3=BCnster?= Date: Wed, 9 Oct 2024 10:10:44 +0200 Subject: [PATCH] tmp multi-module fail --- build.gradle.kts | 197 +---------------- buildSrc/build.gradle.kts | 12 ++ buildSrc/settings.gradle | 1 + buildSrc/src/main/kotlin/Versions.kt | 29 +++ kmmresult/build.gradle.kts | 203 ++++++++++++++++++ .../kotlin/at/asitplus/KmmResult.kt | 0 .../src}/commonTest/kotlin/KmmResultTest.kt | 0 .../src}/jvmTest/java/JavaInteropTests.java | 0 settings.gradle.kts | 19 +- 9 files changed, 268 insertions(+), 193 deletions(-) create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/settings.gradle create mode 100644 buildSrc/src/main/kotlin/Versions.kt create mode 100644 kmmresult/build.gradle.kts rename {src => kmmresult/src}/commonMain/kotlin/at/asitplus/KmmResult.kt (100%) rename {src => kmmresult/src}/commonTest/kotlin/KmmResultTest.kt (100%) rename {src => kmmresult/src}/jvmTest/java/JavaInteropTests.java (100%) diff --git a/build.gradle.kts b/build.gradle.kts index 42a4412..5f8723c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,204 +1,18 @@ -import io.gitlab.arturbosch.detekt.Detekt -import org.gradle.kotlin.dsl.support.listFilesOrdered -import java.net.URI - -plugins { - kotlin("multiplatform") version "2.0.0" - id("maven-publish") - id("signing") +plugins {base + kotlin("multiplatform") version "2.0.0" apply false + id("org.jetbrains.dokka") id("io.github.gradle-nexus.publish-plugin") version "1.3.0" - id("org.jetbrains.dokka") version "2.0.0-Beta" - id("org.jetbrains.kotlinx.kover") version "0.8.0" - id("io.gitlab.arturbosch.detekt") version "1.23.6" } val artifactVersion: String by extra group = "at.asitplus" version = artifactVersion -repositories { - mavenCentral() -} - -val dokkaOutputDir = "$projectDir/docs" -dokka { - val moduleDesc = File("$rootDir/dokka-tmp.md").also { it.createNewFile() } - val readme = - File("${rootDir}/README.md").readText() - val moduleTitle = project.name - moduleDesc.writeText("# Module ${project.name}\n\n$readme") - moduleName.set(moduleTitle) - - dokkaSourceSets { - named("commonMain") { - - includes.from(moduleDesc) - sourceLink { - localDirectory.set(file("src/$name/kotlin")) - remoteUrl.set( - URI("https://github.com/a-sit-plus/kmmresult/tree/development/src/$name/kotlin") - ) - // Suffix which is used to append the line number to the URL. Use #L for GitHub - remoteLineSuffix.set("#L") - } - } - } - dokkaPublicationDirectory.set(file("${rootDir}/docs")) - pluginsConfiguration.html { - footerMessage = "© 2024 A-SIT Plus GmbH" - } - -} - -tasks.dokkaGenerate { - doLast { - rootDir.listFilesOrdered { it.extension.lowercase() == "png" || it.extension.lowercase() == "svg" } - .forEach { it.copyTo(File("$rootDir/docs/html/${it.name}"), overwrite = true) } - - } -} -val deleteDokkaOutputDir by tasks.register("deleteDokkaOutputDirectory") { - delete(dokkaOutputDir) -} -val javadocJar = tasks.register("javadocJar") { - dependsOn(deleteDokkaOutputDir, tasks.dokkaGenerate) - archiveClassifier.set("javadoc") - from(dokkaOutputDir) -} - -tasks.getByName("check") { - dependsOn("detektMetadataMain") +dependencies { + dokka(project(":kmmresult")) } -//first sign everything, then publish! -tasks.withType() { - tasks.withType().forEach { - dependsOn(it) - } -} - -kotlin { - - val xcf = org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkConfig(project, "KmmResult") - listOf( - macosArm64(), - macosX64(), - tvosArm64(), - tvosX64(), - tvosSimulatorArm64(), - iosX64(), - iosArm64(), - iosSimulatorArm64() - ).forEach { - it.binaries.framework { - baseName = "KmmResult" - binaryOption("bundleId", "at.asitplus.KmmResult") - embedBitcode("bitcode") - xcf.add(this) - isStatic = true - } - } - - jvmToolchain(11) - jvm { - compilations.all { - kotlinOptions { - freeCompilerArgs = listOf( - "-Xjsr305=strict" - ) - } - } - withJava() //for Java Interop tests - } - - js(IR) { - browser { testTask { enabled = false } } - nodejs() - } - linuxX64() - linuxArm64() - mingwX64() - - sourceSets { - commonMain.dependencies { - implementation("io.arrow-kt:arrow-core:1.2.4") - } - - commonTest.dependencies { - implementation(kotlin("test")) - } - } - - - - tasks.withType().configureEach { - reports { - xml.required.set(true) - html.required.set(false) - txt.required.set(false) - sarif.required.set(true) - md.required.set(true) - } - } - - dependencies { - detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6") - } - - repositories { - mavenCentral() - } - - publishing { - publications { - withType { - artifact(javadocJar) - pom { - name.set("KmmResult") - description.set("Functional equivalent of kotlin.Result but with KMM goodness") - url.set("https://github.com/a-sit-plus/kmmresult") - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - developers { - developer { - id.set("JesusMcCloud") - name.set("Bernd PrĂ¼nster") - email.set("bernd.pruenster@a-sit.at") - } - developer { - id.set("nodh") - name.set("Christian Kollmann") - email.set("christian.kollmann@a-sit.at") - } - } - scm { - connection.set("scm:git:git@github.com:a-sit-plus/kmmresult.git") - developerConnection.set("scm:git:git@github.com:a-sit-plus/kmmresult.git") - url.set("https://github.com/a-sit-plus/kmmresult") - } - } - } - } - repositories { - mavenLocal() { - signing.isRequired = false - } - } - } -} - -signing { - val signingKeyId: String? by project - val signingKey: String? by project - val signingPassword: String? by project - useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) - sign(publishing.publications) -} nexusPublishing { repositories { @@ -208,4 +22,3 @@ nexusPublishing { } } } - diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..24aaa6f --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,12 @@ +plugins { + `kotlin-dsl` +} + +repositories { + mavenCentral() + gradlePluginPortal() +} + +dependencies { + implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.0.0-Beta") +} \ No newline at end of file diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle new file mode 100644 index 0000000..77dd2de --- /dev/null +++ b/buildSrc/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'backend_buildSrc' diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt new file mode 100644 index 0000000..30d7e14 --- /dev/null +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -0,0 +1,29 @@ +object VersionsBackend { + const val zxing = "3.5.0" + const val semver = "1.1.2" + const val `google-cbor` = "0.01.02" + const val hsmf = "0.8.3" + const val pgsql = "42.7.3" + const val mockito = "5.1.0" + const val okhttp = "4.11.0" + const val scrimage = "4.0.39" + const val pupilidlib = "1.9.0-pupilid" + const val attestation = "2.1.3" + const val jose = "9.25.6" + + object spring { + const val boot = "3.1.3" + const val `dependency-management` = "1.1.3" + const val `cloud-config-client` = "4.0.4" + const val `admin-starter-client` = "3.1.6" + const val doc = "2.3.0" + const val swagger = "2.2.19" + } + + object webjars { + const val locator = "0.47" + const val bootstrap = "5.3.1" + const val jquery = "3.7.1" + const val datatables = "1.13.5" + } +} diff --git a/kmmresult/build.gradle.kts b/kmmresult/build.gradle.kts new file mode 100644 index 0000000..f851c72 --- /dev/null +++ b/kmmresult/build.gradle.kts @@ -0,0 +1,203 @@ +import io.gitlab.arturbosch.detekt.Detekt +import org.gradle.kotlin.dsl.support.listFilesOrdered +import java.net.URI + +plugins { + kotlin("multiplatform") + id("maven-publish") + id("signing") + id("org.jetbrains.dokka") + id("org.jetbrains.kotlinx.kover") version "0.8.0" + id("io.gitlab.arturbosch.detekt") version "1.23.6" +} + +val artifactVersion: String by extra +group = "at.asitplus" +version = artifactVersion + +repositories { + mavenCentral() +} + +val dokkaOutputDir = "$projectDir/docs" +dokka { + val moduleDesc = File("$rootDir/dokka-tmp.md").also { it.createNewFile() } + val readme = + File("${rootDir}/README.md").readText() + val moduleTitle = project.name + moduleDesc.writeText("# Module ${project.name}\n\n$readme") + moduleName.set(moduleTitle) + + + dokkaSourceSets { + register("commonMain") { + includes.from(moduleDesc) + sourceLink { + val path = "${projectDir}/src/$name/kotlin" + println(path) + localDirectory.set(file(path)) + remoteUrl.set( + URI("https://github.com/a-sit-plus/kmmresult/tree/development/src/$name/kotlin") + ) + // Suffix which is used to append the line number to the URL. Use #L for GitHub + remoteLineSuffix.set("#L") + } + } + } + dokkaPublicationDirectory.set(file("${rootDir}/docs")) + pluginsConfiguration.html { + footerMessage = "© 2024 A-SIT Plus GmbH" + } + +} + +tasks.dokkaGenerate { + doLast { + rootDir.listFilesOrdered { it.extension.lowercase() == "png" || it.extension.lowercase() == "svg" } + .forEach { it.copyTo(File("$rootDir/docs/html/${it.name}"), overwrite = true) } + + } +} +val deleteDokkaOutputDir by tasks.register("deleteDokkaOutputDirectory") { + delete(dokkaOutputDir) +} +val javadocJar = tasks.register("javadocJar") { + dependsOn(deleteDokkaOutputDir, tasks.dokkaGenerate) + archiveClassifier.set("javadoc") + from(dokkaOutputDir) +} + +tasks.getByName("check") { + dependsOn("detektMetadataMain") +} + + +//first sign everything, then publish! +tasks.withType() { + tasks.withType().forEach { + dependsOn(it) + } +} + +kotlin { + + val xcf = org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkConfig(project, "KmmResult") + listOf( + macosArm64(), + macosX64(), + tvosArm64(), + tvosX64(), + tvosSimulatorArm64(), + iosX64(), + iosArm64(), + iosSimulatorArm64() + ).forEach { + it.binaries.framework { + baseName = "KmmResult" + binaryOption("bundleId", "at.asitplus.KmmResult") + embedBitcode("bitcode") + xcf.add(this) + isStatic = true + } + } + + jvmToolchain(11) + jvm { + compilations.all { + kotlinOptions { + freeCompilerArgs = listOf( + "-Xjsr305=strict" + ) + } + } + withJava() //for Java Interop tests + } + + js(IR) { + browser { testTask { enabled = false } } + nodejs() + } + linuxX64() + linuxArm64() + mingwX64() + + sourceSets { + commonMain.dependencies { + implementation("io.arrow-kt:arrow-core:1.2.4") + } + + commonTest.dependencies { + implementation(kotlin("test")) + } + } + + + + tasks.withType().configureEach { + reports { + xml.required.set(true) + html.required.set(false) + txt.required.set(false) + sarif.required.set(true) + md.required.set(true) + } + } + + dependencies { + detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6") + } + + repositories { + mavenCentral() + } + + publishing { + publications { + withType { + artifact(javadocJar) + pom { + name.set("KmmResult") + description.set("Functional equivalent of kotlin.Result but with KMM goodness") + url.set("https://github.com/a-sit-plus/kmmresult") + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + developers { + developer { + id.set("JesusMcCloud") + name.set("Bernd PrĂ¼nster") + email.set("bernd.pruenster@a-sit.at") + } + developer { + id.set("nodh") + name.set("Christian Kollmann") + email.set("christian.kollmann@a-sit.at") + } + } + scm { + connection.set("scm:git:git@github.com:a-sit-plus/kmmresult.git") + developerConnection.set("scm:git:git@github.com:a-sit-plus/kmmresult.git") + url.set("https://github.com/a-sit-plus/kmmresult") + } + } + } + } + repositories { + mavenLocal() { + signing.isRequired = false + } + } + } +} + +signing { + val signingKeyId: String? by project + val signingKey: String? by project + val signingPassword: String? by project + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign(publishing.publications) +} + diff --git a/src/commonMain/kotlin/at/asitplus/KmmResult.kt b/kmmresult/src/commonMain/kotlin/at/asitplus/KmmResult.kt similarity index 100% rename from src/commonMain/kotlin/at/asitplus/KmmResult.kt rename to kmmresult/src/commonMain/kotlin/at/asitplus/KmmResult.kt diff --git a/src/commonTest/kotlin/KmmResultTest.kt b/kmmresult/src/commonTest/kotlin/KmmResultTest.kt similarity index 100% rename from src/commonTest/kotlin/KmmResultTest.kt rename to kmmresult/src/commonTest/kotlin/KmmResultTest.kt diff --git a/src/jvmTest/java/JavaInteropTests.java b/kmmresult/src/jvmTest/java/JavaInteropTests.java similarity index 100% rename from src/jvmTest/java/JavaInteropTests.java rename to kmmresult/src/jvmTest/java/JavaInteropTests.java diff --git a/settings.gradle.kts b/settings.gradle.kts index 22c130a..175eddc 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,19 @@ +rootProject.name = "kmmresult-root" //DOKKA BUG with spaces -rootProject.name = "kmmresult" \ No newline at end of file + +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } +} + +@Suppress("UnstableApiUsage") +dependencyResolutionManagement { + repositories { + mavenCentral() + } +} + + +include("kmmresult") \ No newline at end of file