Skip to content

Commit

Permalink
WIP switch to kotlin.uuid.Uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
hfhbd committed Jul 2, 2024
1 parent 5636665 commit c43cd25
Show file tree
Hide file tree
Showing 57 changed files with 128 additions and 1,352 deletions.
1 change: 0 additions & 1 deletion gradle/build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {

dependencies {
implementation(libs.plugins.kotlin.jvm.toDep())
implementation(libs.plugins.kotlin.serialization.toDep())
implementation(libs.plugins.kotlin.parcelize.toDep())
implementation(libs.plugins.android.toDep())
implementation(libs.plugins.binary.toDep())
Expand Down
1 change: 1 addition & 0 deletions gradle/build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
mavenCentral()
google()
gradlePluginPortal()
Expand Down
2 changes: 1 addition & 1 deletion gradle/build-logic/src/main/kotlin/KotlinConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fun KotlinProjectExtension.kotlinConfig() {
sourceSets.configureEach {
languageSettings {
progressiveMode = true
optIn("kotlinx.uuid.InternalAPI")
optIn("kotlin.ExperimentalStdlibApi")
}
}
}
1 change: 0 additions & 1 deletion gradle/build-logic/src/main/kotlin/kotlinJvm.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
kotlin("jvm")
kotlin("plugin.serialization")
}

kotlin {
Expand Down
4 changes: 3 additions & 1 deletion gradle/build-logic/src/main/kotlin/kotlinMPP.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
}

kotlin {
jvm()
js(IR) {
browser()
nodejs()
compilerOptions {
target.set("es2015")
}
}

// tier 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dependencyResolutionManagement {
repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
mavenCentral()
google()
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "2.0.0"
kotlin = "2.0.20-dev-7572"
serialization = "1.7.1"
exposed = "0.52.0"

Expand All @@ -24,7 +24,7 @@ androidx-test-runner = { module = "androidx.test:runner", version = "1.6.1" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
android = { id = "com.android.application", version = "8.5.0" }
android = { id = "com.android.application", version = "8.3.0" }
binary = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.14.0" }
publish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" }
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
Expand Down
21 changes: 1 addition & 20 deletions kotlinx-uuid-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,12 @@ plugins {
}

kotlin {
applyDefaultHierarchyTemplate {
common {
group("linuxDerivat") {
group("androidNative")
group("linux")
}
}
}
applyDefaultHierarchyTemplate()

sourceSets {
commonMain {
dependencies {
implementation(libs.serialization.core)
}
}
commonTest {
dependencies {
implementation(kotlin("test"))
implementation(libs.serialization.json)
implementation(libs.serialization.cbor)
implementation(libs.serialization.protobuf)
}
}
}
Expand Down Expand Up @@ -80,8 +65,4 @@ kotlin {
}
}
}
compilerOptions.freeCompilerArgs.addAll(
"-P",
"plugin:org.jetbrains.kotlin.parcelize:additionalAnnotation=kotlinx.uuid.internal.CommonParcelize",
)
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package kotlinx.uuid.internal

Check warning

Code scanning / detekt

Checks if top level class matches the filename Warning

File 'Parcelabler.kt' contains a single top level declaration and should be named 'UuidParceler.kt'

import android.os.Parcel
import kotlinx.parcelize.Parceler

public object UuidParceler : Parceler<kotlin.uuid.Uuid> {

Check warning

Code scanning / detekt

If a source file contains only a single non-private top-level class or object, the file name should reflect the case-sensitive name plus the .kt extension. Warning

The file name 'Parcelabler' does not match the name of the single top-level declaration 'UuidParceler'.
override fun create(parcel: Parcel): kotlin.uuid.Uuid = kotlin.uuid.Uuid.fromLongs(
parcel.readLong(),
parcel.readLong(),
)

override fun kotlin.uuid.Uuid.write(parcel: Parcel, flags: Int) {
toLongs { mostSignificantBits, leastSignificantBits ->
parcel.writeLong(mostSignificantBits)
parcel.writeLong(leastSignificantBits)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

package kotlinx.uuid

import kotlin.uuid.Uuid

/**
* Converts this [platform.Foundation.NSUUID][platform.Foundation.NSUUID] value to a [kotlinx.uuid.UUID][UUID] value
* by using the [UUIDString][platform.Foundation.NSUUID.UUIDString] representation.
*/
public fun platform.Foundation.NSUUID.toKotlinUUID(): UUID = UUID(UUIDString)
public fun platform.Foundation.NSUUID.toKotlinUUID(): Uuid = Uuid.parse(UUIDString)

/**
* Converts this [kotlinx.uuid.UUID][UUID] value to a [platform.Foundation.NSUUID][platform.Foundation.NSUUID] value
* by using the default [toString] representation.
*/
public fun UUID.toNsUUID(): platform.Foundation.NSUUID = platform.Foundation.NSUUID(toString())
public fun Uuid.toNsUUID(): platform.Foundation.NSUUID = platform.Foundation.NSUUID(toString())

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
package kotlinx.uuid

import kotlin.test.*
import kotlin.uuid.Uuid

class NsUUIDConvertingTest {

@Test
fun toNsUUID() {
val kotlinUUID = UUID(SOME_UUID_STRING)
val kotlinUUID = Uuid.parse(SOME_UUID_STRING)
val nsUUID = kotlinUUID.toNsUUID()
assertEquals(SOME_UUID_STRING, nsUUID.UUIDString.lowercase())
}
Expand Down

This file was deleted.

68 changes: 0 additions & 68 deletions kotlinx-uuid-core/src/commonMain/kotlin/kotlinx/uuid/Encoding.kt

This file was deleted.

51 changes: 0 additions & 51 deletions kotlinx-uuid-core/src/commonMain/kotlin/kotlinx/uuid/Formatter.kt

This file was deleted.

Loading

0 comments on commit c43cd25

Please sign in to comment.