Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update kotlin core dependencies to v1.9.0 #540

Merged
merged 12 commits into from
Jul 25, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ kotlin {
* linux mingw macos
*/
sourceSets {
all {
languageSettings.optIn("kotlin.RequiresOptIn")
}
val commonMain by getting
val commonTest by getting {
dependencies {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]
kotlin = "1.8.22"
kotlin = "1.9.0"
okio = "3.4.0"
serialization = "1.5.1"
diktat = "1.2.5"
kotlinx-cli = "0.3.5"
kotlinx-datetime = "0.4.0"
kotlinx-coroutines = "1.6.3-native-mt"
kotlinx-coroutines = "1.7.2"
junit = "5.10.0"
ktoml = "0.5.0"
multiplatform-diff = "0.4.0"
Expand Down
11 changes: 2 additions & 9 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"*"
],
"excludePackagePatterns": [
"^org\\.jetbrains\\.kotlin[.:]",
"^org\\.jetbrains\\.kotlinx?[.:]",
"^org\\.cqfn\\.diktat[.:]diktat-gradle-plugin"
],
"matchUpdateTypes": [
Expand All @@ -37,17 +37,10 @@
{
"managers": ["gradle"],
"matchPackagePatterns": [
"^org\\.jetbrains\\.kotlin[.:]"
"^org\\.jetbrains\\.kotlinx?[.:]"
],
"groupName": "Kotlin core dependencies",
"groupSlug": "core-kotlin"
},
{
"managers": ["gradle"],
"matchPackagePatterns": [
"^org\\.jetbrains\\.kotlinx:kotlinx-coroutines.*"
],
"versioning": "docker"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,6 @@ enum class CurrentOs {
LINUX, MACOS, UNDEFINED, WINDOWS
}

/**
* Atomic values
*/
expect class AtomicInt(value: Int) {
kgevorkyan marked this conversation as resolved.
Show resolved Hide resolved
/**
* @return value
*/
fun get(): Int

/**
* @param delta increments the value_ by delta
* @return the new value
*/
fun addAndGet(delta: Int): Int
}

/**
* Atomic boolean
*/
@Suppress("FUNCTION_BOOLEAN_PREFIX")
expect class AtomicBoolean(value: Boolean) {
/**
* @return value
*/
fun get(): Boolean

/**
* @param expect expected value
* @param update updated value
* @return the result of the comparison
*/
fun compareAndSet(expect: Boolean, update: Boolean): Boolean
}

/**
* Class that holds value and shares atomic reference to the value (native only)
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ package com.saveourtool.save.core.utils

import com.saveourtool.save.core.config.OutputStreamType

actual class AtomicInt actual constructor(value: Int) {
actual fun get(): Int = error("Not implemented for JS")
actual fun addAndGet(delta: Int): Int = error("Not implemented for JS")
}

actual class AtomicBoolean actual constructor(value: Boolean) {
actual fun get(): Boolean = error("Not implemented for JS")
actual fun compareAndSet(expect: Boolean, update: Boolean): Boolean = error("Not implemented for JS")
}

@Suppress("USE_DATA_CLASS")
actual class GenericAtomicReference<T> actual constructor(valueToStore: T) {
private var value: T = valueToStore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
"MISSING_KDOC_TOP_LEVEL",
"MISSING_KDOC_ON_FUNCTION",
"FILE_NAME_MATCH_CLASS",
"MatchingDeclarationName",
)

package com.saveourtool.save.core.utils

import com.saveourtool.save.core.config.OutputStreamType

actual typealias AtomicInt = java.util.concurrent.atomic.AtomicInteger

actual typealias AtomicBoolean = java.util.concurrent.atomic.AtomicBoolean

@Suppress("USE_DATA_CLASS")
actual class GenericAtomicReference<T> actual constructor(valueToStore: T) {
private val holder: java.util.concurrent.atomic.AtomicReference<T> = java.util.concurrent.atomic.AtomicReference(valueToStore)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ import com.saveourtool.save.core.logging.logTrace
import okio.FileSystem
import okio.Path
import okio.Path.Companion.toPath
import platform.posix.FTW
import platform.posix.FTW_DEPTH
import platform.posix.nftw
import platform.posix.remove
import platform.posix.stat

import kotlinx.cinterop.ByteVar
import kotlinx.cinterop.CPointer
import kotlinx.cinterop.staticCFunction
import kotlinx.cinterop.toKString

Expand All @@ -29,7 +25,8 @@ actual val fs: FileSystem = FileSystem.SYSTEM
*/
@Suppress("MAGIC_NUMBER", "MagicNumber")
actual fun FileSystem.myDeleteRecursively(path: Path) {
nftw(path.toString(), staticCFunction<CPointer<ByteVar>?, CPointer<stat>?, Int, CPointer<FTW>?, Int> { pathName, _, _, _ ->
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
nftw(path.toString(), staticCFunction { pathName, _, _, _ ->
val fileName = pathName!!.toKString()
logTrace("Attempt to delete file $fileName")
remove(fileName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE",
"MISSING_KDOC_TOP_LEVEL",
"MISSING_KDOC_ON_FUNCTION",
"FILE_NAME_MATCH_CLASS"
"FILE_NAME_MATCH_CLASS",
"MatchingDeclarationName",
)

package com.saveourtool.save.core.utils
Expand All @@ -14,44 +15,11 @@ import platform.posix.fprintf
import platform.posix.stderr
import platform.posix.stdout

/**
* Atomic values
*/
actual class AtomicInt actual constructor(value: Int) {
private val holder = kotlin.native.concurrent.AtomicInt(value)

/**
* @return value
*/
actual fun get(): Int = holder.value

/**
* @param delta increments the value_ by delta
* @return the new value
*/
actual fun addAndGet(delta: Int): Int = holder.addAndGet(delta)
}

@Suppress("FUNCTION_BOOLEAN_PREFIX")
actual class AtomicBoolean actual constructor(value: Boolean) {
private val holder = kotlin.native.concurrent.AtomicReference(value)

/**
* @return value
*/
actual fun get(): Boolean = holder.value

/**
* @param expect expected value
* @param update updated value
* @return the result of the comparison
*/
actual fun compareAndSet(expect: Boolean, update: Boolean): Boolean = holder.compareAndSet(expect, update)
}
import kotlinx.cinterop.ExperimentalForeignApi

@Suppress("USE_DATA_CLASS")
actual class GenericAtomicReference<T> actual constructor(valueToStore: T) {
private val holder: kotlin.native.concurrent.AtomicReference<T> = kotlin.native.concurrent.AtomicReference(valueToStore)
private val holder: kotlin.concurrent.AtomicReference<T> = kotlin.concurrent.AtomicReference(valueToStore)
actual fun get(): T = holder.value
actual fun set(newValue: T) {
holder.value = newValue
Expand Down Expand Up @@ -104,11 +72,14 @@ actual fun writeToConsole(msg: String, outputType: OutputStreamType) {
* @param msg a message string
* @param output output stream (stdout or stderr)
*/
fun processStandardStreams(msg: String, output: OutputStreamType) {
private fun processStandardStreams(msg: String, output: OutputStreamType) {
@OptIn(ExperimentalForeignApi::class)
val stream = when (output) {
OutputStreamType.STDERR -> stderr
else -> stdout
}
@OptIn(ExperimentalForeignApi::class)
fprintf(stream, msg.escapePercent() + "\n")
@OptIn(ExperimentalForeignApi::class)
fflush(stream)
}
Loading