From 24e7a1e195d3cfdf024751f2f40af144909ecaea Mon Sep 17 00:00:00 2001 From: Andrey Kuleshov Date: Sun, 11 Feb 2024 02:57:19 +0300 Subject: [PATCH 1/2] Adding new Kotlin DefaultHierarchyTemplate ### What's done: - Migration to DefaultHierarchyTemplate --- ktoml-core/build.gradle.kts | 5 ++++- .../akuleshov7/ktoml/utils/UtilsSimulator.kt | 19 ------------------- ktoml-file/build.gradle.kts | 5 ++++- .../ktoml/file/FileUtilsIosSimulator.kt | 14 -------------- ktoml-source/build.gradle.kts | 5 ++++- 5 files changed, 12 insertions(+), 36 deletions(-) delete mode 100644 ktoml-core/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/utils/UtilsSimulator.kt delete mode 100644 ktoml-file/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/file/FileUtilsIosSimulator.kt diff --git a/ktoml-core/build.gradle.kts b/ktoml-core/build.gradle.kts index da174763..c483d931 100644 --- a/ktoml-core/build.gradle.kts +++ b/ktoml-core/build.gradle.kts @@ -31,9 +31,12 @@ kotlin { linuxX64() macosX64() macosArm64() - ios() + iosX64() + iosArm64() iosSimulatorArm64() + applyDefaultHierarchyTemplate() + sourceSets { all { languageSettings.optIn("kotlin.RequiresOptIn") diff --git a/ktoml-core/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/utils/UtilsSimulator.kt b/ktoml-core/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/utils/UtilsSimulator.kt deleted file mode 100644 index e8b62000..00000000 --- a/ktoml-core/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/utils/UtilsSimulator.kt +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Specific implementation for utilities - */ - -package com.akuleshov7.ktoml.utils - -import kotlin.experimental.ExperimentalNativeApi - -@Suppress("MAGIC_NUMBER") -@OptIn(ExperimentalNativeApi::class) -internal actual fun StringBuilder.appendCodePointCompat(codePoint: Int): StringBuilder = when (codePoint) { - in 0 until Char.MIN_SUPPLEMENTARY_CODE_POINT -> append(codePoint.toChar()) - in Char.MIN_SUPPLEMENTARY_CODE_POINT..Char.MAX_CODE_POINT -> { - append(Char.MIN_HIGH_SURROGATE + ((codePoint - 0x10000) shr 10)) - append(Char.MIN_LOW_SURROGATE + (codePoint and 0x3ff)) - } - else -> throw IllegalArgumentException() -} -public actual fun newLineChar(): Char = '\n' diff --git a/ktoml-file/build.gradle.kts b/ktoml-file/build.gradle.kts index 31182263..f80c01dd 100644 --- a/ktoml-file/build.gradle.kts +++ b/ktoml-file/build.gradle.kts @@ -26,9 +26,12 @@ kotlin { linuxX64() macosX64() macosArm64() - ios() + iosX64() + iosArm64() iosSimulatorArm64() + applyDefaultHierarchyTemplate() + sourceSets { all { languageSettings.optIn("kotlin.RequiresOptIn") diff --git a/ktoml-file/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/file/FileUtilsIosSimulator.kt b/ktoml-file/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/file/FileUtilsIosSimulator.kt deleted file mode 100644 index 6904d387..00000000 --- a/ktoml-file/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/file/FileUtilsIosSimulator.kt +++ /dev/null @@ -1,14 +0,0 @@ -/** - * File utils to read files using okio - */ - -package com.akuleshov7.ktoml.file - -import okio.FileSystem - -/** - * Implementation for getting proper file system to read files with okio - * - * @return proper FileSystem - */ -internal actual fun getOsSpecificFileSystem(): FileSystem = FileSystem.SYSTEM diff --git a/ktoml-source/build.gradle.kts b/ktoml-source/build.gradle.kts index cbb5fc63..f7c95d2f 100644 --- a/ktoml-source/build.gradle.kts +++ b/ktoml-source/build.gradle.kts @@ -26,9 +26,12 @@ kotlin { linuxX64() macosX64() macosArm64() - ios() + iosX64() + iosArm64() iosSimulatorArm64() + applyDefaultHierarchyTemplate() + sourceSets { all { languageSettings.optIn("kotlin.RequiresOptIn") From 8b3330f6d2706c8cf08af36d10fefa2be87c02b8 Mon Sep 17 00:00:00 2001 From: Andrey Kuleshov Date: Sun, 11 Feb 2024 14:58:17 +0300 Subject: [PATCH 2/2] Enhancing publishing mechanism and adding snapshot releases ### What's done: - Added snapshots - Removed dummy useless release configurations --- .github/workflows/build_and_test.yml | 20 +++++++++++++++++++- ktoml-core/build.gradle.kts | 11 ----------- ktoml-file/build.gradle.kts | 11 ----------- ktoml-source/build.gradle.kts | 11 ----------- 4 files changed, 19 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 042d99df..1f595fff 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -6,13 +6,20 @@ on: branches: - 'main' +env: + GRADLE_OPTS: -Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.welcome=never + PGP_SEC: ${{ secrets.PGP_SEC }} + PGP_PASSWORD: ${{ secrets.PGP_PASSWORD }} + SONATYPE_USER: ${{ secrets.SONATYPE_USER }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + jobs: build_and_test_with_code_coverage: name: Build and test runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest, windows-latest, macos-latest ] + os: [ macos-latest ] steps: # actions/checkout v1.* is needed for correct codecov upload, see https://github.com/actions/checkout/issues/237 for details @@ -56,3 +63,14 @@ jobs: with: flags: unittests fail_ci_if_error: true # optional (default = false) + - name: 'Publish a snapshot' + id: publish + if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref == 'refs/heads/main' }} + uses: gradle/gradle-build-action@v3 + with: + gradle-version: wrapper + arguments: | + publish + -Preckon.stage=snapshot + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/ktoml-core/build.gradle.kts b/ktoml-core/build.gradle.kts index c483d931..e27eca2f 100644 --- a/ktoml-core/build.gradle.kts +++ b/ktoml-core/build.gradle.kts @@ -76,17 +76,6 @@ kotlin { } } -publishing { - publications { - create("maven") { - groupId = "com.akuleshov7" - artifactId = "ktoml-core" - version = version - from(components["kotlin"]) - } - } -} - configureSigning() tasks.withType { diff --git a/ktoml-file/build.gradle.kts b/ktoml-file/build.gradle.kts index f80c01dd..1b98e41f 100644 --- a/ktoml-file/build.gradle.kts +++ b/ktoml-file/build.gradle.kts @@ -67,17 +67,6 @@ kotlin { } } -publishing { - publications { - create("maven") { - groupId = "com.akuleshov7" - artifactId = "ktoml-file" - version = version - from(components["kotlin"]) - } - } -} - configureSigning() tasks.withType { diff --git a/ktoml-source/build.gradle.kts b/ktoml-source/build.gradle.kts index f7c95d2f..7387ecd2 100644 --- a/ktoml-source/build.gradle.kts +++ b/ktoml-source/build.gradle.kts @@ -67,17 +67,6 @@ kotlin { } } -publishing { - publications { - create("maven") { - groupId = "com.akuleshov7" - artifactId = "ktoml-source" - version = version - from(components["kotlin"]) - } - } -} - configureSigning() tasks.withType {