Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ concurrency:

permissions:
contents: write
packages: write
pages: write
id-token: write

Expand Down Expand Up @@ -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}"

Expand All @@ -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:
Expand All @@ -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
Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

<p align="center">
<img src="docs/icon.svg" width="128" height="128" alt="JsonCMP Icon"/>
</p>

[![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.

Expand All @@ -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()
}
}
```
Expand All @@ -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:<version>")
}
```

Expand Down
1 change: 1 addition & 0 deletions androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.JsonCmpSample">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 32 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<PublishingExtension>()?.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<Sign>().configureEach {
isEnabled = !gradle.startParameter.taskNames.any { it.contains("MavenLocal", ignoreCase = true) }
}
}

extensions.configure<com.vanniktech.maven.publish.MavenPublishBaseExtension> {
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")
}
}
}
}
Expand Down
19 changes: 5 additions & 14 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:<version>")
}
}
}
Expand All @@ -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:<version>")
}
```

Expand Down
11 changes: 11 additions & 0 deletions docs/icon-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions docs/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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" }
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
6 changes: 4 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,6 +29,8 @@ theme:
- content.tabs.link
- search.highlight
- search.share
logo: icon-logo.svg
favicon: icon.png
icon:
repo: fontawesome/brands/github

Expand Down
11 changes: 6 additions & 5 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -134,7 +135,7 @@ fi
if [[ "$TARGET" == "local" ]]; then
MAVEN_TASK="publishToMavenLocal"
else
MAVEN_TASK="publishAllPublicationsToGitHubPackagesRepository"
MAVEN_TASK="publishAndReleaseToMavenCentral"
fi

cd "$PROJECT_ROOT"
Expand Down
Loading