From 8fdc0c9c93278a37e8790135878b68454a7ef44d Mon Sep 17 00:00:00 2001 From: Rafael Costa Date: Tue, 1 Nov 2022 19:06:57 +0000 Subject: [PATCH 1/3] Added workflow for automatic releases when new push is done to main branches with a tag. --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ gradle.properties | 4 ++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..fa91a6d9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: release +run-name: Publishing new version to maven central. +on: + push: + branches: [ main, compose-1.1, compose-1.2 ] + tags: + - '*.*.*' + +env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyId }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }} + +jobs: + release: + if: github.ref_name != 'main' && github.ref_name != 'compose-1.1' && github.ref_name != 'compose-1.2' + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Cache + uses: actions/cache@v3 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Build + uses: gradle/gradle-build-action@v2 + with: + gradle-version: current + arguments: build + + - name: Run unit tests + run: ./gradlew test + + - name: Publish to Maven Central + run: ./gradlew publishAllPublicationsToMavenCentral diff --git a/gradle.properties b/gradle.properties index 8043af62..1e82f51c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,4 +20,6 @@ android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -android.disableAutomaticComponentCreation=true \ No newline at end of file +android.disableAutomaticComponentCreation=true + +SONATYPE_AUTOMATIC_RELEASE=true \ No newline at end of file From bcafb73ee8134ffcf64582c282d082c94327c143 Mon Sep 17 00:00:00 2001 From: Rafael Costa Date: Tue, 1 Nov 2022 21:02:18 +0000 Subject: [PATCH 2/3] Added run name for build workflow. --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d665901..138b0b5e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,5 @@ name: Build +run-name: Testing build. on: push: From 23fbbfa7afa67959c0d191bfcaa53bbd396c174a Mon Sep 17 00:00:00 2001 From: Hrafn Thorvaldsson Date: Mon, 31 Oct 2022 16:11:54 +0000 Subject: [PATCH 3/3] fix: Generated package name when using hard keyword 'is' --- .../ramcosta/composedestinations/codegen/commons/Utils.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compose-destinations-codegen/src/main/java/com/ramcosta/composedestinations/codegen/commons/Utils.kt b/compose-destinations-codegen/src/main/java/com/ramcosta/composedestinations/codegen/commons/Utils.kt index dd972584..56d90a94 100644 --- a/compose-destinations-codegen/src/main/java/com/ramcosta/composedestinations/codegen/commons/Utils.kt +++ b/compose-destinations-codegen/src/main/java/com/ramcosta/composedestinations/codegen/commons/Utils.kt @@ -26,9 +26,13 @@ fun String.removeInstancesOf(vararg toRemove: String): String { return result } +private val keywords: Set = setOf( + "in", "is" +) + fun String.sanitizePackageName(): String { return split(".") - .joinToString(".") { if (it == "in") "`in`" else it } + .joinToString(".") { if (keywords.contains(it)) "`$it`" else it } } private val humps = "(?<=.)(?=\\p{Upper})".toRegex()