diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a9d5644..3f55ffd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -33,7 +33,7 @@ jobs: uses: actions/checkout@v4 - name: Publish linux - run: ./gradlew publishNativePublicationToGitHubPackagesRepository -PgithubPackagesUser=$GITHUB_ACTOR -PgithubPackagesKey=${{ secrets.GITHUB_TOKEN }} + run: ./gradlew publishLinuxX64PublicationToGitHubPackagesRepository -PgithubPackagesUser=$GITHUB_ACTOR -PgithubPackagesKey=${{ secrets.GITHUB_TOKEN }} publish-darwin: runs-on: macos-latest @@ -42,7 +42,7 @@ jobs: uses: actions/checkout@v4 - name: Publish darwin - run: ./gradlew publishNativePublicationToGitHubPackagesRepository -PgithubPackagesUser=$GITHUB_ACTOR -PgithubPackagesKey=${{ secrets.GITHUB_TOKEN }} + run: ./gradlew publishMacosX64PublicationToGitHubPackagesRepository -PgithubPackagesUser=$GITHUB_ACTOR -PgithubPackagesKey=${{ secrets.GITHUB_TOKEN }} publish-mingw: runs-on: windows-latest @@ -51,4 +51,4 @@ jobs: uses: actions/checkout@v4 - name: Publish mingw - run: ./gradlew.bat publishNativePublicationToGitHubPackagesRepository -PgithubPackagesUser=$GITHUB_ACTOR -PgithubPackagesKey=${{ secrets.GITHUB_TOKEN }} + run: ./gradlew.bat publishMingwX64PublicationToGitHubPackagesRepository -PgithubPackagesUser=$GITHUB_ACTOR -PgithubPackagesKey=${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8ede9e8..dfb17e0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,7 +33,7 @@ jobs: run: sudo apt-get install -y libcurl4-gnutls-dev - name: Run tests - run: ./gradlew nativeTest + run: ./gradlew linuxX64Test - name: Test Report uses: mikepenz/action-junit-report@v4 @@ -49,7 +49,7 @@ jobs: uses: actions/checkout@v4 - name: Run tests - run: ./gradlew nativeTest + run: ./gradlew macosX64Test - name: Test Report uses: mikepenz/action-junit-report@v4 @@ -65,7 +65,7 @@ jobs: uses: actions/checkout@v4 - name: Run tests - run: ./gradlew.bat nativeTest + run: ./gradlew.bat mingwX64Test - name: Test Report uses: mikepenz/action-junit-report@v4 diff --git a/build.gradle.kts b/build.gradle.kts index 1b91565..1af3d32 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,9 +8,6 @@ repositories { mavenCentral() } -val hostOs = System.getProperty("os.name") -val isArm64 = System.getProperty("os.arch") == "aarch64" -val isMingwX64 = hostOs.startsWith("Windows") kotlin { jvm { jvmToolchain(8) @@ -22,48 +19,40 @@ kotlin { } } + val hostOs = System.getProperty("os.name") + val isArm64 = System.getProperty("os.arch") == "aarch64" + val isMingwX64 = hostOs.startsWith("Windows") when { - hostOs == "Mac OS X" && isArm64 -> macosArm64("native") - hostOs == "Mac OS X" && !isArm64 -> macosX64("native") - hostOs == "Linux" && !isArm64 -> linuxX64("native") - isMingwX64 -> mingwX64("native") + hostOs == "Mac OS X" && isArm64 -> macosArm64() + hostOs == "Mac OS X" && !isArm64 -> macosX64() + hostOs == "Linux" && !isArm64 -> linuxX64() + isMingwX64 -> mingwX64() else -> throw GradleException("Host OS is not supported in Kotlin/Native.") } sourceSets { - val commonMain by getting { - dependencies { - implementation(libs.common.ktor.core) - implementation(libs.common.ktor.contentNegotiation) - implementation(libs.common.ktor.serialization) - implementation(libs.common.ktor.logging) - } + commonMain.dependencies { + implementation(libs.common.ktor.core) + implementation(libs.common.ktor.contentNegotiation) + implementation(libs.common.ktor.serialization) + implementation(libs.common.ktor.logging) } - val commonTest by getting { - dependencies { - implementation(libs.common.test.kotlin) - implementation(libs.common.test.ktorMock) - } + commonTest.dependencies { + implementation(libs.common.test.kotlin) + implementation(libs.common.test.ktorMock) } - val jvmMain by getting { - dependencies { - implementation(libs.jvm.ktor.client) - implementation(libs.jvm.ktor.logging) - } + jvmMain.dependencies { + implementation(libs.jvm.ktor.client) + implementation(libs.jvm.ktor.logging) } - val jvmTest by getting - val nativeMain by getting { - dependencies { - when { - hostOs == "Mac OS X" -> implementation(libs.macos.ktor.client) - hostOs == "Linux" -> implementation(libs.linux.ktor.client) - isMingwX64 -> implementation(libs.mingw.ktor.client) - else -> throw GradleException("Host OS is not supported in Kotlin/Native.") - } - + nativeMain.dependencies { + when { + hostOs == "Mac OS X" -> implementation(libs.macos.ktor.client) + hostOs == "Linux" -> implementation(libs.linux.ktor.client) + isMingwX64 -> implementation(libs.mingw.ktor.client) + else -> throw GradleException("Host OS is not supported in Kotlin/Native.") } } - val nativeTest by getting } } @@ -72,13 +61,7 @@ version = "0.0.2-SNAPSHOT" publishing { publications { publications.withType { - artifactId = when { - hostOs == "Mac OS X" && isArm64 -> artifactId.replace("native", "macosarm64") - hostOs == "Mac OS X" && !isArm64 -> artifactId.replace("native", "macosx64") - hostOs == "Linux" && !isArm64 -> artifactId.replace("native", "linuxx64") - isMingwX64 -> artifactId.replace("native", "mingwx64") - else -> throw GradleException("Host OS is not supported in Kotlin/Native.") - }.run { replace("kmp-", "") } + artifactId = artifactId.replace("kmp-", "") pom { url.set("https://github.com/ioki-mobility/kmp-lokalise-api") licenses { diff --git a/gradle.properties b/gradle.properties index 7fc6f1f..4dcde08 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,5 @@ kotlin.code.style=official +kotlin.experimental.tryK2=true +org.gradle.parallel=true +org.gradle.jvmargs=-Xmx6g +org.gradle.caching=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ea4160e..199df5a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "1.9.10" +kotlin = "1.9.20" ktor = "2.3.6" [libraries]