Skip to content

Commit

Permalink
Merge pull request #25 from ioki-mobility/dependabot/gradle/kotlin-1.…
Browse files Browse the repository at this point in the history
…9.20

* Bump kotlin from 1.9.10 to 1.9.20
  * Use K2 compiler
  * Adjust for new hierarchy template
* Speed up Gradle
  • Loading branch information
StefMa authored Nov 14, 2023
2 parents 3502340 + 3604b9d commit 2736f5d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 49 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
67 changes: 25 additions & 42 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}
}

Expand All @@ -72,13 +61,7 @@ version = "0.0.2-SNAPSHOT"
publishing {
publications {
publications.withType<MavenPublication> {
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 {
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
kotlin.code.style=official
kotlin.experimental.tryK2=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx6g
org.gradle.caching=true
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "1.9.10"
kotlin = "1.9.20"
ktor = "2.3.6"

[libraries]
Expand Down

0 comments on commit 2736f5d

Please sign in to comment.