From d73f3a5b8ac18533edcc32feb9180934d8b4b526 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Fri, 21 Feb 2025 10:54:43 +0100 Subject: [PATCH 1/7] Downgrade Ktor. Upgrade atomicfu and kotlinx-coroutines. POM fixes. --- build.gradle.kts | 4 ++-- rhodium-core/build.gradle.kts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c0cf1b9..04864fa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ buildscript { plugins { kotlin("multiplatform") version "2.0.20" apply false id("com.android.library") version "8.2.2" apply false - id("org.jetbrains.kotlinx.atomicfu") version "0.25.0" + id("org.jetbrains.kotlinx.atomicfu") version "0.26.1" id("com.vanniktech.maven.publish") version "0.30.0" //id("org.jetbrains.kotlin.android") version "2.0.0" apply false //id("org.jetbrains.kotlin.plugin.compose") version "2.0.0" apply false @@ -55,7 +55,7 @@ allprojects { pom { name = "Rhodium" description = " A Kotlin Multiplatform library for Nostr" - url = "https://github.com/KotlinGeekDev/Ballast" + url = "https://github.com/KotlinGeekDev/Rhodium" licenses { license { diff --git a/rhodium-core/build.gradle.kts b/rhodium-core/build.gradle.kts index 603514e..6fa23cd 100644 --- a/rhodium-core/build.gradle.kts +++ b/rhodium-core/build.gradle.kts @@ -5,7 +5,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile val kotlinVersion = "2.0.20" -val ktorVersion = "3.0.1" +val ktorVersion = "2.3.13" val kotlinCryptoVersion = "0.4.0" val junitJupiterVersion = "5.10.1" @@ -106,7 +106,7 @@ kotlin { //Ktor implementation("io.ktor:ktor-client-core:$ktorVersion") implementation("io.ktor:ktor-client-websockets:$ktorVersion") - implementation("io.ktor:ktor-client-logging:$ktorVersion") + //implementation("io.ktor:ktor-client-logging:$ktorVersion") //Kotlin base implementation("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}") @@ -120,9 +120,9 @@ kotlin { //Serialization implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1") //Coroutines - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1") //Atomics - implementation("org.jetbrains.kotlinx:atomicfu:0.25.0") + implementation("org.jetbrains.kotlinx:atomicfu:0.26.1") //Date-time implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1") //UUID From 796caa3e7c57de865c8c002a66d21001e547219a Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Fri, 21 Feb 2025 11:37:39 +0100 Subject: [PATCH 2/7] Configure apple targets to spit out frameworks. Enable testing on CI. --- .github/workflows/gradle.yml | 60 +++++++++++++++++++++++++++++++++++ rhodium-core/build.gradle.kts | 32 +++++++++++++++---- 2 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..8979ef2 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,60 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: KMP CI with Gradle + +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "main" ] + workflow_call: + +permissions: + contents: read + +jobs: + build: + strategy: + matrix: + include: + - target: iosSimulatorArm64Test + os: macos-latest + - target: jvmTest + os: ubuntu-latest + - target: linuxX64Test + os: ubuntu-latest + - target: testDebugUnitTest + os: ubuntu-latest + - target: testReleaseUnitTest + os: ubuntu-latest + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - uses: actions/cache@v3 + with: + path: | + ~/.konan + key: ${{ runner.os }}-${{ hashFiles('**/.lock') }} + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Build with Gradle + uses: gradle/gradle-build-action@ce999babab2de1c4b649dc15f0ee67e6246c994f + with: + arguments: ${{ matrix.target }} + - name: Maven Local Publishing + run: ./gradlew publishToMavenLocal --no-configuration-cache + env: + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }} \ No newline at end of file diff --git a/rhodium-core/build.gradle.kts b/rhodium-core/build.gradle.kts index 6fa23cd..f63b1de 100644 --- a/rhodium-core/build.gradle.kts +++ b/rhodium-core/build.gradle.kts @@ -93,11 +93,26 @@ kotlin { } //Apple targets - macosX64() - macosArm64() - iosX64() - iosArm64() - iosSimulatorArm64() + val macosX64 = macosX64() + val macosArm64 = macosArm64() + val iosArm64 = iosArm64() + val iosX64 = iosX64() + val iosSimulatorArm64 = iosSimulatorArm64() + val appleTargets = listOf( + macosX64, macosArm64, + iosArm64, iosX64, iosSimulatorArm64, + ) + + appleTargets.forEach { target -> + with(target) { + binaries { + framework { + baseName = "Rhodium" + } + } + } + } + applyDefaultHierarchyTemplate() @@ -213,8 +228,11 @@ kotlin { implementation("dev.whyoleg.cryptography:cryptography-provider-apple:$kotlinCryptoVersion") } } - macosMain.get().dependsOn(appleMain.get()) - iosMain.get().dependsOn(appleMain.get()) + + appleTargets.forEach { target -> + getByName("${target.targetName}Main") { dependsOn(appleMain.get()) } + getByName("${target.targetName}Test") { dependsOn(appleTest.get()) } + } } } From 280b09d411c4b4d11d18a2d4a3f51cf1266e7224 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Fri, 21 Feb 2025 11:51:28 +0100 Subject: [PATCH 3/7] Fix workflow issues. --- .github/workflows/gradle.yml | 4 ++-- rhodium-core/build.gradle.kts | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 8979ef2..a863ec4 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -24,9 +24,9 @@ jobs: include: - target: iosSimulatorArm64Test os: macos-latest - - target: jvmTest + - target: commonJvmTest os: ubuntu-latest - - target: linuxX64Test + - target: linuxTest os: ubuntu-latest - target: testDebugUnitTest os: ubuntu-latest diff --git a/rhodium-core/build.gradle.kts b/rhodium-core/build.gradle.kts index f63b1de..f681178 100644 --- a/rhodium-core/build.gradle.kts +++ b/rhodium-core/build.gradle.kts @@ -228,6 +228,9 @@ kotlin { implementation("dev.whyoleg.cryptography:cryptography-provider-apple:$kotlinCryptoVersion") } } + appleTest.configure { + dependsOn(commonTest.get()) + } appleTargets.forEach { target -> getByName("${target.targetName}Main") { dependsOn(appleMain.get()) } From 575c04ea02aaab21f99d6bac80059c777a8feb57 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Fri, 21 Feb 2025 12:15:36 +0100 Subject: [PATCH 4/7] Fix regression caused by new coroutines version. Fix a test. --- rhodium-core/build.gradle.kts | 4 ++-- .../src/commonTest/kotlin/rhodium/nostr/NostrTests.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rhodium-core/build.gradle.kts b/rhodium-core/build.gradle.kts index f681178..39966ba 100644 --- a/rhodium-core/build.gradle.kts +++ b/rhodium-core/build.gradle.kts @@ -121,7 +121,7 @@ kotlin { //Ktor implementation("io.ktor:ktor-client-core:$ktorVersion") implementation("io.ktor:ktor-client-websockets:$ktorVersion") - //implementation("io.ktor:ktor-client-logging:$ktorVersion") + implementation("io.ktor:ktor-client-logging:$ktorVersion") //Kotlin base implementation("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}") @@ -135,7 +135,7 @@ kotlin { //Serialization implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1") //Coroutines - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0") //Atomics implementation("org.jetbrains.kotlinx:atomicfu:0.26.1") //Date-time diff --git a/rhodium-core/src/commonTest/kotlin/rhodium/nostr/NostrTests.kt b/rhodium-core/src/commonTest/kotlin/rhodium/nostr/NostrTests.kt index 51cd22d..3936d77 100644 --- a/rhodium-core/src/commonTest/kotlin/rhodium/nostr/NostrTests.kt +++ b/rhodium-core/src/commonTest/kotlin/rhodium/nostr/NostrTests.kt @@ -93,6 +93,6 @@ class NostrTests { println(event) println("Correct Event:") println(correctlyParsedEvent) - assertEquals(correctlyParsedEvent, event) + assertEquals(correctlyParsedEvent.toString(), event.toString()) } } \ No newline at end of file From 30775670635cc5d26b8694bd38b0fa2a80f6d0f8 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Fri, 21 Feb 2025 12:31:01 +0100 Subject: [PATCH 5/7] Update gradle wrapper validation task. --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index a863ec4..62f82eb 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -37,7 +37,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/actions/wrapper-validation@v3 - uses: actions/cache@v3 with: path: | From 6af1b67a30b8157438eab94d30af05b5fe646792 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Fri, 21 Feb 2025 12:54:12 +0100 Subject: [PATCH 6/7] Fix unit tests for Android source set. --- rhodium-core/build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rhodium-core/build.gradle.kts b/rhodium-core/build.gradle.kts index 39966ba..8736873 100644 --- a/rhodium-core/build.gradle.kts +++ b/rhodium-core/build.gradle.kts @@ -194,12 +194,14 @@ kotlin { } androidUnitTest.configure { + dependsOn(commonJvmTest) dependencies { implementation("junit:junit:4.13.2") } } androidInstrumentedTest.configure { + dependsOn(commonJvmTest) dependencies { implementation("androidx.test.ext:junit:1.2.1") implementation("androidx.test.espresso:espresso-core:3.6.1") From cce300af0aa281642d96688094b9f7cb0e573a39 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Fri, 21 Feb 2025 13:08:32 +0100 Subject: [PATCH 7/7] Move to new version: v1.0-beta-17. --- .github/workflows/gradle.yml | 6 +++--- README.md | 6 +++--- build.gradle.kts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 62f82eb..f9dcf3b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -8,10 +8,10 @@ name: KMP CI with Gradle on: - push: - branches: [ "develop" ] +# push: +# branches: [ "develop" ] pull_request: - branches: [ "main" ] + branches: [ "develop" ] workflow_call: permissions: diff --git a/README.md b/README.md index aff4e23..aedd43f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You can include the library from either Maven Central or Jitpack. You can include the library in the common source set like this: ```kotlin dependencies { - implementation("io.github.kotlingeekdev:rhodium:1.0-beta-16") + implementation("io.github.kotlingeekdev:rhodium:1.0-beta-17") } ``` @@ -74,7 +74,7 @@ then, in your module's `build.gradle(.kts)`, you need to add: // build.gradle.kts dependencies { //... - implementation("com.github.KotlinGeekDev.Rhodium:rhodium:1.0-beta-16") + implementation("com.github.KotlinGeekDev.Rhodium:rhodium:1.0-beta-17") } @@ -85,7 +85,7 @@ If you're including it in an Android app, you can just add: // app/build.gradle.kts dependencies { //... - implementation("com.github.KotlinGeekDev.Rhodium:rhodium-android:1.0-beta-16") + implementation("com.github.KotlinGeekDev.Rhodium:rhodium-android:1.0-beta-17") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index 04864fa..c98b228 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,7 +31,7 @@ allprojects { val isJitpack = System.getenv("JITPACK") == "true" group = "io.github.kotlingeekdev" - version = "1.0-beta-16" + version = "1.0-beta-17" // val javadocJar = tasks.register("javadocJar") {