Skip to content

Commit

Permalink
ffi: migrate kotlin packages to org.rust-nostr
Browse files Browse the repository at this point in the history
Closes #405

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
  • Loading branch information
yukibtc committed Jun 7, 2024
1 parent 6a502cc commit 74c86c8
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 154 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* sdk: send NIP-42 event only to target relay ([Yuki Kishimoto])
* sqlite: bump `rusqlite` to `v0.31` ([Yuki Kishimoto])
* nwc: change `NWC::new` and `NWC::with_opts` fingerprint ([Yuki Kishimoto])
* ffi: migrate kotlin packages to `org.rust-nostr` ([Yuki Kishimoto])
* bindings(sdk): log git hash after logger initialization ([Yuki Kishimoto])
* ffi(nostr): set default args values where possible ([Yuki Kishimoto])
* ffi(nostr): convert `verify_nip05` and `get_nip05_profile` to async functions ([Yuki Kishimoto])
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ Learn more about `rust-nostr` at <https://rust-nostr.org>.
* **nostr**:
* Rust: https://crates.io/crates/nostr
* Python: https://pypi.org/project/nostr-protocol
* Kotlin: https://central.sonatype.com/artifact/io.github.rust-nostr/nostr
* Kotlin: https://central.sonatype.com/artifact/org.rust-nostr/nostr
* Swift: https://github.com/rust-nostr/nostr-swift
* JavaScript: https://www.npmjs.com/package/@rust-nostr/nostr
* **nostr-sdk**:
* Rust: https://crates.io/crates/nostr-sdk
* Python: https://pypi.org/project/nostr-sdk
* Kotlin: https://central.sonatype.com/artifact/io.github.rust-nostr/nostr-sdk
* Kotlin: https://central.sonatype.com/artifact/org.rust-nostr/nostr-sdk
* Swift: https://github.com/rust-nostr/nostr-sdk-swift
* JavaScript: https://www.npmjs.com/package/@rust-nostr/nostr-sdk

Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-ffi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ just python

### Kotlin

For most users, we recommend using our official Kotlin package: [io.github.rust-nostr:nostr](https://central.sonatype.com/artifact/io.github.rust-nostr/nostr/).
For most users, we recommend using our official Kotlin package: [org.rust-nostr:nostr](https://central.sonatype.com/artifact/org.rust-nostr/nostr/).

If you want to compile from source or need more options, read on.

Expand Down
28 changes: 0 additions & 28 deletions bindings/nostr-ffi/bindings-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,3 @@ buildscript {
classpath("com.android.tools.build:gradle:8.3.0")
}
}

plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}

// library version is defined in gradle.properties
val libraryVersion: String by project

// These properties are required here so that the nexus publish-plugin
// finds a staging profile with the correct group (group is otherwise set as "")
// and knows whether to publish to a SNAPSHOT repository or not
// https://github.com/gradle-nexus/publish-plugin#applying-the-plugin
group = "io.github.rust-nostr"
version = libraryVersion

nexusPublishing {
repositories {
create("sonatype") {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))

val ossrhUsername: String? by project
val ossrhPassword: String? by project
username.set(ossrhUsername)
password.set(ossrhPassword)
}
}
}
1 change: 0 additions & 1 deletion bindings/nostr-ffi/bindings-android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ org.gradle.warning.mode=all
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
libraryVersion=0.12.0
79 changes: 34 additions & 45 deletions bindings/nostr-ffi/bindings-android/lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// library version is defined in gradle.properties
val libraryVersion: String by project

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android") version "1.9.22"
id("maven-publish")
id("com.vanniktech.maven.publish") version "0.28.0"
id("signing")
}

Expand Down Expand Up @@ -39,13 +36,6 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}

publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}

dependencies {
Expand All @@ -54,44 +44,43 @@ dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
}

afterEvaluate {
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "io.github.rust-nostr"
artifactId = "nostr"
version = libraryVersion
mavenPublishing {
configure(com.vanniktech.maven.publish.AndroidMultiVariantLibrary(
sourcesJar = true,
publishJavadocJar = true,
))

from(components["release"])
pom {
name.set("nostr")
description.set("Nostr protocol implementation")
url.set("https://rust-nostr.org")
licenses {
license {
name.set("MIT")
url.set("https://github.com/rust-nostr/nostr/blob/master/LICENSE")
}
}
developers {
developer {
id.set("yukibtc")
name.set("Yuki Kishimoto")
email.set("yukikishimoto@protonmail.com")
}
}
scm {
connection.set("scm:git:github.com/rust-nostr/nostr.git")
developerConnection.set("scm:git:ssh://github.com/rust-nostr/nostr.git")
url.set("https://github.com/rust-nostr/nostr")
}
}
}
}
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)

signAllPublications()

coordinates("org.rust-nostr", "nostr", "0.12.0")

