- Migrates Quartz from Android to CommonMain
- Fully converts OpenTimestamp Java codebase to Kotlin, migrating the sync and async HTTP call interfaces to OkHttp and coroutines - Redesigns parsing of relay commands, messages and filters for performance in Jackson. - Starts the use of KotlinX Serialization when speed is not a requirement - Migrates all Jackson field annotations to Kotlin Serialization - Migrates Regex use in Quarts to Kotlin's Regex class - Migrates Base64 from Android to Kotlin - Migrates UUID from Android/Java to Kotlin - Migrates LRUCache usage from Android/Java to Kotlin collections - Migrates all String to bytearray conversions to Kotlin methods - Migrates all System.arraycopy calls to kotlin native ones. - Separates parsing code from the data classes Companion objects - Exposes Rfc3986 normalizations to each platform. - Exposes URI parsing classes to each platform. - Exposes URL Encoders to each platform. - Exposes BigDecimal to each platform. - Exposes the Url Detector to each platform. - Exposes MacInstances to each platform - Exposes Diggest instances to each platform. - Exposes a BitSet to each platform. - Exposes GZip to each platform. - Exposes Secp256k1 to each platform. - Exposes SecureRandom to each platform. - Exposes Time in seconds to each platform. - Exposes the LargeCache to each platform. - Exposes AES CBC and AES GCM encryption/decryption to each platform - Migrate test assertions to Kotlin Tests - Exposes Address class to each platform because of the Parceleable - Creates our own ByteArrayOutputStream. - Removes Lock features inside the Bloomfilters because we don't need data consistency/ - Migrates UserMetadata parser from Jackson to Kotlin serialization - Removes the need for Static methods in each tag. - Adds an event template serializer - Adds KotlinX Datetime to migrate some of the date-based logs - Adds support for LibSodium in the JVM platform - Creates a shared test build for iOS targets - Fixes several usages of Reflection when serializing classes - Fixes a bug on loading RelayDB for the HintBloom filter test - Increases the Bloom filter space to better use hints in the app. - Removes support for iOS in x86 - Creates a Jackson mapper just for NIP-55, which stays in the Android build only. - Keeps the event store in the android build as well. - Removes @Syncronized tags in favor of Mutexes. - Improved sendAndWaitForResponse NostrClient method to properly account for returns from each relay. - Removes the need for GlobalScope and async calls in the downloadFirstEvent method. - Restructures the parser and serialization of the relay messages and commands for performance with Jackson - Removes the dependency on Jackson's error classes across the codebase. - Moves the hint to quote tag extension methods to their own packages. - Speeds up the generation of Bech32 addresses - Migrates NIP-6 and Blossom uploads to use Kotlin Serialization
This commit is contained in:
+63
-38
@@ -3,6 +3,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
alias(libs.plugins.androidLibrary)
|
||||
alias(libs.plugins.serialization)
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -44,6 +45,7 @@ android {
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-Xstring-concat=inline")
|
||||
freeCompilerArgs.add("-Xexpect-actual-classes")
|
||||
}
|
||||
jvm {
|
||||
compilerOptions {
|
||||
@@ -70,12 +72,6 @@ kotlin {
|
||||
// https://developer.android.com/kotlin/multiplatform/migrate
|
||||
val xcfName = "quartz-kmpKit"
|
||||
|
||||
iosX64 {
|
||||
binaries.framework {
|
||||
baseName = xcfName
|
||||
}
|
||||
}
|
||||
|
||||
iosArm64 {
|
||||
binaries.framework {
|
||||
baseName = xcfName
|
||||
@@ -102,7 +98,17 @@ kotlin {
|
||||
// @Immutable and @Stable
|
||||
implementation(libs.androidx.compose.runtime)
|
||||
|
||||
// Bitcoin secp256k1 bindings
|
||||
api(libs.secp256k1.kmp.common)
|
||||
|
||||
// Kotlin serialization for the times where we need the Json tree and performance is not that important.
|
||||
implementation(libs.kotlinx.serialization.json)
|
||||
|
||||
// in your shared module's dependencies block
|
||||
implementation( libs.kotlinx.datetime)
|
||||
|
||||
// immutable collections to avoid recomposition
|
||||
implementation(libs.kotlinx.collections.immutable)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,25 +118,38 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
jvmMain {
|
||||
// Must be defined before androidMain and jvmMain
|
||||
val jvmAndroid = create("jvmAndroid") {
|
||||
dependsOn(commonMain.get())
|
||||
|
||||
dependencies {
|
||||
// Bitcoin secp256k1 bindings
|
||||
api(libs.secp256k1.kmp.jni.jvm)
|
||||
|
||||
// Performant Parser of JSONs into Events
|
||||
api(libs.jackson.module.kotlin)
|
||||
|
||||
// immutable collections to avoid recomposition
|
||||
api(libs.kotlinx.collections.immutable)
|
||||
|
||||
// Parses URLs from Text:
|
||||
api(libs.url.detector)
|
||||
// For LruCache
|
||||
implementation(libs.androidx.collection.jvm)
|
||||
|
||||
// Normalizes URLs
|
||||
api(libs.rfc3986.normalizer)
|
||||
|
||||
// Performant Parser of JSONs into Events
|
||||
api(libs.jackson.module.kotlin)
|
||||
|
||||
// Parses URLs from Text:
|
||||
api(libs.url.detector)
|
||||
|
||||
// Websockets API
|
||||
implementation(libs.okhttp)
|
||||
implementation(libs.okhttpCoroutines)
|
||||
}
|
||||
}
|
||||
|
||||
jvmMain {
|
||||
dependsOn(jvmAndroid)
|
||||
dependencies {
|
||||
// Bitcoin secp256k1 bindings
|
||||
api(libs.secp256k1.kmp.jni.jvm)
|
||||
|
||||
// LibSodium for ChaCha encryption (NIP-44)
|
||||
implementation (libs.lazysodium.java)
|
||||
implementation (libs.jna)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +161,7 @@ kotlin {
|
||||
}
|
||||
|
||||
androidMain {
|
||||
dependsOn(jvmAndroid)
|
||||
dependencies {
|
||||
implementation(libs.androidx.core.ktx)
|
||||
|
||||
@@ -154,21 +174,6 @@ kotlin {
|
||||
// LibSodium for ChaCha encryption (NIP-44)
|
||||
implementation ("com.goterl:lazysodium-android:5.2.0@aar")
|
||||
implementation ("net.java.dev.jna:jna:5.17.0@aar")
|
||||
|
||||
// Performant Parser of JSONs into Events
|
||||
api(libs.jackson.module.kotlin)
|
||||
|
||||
// immutable collections to avoid recomposition
|
||||
api(libs.kotlinx.collections.immutable)
|
||||
|
||||
// Parses URLs from Text:
|
||||
api(libs.url.detector)
|
||||
|
||||
// Normalizes URLs
|
||||
api(libs.rfc3986.normalizer)
|
||||
|
||||
// Websockets API
|
||||
implementation(libs.okhttp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,13 +194,33 @@ kotlin {
|
||||
}
|
||||
|
||||
iosMain {
|
||||
dependsOn(commonMain.get())
|
||||
dependencies {
|
||||
// Add iOS-specific dependencies here. This a source set created by Kotlin Gradle
|
||||
// Plugin (KGP) that each specific iOS target (e.g., iosX64) depends on as
|
||||
// part of KMP’s default source set hierarchy. Note that this source set depends
|
||||
// on common by default and will correctly pull the iOS artifacts of any
|
||||
// KMP dependencies declared in commonMain.
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
val iosArm64Main by getting {
|
||||
dependsOn(iosMain.get()) // iosArm64Main depends on iosMain
|
||||
}
|
||||
|
||||
val iosSimulatorArm64Main by getting {
|
||||
dependsOn(iosMain.get()) // iosSimulatorArm64Main depends on iosMain
|
||||
}
|
||||
|
||||
iosTest {
|
||||
dependsOn(commonTest.get())
|
||||
dependencies {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
val iosArm64Test by getting {
|
||||
dependsOn(iosTest.get()) // iosArm64Main depends on iosMain
|
||||
}
|
||||
|
||||
val iosSimulatorArm64Test by getting {
|
||||
dependsOn(iosTest.get()) // iosSimulatorArm64Main depends on iosMain
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user