From 171570159e40a428a37d6ac193bf191e09822361 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Sun, 25 Feb 2024 13:17:08 +0100 Subject: [PATCH 1/4] add Java tests for verifying `@JvmStatic` (#14) --- .../lang/kotlin-multiplatform-base.gradle.kts | 2 +- .../net/thauvin/erik/urlencoder/TestData.kt | 43 ++++++++++++++++ .../erik/urlencoder/UrlEncoderUtilTest.kt | 29 +++-------- .../erik/urlencoder/UrlEncoderJavaTest.java | 50 +++++++++++++++++++ 4 files changed, 102 insertions(+), 22 deletions(-) create mode 100644 urlencoder-lib/src/commonTest/kotlin/net/thauvin/erik/urlencoder/TestData.kt create mode 100644 urlencoder-lib/src/jvmTest/java/net/thauvin/erik/urlencoder/UrlEncoderJavaTest.java diff --git a/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts index 5665e86..7775dfc 100644 --- a/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts @@ -36,7 +36,7 @@ kotlin { targets.withType().configureEach { testRuns.configureEach { executionTask.configure { - // useJUnitPlatform() + useJUnitPlatform() } } } diff --git a/urlencoder-lib/src/commonTest/kotlin/net/thauvin/erik/urlencoder/TestData.kt b/urlencoder-lib/src/commonTest/kotlin/net/thauvin/erik/urlencoder/TestData.kt new file mode 100644 index 0000000..6cbf139 --- /dev/null +++ b/urlencoder-lib/src/commonTest/kotlin/net/thauvin/erik/urlencoder/TestData.kt @@ -0,0 +1,43 @@ +/* + * Copyright 2001-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.thauvin.erik.urlencoder + +import kotlin.jvm.JvmField + +const val standardContent = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVQXYZ0123456789-_." + +val invalidContent = listOf("sdkjfh%", "sdkjfh%6", "sdkjfh%xx", "sdfjfh%-1") + +/** + * List of unencoded content paired with the encoded content. + */ +val decodedToEncoded = listOf( + TestData("a test &", "a%20test%20%26"), + TestData( + "!abcdefghijklmnopqrstuvwxyz%%ABCDEFGHIJKLMNOPQRSTUVQXYZ0123456789-_.~=", + "%21abcdefghijklmnopqrstuvwxyz%25%25ABCDEFGHIJKLMNOPQRSTUVQXYZ0123456789-_.%7E%3D" + ), + TestData("%#okékÉȢ smile!😁", "%25%23ok%C3%A9k%C3%89%C8%A2%20smile%21%F0%9F%98%81"), + TestData("\uD808\uDC00\uD809\uDD00\uD808\uDF00\uD808\uDD00", "%F0%92%80%80%F0%92%94%80%F0%92%8C%80%F0%92%84%80"), +) + +data class TestData( + @JvmField + val unencoded: String, + @JvmField + val encoded: String, +) diff --git a/urlencoder-lib/src/commonTest/kotlin/net/thauvin/erik/urlencoder/UrlEncoderUtilTest.kt b/urlencoder-lib/src/commonTest/kotlin/net/thauvin/erik/urlencoder/UrlEncoderUtilTest.kt index 7b52619..102bbfa 100644 --- a/urlencoder-lib/src/commonTest/kotlin/net/thauvin/erik/urlencoder/UrlEncoderUtilTest.kt +++ b/urlencoder-lib/src/commonTest/kotlin/net/thauvin/erik/urlencoder/UrlEncoderUtilTest.kt @@ -23,30 +23,17 @@ import kotlin.test.DefaultAsserter.assertEquals import kotlin.test.DefaultAsserter.assertSame class UrlEncoderUtilTest { - private val same = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVQXYZ0123456789-_." - - companion object { - val invalid = listOf("sdkjfh%", "sdkjfh%6", "sdkjfh%xx", "sdfjfh%-1") - - val validMap = listOf( - "a test &" to "a%20test%20%26", - "!abcdefghijklmnopqrstuvwxyz%%ABCDEFGHIJKLMNOPQRSTUVQXYZ0123456789-_.~=" to - "%21abcdefghijklmnopqrstuvwxyz%25%25ABCDEFGHIJKLMNOPQRSTUVQXYZ0123456789-_.%7E%3D", - "%#okékÉȢ smile!😁" to "%25%23ok%C3%A9k%C3%89%C8%A2%20smile%21%F0%9F%98%81", - "\uD808\uDC00\uD809\uDD00\uD808\uDF00\uD808\uDD00" to "%F0%92%80%80%F0%92%94%80%F0%92%8C%80%F0%92%84%80", - ) - } @Test fun decodeURL() { - for (m in validMap) { - assertEquals(m.first, decode(m.second)) + for ((unencoded, encoded) in decodedToEncoded) { + assertEquals(unencoded, decode(encoded)) } } @Test fun decodeWithException() { - for (source in invalid) { + for (source in invalidContent) { assertFailsWith( message = "decode($source)", block = { decode(source) } @@ -56,7 +43,7 @@ class UrlEncoderUtilTest { @Test fun decodeWhenNoneNeeded() { - assertSame(same, decode(same)) + assertSame(standardContent, decode(standardContent)) assertEquals("decode('')", decode(""), "") assertEquals("decode(' ')", decode(" "), " ") } @@ -72,8 +59,8 @@ class UrlEncoderUtilTest { @Test fun encodeURL() { - for (m in validMap) { - assertEquals(m.second, encode(m.first)) + for ((unencoded, encoded) in decodedToEncoded) { + assertEquals(encoded, encode(unencoded)) } } @@ -86,8 +73,8 @@ class UrlEncoderUtilTest { @Test fun encodeWhenNoneNeeded() { - assertSame(encode(same), same) - assertSame("with empty allow", encode(same, allow = ""), same) + assertSame(encode(standardContent), standardContent) + assertSame("with empty allow", encode(standardContent, allow = ""), standardContent) } @Test diff --git a/urlencoder-lib/src/jvmTest/java/net/thauvin/erik/urlencoder/UrlEncoderJavaTest.java b/urlencoder-lib/src/jvmTest/java/net/thauvin/erik/urlencoder/UrlEncoderJavaTest.java new file mode 100644 index 0000000..8fa9561 --- /dev/null +++ b/urlencoder-lib/src/jvmTest/java/net/thauvin/erik/urlencoder/UrlEncoderJavaTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2001-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.thauvin.erik.urlencoder; + +import org.junit.jupiter.api.Test; + +import static net.thauvin.erik.urlencoder.TestDataKt.getDecodedToEncoded; +import static net.thauvin.erik.urlencoder.UrlEncoderUtil.decode; +import static net.thauvin.erik.urlencoder.UrlEncoderUtil.encode; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertEquals; + +class UrlEncoderJavaTest { + + @Test + public void decodeURL() { + assertAll( + getDecodedToEncoded() + .stream() + .map(data -> + () -> assertEquals(data.unencoded, decode(data.encoded)) + ) + ); + } + + @Test + public void encodeURL() { + assertAll( + getDecodedToEncoded() + .stream() + .map(data -> + () -> assertEquals(data.encoded, encode(data.unencoded)) + ) + ); + } +} From 8890fef6657a4594fb4cf9f5918c193690f6d2a2 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Tue, 26 Mar 2024 21:52:11 +0100 Subject: [PATCH 2/4] bump Kotlin to 1.9.23, enable additional Kotlin Multiplatform targets (#15) * bump Kotlin to 1.9.23, enable additional Kotlin Multiplatform targets * replace soon-to-be-deprecated kotlinOptions with newer compilerOptions --- buildSrc/build.gradle.kts | 4 +- .../lang/kotlin-multiplatform-base.gradle.kts | 22 ++- .../lang/kotlin-multiplatform-js.gradle.kts | 38 ++++- .../kotlin-multiplatform-native.gradle.kts | 92 ++----------- settings.gradle.kts | 130 ++++++++++-------- urlencoder-app/build.gradle.kts | 21 ++- 6 files changed, 134 insertions(+), 173 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 44a6ad5..d8dfb77 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -6,6 +6,6 @@ dependencies { implementation("com.github.ben-manes:gradle-versions-plugin:0.51.0") implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.1") implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.10") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23") implementation("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.4") -} \ No newline at end of file +} diff --git a/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts index 7775dfc..d41b539 100644 --- a/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-base.gradle.kts @@ -3,7 +3,9 @@ package buildsrc.conventions.lang import buildsrc.utils.Rife2TestListener import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile @@ -24,29 +26,21 @@ plugins { kotlin { //jvmToolchain(11) - targets.configureEach { - compilations.configureEach { - kotlinOptions { - languageVersion = "1.6" - } - } + applyDefaultHierarchyTemplate() + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + languageVersion = KotlinVersion.KOTLIN_1_6 } // configure all Kotlin/JVM Tests to use JUnit targets.withType().configureEach { testRuns.configureEach { executionTask.configure { - useJUnitPlatform() + useJUnitPlatform() } } } - - sourceSets.configureEach { - languageSettings { - // languageVersion = - // apiVersion = - } - } } tasks { diff --git a/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-js.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-js.gradle.kts index 2a0034a..5474801 100644 --- a/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-js.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-js.gradle.kts @@ -1,5 +1,7 @@ package buildsrc.conventions.lang +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl + /** conventions for a Kotlin/JS subproject */ plugins { @@ -7,12 +9,38 @@ plugins { } kotlin { - targets { - js(IR) { - browser() - nodejs() - } + js(IR) { + browser() + nodejs() + } + + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + browser() + nodejs() + } + + @OptIn(ExperimentalWasmDsl::class) + wasmWasi { + nodejs() } } relocateKotlinJsStore() + + +//region FIXME: WORKAROUND https://youtrack.jetbrains.com/issue/KT-65864 +rootProject.plugins.withType { + rootProject.extensions.configure { + // Use a Node.js version current enough to support Kotlin/Wasm + nodeVersion = "22.0.0-nightly2024010568c8472ed9" + logger.lifecycle("Using Node.js $nodeVersion to support Kotlin/Wasm") + nodeDownloadBaseUrl = "https://nodejs.org/download/nightly" + } +} + +rootProject.tasks.withType().configureEach { + // Prevent Yarn from complaining about newer Node.js versions. + args.add("--ignore-engines") +} +//endregion diff --git a/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-native.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-native.gradle.kts index f8ca72a..70022cc 100644 --- a/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-native.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/conventions/lang/kotlin-multiplatform-native.gradle.kts @@ -7,94 +7,26 @@ plugins { } kotlin { - - // Native targets all extend commonMain and commonTest. - // - // Some targets (ios, tvos, watchos) are shortcuts provided by the Kotlin DSL, that - // provide additional targets, except for 'simulators' which must be defined manually. - // https://kotlinlang.org/docs/multiplatform-share-on-platforms.html#use-target-shortcuts - // - // common/ - // └── native/ - // ├── linuxX64 - // ├── mingwX64 - // ├── macosX64 - // ├── macosArm64 - // ├── ios/ (shortcut) - // │ ├── iosArm64 - // │ ├── iosX64 - // │ └── iosSimulatorArm64 - // ├── tvos/ (shortcut) - // │ ├── tvosArm64 - // │ ├── tvosX64 - // │ └── tvosSimulatorArm64Main - // └── watchos/ (shortcut) - // ├── watchosArm32 - // ├── watchosArm64 - // ├── watchosX64 - // └── watchosSimulatorArm64Main - linuxX64() mingwX64() + linuxArm64() + macosX64() macosArm64() - // https://kotlinlang.org/docs/multiplatform-share-on-platforms.html#use-target-shortcuts - ios() // iosArm64, iosX64 - watchos() // watchosArm32, watchosArm64, watchosX64 - tvos() // tvosArm64, tvosX64 - + iosArm64() + iosX64() iosSimulatorArm64() - tvosSimulatorArm64() + + watchosArm32() + watchosArm64() + watchosX64() watchosSimulatorArm64() + watchosDeviceArm64() - @Suppress("UNUSED_VARIABLE") - sourceSets { - val commonMain by getting {} - val commonTest by getting {} - - val nativeMain by creating { dependsOn(commonMain) } - val nativeTest by creating { dependsOn(commonTest) } - - // Linux - val linuxX64Main by getting { dependsOn(nativeMain) } - val linuxX64Test by getting { dependsOn(nativeTest) } - - // Windows - MinGW - val mingwX64Main by getting { dependsOn(nativeMain) } - val mingwX64Test by getting { dependsOn(nativeTest) } - - // Apple - macOS - val macosArm64Main by getting { dependsOn(nativeMain) } - val macosArm64Test by getting { dependsOn(nativeTest) } - - val macosX64Main by getting { dependsOn(nativeMain) } - val macosX64Test by getting { dependsOn(nativeTest) } - - // Apple - iOS - val iosMain by getting { dependsOn(nativeMain) } - val iosTest by getting { dependsOn(nativeTest) } - - val iosSimulatorArm64Main by getting { dependsOn(iosMain) } - // val iosSimulatorArm64Test by getting { dependsOn(iosTest) } - - // // Apple - tvOS - // val tvosMain by getting { dependsOn(nativeMain) } - // val tvosTest by getting { dependsOn(nativeTest) } - - // val tvosSimulatorArm64Main by getting { dependsOn(tvosMain) } - // val tvosSimulatorArm64Test by getting { dependsOn(tvosTest) } - - // // Apple - watchOS - // val watchosMain by getting { dependsOn(nativeMain) } - // val watchosTest by getting { dependsOn(nativeTest) } - - // val watchosSimulatorArm64Main by getting { dependsOn(watchosMain) } - // val watchosSimulatorArm64Test by getting { dependsOn(watchosTest) } - - // val iosArm32Main by getting { dependsOn(desktopMain) } - // val iosArm32Test by getting { dependsOn(nativeTest) } - } + tvosArm64() + tvosX64() + tvosSimulatorArm64() } diff --git a/settings.gradle.kts b/settings.gradle.kts index 03ddb65..9e70d32 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,82 +1,90 @@ rootProject.name = "urlencoder" pluginManagement { - repositories { - mavenCentral() - gradlePluginPortal() - } + repositories { + mavenCentral() + gradlePluginPortal() + } } @Suppress("UnstableApiUsage") dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) - repositories { - mavenCentral() - maven("https://oss.sonatype.org/content/repositories/snapshots") { - name = "Sonatype Snapshots" - mavenContent { snapshotsOnly() } - } - - // Declare the Node.js & Yarn download repositories - exclusiveContent { - forRepository { - ivy("https://nodejs.org/dist/") { - name = "Node Distributions at $url" - patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") } - metadataSources { artifact() } - content { includeModule("org.nodejs", "node") } + repositories { + mavenCentral() + maven("https://oss.sonatype.org/content/repositories/snapshots") { + name = "Sonatype Snapshots" + mavenContent { snapshotsOnly() } } - } - filter { includeGroup("org.nodejs") } - } - exclusiveContent { - forRepository { - ivy("https://github.com/yarnpkg/yarn/releases/download") { - name = "Yarn Distributions at $url" - patternLayout { artifact("v[revision]/[artifact](-v[revision]).[ext]") } - metadataSources { artifact() } - content { includeModule("com.yarnpkg", "yarn") } + // Declare the Node.js & Yarn download repositories + exclusiveContent { + forRepositories( + ivy("https://nodejs.org/dist/") { + name = "Node Distributions at $url" + patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") } + metadataSources { artifact() } + }, + ivy("https://nodejs.org/download/v8-canary/") { + name = "Node Canary Distributions at $url" + patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") } + metadataSources { artifact() } + }, + ivy("https://nodejs.org/download/nightly/") { + name = "Node Nightly Distributions at $url" + patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") } + metadataSources { artifact() } + }, + ) + filter { includeGroup("org.nodejs") } } - } - filter { includeGroup("com.yarnpkg") } - } - // workaround for https://youtrack.jetbrains.com/issue/KT-51379 - exclusiveContent { - forRepository { - ivy("https://download.jetbrains.com/kotlin/native/builds") { - name = "Kotlin Native" - patternLayout { - // example download URLs: - // https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/linux-x86_64/kotlin-native-prebuilt-linux-x86_64-1.7.20.tar.gz - // https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/windows-x86_64/kotlin-native-prebuilt-windows-x86_64-1.7.20.zip - // https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/macos-x86_64/kotlin-native-prebuilt-macos-x86_64-1.7.20.tar.gz - listOf( - "macos-x86_64", - "macos-aarch64", - "osx-x86_64", - "osx-aarch64", - "linux-x86_64", - "windows-x86_64", - ).forEach { os -> - listOf("dev", "releases").forEach { stage -> - artifact("$stage/[revision]/$os/[artifact]-[revision].[ext]") - } + exclusiveContent { + forRepository { + ivy("https://github.com/yarnpkg/yarn/releases/download") { + name = "Yarn Distributions at $url" + patternLayout { artifact("v[revision]/[artifact](-v[revision]).[ext]") } + metadataSources { artifact() } + } } - } - metadataSources { artifact() } + filter { includeGroup("com.yarnpkg") } + } + + // workaround for https://youtrack.jetbrains.com/issue/KT-51379 + exclusiveContent { + forRepository { + ivy("https://download.jetbrains.com/kotlin/native/builds") { + name = "Kotlin Native" + patternLayout { + // example download URLs: + // https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/linux-x86_64/kotlin-native-prebuilt-linux-x86_64-1.7.20.tar.gz + // https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/windows-x86_64/kotlin-native-prebuilt-windows-x86_64-1.7.20.zip + // https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/macos-x86_64/kotlin-native-prebuilt-macos-x86_64-1.7.20.tar.gz + listOf( + "macos-x86_64", + "macos-aarch64", + "osx-x86_64", + "osx-aarch64", + "linux-x86_64", + "windows-x86_64", + ).forEach { os -> + listOf("dev", "releases").forEach { stage -> + artifact("$stage/[revision]/$os/[artifact]-[revision].[ext]") + } + } + } + metadataSources { artifact() } + } + } + filter { includeModuleByRegex(".*", ".*kotlin-native-prebuilt.*") } } - } - filter { includeModuleByRegex(".*", ".*kotlin-native-prebuilt.*") } } - } } enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") include( - ":urlencoder-app", - ":urlencoder-lib", + ":urlencoder-app", + ":urlencoder-lib", ) diff --git a/urlencoder-app/build.gradle.kts b/urlencoder-app/build.gradle.kts index 93a9789..c3fc159 100644 --- a/urlencoder-app/build.gradle.kts +++ b/urlencoder-app/build.gradle.kts @@ -1,17 +1,21 @@ import org.jetbrains.dokka.gradle.DokkaTask +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi plugins { buildsrc.conventions.lang.`kotlin-multiplatform-jvm` -// buildsrc.conventions.lang.`kotlin-multiplatform-js` -// buildsrc.conventions.lang.`kotlin-multiplatform-native` buildsrc.conventions.publishing - id("application") id("com.github.ben-manes.versions") } val urlEncoderMainClass = "net.thauvin.erik.urlencoder.UrlEncoder" kotlin { + jvm { + @OptIn(ExperimentalKotlinGradlePluginApi::class) + mainRun { + mainClass.set(urlEncoderMainClass) + } + } sourceSets { commonMain { dependencies { @@ -32,10 +36,6 @@ base { archivesName.set(rootProject.name) } -application { - mainClass.set(urlEncoderMainClass) -} - tasks { jvmJar { manifest { @@ -45,14 +45,13 @@ tasks { val fatJar by registering(Jar::class) { group = LifecycleBasePlugin.BUILD_GROUP - dependsOn.addAll(listOf("compileJava", "compileKotlinJvm", "processResources")) archiveClassifier.set("all") duplicatesStrategy = DuplicatesStrategy.EXCLUDE - manifest { attributes(mapOf("Main-Class" to application.mainClass)) } - from(sourceSets.main.get().output) + manifest { attributes(mapOf("Main-Class" to urlEncoderMainClass)) } + from(sourceSets.main.map { it.output }) dependsOn(configurations.jvmRuntimeClasspath) from(configurations.jvmRuntimeClasspath.map { classpath -> - classpath.incoming.artifacts.artifactFiles.files.filter { it.name.endsWith("jar") }.map { zipTree(it) } + classpath.filter { it.name.endsWith(".jar") }.map { zipTree(it) } }) } From b59d01ec6d9de4819498b61cfb10c4bb7d31fbe7 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 26 Mar 2024 14:13:32 -0700 Subject: [PATCH 3/4] Bumped Dokka to version 1.9.20 --- buildSrc/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index d8dfb77..48a5c25 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -5,7 +5,7 @@ plugins { dependencies { implementation("com.github.ben-manes:gradle-versions-plugin:0.51.0") implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.1") - implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.10") + implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23") implementation("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.4") } From a689c56e1eb7fdd4029d8a8013f230ccacfb977f Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 26 Mar 2024 14:14:08 -0700 Subject: [PATCH 4/4] Bumped Gradle to version 8.7 --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22c..b82aa23 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.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME