From 854ea84351a8933c2ea4bbac8371cb51b6deccaf Mon Sep 17 00:00:00 2001 From: Syer10 Date: Sun, 17 Dec 2023 16:41:25 -0500 Subject: [PATCH] Kotlin 1.9.21 --- build.gradle.kts | 79 ++++++++----------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../appdirs/impl/ShellFolderResolver.kt | 15 +++- 3 files changed, 47 insertions(+), 49 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0c48e8a..7e8bd5f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ import java.util.Properties plugins { - kotlin("multiplatform") version "1.9.10" + kotlin("multiplatform") version "1.9.21" id("com.vanniktech.maven.publish") version "0.25.1" } @@ -28,6 +28,23 @@ kotlin { linuxArm64() mingwX64() + @OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class) + applyHierarchyTemplate { + common { + group("macosNative") { + withMacosX64() + withMacosArm64() + } + group("mingwNative") { + withMingwX64() + } + group("linuxNative") { + withLinuxX64() + withLinuxArm64() + } + } + } + sourceSets { val commonMain by getting val commonTest by getting { @@ -60,6 +77,14 @@ kotlin { dependsOn(commonTest) } + // Native + val nativeMain by creating { + dependsOn(commonMain) + } + val nativeTest by creating { + dependsOn(commonTest) + } + // JVM val jvmMain by getting { dependsOn(macosMain) @@ -75,77 +100,39 @@ kotlin { dependsOn(windowsTest) } - // Native - val nativeMain by creating { - dependsOn(commonMain) - } - val nativeTest by creating { - dependsOn(commonTest) - } - // Mac OS Native - val macosNativeMain by creating { + getByName("macosNativeMain") { dependsOn(nativeMain) dependsOn(macosMain) } - val macosNativeTest by creating { + getByName("macosNativeTest") { dependsOn(nativeTest) dependsOn(macosTest) } - val macosX64Main by getting { - dependsOn(macosNativeMain) - } - val macosX64Test by getting { - dependsOn(macosNativeTest) - } - val macosArm64Main by getting { - dependsOn(macosNativeMain) - } - val macosArm64Test by getting { - dependsOn(macosNativeTest) - } // Linux - val linuxNativeMain by creating { + getByName("linuxNativeMain") { dependsOn(nativeMain) dependsOn(unixMain) } - val linuxNativeTest by creating { + getByName("linuxNativeTest") { dependsOn(nativeTest) dependsOn(unixTest) } - val linuxX64Main by getting { - dependsOn(linuxNativeMain) - } - val linuxX64Test by getting { - dependsOn(linuxNativeTest) - } - val linuxArm64Main by getting { - dependsOn(linuxNativeMain) - } - val linuxArm64Test by getting { - dependsOn(linuxNativeTest) - } // Mingw - val mingwNativeMain by creating { + getByName("mingwNativeMain") { dependsOn(nativeMain) dependsOn(windowsMain) } - val mingwNativeTest by creating { + getByName("mingwNativeTest") { dependsOn(nativeTest) dependsOn(windowsTest) } - val mingwX64Main by getting { - dependsOn(mingwNativeMain) - } - val mingwX64Test by getting { - dependsOn(mingwNativeTest) - } } } -// Read in the signing.properties file if it is exists +// Read in the signing.properties file if it exists val signingPropsFile: File = rootProject.file("release/signing.properties") if (signingPropsFile.exists()) { Properties().apply { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 27313fb..e411586 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/mingwNativeMain/kotlin/ca/gosyer/appdirs/impl/ShellFolderResolver.kt b/src/mingwNativeMain/kotlin/ca/gosyer/appdirs/impl/ShellFolderResolver.kt index 0e12727..9413074 100644 --- a/src/mingwNativeMain/kotlin/ca/gosyer/appdirs/impl/ShellFolderResolver.kt +++ b/src/mingwNativeMain/kotlin/ca/gosyer/appdirs/impl/ShellFolderResolver.kt @@ -21,7 +21,12 @@ internal class ShellFolderResolver : WindowsFolderResolver { return try { memScoped { val result = alloc() - val hResult = SHGetKnownFolderPath(convertFolderIdToGuid(folderId).ptr, 0u, null, result.ptr) + val hResult = SHGetKnownFolderPath( + convertFolderIdToGuid(folderId).ptr, + 0u, + null, + result.ptr + ) if (hResult < 0) { throw AppDirsException( "SHGetKnownFolderPath returns an error: $hResult" @@ -35,7 +40,13 @@ internal class ShellFolderResolver : WindowsFolderResolver { try { memScoped { val result = alloc() - val hResult = SHGetFolderPathW(null, convertFolderIdToCsidl(folderId), null, 0u, result.value) + val hResult = SHGetFolderPathW( + null, + convertFolderIdToCsidl(folderId), + null, + 0u, + result.value + ) if (hResult < 0) { throw AppDirsException( "SHGetKnownFolderPath returns an error: $hResult"