Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
with:
java-version: 1.8
- run: chmod +x gradlew
- run: ./gradlew build --info --scan
- run: ./gradlew build
build-on-macos:
runs-on: macos-latest
steps:
Expand All @@ -20,4 +20,4 @@ jobs:
with:
java-version: 1.8
- run: chmod +x gradlew
- run: ./gradlew build --info --scan
- run: ./gradlew build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.idea/
.gradle/
.kotlin/
build/
.idea_modules/
hs_err_pid*
Expand Down
16 changes: 8 additions & 8 deletions benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ plugins {
kotlin("jvm")
kotlin("kapt")
kotlin("plugin.serialization")
id("me.champeau.gradle.jmh")
id("me.champeau.jmh")
}
apply(plugin = "me.champeau.gradle.jmh")
apply(plugin = "me.champeau.jmh")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line can be dropped


dependencies {
api(kotlin("stdlib-jdk8"))
api("org.openjdk.jmh:jmh-core:1.23")
api("org.openjdk.jmh:jmh-generator-annprocess:1.21")
api("org.openjdk.jmh:jmh-core:1.37")
api("org.openjdk.jmh:jmh-generator-annprocess:1.37")
api(project(":yamlkt"))
api(kotlinx("serialization-core", Versions.serialization))
api(kotlinx("serialization-json", Versions.serialization))
kapt("org.openjdk.jmh:jmh-generator-annprocess:1.21")
kapt("org.openjdk.jmh:jmh-generator-annprocess:1.37")
api("com.charleskorn.kaml:kaml:0.17.0")
api("org.yaml:snakeyaml:1.26")
api("com.google.code.gson:gson:2.8.6")
api("com.alibaba:fastjson:1.2.75")
api("com.google.code.gson:gson:2.11.0")
api("com.alibaba:fastjson:1.2.83") // Next major: 2.0.51
}


group = ""

jmh {
include = listOf("DeserializingTest")
includes.set(listOf("DeserializingTest"))
}

val compileKotlin: KotlinCompile by tasks
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
kotlin("multiplatform") version Versions.kotlin apply false
kotlin("plugin.serialization") version Versions.kotlin apply false

id("me.champeau.gradle.jmh") version "0.5.3" apply false
id("me.champeau.jmh") version "0.7.2" apply false
}

allprojects {
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
object Versions {
const val version = "0.13.0"

const val kotlin = "1.8.0"
const val serialization = "1.5.0"
const val kotlin = "2.0.0"
const val serialization = "1.7.0"

const val mavenCentralPublish = "1.0.0-dev-3"
}
Expand Down
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# style guide
kotlin.code.style=official
kotlin.incremental.multiplatform=true
kotlin.js.compiler=both
kotlin.js.compiler=ir
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this property is not needed anymore

kotlin.native.ignoreDisabledTargets=true
systemProp.org.gradle.internal.publish.checksums.insecure=true
org.gradle.vfs.watch=true

kotlin.mpp.enableCompatibilityMetadataVariant=true
org.gradle.jvmargs=-Xmx2g "-XX:MaxMetaspaceSize=2g"
kotlin.mpp.enableCInteropCommonization=true
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenLocal()
mavenCentral()
}
}

Expand Down
175 changes: 36 additions & 139 deletions yamlkt/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
@file:Suppress("UNUSED_VARIABLE")

import org.apache.tools.ant.taskdefs.condition.Os
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet

