Skip to content

Commit

Permalink
huge update...
Browse files Browse the repository at this point in the history
  • Loading branch information
astinz committed Jul 8, 2024
1 parent 02f8732 commit ebfb482
Show file tree
Hide file tree
Showing 99 changed files with 3,505 additions and 437 deletions.
64 changes: 0 additions & 64 deletions .github/workflows/publish.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release
on:
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
release:
runs-on: macos-latest
if: github.ref == 'refs/heads/master'
environment: Sonatype
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SONATYPE_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SONATYPE_SIGNING_KEY_PASSWORD }}

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Grant execute permissions to publish script
run: chmod +x ./scripts/release
- name: Release to Sonatype (Maven Central)
shell: bash
run: ./scripts/release
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group = "xyz.mcxross.ksui"

version = "2.0.0-SNAPSHOT"
version = "2.1.0-SNAPSHOT"

plugins {
kotlin("jvm") apply false
Expand All @@ -9,7 +9,8 @@ plugins {
kotlin("multiplatform") apply false
kotlin("plugin.serialization") apply false
id("org.jetbrains.dokka") version "1.9.10" apply false
id("xyz.mcxross.graphql") version "1.0.0-SNAPSHOT" apply false
id("xyz.mcxross.graphql") version "0.1.0-beta06" apply false
id("com.vanniktech.maven.publish") version "0.29.0" apply false
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
ktor = "2.3.7"
junit = "5.8.1"
graphql-multiplatform-client = "1.0-SNAPSHOT"
graphql-multiplatform-client = "0.1.0-beta06"

[libraries]
bcs = { module = "xyz.mcxross.bcs:bcs", version = "1.0.1-SNAPSHOT" }
Expand Down
118 changes: 45 additions & 73 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.SonatypeHost
import java.net.URL
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.signing
import org.jetbrains.dokka.gradle.DokkaTask
import xyz.mcxross.graphql.plugin.gradle.config.GraphQLSerializer
import xyz.mcxross.graphql.plugin.gradle.graphql

plugins {
Expand All @@ -12,13 +11,12 @@ plugins {
kotlin("plugin.serialization")
id("org.jetbrains.dokka")
id("xyz.mcxross.graphql")
id("maven-publish")
id("signing")
id("com.vanniktech.maven.publish")
}

group = "xyz.mcxross.ksui"

version = "2.0.0-SNAPSHOT"
version = "2.1.0-SNAPSHOT"

repositories {
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") }
Expand Down Expand Up @@ -93,12 +91,11 @@ graphql {
client {
endpoint = "https://sui-devnet.mystenlabs.com/graphql"
packageName = "xyz.mcxross.ksui.generated"
serializer = GraphQLSerializer.KOTLINX
}
}

android {
namespace = "mcxross.ksui"
namespace = "xyz.mcxross.ksui"
defaultConfig {
minSdk = 24
compileSdk = 33
Expand All @@ -112,6 +109,10 @@ android {
}
}

tasks.withType<DokkaTask>().configureEach {
notCompatibleWithConfigurationCache("https://github.com/Kotlin/dokka/issues/2231")
}

tasks.getByName<DokkaTask>("dokkaHtml") {
moduleName.set("Ksui")
outputDirectory.set(file(buildDir.resolve("dokka")))
Expand All @@ -127,74 +128,45 @@ tasks.getByName<DokkaTask>("dokkaHtml") {
}
}

tasks.withType<DokkaTask>().configureEach {
notCompatibleWithConfigurationCache("https://github.com/Kotlin/dokka/issues/2231")
}

val javadocJar =
tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
dependsOn("dokkaHtml")
from(buildDir.resolve("dokka"))
}

fun getExtraString(name: String) = ext[name]?.toString()

publishing {
if (hasProperty("sonatypeUser") && hasProperty("sonatypePass")) {
repositories {
maven {
name = "sonatype"
val isSnapshot = version.toString().endsWith("-SNAPSHOT")
setUrl(
if (isSnapshot) {
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
} else {
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
)
credentials {
username = property("sonatypeUser") as String
password = property("sonatypePass") as String
}
mavenPublishing {
coordinates("xyz.mcxross.ksui", "ksui", version.toString())

configure(
KotlinMultiplatform(
javadocJar = JavadocJar.Dokka("dokkaHtml"),
sourcesJar = true,
androidVariantsToPublish = listOf("debug", "release"),
)
)

pom {
name.set("Ksui")
description.set("Multiplatform SDK for the SUI blockchain")
inceptionYear.set("2023")
url.set("https://github.com/mcxross")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
}

publications.withType<MavenPublication> {
artifact(javadocJar.get())

pom {
name.set("KMP Sui library")
description.set(
"Multiplatform Kotlin language JSON-RPC wrapper and crypto utilities for interacting with a Sui Full node."
)
url.set("https://github.com/mcxross")

licenses {
license {
name.set("Apache License, Version 2.0")
url.set("https://opensource.org/licenses/APACHE-2.0")
}
developers {
developer {
id.set("mcxross")
name.set("Mcxross")
email.set("oss@mcxross.xyz")
url.set("https://mcxross.xyz/")
}
developers {
developer {
id.set("mcxross")
name.set("Mcxross")
email.set("oss@mcxross.xyz")
}
}
scm { url.set("https://github.com/mcxross/ksui") }
}
scm {
url.set("https://github.com/mcxross/ksui")
connection.set("scm:git:ssh://github.com/mcxross/ksui.git")
developerConnection.set("scm:git:ssh://github.com/mcxross/ksui.git")
}
}
}

signing {
val sonatypeGpgKey = System.getenv("SONATYPE_GPG_KEY")
val sonatypeGpgKeyPassword = System.getenv("SONATYPE_GPG_KEY_PASSWORD")
when {
sonatypeGpgKey == null || sonatypeGpgKeyPassword == null -> useGpgCmd()
else -> useInMemoryPgpKeys(sonatypeGpgKey, sonatypeGpgKeyPassword)
}
// sign(publishing.publications)
publishToMavenCentral(SonatypeHost.S01, automaticRelease = true)

signAllPublications()
}
13 changes: 0 additions & 13 deletions lib/src/androidMain/kotlin/xyz/mcxross/ksui/client/Platform.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package xyz.mcxross.ksui.util

import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.CoroutineScope

actual fun <T> runBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> T) {}
13 changes: 13 additions & 0 deletions lib/src/commonMain/kotlin/xyz/mcxross/ksui/Sui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,22 @@ import xyz.mcxross.ksui.protocol.Coin
import xyz.mcxross.ksui.protocol.Faucet
import xyz.mcxross.ksui.protocol.General
import xyz.mcxross.ksui.protocol.Governance
import xyz.mcxross.ksui.protocol.Move
import xyz.mcxross.ksui.protocol.Object
import xyz.mcxross.ksui.protocol.Sns
import xyz.mcxross.ksui.protocol.Transaction

/**
* Sui is a class that implements all the interfaces of the Sui API.
*
* It is the entry point for all the API calls and related operations.
*/
class Sui(config: SuiConfig = SuiConfig()) :
Coin by xyz.mcxross.ksui.api.Coin(config),
Governance by xyz.mcxross.ksui.api.Governance(config),
General by xyz.mcxross.ksui.api.General(config),
Transaction by xyz.mcxross.ksui.api.Transaction(config),
Object by xyz.mcxross.ksui.api.Object(config),
Sns by xyz.mcxross.ksui.api.Sns(config),
Move by xyz.mcxross.ksui.api.Move(config),
Faucet by xyz.mcxross.ksui.api.Faucet(config)
Loading

0 comments on commit ebfb482

Please sign in to comment.