From dd2e3562732300d2d58e38612c840742889ef3dd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 16:16:57 +0000 Subject: [PATCH 1/8] Update Kotlin core dependencies --- gradle/libs.versions.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8c3b1d6d20..1228d24b4a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,12 +1,12 @@ [versions] -kotlin = "1.9.10" +kotlin = "1.9.22" jetbrains-annotations = "24.0.1" save-cli = "0.3.10" ktor = "2.3.6" okio = "3.3.0" -serialization = "1.6.0" -kotlinx-datetime = "0.4.1" -kotlinx-coroutines = "1.7.3" +serialization = "1.6.3" +kotlinx-datetime = "0.5.0" +kotlinx-coroutines = "1.8.0" kotlin-wrappers = "1.0.0-pre.634" spring-boot = "2.7.17" spring-cloud = "3.1.9" From 32456f9bc8d86d8a59ba5a999d08fb3d0bda19a6 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 29 Feb 2024 11:07:29 +0300 Subject: [PATCH 2/8] spotlessApply + removed deprecated api --- .../cosv/frontend/components/topbar/TopBarLinks.kt | 6 +++--- .../kotlin/com/saveourtool/save/utils/PlatformUtils.kt | 2 +- .../basic/testsuiteselector/TestSuiteSelectorSearchMode.kt | 2 +- .../save/frontend/components/topbar/TopBarLinks.kt | 6 +++--- .../save/frontend/components/views/ExecutionView.kt | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cosv-frontend/src/main/kotlin/com/saveourtool/cosv/frontend/components/topbar/TopBarLinks.kt b/cosv-frontend/src/main/kotlin/com/saveourtool/cosv/frontend/components/topbar/TopBarLinks.kt index e1be33ff37..c635bd00a1 100644 --- a/cosv-frontend/src/main/kotlin/com/saveourtool/cosv/frontend/components/topbar/TopBarLinks.kt +++ b/cosv-frontend/src/main/kotlin/com/saveourtool/cosv/frontend/components/topbar/TopBarLinks.kt @@ -49,9 +49,9 @@ val topBarLinks: FC = FC { props -> className = ClassName( "nav-link d-flex align-items-center me-2 ${ textColor( - elem.hrefAnchor, - props.location - ) + elem.hrefAnchor, + props.location + ) } active mx-2 text-nowrap col-auto" ) to = elem.hrefAnchor diff --git a/save-cloud-common/src/nativeMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt b/save-cloud-common/src/nativeMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt index 0d5ff19117..a85fc06e7f 100644 --- a/save-cloud-common/src/nativeMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt +++ b/save-cloud-common/src/nativeMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt @@ -8,7 +8,7 @@ import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.toKString actual class AtomicLong actual constructor(value: Long) { - private val kotlinAtomicLong = kotlin.native.concurrent.AtomicLong(value) + private val kotlinAtomicLong = kotlin.concurrent.AtomicLong(value) actual fun get(): Long = kotlinAtomicLong.value diff --git a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/components/basic/testsuiteselector/TestSuiteSelectorSearchMode.kt b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/components/basic/testsuiteselector/TestSuiteSelectorSearchMode.kt index cf186889fa..b06d3118a7 100644 --- a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/components/basic/testsuiteselector/TestSuiteSelectorSearchMode.kt +++ b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/components/basic/testsuiteselector/TestSuiteSelectorSearchMode.kt @@ -92,7 +92,7 @@ private fun testSuiteSelectorSearchMode() = FC val testSuitesFromBackend: List = get( url = "$apiUrl/test-suites/${props.currentOrganizationName}/filtered${ filters.copy(language = encodeURIComponent(filters.language)) - .toQueryParams("isContest" to "${props.selectorPurpose == CONTEST}") + .toQueryParams("isContest" to "${props.selectorPurpose == CONTEST}") }", headers = jsonHeaders, loadingHandler = ::noopLoadingHandler, diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/topbar/TopBarLinks.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/topbar/TopBarLinks.kt index a516f97106..de5acdffd7 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/topbar/TopBarLinks.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/topbar/TopBarLinks.kt @@ -53,9 +53,9 @@ val topBarLinks: FC = FC { props -> className = ClassName( "nav-link d-flex align-items-center me-2 ${ textColor( - elem.hrefAnchor, - props.location - ) + elem.hrefAnchor, + props.location + ) } active mx-2 text-nowrap col-auto" ) to = elem.hrefAnchor diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ExecutionView.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ExecutionView.kt index e5ac2ec0cd..121319363d 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ExecutionView.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ExecutionView.kt @@ -145,7 +145,7 @@ class ExecutionView : AbstractView(Style.SAVE_LI td { +"${ cellContext.value?.let { Instant.fromEpochSeconds(it, 0) } - ?: "Running" + ?: "Running" }" } } @@ -155,7 +155,7 @@ class ExecutionView : AbstractView(Style.SAVE_LI td { +"${ cellContext.value?.let { Instant.fromEpochSeconds(it, 0) } - ?: "Running" + ?: "Running" }" } } From 094356857dcf58a99c833301b087b29dc0d4dd2c Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 29 Feb 2024 11:27:02 +0300 Subject: [PATCH 3/8] diktatFix + fixed actual\expected classes --- .../frontend/components/topbar/TopBarLinks.kt | 6 ++--- .../com/saveourtool/save/agent/SaveAgent.kt | 6 ++--- .../saveourtool/save/agent/utils/HttpUtils.kt | 4 +-- .../saveourtool/save/utils/PlatformUtils.kt | 27 ++++++++++++------- .../saveourtool/save/utils/PlatformUtils.kt | 20 ++++++-------- .../saveourtool/save/utils/PlatformUtils.kt | 16 +++++++---- .../saveourtool/save/utils/PlatformUtils.kt | 15 +++++------ .../TestSuiteSelectorSearchMode.kt | 2 +- .../frontend/components/topbar/TopBarLinks.kt | 6 ++--- .../components/views/ExecutionView.kt | 4 +-- 10 files changed, 58 insertions(+), 48 deletions(-) diff --git a/cosv-frontend/src/main/kotlin/com/saveourtool/cosv/frontend/components/topbar/TopBarLinks.kt b/cosv-frontend/src/main/kotlin/com/saveourtool/cosv/frontend/components/topbar/TopBarLinks.kt index c635bd00a1..e1be33ff37 100644 --- a/cosv-frontend/src/main/kotlin/com/saveourtool/cosv/frontend/components/topbar/TopBarLinks.kt +++ b/cosv-frontend/src/main/kotlin/com/saveourtool/cosv/frontend/components/topbar/TopBarLinks.kt @@ -49,9 +49,9 @@ val topBarLinks: FC = FC { props -> className = ClassName( "nav-link d-flex align-items-center me-2 ${ textColor( - elem.hrefAnchor, - props.location - ) + elem.hrefAnchor, + props.location + ) } active mx-2 text-nowrap col-auto" ) to = elem.hrefAnchor diff --git a/save-agent/src/commonMain/kotlin/com/saveourtool/save/agent/SaveAgent.kt b/save-agent/src/commonMain/kotlin/com/saveourtool/save/agent/SaveAgent.kt index 11e66b4276..afefa47c1e 100644 --- a/save-agent/src/commonMain/kotlin/com/saveourtool/save/agent/SaveAgent.kt +++ b/save-agent/src/commonMain/kotlin/com/saveourtool/save/agent/SaveAgent.kt @@ -51,12 +51,12 @@ class SaveAgent( /** * The current [AgentState] of this agent. Initial value corresponds to the period when agent needs to finish its configuration. */ - val state = GenericAtomicReference(AgentState.BUSY) + val state = createGenericAtomicReference(AgentState.BUSY) // fixme (limitation of old MM): can't use atomic reference to Instant here, because when using `Clock.System.now()` as an assigned value // Kotlin throws `kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlinx.datetime.Instant...` - private val executionStartSeconds = AtomicLong(0L) - private val saveProcessJob: GenericAtomicReference = GenericAtomicReference(null) + private val executionStartSeconds = createAtomicLong(0L) + private val saveProcessJob: GenericAtomicReference = createGenericAtomicReference(null) private val backgroundContext = newSingleThreadContext("background") private val saveProcessContext = newSingleThreadContext("save-process") private val reportFormat = Json { diff --git a/save-agent/src/commonMain/kotlin/com/saveourtool/save/agent/utils/HttpUtils.kt b/save-agent/src/commonMain/kotlin/com/saveourtool/save/agent/utils/HttpUtils.kt index 19d82dd1bd..b3477fa756 100644 --- a/save-agent/src/commonMain/kotlin/com/saveourtool/save/agent/utils/HttpUtils.kt +++ b/save-agent/src/commonMain/kotlin/com/saveourtool/save/agent/utils/HttpUtils.kt @@ -8,7 +8,7 @@ import com.saveourtool.save.agent.AgentState import com.saveourtool.save.agent.SaveAgent import com.saveourtool.save.core.logging.logWarn import com.saveourtool.save.core.utils.runIf -import com.saveourtool.save.utils.AtomicLong +import com.saveourtool.save.utils.createAtomicLong import com.saveourtool.save.utils.failureOrNotOk import com.saveourtool.save.utils.fs import com.saveourtool.save.utils.notOk @@ -82,7 +82,7 @@ internal suspend fun HttpClient.download(url: String, file: Path): Result if (httpResponse.status.isSuccess()) { val channel: ByteReadChannel = httpResponse.body() - val totalBytes = AtomicLong(0L) + val totalBytes = createAtomicLong(0L) while (!channel.isClosedForRead) { val packet = channel.readRemaining(DEFAULT_HTTP_BUFFER_SIZE.toLong()) while (!packet.isEmpty) { diff --git a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt index 4c0f6bd3f7..8d399c86c6 100644 --- a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt +++ b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt @@ -5,7 +5,6 @@ package com.saveourtool.save.utils import com.saveourtool.save.core.logging.logDebug -import com.saveourtool.save.core.utils.GenericAtomicReference import kotlin.time.Duration import kotlin.time.DurationUnit @@ -14,7 +13,7 @@ import kotlinx.datetime.Clock /** * Atomic values */ -expect class AtomicLong(value: Long) { +interface AtomicLong { /** * @return value */ @@ -33,12 +32,15 @@ expect class AtomicLong(value: Long) { } /** - * Class that holds value and shares atomic reference to the value - * - * @param valueToStore value to store + * @param value + * @return [AtomicLong] with initial value [value] + */ +expect fun createAtomicLong(value: Long): AtomicLong + +/** + * Class that holds value and shares atomic reference to the value */ -@Suppress("USE_DATA_CLASS") -expect class GenericAtomicReference(valueToStore: T) { +interface GenericAtomicReference { /** * @return stored value */ @@ -50,6 +52,13 @@ expect class GenericAtomicReference(valueToStore: T) { fun set(newValue: T) } + +/** + * @param valueToStore + * @return create [GenericAtomicReference] with initial value [valueToStore] + */ +expect fun createGenericAtomicReference(valueToStore: T): GenericAtomicReference + /** * A wrapper around a value of type [T] that caches it for [expirationTimeSeconds] and then recalculates * using [valueGetter] @@ -62,8 +71,8 @@ class ExpiringValueWrapper( private val valueGetter: () -> T, ) { private val expirationTimeSeconds = expirationTime.toLong(DurationUnit.SECONDS) - private val lastUpdateTimeSeconds = AtomicLong(0) - private val value: GenericAtomicReference = GenericAtomicReference(valueGetter()) + private val lastUpdateTimeSeconds = createAtomicLong(0) + private val value: GenericAtomicReference = createGenericAtomicReference(valueGetter()) /** * @return cached value or refreshes the value and returns it diff --git a/save-cloud-common/src/jsMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt b/save-cloud-common/src/jsMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt index 5648366b5c..efd5fa26c9 100644 --- a/save-cloud-common/src/jsMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt +++ b/save-cloud-common/src/jsMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt @@ -4,22 +4,18 @@ package com.saveourtool.save.utils -actual class AtomicLong actual constructor(value: Long) { - actual fun get(): Long = throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) +actual fun createAtomicLong(value: Long): AtomicLong = object : AtomicLong { + override fun get(): Long = throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) - actual fun set(newValue: Long) { - throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) - } + override fun set(newValue: Long) = throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) - actual fun addAndGet(delta: Long): Long = throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) + override fun addAndGet(delta: Long): Long = throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) } -@Suppress("USE_DATA_CLASS") -actual class GenericAtomicReference actual constructor(valueToStore: T) { - actual fun get(): T = throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) - actual fun set(newValue: T) { - throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) - } +actual fun createGenericAtomicReference(valueToStore: T): GenericAtomicReference = object : GenericAtomicReference { + override fun get(): T = throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) + + override fun set(newValue: T) = throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) } actual fun getenv(envName: String): String? = throw NotImplementedError(NOT_IMPLEMENTED_ON_JS) diff --git a/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt b/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt index 5edfb454cd..6dd3f681e2 100644 --- a/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt +++ b/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt @@ -7,13 +7,19 @@ package com.saveourtool.save.utils -actual typealias AtomicLong = java.util.concurrent.atomic.AtomicLong +actual fun createAtomicLong(value: Long): AtomicLong = object : AtomicLong { + private val holder = java.util.concurrent.atomic.AtomicLong(value) + override fun get(): Long = holder.get() -@Suppress("USE_DATA_CLASS") -actual class GenericAtomicReference actual constructor(valueToStore: T) { + override fun set(newValue: Long) = holder.set(newValue) + + override fun addAndGet(delta: Long): Long = holder.addAndGet(delta) +} + +actual fun createGenericAtomicReference(valueToStore: T): GenericAtomicReference = object : GenericAtomicReference { private val holder: java.util.concurrent.atomic.AtomicReference = java.util.concurrent.atomic.AtomicReference(valueToStore) - actual fun get(): T = holder.get() - actual fun set(newValue: T) { + override fun get(): T = holder.get() + override fun set(newValue: T) { holder.set(newValue) } } diff --git a/save-cloud-common/src/nativeMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt b/save-cloud-common/src/nativeMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt index a85fc06e7f..a48a4b361b 100644 --- a/save-cloud-common/src/nativeMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt +++ b/save-cloud-common/src/nativeMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt @@ -7,23 +7,22 @@ package com.saveourtool.save.utils import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.toKString -actual class AtomicLong actual constructor(value: Long) { +actual fun createAtomicLong(value: Long): AtomicLong = object : AtomicLong { private val kotlinAtomicLong = kotlin.concurrent.AtomicLong(value) - actual fun get(): Long = kotlinAtomicLong.value + override fun get(): Long = kotlinAtomicLong.value - actual fun set(newValue: Long) { + override fun set(newValue: Long) { kotlinAtomicLong.value = newValue } - actual fun addAndGet(delta: Long): Long = kotlinAtomicLong.addAndGet(delta) + override fun addAndGet(delta: Long): Long = kotlinAtomicLong.addAndGet(delta) } -@Suppress("USE_DATA_CLASS") -actual class GenericAtomicReference actual constructor(valueToStore: T) { +actual fun createGenericAtomicReference(valueToStore: T): GenericAtomicReference = object : GenericAtomicReference { private val holder: kotlin.concurrent.AtomicReference = kotlin.concurrent.AtomicReference(valueToStore) - actual fun get(): T = holder.value - actual fun set(newValue: T) { + override fun get(): T = holder.value + override fun set(newValue: T) { holder.value = newValue } } diff --git a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/components/basic/testsuiteselector/TestSuiteSelectorSearchMode.kt b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/components/basic/testsuiteselector/TestSuiteSelectorSearchMode.kt index b06d3118a7..cf186889fa 100644 --- a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/components/basic/testsuiteselector/TestSuiteSelectorSearchMode.kt +++ b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/components/basic/testsuiteselector/TestSuiteSelectorSearchMode.kt @@ -92,7 +92,7 @@ private fun testSuiteSelectorSearchMode() = FC val testSuitesFromBackend: List = get( url = "$apiUrl/test-suites/${props.currentOrganizationName}/filtered${ filters.copy(language = encodeURIComponent(filters.language)) - .toQueryParams("isContest" to "${props.selectorPurpose == CONTEST}") + .toQueryParams("isContest" to "${props.selectorPurpose == CONTEST}") }", headers = jsonHeaders, loadingHandler = ::noopLoadingHandler, diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/topbar/TopBarLinks.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/topbar/TopBarLinks.kt index de5acdffd7..a516f97106 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/topbar/TopBarLinks.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/topbar/TopBarLinks.kt @@ -53,9 +53,9 @@ val topBarLinks: FC = FC { props -> className = ClassName( "nav-link d-flex align-items-center me-2 ${ textColor( - elem.hrefAnchor, - props.location - ) + elem.hrefAnchor, + props.location + ) } active mx-2 text-nowrap col-auto" ) to = elem.hrefAnchor diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ExecutionView.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ExecutionView.kt index 121319363d..e5ac2ec0cd 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ExecutionView.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ExecutionView.kt @@ -145,7 +145,7 @@ class ExecutionView : AbstractView(Style.SAVE_LI td { +"${ cellContext.value?.let { Instant.fromEpochSeconds(it, 0) } - ?: "Running" + ?: "Running" }" } } @@ -155,7 +155,7 @@ class ExecutionView : AbstractView(Style.SAVE_LI td { +"${ cellContext.value?.let { Instant.fromEpochSeconds(it, 0) } - ?: "Running" + ?: "Running" }" } } From 6ee3f538ec77791b2ea810ac5687ebcb5c11daf4 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 29 Feb 2024 11:33:39 +0300 Subject: [PATCH 4/8] diktatFix --- .../saveourtool/save/utils/PlatformUtils.kt | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt index 8d399c86c6..bd1ce5f44e 100644 --- a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt +++ b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt @@ -31,12 +31,6 @@ interface AtomicLong { fun addAndGet(delta: Long): Long } -/** - * @param value - * @return [AtomicLong] with initial value [value] - */ -expect fun createAtomicLong(value: Long): AtomicLong - /** * Class that holds value and shares atomic reference to the value */ @@ -52,13 +46,6 @@ interface GenericAtomicReference { fun set(newValue: T) } - -/** - * @param valueToStore - * @return create [GenericAtomicReference] with initial value [valueToStore] - */ -expect fun createGenericAtomicReference(valueToStore: T): GenericAtomicReference - /** * A wrapper around a value of type [T] that caches it for [expirationTimeSeconds] and then recalculates * using [valueGetter] @@ -87,6 +74,18 @@ class ExpiringValueWrapper( } } +/** + * @param value + * @return [AtomicLong] with initial value [value] + */ +expect fun createAtomicLong(value: Long): AtomicLong + +/** + * @param valueToStore + * @return create [GenericAtomicReference] with initial value [valueToStore] + */ +expect fun createGenericAtomicReference(valueToStore: T): GenericAtomicReference + /** * @param envName * @return env variable name From 7a5cf824d3b774ab52beb32c9ad6dd7cad5c7db3 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 29 Feb 2024 13:56:53 +0300 Subject: [PATCH 5/8] diktatFix --- .../kotlin/com/saveourtool/save/utils/PlatformUtils.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt b/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt index 6dd3f681e2..fd23413b5a 100644 --- a/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt +++ b/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/utils/PlatformUtils.kt @@ -1,3 +1,7 @@ +/** + * Platform utils + */ + @file:Suppress("FILE_NAME_MATCH_CLASS") /** * Platform dependent utility methods From 03cf9b21ec52c8915f47ffaaf0ece267e30da358 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Fri, 1 Mar 2024 17:08:43 +0300 Subject: [PATCH 6/8] fixed test for JS --- frontend-common/karma.config.d/custom-config.js | 10 +++++----- save-frontend/karma.config.d/custom-config.js | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend-common/karma.config.d/custom-config.js b/frontend-common/karma.config.d/custom-config.js index 0c88d3dc9c..25274c721d 100644 --- a/frontend-common/karma.config.d/custom-config.js +++ b/frontend-common/karma.config.d/custom-config.js @@ -8,7 +8,7 @@ test: /\.js$/, use: {loader: 'istanbul-instrumenter-loader'}, // fixme: need to exclude Kotlin dependencies - include: [path.resolve(__dirname, '../save-cloud-save-frontend-common/kotlin/')] + include: [path.resolve(__dirname, '../save-cloud-frontend-common/kotlin/')] } ) config.coverageIstanbulReporter = { @@ -24,12 +24,12 @@ config.set({ } }, proxies: { - // serving mockServiceWorker.js.js from location relative to base url + // serving mockServiceWorker.js from location relative to base url // the file should be included into Karma's `files` to be served by server at all - '/mockServiceWorker.js': '/base/mockServiceWorker.js', + '/mockServiceWorker.js': '/base/node_modules/mockServiceWorker.js', }, }) // http://karma-runner.github.io/6.3/config/files.html -// 'All of the relative patterns will get resolved using the basePath first.', where basePath is set by KGP to `node_modules` -config.files.push('./mockServiceWorker.js') +// 'All of the relative patterns will get resolved using the basePath first.', where basePath is NOT set by KGP to `node_modules` after migration to 1.9 +config.files.push('./node_modules/mockServiceWorker.js') diff --git a/save-frontend/karma.config.d/custom-config.js b/save-frontend/karma.config.d/custom-config.js index 89c1081706..f84f21137a 100644 --- a/save-frontend/karma.config.d/custom-config.js +++ b/save-frontend/karma.config.d/custom-config.js @@ -24,12 +24,12 @@ config.set({ } }, proxies: { - // serving mockServiceWorker.js.js from location relative to base url + // serving mockServiceWorker.js from location relative to base url // the file should be included into Karma's `files` to be served by server at all - '/mockServiceWorker.js': '/base/mockServiceWorker.js', + '/mockServiceWorker.js': '/base/node_modules/mockServiceWorker.js', }, }) // http://karma-runner.github.io/6.3/config/files.html -// 'All of the relative patterns will get resolved using the basePath first.', where basePath is set by KGP to `node_modules` -config.files.push('./mockServiceWorker.js') +// 'All of the relative patterns will get resolved using the basePath first.', where basePath is NOT set by KGP to `node_modules` after migration to 1.9 +config.files.push('./node_modules/mockServiceWorker.js') From b682aadd80c09f9ca78db9dc549953d01d9d7ea0 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Tue, 5 Mar 2024 17:34:14 +0300 Subject: [PATCH 7/8] @OptIn(ExperimentalNativeApi::class) --- .../kotlin/com/saveoourtool/save/demo/agent/ServerTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/save-demo-agent/src/nativeTest/kotlin/com/saveoourtool/save/demo/agent/ServerTest.kt b/save-demo-agent/src/nativeTest/kotlin/com/saveoourtool/save/demo/agent/ServerTest.kt index cf82d3c44f..63dfb52d8d 100644 --- a/save-demo-agent/src/nativeTest/kotlin/com/saveoourtool/save/demo/agent/ServerTest.kt +++ b/save-demo-agent/src/nativeTest/kotlin/com/saveoourtool/save/demo/agent/ServerTest.kt @@ -10,6 +10,7 @@ import io.ktor.utils.io.core.* import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlin.experimental.ExperimentalNativeApi import kotlin.test.* class ServerTest { @@ -27,6 +28,7 @@ class ServerTest { server.stop() } + @OptIn(ExperimentalNativeApi::class) @Test fun testServerStartup() { httpClient().use { client -> From 610ad2bdbf62840fc4a1d5f81f2a1a4d179a2f3e Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 6 Mar 2024 11:11:45 +0300 Subject: [PATCH 8/8] fixed import @JsModule("@react-sigma/*") --- .../externals/graph/sigma/layouts/LayoutCircular.kt | 7 ++----- .../externals/graph/sigma/layouts/LayoutForceAtlas2.kt | 8 +++----- .../externals/graph/sigma/layouts/LayoutRandom.kt | 7 ++----- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutCircular.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutCircular.kt index e032f7ee0b..e02f3ffa18 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutCircular.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutCircular.kt @@ -1,15 +1,12 @@ @file:Suppress("FILE_NAME_MATCH_CLASS", "HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE") -@file:JsModule("@react-sigma/layout-circular") -@file:JsNonModule package com.saveourtool.save.frontend.externals.graph.sigma.layouts -import react.* - /** * @param settings * @return [LayoutInstance] with positions and assign functions */ -@JsName("useLayoutCircular") +@JsModule("@react-sigma/layout-circular") +@JsNonModule @JsExport external fun useLayoutCircular(settings: dynamic = definedExternally): LayoutInstance diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutForceAtlas2.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutForceAtlas2.kt index 2a1b490b77..76008bc9c1 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutForceAtlas2.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutForceAtlas2.kt @@ -1,14 +1,12 @@ @file:Suppress("FILE_NAME_MATCH_CLASS", "HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE") -@file:JsModule("@react-sigma/layout-forceatlas2") -@file:JsNonModule package com.saveourtool.save.frontend.externals.graph.sigma.layouts -import react.* - /** * @param settings * @return [LayoutInstance] with positions and assign functions */ -@JsName("useLayoutForceAtlas2") +@JsModule("@react-sigma/layout-forceatlas2") +@JsNonModule +@JsExport external fun useLayoutForceAtlas2(settings: dynamic = definedExternally): LayoutInstance diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutRandom.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutRandom.kt index 8b229d530a..305b38a7da 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutRandom.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/externals/graph/sigma/layouts/LayoutRandom.kt @@ -1,15 +1,12 @@ @file:Suppress("FILE_NAME_MATCH_CLASS", "HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE") -@file:JsModule("@react-sigma/layout-random") -@file:JsNonModule package com.saveourtool.save.frontend.externals.graph.sigma.layouts -import react.* - /** * @param settings * @return [LayoutInstance] with positions and assign functions */ -@JsName("useLayoutRandom") +@JsModule("@react-sigma/layout-random") +@JsNonModule @JsExport external fun useLayoutRandom(settings: dynamic = definedExternally): LayoutInstance