diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b98c17f..d6489de 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,6 @@ concurrency: permissions: contents: write - packages: write pages: write id-token: write @@ -102,7 +101,7 @@ jobs: BUILD_BADGE="[![Build](https://github.com/${REPO}/actions/workflows/deploy.yml/badge.svg)](https://github.com/${REPO}/actions/workflows/deploy.yml)" COVERAGE_BADGE="[![Coverage](https://img.shields.io/badge/coverage-${COVERAGE}%25-${COLOR})](https://github.com/${REPO}/actions/workflows/deploy.yml)" VERSION_ESCAPED=$(echo "$VERSION" | sed 's/-/--/g') - MAVEN_BADGE="[![Maven](https://img.shields.io/badge/maven-${VERSION_ESCAPED}-blue)](https://github.com/${REPO}/packages)" + MAVEN_BADGE="[![Maven Central](https://img.shields.io/badge/maven--central-${VERSION_ESCAPED}-blue)](https://central.sonatype.com/artifact/dev.skymansandy/json-cmp)" BADGE_LINE="${BUILD_BADGE} ${COVERAGE_BADGE} ${MAVEN_BADGE}" @@ -129,7 +128,7 @@ jobs: git push publish: - name: Publish SDK + name: Publish to Maven Central needs: test-and-coverage runs-on: macos-latest steps: @@ -142,11 +141,13 @@ jobs: - uses: gradle/actions/setup-gradle@v4 - - name: Publish to GitHub Packages + - name: Publish and release to Maven Central env: - MAVEN_REPO_USERNAME: ${{ github.actor }} - MAVEN_REPO_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew publishAllPublicationsToGitHubPackagesRepository + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }} + run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache deploy-docs: name: Deploy Docs diff --git a/README.md b/README.md index 5be57bc..253d850 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # JsonCMP -[![Build](https://github.com/skymansandy/jsonCMP/actions/workflows/deploy.yml/badge.svg)](https://github.com/skymansandy/jsonCMP/actions/workflows/deploy.yml) [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://github.com/skymansandy/jsonCMP/actions/workflows/deploy.yml) [![Maven](https://img.shields.io/badge/maven-1.0.0--alpha1-blue)](https://github.com/skymansandy/jsonCMP/packages) +

+ JsonCMP Icon +

