Skip to content

Commit

Permalink
<upgrade> kmp version to 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BppleMan committed Jan 7, 2025
1 parent bf4d214 commit d9002f9
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 80 deletions.
5 changes: 0 additions & 5 deletions .idea/material_theme_project_new.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

Kotlin Native library for create sub-process and redirect their I/O.

# v2.2.0
# v2.3.0

Rust is an excellent language that takes into account both performance and engineering.

Expand Down Expand Up @@ -45,8 +45,8 @@ It will bring

# Dependent

- Rust Standard Library 1.69.0 (No support for later versions)
- Kotlin Multiplatform 2.0.10
- Rust Standard Library 1.83.0
- Kotlin Multiplatform 2.1.0

# Usage

Expand Down Expand Up @@ -98,7 +98,7 @@ Dependency:

### 1. Dependencies

- rust toolchain - <= 1.69.0 (https://rustup.rs) (recommend)
- rust toolchain - >= 1.83.0 (https://rustup.rs)
- just (install with `cargo install just`)
- cross-compile toolchain
- x86_64-apple-darwin
Expand Down
43 changes: 29 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
Expand All @@ -10,7 +9,7 @@ plugins {
}

val sharedGroup = "com.kgit2"
val sharedVersion = "2.2.1"
val sharedVersion = "2.3.0"

group = sharedGroup
version = sharedVersion
Expand All @@ -27,7 +26,6 @@ subprojects {

kotlin {
jvm {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
Expand Down Expand Up @@ -62,32 +60,49 @@ kotlin {
applyDefaultHierarchyTemplate()

sourceSets {
// add opt-in
all {
// languageSettings.optIn("kotlinx.cinterop.UnsafeNumber")
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
languageSettings.optIn("kotlin.experimental.ExperimentalNativeApi")
// languageSettings.optIn("kotlin.native.runtime.NativeRuntimeApi")
languageSettings.optIn("kotlin.ExperimentalStdlibApi")
val sourceSetsNeedOptIn = setOf(
nativeMain,
appleMain,
macosMain,
macosX64Main,
macosArm64Main,
linuxMain,
linuxX64Main,
linuxArm64Main,
mingwMain,
mingwX64Main,
)

sourceSetsNeedOptIn.forEach { sourceSet ->
sourceSet.languageSettings {
optIn("kotlinx.cinterop.ExperimentalForeignApi")
optIn("kotlin.experimental.ExperimentalNativeApi")
}
}

commonMain {
languageSettings {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}

commonMain {
dependencies {
implementation("org.jetbrains.kotlinx:atomicfu:0.23.1")
}
}

commonTest {
dependencies {
implementation(kotlin("test"))
}
}

nativeMain {
languageSettings {
optIn("kotlinx.cinterop.ExperimentalForeignApi")
}
}
}
}

Expand Down Expand Up @@ -192,7 +207,7 @@ if (ossrhUsername != null && ossrhPassword != null) {
}

enum class Platform(
val archName: String
val archName: String,
) {
MACOS_X64("x86_64-apple-darwin"),
MACOS_ARM64("aarch64-apple-darwin"),
Expand Down
6 changes: 6 additions & 0 deletions kommand-core/.idea/git_toolbox_blame.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions kommand-core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions kommand-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = [
]

[workspace.package]
version = "2.1.2"
version = "2.3.0"
edition = "2021"
authors = ["BppleMan"]

Expand All @@ -23,8 +23,3 @@ crate-type = ["rlib", "staticlib"]

[build-dependencies]
cbindgen = "0.26.0"

[package.metadata.cargo-xbuild]
memcpy = true
sysroot_path = "/Users/bppleman/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-pc-windows-gnu:/Users/bppleman/.konan/dependencies/msys2-mingw-w64-x86_64-2/x86_64-w64-mingw32"
panic_immediate_abort = false
2 changes: 1 addition & 1 deletion kommand-core/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.69.0"
channel = "1.83.0"
targets = ["x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "x86_64-pc-windows-gnu"]
14 changes: 3 additions & 11 deletions kommand-examples/example1/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

val currentPlatform: Platform = when {
DefaultNativePlatform.getCurrentOperatingSystem().isMacOsX && DefaultNativePlatform.getCurrentArchitecture().isAmd64 -> Platform.MACOS_X64
Expand All @@ -20,8 +21,8 @@ repositories {

kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "17"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
withJava()
testRuns["test"].executionTask.configure {
Expand All @@ -48,15 +49,6 @@ kotlin {
applyDefaultHierarchyTemplate()

sourceSets {
// add opt-in
all {
languageSettings.optIn("kotlinx.cinterop.UnsafeNumber")
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
languageSettings.optIn("kotlin.experimental.ExperimentalNativeApi")
languageSettings.optIn("kotlin.native.runtime.NativeRuntimeApi")
languageSettings.optIn("kotlin.ExperimentalStdlibApi")
}

commonMain {
dependencies {
implementation(rootProject)
Expand Down
14 changes: 3 additions & 11 deletions kommand-examples/example2/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

val currentPlatform: Platform = when {
DefaultNativePlatform.getCurrentOperatingSystem().isMacOsX && DefaultNativePlatform.getCurrentArchitecture().isAmd64 -> Platform.MACOS_X64
Expand All @@ -20,8 +21,8 @@ repositories {

kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "17"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
withJava()
testRuns["test"].executionTask.configure {
Expand All @@ -48,15 +49,6 @@ kotlin {
applyDefaultHierarchyTemplate()

sourceSets {
// add opt-in
all {
languageSettings.optIn("kotlinx.cinterop.UnsafeNumber")
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
languageSettings.optIn("kotlin.experimental.ExperimentalNativeApi")
languageSettings.optIn("kotlin.native.runtime.NativeRuntimeApi")
languageSettings.optIn("kotlin.ExperimentalStdlibApi")
}

commonMain {
dependencies {
implementation(rootProject)
Expand Down
14 changes: 3 additions & 11 deletions kommand-examples/example3/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

val currentPlatform: Platform = when {
DefaultNativePlatform.getCurrentOperatingSystem().isMacOsX && DefaultNativePlatform.getCurrentArchitecture().isAmd64 -> Platform.MACOS_X64
Expand All @@ -20,8 +21,8 @@ repositories {

kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "17"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
withJava()
testRuns["test"].executionTask.configure {
Expand All @@ -48,15 +49,6 @@ kotlin {
applyDefaultHierarchyTemplate()

sourceSets {
// add opt-in
all {
languageSettings.optIn("kotlinx.cinterop.UnsafeNumber")
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
languageSettings.optIn("kotlin.experimental.ExperimentalNativeApi")
languageSettings.optIn("kotlin.native.runtime.NativeRuntimeApi")
languageSettings.optIn("kotlin.ExperimentalStdlibApi")
}

commonMain {
dependencies {
implementation(rootProject)
Expand Down
14 changes: 3 additions & 11 deletions kommand-examples/timeout/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

val currentPlatform: Platform = when {
DefaultNativePlatform.getCurrentOperatingSystem().isMacOsX && DefaultNativePlatform.getCurrentArchitecture().isAmd64 -> Platform.MACOS_X64
Expand All @@ -20,8 +21,8 @@ repositories {

kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "17"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
withJava()
testRuns["test"].executionTask.configure {
Expand All @@ -48,15 +49,6 @@ kotlin {
applyDefaultHierarchyTemplate()

sourceSets {
// add opt-in
all {
languageSettings.optIn("kotlinx.cinterop.UnsafeNumber")
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
languageSettings.optIn("kotlin.experimental.ExperimentalNativeApi")
languageSettings.optIn("kotlin.native.runtime.NativeRuntimeApi")
languageSettings.optIn("kotlin.ExperimentalStdlibApi")
}

commonMain {
dependencies {
implementation(rootProject)
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pluginManagement {
plugins {
kotlin("jvm") version "2.0.10" apply false
kotlin("multiplatform") version "2.0.10" apply false
kotlin("jvm") version "2.1.0" apply false
kotlin("multiplatform") version "2.1.0" apply false
id("org.jetbrains.dokka") version "1.9.20" apply false
id("io.github.gradle-nexus.publish-plugin") version "1.3.0" apply false
}
Expand Down

0 comments on commit d9002f9

Please sign in to comment.