pom {
name.set("nostr")
description.set("Nostr protocol implementation")
url.set("https://rust-nostr.org")
licenses {
license {
name.set("MIT")
url.set("https://github.com/rust-nostr/nostr/blob/master/LICENSE")
}
}
developers {
developer {
id.set("yukibtc")
name.set("Yuki Kishimoto")
email.set("yukikishimoto@protonmail.com")
}
}
scm {
connection.set("scm:git:github.com/rust-nostr/nostr.git")
developerConnection.set("scm:git:ssh://github.com/rust-nostr/nostr.git")
url.set("https://github.com/rust-nostr/nostr")
}
}
}

signing {
useGpgCmd()
sign(publishing.publications)
}
2 changes: 1 addition & 1 deletion bindings/nostr-ffi/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bindings-android: sdk-root kotlin assemble-aar
# Publish android bindings
[confirm]
publish-android: bindings-android
cd bindings-android && ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
cd bindings-android && ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache

[private]
ios-universal:
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-ffi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ just python

### Kotlin

For most users, we recommend using our official Kotlin package: [io.github.rust-nostr:nostr-sdk](https://central.sonatype.com/artifact/io.github.rust-nostr/nostr-sdk/).
For most users, we recommend using our official Kotlin package: [org.rust-nostr:nostr-sdk](https://central.sonatype.com/artifact/org.rust-nostr/nostr-sdk/).

If you want to compile from source or need more options, read on.

Expand Down
28 changes: 0 additions & 28 deletions bindings/nostr-sdk-ffi/bindings-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,3 @@ buildscript {
classpath("com.android.tools.build:gradle:8.3.0")
}
}

plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}

// library version is defined in gradle.properties
val libraryVersion: String by project

// These properties are required here so that the nexus publish-plugin
// finds a staging profile with the correct group (group is otherwise set as "")
// and knows whether to publish to a SNAPSHOT repository or not
// https://github.com/gradle-nexus/publish-plugin#applying-the-plugin
group = "io.github.rust-nostr"
version = libraryVersion

nexusPublishing {
repositories {
create("sonatype") {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))

val ossrhUsername: String? by project
val ossrhPassword: String? by project
username.set(ossrhUsername)
password.set(ossrhPassword)
}
}
}
1 change: 0 additions & 1 deletion bindings/nostr-sdk-ffi/bindings-android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ org.gradle.warning.mode=all
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
libraryVersion=0.12.0
79 changes: 34 additions & 45 deletions bindings/nostr-sdk-ffi/bindings-android/lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// library version is defined in gradle.properties
val libraryVersion: String by project

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android") version "1.9.22"
id("maven-publish")
id("com.vanniktech.maven.publish") version "0.28.0"
id("signing")
}

Expand Down Expand Up @@ -39,13 +36,6 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}

publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}

dependencies {
Expand All @@ -54,44 +44,43 @@ dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
}

afterEvaluate {
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "io.github.rust-nostr"
artifactId = "nostr-sdk"
version = libraryVersion
mavenPublishing {
configure(com.vanniktech.maven.publish.AndroidMultiVariantLibrary(
sourcesJar = true,
publishJavadocJar = true,
))

from(components["release"])
pom {
name.set("nostr-sdk")
description.set("High level Nostr client library.")
url.set("https://rust-nostr.org")
licenses {
license {
name.set("MIT")
url.set("https://github.com/rust-nostr/nostr/blob/master/LICENSE")
}
}
developers {
developer {
id.set("yukibtc")
name.set("Yuki Kishimoto")
email.set("yukikishimoto@protonmail.com")
}
}
scm {
connection.set("scm:git:github.com/rust-nostr/nostr.git")
developerConnection.set("scm:git:ssh://github.com/rust-nostr/nostr.git")
url.set("https://github.com/rust-nostr/nostr")
}
}
}
}
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)

signAllPublications()

coordinates("org.rust-nostr", "nostr-sdk", "0.12.0")

pom {
name.set("nostr-sdk")
description.set("High level Nostr client library.")
url.set("https://rust-nostr.org")
licenses {
license {
name.set("MIT")
url.set("https://github.com/rust-nostr/nostr/blob/master/LICENSE")
}
}
developers {
developer {
id.set("yukibtc")
name.set("Yuki Kishimoto")
email.set("yukikishimoto@protonmail.com")
}
}
scm {
connection.set("scm:git:github.com/rust-nostr/nostr.git")
developerConnection.set("scm:git:ssh://github.com/rust-nostr/nostr.git")
url.set("https://github.com/rust-nostr/nostr")
}
}
}

signing {
useGpgCmd()
sign(publishing.publications)
}
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-ffi/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bindings-android: sdk-root kotlin assemble-aar
# Publish android bindings
[confirm]
publish-android: bindings-android
cd bindings-android && ./gradlew publishToSonatype closeAndReleaseSonatypeStagingReposit
cd bindings-android && ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache

[private]
ios-universal:
Expand Down

0 comments on commit 74c86c8

Please sign in to comment.