+ +[![Build](https://github.com/skymansandy/jsonCMP/actions/workflows/deploy.yml/badge.svg)](https://github.com/skymansandy/jsonCMP/actions/workflows/deploy.yml) [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://github.com/skymansandy/jsonCMP/actions/workflows/deploy.yml) [![Maven Central](https://img.shields.io/badge/maven--central-1.0.0--alpha1-blue)](https://central.sonatype.com/artifact/dev.skymansandy/json-cmp) Kotlin Multiplatform Compose JSON viewer and editor component for Android, iOS, and JVM Desktop. @@ -14,19 +18,14 @@ Kotlin Multiplatform Compose JSON viewer and editor component for Android, iOS, ## Installation -Add the GitHub Packages repository to your `settings.gradle.kts`: +Add `mavenCentral()` to your repositories in `settings.gradle.kts`: ```kotlin // settings.gradle.kts dependencyResolutionManagement { repositories { - maven { - url = uri("https://maven.pkg.github.com/skymansandy/jsonCMP") - credentials { - username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_USERNAME") - password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN") - } - } + mavenCentral() + google() } } ``` @@ -36,7 +35,7 @@ Then add the dependency: ```kotlin // build.gradle.kts dependencies { - implementation("dev.skymansandy:json-cmp:1.0.0-alpha1") + implementation("dev.skymansandy:json-cmp:") } ``` diff --git a/androidApp/src/main/AndroidManifest.xml b/androidApp/src/main/AndroidManifest.xml index 386388d..dee31b9 100644 --- a/androidApp/src/main/AndroidManifest.xml +++ b/androidApp/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ diff --git a/androidApp/src/main/res/mipmap-hdpi/ic_launcher.png b/androidApp/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..dd9c636 Binary files /dev/null and b/androidApp/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/androidApp/src/main/res/mipmap-mdpi/ic_launcher.png b/androidApp/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..bff852b Binary files /dev/null and b/androidApp/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/androidApp/src/main/res/mipmap-xhdpi/ic_launcher.png b/androidApp/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..91ee82c Binary files /dev/null and b/androidApp/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher.png b/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..f74c633 Binary files /dev/null and b/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..83faa8a Binary files /dev/null and b/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/build.gradle.kts b/build.gradle.kts index f25eb20..4d1486d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.detekt) apply false alias(libs.plugins.mokkery) apply false alias(libs.plugins.kover) + alias(libs.plugins.mavenPublish) apply false } dependencies { @@ -29,28 +30,41 @@ subprojects { val jsoncmpGroup = findProperty("jsoncmp.group") as String val jsoncmpVersion = findProperty("jsoncmp.version") as String - group = jsoncmpGroup - version = jsoncmpVersion - - apply(plugin = "maven-publish") + apply(plugin = "com.vanniktech.maven.publish") afterEvaluate { - extensions.findByType()?.apply { - repositories { - maven { - name = "GitHubPackages" - url = uri( - System.getenv("MAVEN_REPO_URL") - ?: "https://maven.pkg.github.com/skymansandy/jsonCMP" - ) - credentials { - username = System.getenv("MAVEN_REPO_USERNAME") - ?: findProperty("gpr.user") as? String ?: "" - password = System.getenv("MAVEN_REPO_PASSWORD") - ?: findProperty("gpr.key") as? String ?: "" - } + tasks.withType().configureEach { + isEnabled = !gradle.startParameter.taskNames.any { it.contains("MavenLocal", ignoreCase = true) } + } + } + + extensions.configure { + coordinates(jsoncmpGroup, name, jsoncmpVersion) + publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL, automaticRelease = true) + signAllPublications() + + pom { + name.set("JsonCMP") + description.set("Kotlin Multiplatform Compose JSON viewer and editor component") + url.set("https://github.com/skymansandy/jsonCMP") + licenses { + license { + name.set("MIT License") + url.set("https://opensource.org/licenses/MIT") + } + } + developers { + developer { + id.set("skymansandy") + name.set("skymansandy") + email.set("iamsandythedev@gmail.com") } } + scm { + url.set("https://github.com/skymansandy/jsonCMP") + connection.set("scm:git:git://github.com/skymansandy/jsonCMP.git") + developerConnection.set("scm:git:ssh://github.com/skymansandy/jsonCMP.git") + } } } } diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 1fd8ce2..cc4ac93 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -2,27 +2,18 @@ ## Repository Setup -JsonCMP is published to GitHub Packages. Add the repository to your `settings.gradle.kts`: +JsonCMP is published to Maven Central. Add `mavenCentral()` to your repositories in `settings.gradle.kts`: ```kotlin // settings.gradle.kts dependencyResolutionManagement { repositories { - maven { - url = uri("https://maven.pkg.github.com/skymansandy/jsonCMP") - credentials { - username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_USERNAME") - password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN") - } - } + mavenCentral() + google() } } ``` -> **Note:** GitHub Packages requires authentication. Add `gpr.user` and `gpr.key` to your -> `~/.gradle/gradle.properties` or set `GITHUB_USERNAME` and `GITHUB_TOKEN` environment variables. -> The token needs the `read:packages` scope. - ## Gradle (Kotlin DSL) Add the dependency to your KMP module: @@ -34,7 +25,7 @@ Add the dependency to your KMP module: kotlin { sourceSets { commonMain.dependencies { - implementation("dev.skymansandy:json-cmp:1.0.0-alpha2") + implementation("dev.skymansandy:json-cmp:") } } } @@ -45,7 +36,7 @@ Add the dependency to your KMP module: ```kotlin // build.gradle.kts dependencies { - implementation("dev.skymansandy:json-cmp:1.0.0-alpha2") + implementation("dev.skymansandy:json-cmp:") } ``` diff --git a/docs/icon-logo.svg b/docs/icon-logo.svg new file mode 100644 index 0000000..0ae3ba3 --- /dev/null +++ b/docs/icon-logo.svg @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/docs/icon.png b/docs/icon.png new file mode 100644 index 0000000..d6db3bd Binary files /dev/null and b/docs/icon.png differ diff --git a/docs/icon.svg b/docs/icon.svg new file mode 100644 index 0000000..2a83cae --- /dev/null +++ b/docs/icon.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/gradle.properties b/gradle.properties index f94d15c..b8c09e6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,4 +17,4 @@ android.r8.strictFullModeForKeepRules=false #Publishing jsoncmp.group=dev.skymansandy -jsoncmp.version=1.0.0-alpha1 +jsoncmp.version=1.0.0-beta1 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0865786..cbff344 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,6 +22,7 @@ composeBom = "2026.03.00" detekt = "1.23.8" mokkery = "3.3.0" kover = "0.9.7" +mavenPublish = "0.30.0" kotest = "6.1.7" turbine = "1.2.1" @@ -65,3 +66,4 @@ androidLint = { id = "com.android.lint", version.ref = "agp" } detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } mokkery = { id = "dev.mokkery", version.ref = "mokkery" } kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } +mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" } diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/component/editor/CodeEditor.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/component/editor/CodeEditor.kt index 41f6c2f..23cc0b0 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/component/editor/CodeEditor.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/component/editor/CodeEditor.kt @@ -148,18 +148,17 @@ private fun LineNumberGutter( } .padding(start = 12.dp, end = 8.dp), ) { measurables, constraints -> - val textLayout = textLayoutResult val placeables = measurables.map { it.measure(constraints.copy(minWidth = 0, minHeight = 0)) } val width = placeables.maxOfOrNull { it.width } ?: 0 - val height = if (textLayout != null && textLayout.lineCount > 0) { - textLayout.getLineBottom(textLayout.lineCount - 1).toInt() + val height = if (textLayoutResult.lineCount > 0) { + textLayoutResult.getLineBottom(textLayoutResult.lineCount - 1).toInt() } else { placeables.sumOf { it.height } } layout(width, height) { placeables.forEachIndexed { index, placeable -> - val y = textLayout?.getLineTop(index)?.toInt() ?: (index * (placeables.firstOrNull()?.height ?: 0)) + val y = textLayoutResult.getLineTop(index).toInt() ?: (index * (placeables.firstOrNull()?.height ?: 0)) placeable.placeRelative(0, y) } } diff --git a/mkdocs.yml b/mkdocs.yml index 5dd4dfe..9ee183d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -8,13 +8,13 @@ theme: name: material palette: - scheme: default - primary: teal + primary: deep purple accent: amber toggle: icon: material/brightness-7 name: Switch to dark mode - scheme: slate - primary: teal + primary: deep purple accent: amber toggle: icon: material/brightness-4 @@ -29,6 +29,8 @@ theme: - content.tabs.link - search.highlight - search.share + logo: icon-logo.svg + favicon: icon.png icon: repo: fontawesome/brands/github diff --git a/scripts/publish.sh b/scripts/publish.sh index d6743aa..7af734d 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -41,11 +41,12 @@ EXAMPLES: $(basename "$0") --remote --version 1.0.0-beta1 ENVIRONMENT VARIABLES (for --remote): - MAVEN_REPO_URL Remote Maven repository URL - MAVEN_REPO_USERNAME Repository username - MAVEN_REPO_PASSWORD Repository password/token + OSSRH_USERNAME Sonatype OSSRH username + OSSRH_PASSWORD Sonatype OSSRH password/token + GPG_PRIVATE_KEY ASCII-armored GPG private key (for signing) + GPG_PASSPHRASE GPG key passphrase - Alternatively, set gpr.user and gpr.key in ~/.gradle/gradle.properties + Alternatively, set ossrh.username and ossrh.password in ~/.gradle/gradle.properties EOF exit 0 } @@ -134,7 +135,7 @@ fi if [[ "$TARGET" == "local" ]]; then MAVEN_TASK="publishToMavenLocal" else - MAVEN_TASK="publishAllPublicationsToGitHubPackagesRepository" + MAVEN_TASK="publishAndReleaseToMavenCentral" fi cd "$PROJECT_ROOT"