plugins {
id("me.him188.maven-central-publish")
kotlin("multiplatform")
Expand All @@ -13,129 +8,44 @@ plugins {
kotlin {
explicitApi()

targets {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
}
js(BOTH) {
compilations.all {
kotlinOptions {
moduleKind = "umd"
sourceMap = true
metaInfo = true
}
}
browser()
nodejs()
}


val ideaActive = System.getProperty("idea.active") == "true" && System.getProperty("publication.test") != "true"

val nativeMainSets = mutableListOf<KotlinSourceSet>()
val nativeTestSets = mutableListOf<KotlinSourceSet>()

if (ideaActive) {
when {
Os.isFamily(Os.FAMILY_MAC) -> if (Os.isArch("aarch64")) macosArm64("native") else macosX64("native")
Os.isFamily(Os.FAMILY_WINDOWS) -> mingwX64("native")
else -> linuxX64("native")
}
} else {
// https://kotlinlang.org/docs/native-target-support.html
// Updated for Kotlin 1.8.0, serialization 1.5.0
//kotlinx-serialization-core-iosarm32/ - -
//kotlinx-serialization-core-iosarm64/ - -
//kotlinx-serialization-core-iossimulatorarm64/ - -
//kotlinx-serialization-core-iosx64/ - -
//kotlinx-serialization-core-js/ - -
//kotlinx-serialization-core-jvm/ - -
//kotlinx-serialization-core-linuxarm32hfp/ - -
//kotlinx-serialization-core-linuxarm64/ - -
//kotlinx-serialization-core-linuxx64/ - -
//kotlinx-serialization-core-macosarm64/ - -
//kotlinx-serialization-core-macosx64/ - -
//kotlinx-serialization-core-metadata/ - -
//kotlinx-serialization-core-mingwx64/ - -
//kotlinx-serialization-core-mingwx86/ - -
//kotlinx-serialization-core-tvosarm64/ - -
//kotlinx-serialization-core-tvossimulatorarm64/ - -
//kotlinx-serialization-core-tvosx64/ - -
//kotlinx-serialization-core-watchosarm32/ - -
//kotlinx-serialization-core-watchosarm64/ - -
//kotlinx-serialization-core-watchossimulatora.../ - -
//kotlinx-serialization-core-watchosx64/ - -
//kotlinx-serialization-core-watchosx86/
// Commented ones are not supported by kotlinx-coroutines-core
val nativeTargets: List<String> = arrayOf(
// Tier 1:
"linuxX64",
"macosX64",
"macosArm64",
"iosSimulatorArm64",
"iosX64",

// Tier 2:
"linuxArm64",
// "watchosSimulatorArm64",
"watchosX64w",
"wwatchosArm32",
"watchosArm64",
"tvosSimulatorArm64",
"tvosX64",
"tvosArm64",
"iosArm64",

// Tier 3:
// "androidNativeArm32",
// "androidNativeArm64",
// "androidNativeX86",
// "androidNativeX64",
"mingwX64",
// "watchosDeviceArm64",

// Deprecated:
"iosArm32",
"watchosX86",
// "wasm32",
"mingwX86",
"linuxArm32Hfp",
// "linuxMips32",
// "linuxMipsel32",
).flatMap { it.split(", ") }
presets.filter { it.name in nativeTargets }
.forEach { preset ->
val target = targetFromPreset(preset, preset.name)
nativeMainSets.add(target.compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.MAIN_COMPILATION_NAME].kotlinSourceSets.first())
nativeTestSets.add(target.compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.TEST_COMPILATION_NAME].kotlinSourceSets.first())
}

sourceSets {
if (!ideaActive) {
configure(nativeMainSets) {
dependsOn(sourceSets.maybeCreate("nativeMain"))
}

configure(nativeTestSets) {
dependsOn(sourceSets.maybeCreate("nativeTest"))
}
}
}
}

/*
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}*/
jvmToolchain(8)
jvm()
js {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to add wasmJs and wasmWasi targets as well
As far as I can see, js or native could be used there

browser()
nodejs()
}

// https://kotlinlang.org/docs/native-target-support.html
// Updated for Kotlin 2.0.0, serialization 1.7.0
// Commented ones are not supported by kotlinx-coroutines-core

// Tier 1:
macosX64()
macosArm64()
iosSimulatorArm64()
iosX64()

// Tier 2:
linuxX64()
linuxArm64()
watchosSimulatorArm64()
watchosX64()
watchosArm32()
watchosArm64()
tvosSimulatorArm64()
tvosX64()
tvosArm64()
iosArm64()

// Tier 3:
//androidNativeArm32()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any issue with those targets?

//androidNativeArm64()
//androidNativeX86()
//androidNativeX64()
mingwX64()
watchosDeviceArm64()

applyDefaultHierarchyTemplate()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed, as hierarchy is applied automatically if there is no manual source set creation

sourceSets {
val serializationVersion: String = Versions.serialization

Expand Down Expand Up @@ -166,26 +76,13 @@ kotlin {
api(kotlin("reflect"))
}
}

val jvmMain by getting
val jvmTest by getting {
dependencies {
api(kotlin("test-junit"))
api("com.charleskorn.kaml:kaml:0.34.0")
api("org.yaml:snakeyaml:1.26")
}
}

val jsMain by getting
val jsTest by getting

val nativeMain by getting {
dependsOn(commonMain)
}

val nativeTest by getting {
dependsOn(commonTest)
}
}
}

Expand Down