diff --git a/buildSrc/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-library.gradle.kts b/buildSrc/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-library.gradle.kts index 1d9aa3ba7..21ff2889e 100644 --- a/buildSrc/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-library.gradle.kts +++ b/buildSrc/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-library.gradle.kts @@ -31,16 +31,6 @@ kotlin { macosX64(), /* macosArm64() */ ) - if (project.name == "save-common") { - // additionally, save-common should be available for JS too - // fixme: shouldn't rely on hardcoded project name here - js(IR).browser() - - // store yarn.lock in the root directory - rootProject.extensions.configure { - lockFileDirectory = rootProject.projectDir - } - } if (hasProperty("disableRedundantTargets") && (property("disableRedundantTargets") as String?) != "false") { // with this flag we exclude targets that are present on multiple OS to speed up build @@ -58,55 +48,20 @@ kotlin { } } - /* - * Common structure for MPP libraries: - * common - * | - * nonJs - * / \ - * native JVM - * / | \ - * linux mingw macos - */ sourceSets { - val commonMain by getting val commonTest by getting { dependencies { implementation("io.kotest:kotest-assertions-core:5.8.0") - } - } - val commonNonJsMain by creating { - dependsOn(commonMain) - } - val commonNonJsTest by creating { - dependsOn(commonTest) - dependencies { implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) } } - val jvmMain by getting { - dependsOn(commonNonJsMain) - } val jvmTest by getting { - dependsOn(commonNonJsTest) dependencies { implementation(kotlin("test-junit5")) implementation("org.junit.jupiter:junit-jupiter-engine:5.10.1") } } - val nativeMain by creating { - dependsOn(commonNonJsMain) - } - val nativeTest by creating { - dependsOn(commonNonJsTest) - } - nativeTargets.forEach { - getByName("${it.name}Main").dependsOn(nativeMain) - } - nativeTargets.forEach { - getByName("${it.name}Test").dependsOn(nativeTest) - } } } diff --git a/diktat-analysis.yml b/diktat-analysis.yml index 858871f72..bde00fce5 100644 --- a/diktat-analysis.yml +++ b/diktat-analysis.yml @@ -3,8 +3,8 @@ configuration: domainName: com.saveourtool.save kotlinVersion: 1.6 - srcDirectories: "main,nativeMain,commonNonJsMain" - testDirs: "test,nativeTest,commonTest,jvmTest,commonNonJsTest" + srcDirectories: "main,nativeMain,commonMain" + testDirs: "test,nativeTest,commonTest,jvmTest,commonTest" - name: AVOID_NULL_CHECKS enabled: false - name: ENUM_VALUE diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1155bdb53..e5a7c0514 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "1.9.10" +kotlin = "1.9.20" okio = "3.6.0" serialization = "1.6.0" diktat = "1.2.5" diff --git a/save-cli/build.gradle.kts b/save-cli/build.gradle.kts index bb1b98df0..0aa922675 100644 --- a/save-cli/build.gradle.kts +++ b/save-cli/build.gradle.kts @@ -18,11 +18,6 @@ kotlin { val commonMain by getting { dependencies { api(libs.okio) - } - } - - val commonNonJsMain by getting { - dependencies { implementation(projects.saveCore) implementation(projects.saveCommon) implementation(libs.kotlinx.serialization.properties) diff --git a/save-cli/src/commonNonJsMain/kotlin/com/saveourtool/save/cli/ExitCodes.kt b/save-cli/src/commonMain/kotlin/com/saveourtool/save/cli/ExitCodes.kt similarity index 100% rename from save-cli/src/commonNonJsMain/kotlin/com/saveourtool/save/cli/ExitCodes.kt rename to save-cli/src/commonMain/kotlin/com/saveourtool/save/cli/ExitCodes.kt diff --git a/save-cli/src/commonNonJsMain/kotlin/com/saveourtool/save/cli/SaveCliRunner.kt b/save-cli/src/commonMain/kotlin/com/saveourtool/save/cli/SaveCliRunner.kt similarity index 100% rename from save-cli/src/commonNonJsMain/kotlin/com/saveourtool/save/cli/SaveCliRunner.kt rename to save-cli/src/commonMain/kotlin/com/saveourtool/save/cli/SaveCliRunner.kt diff --git a/save-cli/src/commonNonJsMain/kotlin/com/saveourtool/save/cli/config/SavePropertiesExt.kt b/save-cli/src/commonMain/kotlin/com/saveourtool/save/cli/config/SavePropertiesExt.kt similarity index 100% rename from save-cli/src/commonNonJsMain/kotlin/com/saveourtool/save/cli/config/SavePropertiesExt.kt rename to save-cli/src/commonMain/kotlin/com/saveourtool/save/cli/config/SavePropertiesExt.kt diff --git a/save-cli/src/commonNonJsMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt b/save-cli/src/commonMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt similarity index 74% rename from save-cli/src/commonNonJsMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt rename to save-cli/src/commonMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt index ff7dffc85..8795eb22c 100644 --- a/save-cli/src/commonNonJsMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt +++ b/save-cli/src/commonMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt @@ -7,18 +7,17 @@ package com.saveourtool.save.cli.logging import com.saveourtool.save.cli.ExitCodes /** - * Log [message] with level ERROR and exit process with code [exitCode] + * Log result of [messageSupplier] with level WARN * - * @param exitCode exit code - * @param message message to log - * @return nothing, program terminates in this method + * @param messageSupplier supplier for message to log */ -@Deprecated("never use this method in save-core as it can lead to a break of save-cloud application") -expect fun logErrorAndExit(exitCode: ExitCodes, message: String): Nothing +expect fun logWarn(messageSupplier: () -> String): Unit /** - * Log result of [messageSupplier] with level WARN + * Log [message] with level ERROR and exit process with code [exitCode] * - * @param messageSupplier supplier for message to log + * @param exitCode exit code + * @param message message to log + * @return nothing, program terminates in this method */ -expect fun logWarn(messageSupplier: () -> String): Unit +internal expect fun logErrorAndExit(exitCode: ExitCodes, message: String): Nothing diff --git a/save-cli/src/jvmMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt b/save-cli/src/jvmMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt index 54adcf7a7..4534d7ad2 100644 --- a/save-cli/src/jvmMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt +++ b/save-cli/src/jvmMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt @@ -9,11 +9,11 @@ import com.saveourtool.save.core.logging.logError import com.saveourtool.save.core.logging.logWarn import kotlin.system.exitProcess -actual fun logErrorAndExit(exitCode: ExitCodes, message: String): Nothing { - logError(message) - exitProcess(exitCode.code) -} - actual fun logWarn(messageSupplier: () -> String) { logWarn(messageSupplier()) } + +internal actual fun logErrorAndExit(exitCode: ExitCodes, message: String): Nothing { + logError(message) + exitProcess(exitCode.code) +} diff --git a/save-cli/src/nativeMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt b/save-cli/src/nativeMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt index 54adcf7a7..4534d7ad2 100644 --- a/save-cli/src/nativeMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt +++ b/save-cli/src/nativeMain/kotlin/com/saveourtool/save/cli/logging/Logger.kt @@ -9,11 +9,11 @@ import com.saveourtool.save.core.logging.logError import com.saveourtool.save.core.logging.logWarn import kotlin.system.exitProcess -actual fun logErrorAndExit(exitCode: ExitCodes, message: String): Nothing { - logError(message) - exitProcess(exitCode.code) -} - actual fun logWarn(messageSupplier: () -> String) { logWarn(messageSupplier()) } + +internal actual fun logErrorAndExit(exitCode: ExitCodes, message: String): Nothing { + logError(message) + exitProcess(exitCode.code) +} diff --git a/save-common-test/build.gradle.kts b/save-common-test/build.gradle.kts index abaec1e65..8cf84e60b 100644 --- a/save-common-test/build.gradle.kts +++ b/save-common-test/build.gradle.kts @@ -4,7 +4,7 @@ plugins { kotlin { sourceSets { - val commonNonJsMain by getting { + val commonMain by getting { dependencies { implementation(projects.saveCommon) api(libs.okio) diff --git a/save-common-test/src/commonNonJsMain/kotlin/com/saveourtool/save/Utils.kt b/save-common-test/src/commonMain/kotlin/com/saveourtool/save/Utils.kt similarity index 69% rename from save-common-test/src/commonNonJsMain/kotlin/com/saveourtool/save/Utils.kt rename to save-common-test/src/commonMain/kotlin/com/saveourtool/save/Utils.kt index 0c605b01a..5803acd10 100644 --- a/save-common-test/src/commonNonJsMain/kotlin/com/saveourtool/save/Utils.kt +++ b/save-common-test/src/commonMain/kotlin/com/saveourtool/save/Utils.kt @@ -10,16 +10,6 @@ import okio.FileSystem import okio.Path import kotlin.random.Random -/** - * Marks method to be executed before all tests, supported on JVM and Native - */ -expect annotation class BeforeClass - -/** - * Marks method to be executed after all tests, supported on JVM and Native - */ -expect annotation class AfterClass - /** * Create a temporary directory * diff --git a/save-common-test/src/commonNonJsMain/kotlin/com/saveourtool/save/plugin/MockPlugin.kt b/save-common-test/src/commonMain/kotlin/com/saveourtool/save/plugin/MockPlugin.kt similarity index 100% rename from save-common-test/src/commonNonJsMain/kotlin/com/saveourtool/save/plugin/MockPlugin.kt rename to save-common-test/src/commonMain/kotlin/com/saveourtool/save/plugin/MockPlugin.kt diff --git a/save-common-test/src/jvmMain/kotlin/com/saveourtool/save/Utils.kt b/save-common-test/src/jvmMain/kotlin/com/saveourtool/save/Utils.kt deleted file mode 100644 index 1d79e8e6e..000000000 --- a/save-common-test/src/jvmMain/kotlin/com/saveourtool/save/Utils.kt +++ /dev/null @@ -1,10 +0,0 @@ -@file:JvmName("UtilsJvm") -@file:Suppress("HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE") - -package com.saveourtool.save - -import org.junit.jupiter.api.AfterAll -import org.junit.jupiter.api.BeforeAll - -actual typealias BeforeClass = BeforeAll -actual typealias AfterClass = AfterAll diff --git a/save-common-test/src/nativeMain/kotlin/com/saveourtool/save/Utils.kt b/save-common-test/src/nativeMain/kotlin/com/saveourtool/save/Utils.kt deleted file mode 100644 index b1d4511f8..000000000 --- a/save-common-test/src/nativeMain/kotlin/com/saveourtool/save/Utils.kt +++ /dev/null @@ -1,6 +0,0 @@ -@file:Suppress("HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE") - -package com.saveourtool.save - -actual typealias BeforeClass = kotlin.test.BeforeClass -actual typealias AfterClass = kotlin.test.AfterClass diff --git a/save-common/build.gradle.kts b/save-common/build.gradle.kts index 626ba4633..ed29c1151 100644 --- a/save-common/build.gradle.kts +++ b/save-common/build.gradle.kts @@ -3,6 +3,26 @@ plugins { } kotlin { + // additionally, save-common should be available for JS too + js(IR) { + browser() + // tests don't work on JS + testRuns.configureEach { + filter { + setExcludePatterns( + "*ExtraFlagsExtractorTest*", + "*ProcessBuilderTest*", + "*FileUtilsTest*", + ) + } + } + } + + // store yarn.lock in the root directory + rootProject.extensions.configure { + lockFileDirectory = rootProject.projectDir + } + sourceSets { val commonMain by getting { dependencies { @@ -17,5 +37,11 @@ kotlin { implementation(libs.okio.fakefilesystem) } } + val jsTest by getting { + dependencies { + implementation(kotlin("test-js")) + implementation(kotlin("test-js-runner")) + } + } } } diff --git a/save-common/src/commonMain/kotlin/com/saveourtool/save/core/logging/Logger.kt b/save-common/src/commonMain/kotlin/com/saveourtool/save/core/logging/Logger.kt index 5f5471cd1..792aaf435 100644 --- a/save-common/src/commonMain/kotlin/com/saveourtool/save/core/logging/Logger.kt +++ b/save-common/src/commonMain/kotlin/com/saveourtool/save/core/logging/Logger.kt @@ -10,9 +10,9 @@ package com.saveourtool.save.core.logging import com.saveourtool.save.core.config.LogType import com.saveourtool.save.core.config.OutputStreamType import com.saveourtool.save.core.utils.GenericAtomicReference +import com.saveourtool.save.core.utils.createGenericAtomicReference import com.saveourtool.save.core.utils.writeToStream -import kotlin.native.concurrent.SharedImmutable import kotlinx.datetime.Clock import kotlinx.datetime.TimeZone import kotlinx.datetime.toLocalDateTime @@ -20,8 +20,7 @@ import kotlinx.datetime.toLocalDateTime /** * Logging mode */ -@SharedImmutable -val logType: GenericAtomicReference = GenericAtomicReference(LogType.WARN) +val logType: GenericAtomicReference = createGenericAtomicReference(LogType.WARN) /** * Whether to add time stamps to log messages diff --git a/save-common/src/commonMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt b/save-common/src/commonMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt index 6341f3674..a3851979e 100644 --- a/save-common/src/commonMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt +++ b/save-common/src/commonMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt @@ -16,12 +16,10 @@ enum class CurrentOs { } /** - * Class that holds value and shares atomic reference to the value (native only) + * Interface that holds value and shares atomic reference to the value (native only) * - * @param valueToStore value to store */ -@Suppress("USE_DATA_CLASS") -expect class GenericAtomicReference(valueToStore: T) { +interface GenericAtomicReference { /** * @return stored value */ @@ -33,6 +31,12 @@ expect class GenericAtomicReference(valueToStore: T) { fun set(newValue: T) } +/** + * @param valueToStore value to store + * @return a new [GenericAtomicReference] with default value [valueToStore] + */ +expect fun createGenericAtomicReference(valueToStore: T): GenericAtomicReference + /** * Get type of current OS * diff --git a/save-common/src/commonMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilder.kt b/save-common/src/commonMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilder.kt index 4dfb73383..24f15996e 100644 --- a/save-common/src/commonMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilder.kt +++ b/save-common/src/commonMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilder.kt @@ -19,13 +19,9 @@ import okio.Path.Companion.toPath import kotlinx.datetime.Clock /** - * A class that is capable of executing processes, specific to different OS and returning their output. + * An interface that is capable of executing processes, specific to different OS and returning their output. */ -expect class ProcessBuilderInternal( - stdoutFile: Path, - stderrFile: Path, - useInternalRedirections: Boolean, -) { +interface ProcessBuilderInternal { /** * Modify execution command according behavior of different OS, * also stdout and stderr will be redirected to tmp files @@ -97,7 +93,7 @@ class ProcessBuilder(private val useInternalRedirections: Boolean, private val f val stderrFile = tmpDir / "stderr.txt" logTrace("Creating stderr file of ProcessBuilder: $stderrFile") // Instance, containing platform-dependent realization of command execution - val processBuilderInternal = ProcessBuilderInternal(stdoutFile, stderrFile, useInternalRedirections) + val processBuilderInternal = createProcessBuilderInternal(stdoutFile, stderrFile, useInternalRedirections) fs.createDirectories(tmpDir) fs.createFile(stdoutFile) fs.createFile(stderrFile) @@ -236,3 +232,15 @@ data class ExecutionResult( val stdout: List, val stderr: List, ) + +/** + * @param stdoutFile + * @param stderrFile + * @param useInternalRedirections + * @return implementation of [ProcessBuilderInternal] + */ +expect fun createProcessBuilderInternal( + stdoutFile: Path, + stderrFile: Path, + useInternalRedirections: Boolean, +): ProcessBuilderInternal diff --git a/save-common/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ExtraFlagsExtractorTest.kt b/save-common/src/commonTest/kotlin/com/saveourtool/save/core/ExtraFlagsExtractorTest.kt similarity index 96% rename from save-common/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ExtraFlagsExtractorTest.kt rename to save-common/src/commonTest/kotlin/com/saveourtool/save/core/ExtraFlagsExtractorTest.kt index 01973226b..bcff38942 100644 --- a/save-common/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ExtraFlagsExtractorTest.kt +++ b/save-common/src/commonTest/kotlin/com/saveourtool/save/core/ExtraFlagsExtractorTest.kt @@ -8,6 +8,7 @@ import com.saveourtool.save.core.plugin.resolvePlaceholdersFrom import com.saveourtool.save.core.plugin.splitByNonEscaped import okio.fakefilesystem.FakeFileSystem +import kotlin.js.JsName import kotlin.test.Test import kotlin.test.assertEquals @@ -18,6 +19,7 @@ import kotlin.test.assertEquals ) class ExtraFlagsExtractorTest { @Test + @JsName("basic_test") fun `basic test`() { val extraFlagsExtractor = ExtraFlagsExtractor( GeneralConfig(runConfigPattern = Regex("""// RUN: (.*[^\\]=.*)""")), @@ -41,6 +43,7 @@ class ExtraFlagsExtractorTest { } @Test + @JsName("should_resolve_placeholders") fun `should resolve placeholders`() { // basic test checkPlaceholders( @@ -80,6 +83,7 @@ class ExtraFlagsExtractorTest { } @Test + @JsName("should_join_multiline_directives") fun `should join multiline directives`() { checkMultilineDirectives( Regex("""// RUN: (.*([^\\]=)?.*)\\?"""), @@ -130,6 +134,7 @@ class ExtraFlagsExtractorTest { } @Test + @JsName("test_for_splitByNonEscaped") fun `test for splitByNonEscaped`() { assertEquals( listOf("this string\\, not split"), diff --git a/save-common/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ProcessBuilderTest.kt b/save-common/src/commonTest/kotlin/com/saveourtool/save/core/ProcessBuilderTest.kt similarity index 88% rename from save-common/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ProcessBuilderTest.kt rename to save-common/src/commonTest/kotlin/com/saveourtool/save/core/ProcessBuilderTest.kt index 35cfc92d3..f5ca49551 100644 --- a/save-common/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ProcessBuilderTest.kt +++ b/save-common/src/commonTest/kotlin/com/saveourtool/save/core/ProcessBuilderTest.kt @@ -9,6 +9,7 @@ import com.saveourtool.save.core.utils.ProcessBuilder import com.saveourtool.save.core.utils.ProcessBuilder.Companion.processCommandWithEcho import com.saveourtool.save.core.utils.ProcessExecutionException import com.saveourtool.save.core.utils.isCurrentOsWindows +import kotlin.js.JsName import kotlin.test.Test import kotlin.test.assertEquals @@ -18,6 +19,7 @@ class ProcessBuilderTest { private val processBuilder = ProcessBuilder(useInternalRedirections = true, fs) @Test + @JsName("empty_command") fun `empty command`() { try { processBuilder.exec(" ", "", null, 10_000L) @@ -27,6 +29,7 @@ class ProcessBuilderTest { } @Test + @JsName("check_stdout") fun `check stdout`() { val actualResult = processBuilder.exec("echo something", "", null, 10_000L) val expectedCode = 0 @@ -38,6 +41,7 @@ class ProcessBuilderTest { @Test @Suppress("SAY_NO_TO_VAR") + @JsName("check_stdout_with_redirection") fun `check stdout with redirection`() { val actualResult = processBuilder.exec("echo something >/dev/null", "", null, 10_000L) val expectedCode: Int @@ -58,12 +62,14 @@ class ProcessBuilderTest { } @Test + @JsName("command_without_echo") fun `command without echo`() { val inputCommand = "cd /some/dir; cat /some/file ; ls" assertEquals(inputCommand, processCommandWithEcho(inputCommand)) } @Test + @JsName("simple_check") fun `simple check`() { val inputCommand = "echo something" val expectedCommand = "echo | set /p dummyName=\"something\"" @@ -71,6 +77,7 @@ class ProcessBuilderTest { } @Test + @JsName("simple_check_with_redirection") fun `simple check with redirection`() { val inputCommand = "echo something > /dev/null" val expectedCommand = "echo | set /p dummyName=\"something\" > /dev/null" @@ -78,6 +85,7 @@ class ProcessBuilderTest { } @Test + @JsName("simple_check_with_redirection_without_first_whitespace") fun `simple check with redirection without first whitespace`() { val inputCommand = "echo something> /dev/null" val expectedCommand = "echo | set /p dummyName=\"something\" > /dev/null" @@ -85,6 +93,7 @@ class ProcessBuilderTest { } @Test + @JsName("simple_check_with_redirection_without_whitespaces_at_all") fun `simple check with redirection without whitespaces at all`() { val inputCommand = "echo something>/dev/null" val expectedCommand = "echo | set /p dummyName=\"something\" >/dev/null" @@ -92,6 +101,7 @@ class ProcessBuilderTest { } @Test + @JsName("one_long_echo") fun `one long echo`() { val inputCommand = "echo stub STUB stub foo bar " val expectedCommand = "echo | set /p dummyName=\"stub STUB stub foo bar\"" @@ -99,6 +109,7 @@ class ProcessBuilderTest { } @Test + @JsName("change_multiple_echo_commands_with_redirections") fun `change multiple echo commands with redirections`() { val inputCommand = "echo a > /dev/null && echo b 2>/dev/null && ls" val expectedCommand = "echo | set /p dummyName=\"a\" > /dev/null && echo | set /p dummyName=\"b\" 2>/dev/null && ls" @@ -106,6 +117,7 @@ class ProcessBuilderTest { } @Test + @JsName("change_multiple_echo_commands_with_redirections_2") fun `change multiple echo commands with redirections 2`() { val inputCommand = "echo a > /dev/null ; echo b 2>/dev/null ; ls" val expectedCommand = "echo | set /p dummyName=\"a\" > /dev/null ; echo | set /p dummyName=\"b\" 2>/dev/null ; ls" @@ -113,6 +125,7 @@ class ProcessBuilderTest { } @Test + @JsName("change_multiple_echo_commands_with_redirections_3") fun `change multiple echo commands with redirections 3`() { val inputCommand = "echo a > /dev/null; echo b 2>/dev/null; ls" val expectedCommand = "echo | set /p dummyName=\"a\" > /dev/null ; echo | set /p dummyName=\"b\" 2>/dev/null ; ls" @@ -120,6 +133,7 @@ class ProcessBuilderTest { } @Test + @JsName("extra_whitespaces_shouldn_t_influence_to_echo") fun `extra whitespaces shouldn't influence to echo`() { val inputCommand = "echo foo bar ; echo b; ls" val expectedCommand = "echo | set /p dummyName=\"foo bar\" ; echo | set /p dummyName=\"b\" ; ls" diff --git a/save-common/src/commonNonJsTest/kotlin/com/saveourtool/save/core/files/FileUtilsTest.kt b/save-common/src/commonTest/kotlin/com/saveourtool/save/core/files/FileUtilsTest.kt similarity index 94% rename from save-common/src/commonNonJsTest/kotlin/com/saveourtool/save/core/files/FileUtilsTest.kt rename to save-common/src/commonTest/kotlin/com/saveourtool/save/core/files/FileUtilsTest.kt index 98e8f0fae..429da1be4 100644 --- a/save-common/src/commonNonJsTest/kotlin/com/saveourtool/save/core/files/FileUtilsTest.kt +++ b/save-common/src/commonTest/kotlin/com/saveourtool/save/core/files/FileUtilsTest.kt @@ -2,6 +2,7 @@ package com.saveourtool.save.core.files import okio.FileSystem import okio.Path +import kotlin.js.JsName import kotlin.test.AfterTest import kotlin.test.BeforeTest import kotlin.test.Test @@ -40,6 +41,7 @@ class FileUtilsTest { * | | |-- file231 */ @Test + @JsName("example_for_findAllFilesMatching") fun `example for findAllFilesMatching`() { val directory1 = (tmpDir / "directory1").also(fs::createDirectory) val file11 = fs.createFile(directory1 / "file11") @@ -68,6 +70,7 @@ class FileUtilsTest { } @Test + @JsName("example_for_findDescendantDirectoriesBy") fun `example for findDescendantDirectoriesBy`() { val directory1 = (tmpDir / "directory1").also(fs::createDirectory) fs.createFile(directory1 / "file1") @@ -90,6 +93,7 @@ class FileUtilsTest { } @Test + @JsName("create_relative_path_when_config_and_test_resource_located_in_the_same_directory") fun `create relative path when config and test resource located in the same directory`() { val config = fs.createFile(tmpDir / "save.toml") val testFile = fs.createFile(tmpDir / "Test1Test.java") @@ -99,6 +103,7 @@ class FileUtilsTest { } @Test + @JsName("create_relative_path_in_case_of_branchy_file_tree") fun `create relative path in case of branchy file tree`() { fs.createDirectories(tmpDir / "dir2" / "dir3" / "dir4") fs.createDirectory(tmpDir / "dir2" / "dir3" / "dir33") diff --git a/save-common/src/jsMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt b/save-common/src/jsMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt index e41698b4f..949ce40de 100644 --- a/save-common/src/jsMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt +++ b/save-common/src/jsMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt @@ -13,14 +13,14 @@ package com.saveourtool.save.core.utils import com.saveourtool.save.core.config.OutputStreamType -@Suppress("USE_DATA_CLASS") -actual class GenericAtomicReference actual constructor(valueToStore: T) { - private var value: T = valueToStore - actual fun get(): T = value - actual fun set(newValue: T) { - value = newValue - } -} +actual fun createGenericAtomicReference(valueToStore: T): GenericAtomicReference = + object : GenericAtomicReference { + private var value: T = valueToStore + override fun get(): T = value + override fun set(newValue: T) { + value = newValue + } + } actual fun getCurrentOs(): CurrentOs = error("Not implemented for JS") diff --git a/save-common/src/jsMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilder.kt b/save-common/src/jsMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilder.kt index 963504aec..c6358bc31 100644 --- a/save-common/src/jsMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilder.kt +++ b/save-common/src/jsMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilder.kt @@ -1,22 +1,17 @@ -@file:Suppress( - "MISSING_KDOC_TOP_LEVEL", - "MISSING_KDOC_CLASS_ELEMENTS", - "KDOC_NO_EMPTY_TAGS", - "MISSING_KDOC_ON_FUNCTION", - "FILE_NAME_MATCH_CLASS", - "MatchingDeclarationName", -) +/** + * Implementation of [ProcessBuilderInternal] for JS + */ package com.saveourtool.save.core.utils import okio.Path -actual class ProcessBuilderInternal actual constructor( +actual fun createProcessBuilderInternal( stdoutFile: Path, stderrFile: Path, useInternalRedirections: Boolean, -) { - actual fun prepareCmd(command: String): String = error("Not implemented for JS") +): ProcessBuilderInternal = object : ProcessBuilderInternal { + override fun prepareCmd(command: String): String = error("Not implemented for JS") - actual fun exec(cmd: String, timeOutMillis: Long): Int = error("Not implemented for JS") + override fun exec(cmd: String, timeOutMillis: Long): Int = error("Not implemented for JS") } diff --git a/save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt b/save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt index 2fb595b59..c41cf8617 100644 --- a/save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt +++ b/save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt @@ -10,14 +10,14 @@ package com.saveourtool.save.core.utils import com.saveourtool.save.core.config.OutputStreamType -@Suppress("USE_DATA_CLASS") -actual class GenericAtomicReference actual constructor(valueToStore: T) { - 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) { - holder.set(newValue) - } -} +actual fun createGenericAtomicReference(valueToStore: T): GenericAtomicReference = + object : GenericAtomicReference { + private val holder = java.util.concurrent.atomic.AtomicReference(valueToStore) + override fun get(): T = holder.get() + override fun set(newValue: T) { + holder.set(newValue) + } + } actual fun getCurrentOs() = when { System.getProperty("os.name").startsWith("Linux", ignoreCase = true) -> CurrentOs.LINUX diff --git a/save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternal.kt b/save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternalImpl.kt similarity index 84% rename from save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternal.kt rename to save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternalImpl.kt index f36dfa258..8c1488474 100644 --- a/save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternal.kt +++ b/save-common/src/jvmMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternalImpl.kt @@ -6,23 +6,17 @@ import okio.Path import java.io.BufferedReader import java.io.InputStreamReader -import kotlinx.coroutines.ObsoleteCoroutinesApi import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.coroutines.newFixedThreadPoolContext import kotlinx.coroutines.runBlocking -@Suppress("MISSING_KDOC_TOP_LEVEL", - "MISSING_KDOC_CLASS_ELEMENTS", - "MISSING_KDOC_ON_FUNCTION" -) -actual class ProcessBuilderInternal actual constructor( +private class ProcessBuilderInternalImpl( private val stdoutFile: Path, private val stderrFile: Path, - private val useInternalRedirections: Boolean -) { - @OptIn(ExperimentalStdlibApi::class) - actual fun prepareCmd(command: String): String { + private val useInternalRedirections: Boolean, +) : ProcessBuilderInternal { + override fun prepareCmd(command: String): String { val cmd = buildList { if (isCurrentOsWindows()) { add("CMD") @@ -36,9 +30,8 @@ actual class ProcessBuilderInternal actual constructor( return cmd.joinToString() } - @OptIn(ObsoleteCoroutinesApi::class) @Suppress("UnsafeCallOnNullableType") - actual fun exec( + override fun exec( cmd: String, timeOutMillis: Long, ): Int { @@ -92,3 +85,9 @@ actual class ProcessBuilderInternal actual constructor( } } } + +actual fun createProcessBuilderInternal( + stdoutFile: Path, + stderrFile: Path, + useInternalRedirections: Boolean, +): ProcessBuilderInternal = ProcessBuilderInternalImpl(stdoutFile, stderrFile, useInternalRedirections) diff --git a/save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt b/save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt index f2ce29902..1985fc263 100644 --- a/save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt +++ b/save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/PlatformUtils.kt @@ -15,17 +15,9 @@ import platform.posix.fprintf import platform.posix.stderr import platform.posix.stdout +import kotlin.experimental.ExperimentalNativeApi import kotlinx.cinterop.ExperimentalForeignApi -@Suppress("USE_DATA_CLASS") -actual class GenericAtomicReference actual constructor(valueToStore: T) { - private val holder: kotlin.concurrent.AtomicReference = kotlin.concurrent.AtomicReference(valueToStore) - actual fun get(): T = holder.value - actual fun set(newValue: T) { - holder.value = newValue - } -} - /** * Escaping percent symbol in the string in case it is not escaped already * @@ -51,6 +43,16 @@ fun String.escapePercent(): String { return stringBuilder.toString() } +actual fun createGenericAtomicReference(valueToStore: T): GenericAtomicReference = + object : GenericAtomicReference { + private val holder = kotlin.concurrent.AtomicReference(valueToStore) + override fun get(): T = holder.value + override fun set(newValue: T) { + holder.value = newValue + } + } + +@OptIn(ExperimentalNativeApi::class) actual fun getCurrentOs() = when (Platform.osFamily) { OsFamily.LINUX -> CurrentOs.LINUX OsFamily.MACOSX -> CurrentOs.MACOS diff --git a/save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternal.kt b/save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternalImpl.kt similarity index 76% rename from save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternal.kt rename to save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternalImpl.kt index f10773b9f..e430387fa 100644 --- a/save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternal.kt +++ b/save-common/src/nativeMain/kotlin/com/saveourtool/save/core/utils/ProcessBuilderInternalImpl.kt @@ -1,5 +1,3 @@ -@file:Suppress("FILE_WILDCARD_IMPORTS") - package com.saveourtool.save.core.utils import com.saveourtool.save.core.logging.logTrace @@ -14,23 +12,19 @@ import kotlinx.coroutines.joinAll import kotlinx.coroutines.newSingleThreadContext import kotlinx.coroutines.runBlocking -@Suppress("MISSING_KDOC_TOP_LEVEL", - "MISSING_KDOC_CLASS_ELEMENTS", - "MISSING_KDOC_ON_FUNCTION" -) -actual class ProcessBuilderInternal actual constructor( +private class ProcessBuilderInternalImpl( private val stdoutFile: Path, private val stderrFile: Path, - private val useInternalRedirections: Boolean -) { - actual fun prepareCmd(command: String) = if (useInternalRedirections) { + private val useInternalRedirections: Boolean, +) : ProcessBuilderInternal { + override fun prepareCmd(command: String) = if (useInternalRedirections) { "($command) >$stdoutFile 2>$stderrFile" } else { command } @OptIn(ExperimentalCoroutinesApi::class) - actual fun exec( + override fun exec( cmd: String, timeOutMillis: Long ): Int { @@ -66,3 +60,9 @@ actual class ProcessBuilderInternal actual constructor( logTrace("Executed kill command: $killCmd") } } + +actual fun createProcessBuilderInternal( + stdoutFile: Path, + stderrFile: Path, + useInternalRedirections: Boolean, +): ProcessBuilderInternal = ProcessBuilderInternalImpl(stdoutFile, stderrFile, useInternalRedirections) diff --git a/save-core/build.gradle.kts b/save-core/build.gradle.kts index 85ef66bf9..dbbd09815 100644 --- a/save-core/build.gradle.kts +++ b/save-core/build.gradle.kts @@ -13,7 +13,7 @@ plugins { kotlin { sourceSets { - val commonNonJsMain by getting { + val commonMain by getting { dependencies { implementation(projects.saveCommon) implementation(projects.saveReporters) @@ -29,7 +29,7 @@ kotlin { implementation(projects.savePlugins.warnPlugin) } } - val commonNonJsTest by getting { + val commonTest by getting { dependencies { implementation(projects.saveCommonTest) implementation(kotlin("test-common")) @@ -67,7 +67,7 @@ val generateVersionFileTaskProvider = tasks.register("generateVersionsFile") { ) } } -kotlin.sourceSets.getByName("commonNonJsMain") { +kotlin.sourceSets.getByName("commonMain") { kotlin.srcDir( generateVersionFileTaskProvider.zip(generateConfigOptionsTaskProvider) { _, _ -> // Simply discard both tasks. However, `zip` is essential to tell Gradle diff --git a/save-core/src/commonNonJsMain/kotlin/com/saveourtool/save/core/Save.kt b/save-core/src/commonMain/kotlin/com/saveourtool/save/core/Save.kt similarity index 100% rename from save-core/src/commonNonJsMain/kotlin/com/saveourtool/save/core/Save.kt rename to save-core/src/commonMain/kotlin/com/saveourtool/save/core/Save.kt diff --git a/save-core/src/commonNonJsMain/kotlin/com/saveourtool/save/core/files/ConfigDetector.kt b/save-core/src/commonMain/kotlin/com/saveourtool/save/core/files/ConfigDetector.kt similarity index 100% rename from save-core/src/commonNonJsMain/kotlin/com/saveourtool/save/core/files/ConfigDetector.kt rename to save-core/src/commonMain/kotlin/com/saveourtool/save/core/files/ConfigDetector.kt diff --git a/save-core/src/commonNonJsMain/kotlin/com/saveourtool/save/core/utils/CliUtils.kt b/save-core/src/commonMain/kotlin/com/saveourtool/save/core/utils/CliUtils.kt similarity index 100% rename from save-core/src/commonNonJsMain/kotlin/com/saveourtool/save/core/utils/CliUtils.kt rename to save-core/src/commonMain/kotlin/com/saveourtool/save/core/utils/CliUtils.kt diff --git a/save-core/src/commonNonJsMain/kotlin/com/saveourtool/save/core/utils/TestConfigUtils.kt b/save-core/src/commonMain/kotlin/com/saveourtool/save/core/utils/TestConfigUtils.kt similarity index 100% rename from save-core/src/commonNonJsMain/kotlin/com/saveourtool/save/core/utils/TestConfigUtils.kt rename to save-core/src/commonMain/kotlin/com/saveourtool/save/core/utils/TestConfigUtils.kt diff --git a/save-core/src/commonNonJsMain/kotlin/com/saveourtool/save/core/utils/TomlUtils.kt b/save-core/src/commonMain/kotlin/com/saveourtool/save/core/utils/TomlUtils.kt similarity index 100% rename from save-core/src/commonNonJsMain/kotlin/com/saveourtool/save/core/utils/TomlUtils.kt rename to save-core/src/commonMain/kotlin/com/saveourtool/save/core/utils/TomlUtils.kt diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ConfigDetectorRegressionTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/ConfigDetectorRegressionTest.kt similarity index 100% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ConfigDetectorRegressionTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/ConfigDetectorRegressionTest.kt diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ConfigDetectorTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/ConfigDetectorTest.kt similarity index 100% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ConfigDetectorTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/ConfigDetectorTest.kt diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/MergeAndOverrideConfigsTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/MergeAndOverrideConfigsTest.kt similarity index 98% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/MergeAndOverrideConfigsTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/MergeAndOverrideConfigsTest.kt index a79a7703a..bbdb2678b 100644 --- a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/MergeAndOverrideConfigsTest.kt +++ b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/MergeAndOverrideConfigsTest.kt @@ -383,7 +383,7 @@ class MergeAndOverrideConfigsTest { @Test fun `merge real toml configs with empty execFlag in child`() { - val toml1 = "src/commonNonJsTest/resources/merge_configs/save.toml" + val toml1 = "src/commonTest/resources/merge_configs/save.toml" val configList1 = createPluginConfigListFromToml(toml1.toPath(), fs) val parentGeneralConfig: GeneralConfig = configList1.singleIsInstance() @@ -392,7 +392,7 @@ class MergeAndOverrideConfigsTest { assertEquals(listOf("Tag"), parentGeneralConfig.tags) assertEquals(null, parentWarnConfig.execFlags) - val toml2 = "src/commonNonJsTest/resources/merge_configs/inner/save.toml" + val toml2 = "src/commonTest/resources/merge_configs/inner/save.toml" val configList2 = createPluginConfigListFromToml(toml2.toPath(), fs) val childGeneralConfig: GeneralConfig = configList2.singleIsInstance() @@ -418,10 +418,10 @@ class MergeAndOverrideConfigsTest { @Test fun `override real toml configs`() { - val saveToml = "src/commonNonJsTest/resources/override_configs".toPath().resolveSaveTomlConfig() + val saveToml = "src/commonTest/resources/override_configs".toPath().resolveSaveTomlConfig() val configs = createPluginConfigListFromToml(saveToml, fs) - val saveOverridesToml = "src/commonNonJsTest/resources/override_configs".toPath().resolveSaveOverridesTomlConfig() + val saveOverridesToml = "src/commonTest/resources/override_configs".toPath().resolveSaveOverridesTomlConfig() val overrides = createPluginConfigListFromToml(saveOverridesToml, fs) val testConfig = TestConfig( diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/PerformAnalysisTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/PerformAnalysisTest.kt similarity index 93% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/PerformAnalysisTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/PerformAnalysisTest.kt index b90288f3b..74b991f01 100644 --- a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/PerformAnalysisTest.kt +++ b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/PerformAnalysisTest.kt @@ -2,14 +2,11 @@ package com.saveourtool.save.core import com.saveourtool.save.core.config.ReportType import com.saveourtool.save.core.config.SaveProperties - -import okio.FileSystem +import com.saveourtool.save.core.files.fs import kotlin.test.Test class PerformAnalysisTest { - private val fs: FileSystem = FileSystem.SYSTEM - @Test fun `detect plugins`() { val saveProperties = SaveProperties( diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ValidationTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/ValidationTest.kt similarity index 100% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/ValidationTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/ValidationTest.kt diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/integration/ClassicFixTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/integration/ClassicFixTest.kt similarity index 100% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/integration/ClassicFixTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/integration/ClassicFixTest.kt diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/integration/ClassicWarnTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/integration/ClassicWarnTest.kt similarity index 100% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/integration/ClassicWarnTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/integration/ClassicWarnTest.kt diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/integration/FixAndWarnDirTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/integration/FixAndWarnDirTest.kt similarity index 100% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/integration/FixAndWarnDirTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/integration/FixAndWarnDirTest.kt diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/integration/FixDirTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/integration/FixDirTest.kt similarity index 100% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/integration/FixDirTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/integration/FixDirTest.kt diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/integration/WarnDirTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/integration/WarnDirTest.kt similarity index 100% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/integration/WarnDirTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/integration/WarnDirTest.kt diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/test/utils/TestUtilsCommon.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/test/utils/TestUtilsCommon.kt similarity index 100% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/test/utils/TestUtilsCommon.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/test/utils/TestUtilsCommon.kt diff --git a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/utils/CliUtilsTest.kt b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/utils/CliUtilsTest.kt similarity index 98% rename from save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/utils/CliUtilsTest.kt rename to save-core/src/commonTest/kotlin/com/saveourtool/save/core/utils/CliUtilsTest.kt index 9498f46b7..19c83fd5c 100644 --- a/save-core/src/commonNonJsTest/kotlin/com/saveourtool/save/core/utils/CliUtilsTest.kt +++ b/save-core/src/commonTest/kotlin/com/saveourtool/save/core/utils/CliUtilsTest.kt @@ -1,5 +1,6 @@ package com.saveourtool.save.core.utils +import com.saveourtool.save.core.files.fs import okio.FileSystem import okio.IOException @@ -13,7 +14,6 @@ import kotlinx.cli.ArgType import kotlinx.cli.default class CliUtilsTest { - private val fs: FileSystem = FileSystem.SYSTEM private val tmpDir = (FileSystem.SYSTEM_TEMPORARY_DIRECTORY / FileSystem::class.simpleName!!) @Test diff --git a/save-core/src/commonNonJsTest/resources/merge_configs/inner/save.toml b/save-core/src/commonTest/resources/merge_configs/inner/save.toml similarity index 100% rename from save-core/src/commonNonJsTest/resources/merge_configs/inner/save.toml rename to save-core/src/commonTest/resources/merge_configs/inner/save.toml diff --git a/save-core/src/commonNonJsTest/resources/merge_configs/save.toml b/save-core/src/commonTest/resources/merge_configs/save.toml similarity index 100% rename from save-core/src/commonNonJsTest/resources/merge_configs/save.toml rename to save-core/src/commonTest/resources/merge_configs/save.toml diff --git a/save-core/src/commonNonJsTest/resources/override_configs/save-overrides.toml b/save-core/src/commonTest/resources/override_configs/save-overrides.toml similarity index 100% rename from save-core/src/commonNonJsTest/resources/override_configs/save-overrides.toml rename to save-core/src/commonTest/resources/override_configs/save-overrides.toml diff --git a/save-core/src/commonNonJsTest/resources/override_configs/save.toml b/save-core/src/commonTest/resources/override_configs/save.toml similarity index 100% rename from save-core/src/commonNonJsTest/resources/override_configs/save.toml rename to save-core/src/commonTest/resources/override_configs/save.toml diff --git a/save-core/src/commonNonJsTest/resources/save-overrides.toml b/save-core/src/commonTest/resources/save-overrides.toml similarity index 100% rename from save-core/src/commonNonJsTest/resources/save-overrides.toml rename to save-core/src/commonTest/resources/save-overrides.toml diff --git a/save-plugins/fix-and-warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugins/fixandwarn/FixAndWarnPluginTest.kt b/save-plugins/fix-and-warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugins/fixandwarn/FixAndWarnPluginTest.kt similarity index 100% rename from save-plugins/fix-and-warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugins/fixandwarn/FixAndWarnPluginTest.kt rename to save-plugins/fix-and-warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugins/fixandwarn/FixAndWarnPluginTest.kt diff --git a/save-plugins/fix-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugins/fix/FixPluginTest.kt b/save-plugins/fix-plugin/src/commonTest/kotlin/com/saveourtool/save/plugins/fix/FixPluginTest.kt similarity index 99% rename from save-plugins/fix-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugins/fix/FixPluginTest.kt rename to save-plugins/fix-plugin/src/commonTest/kotlin/com/saveourtool/save/plugins/fix/FixPluginTest.kt index 25850f52f..9b5bae5e8 100644 --- a/save-plugins/fix-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugins/fix/FixPluginTest.kt +++ b/save-plugins/fix-plugin/src/commonTest/kotlin/com/saveourtool/save/plugins/fix/FixPluginTest.kt @@ -175,6 +175,9 @@ class FixPluginTest { fs.deleteRecursively(tmpDir) } + /** + * @return file pairs + */ internal fun discoverFilePairs() = FixPlugin( TestConfig( tmpDir / "save.toml", diff --git a/save-plugins/warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugin/warn/WarnPluginTest.kt b/save-plugins/warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugin/warn/WarnPluginTest.kt similarity index 100% rename from save-plugins/warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugin/warn/WarnPluginTest.kt rename to save-plugins/warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugin/warn/WarnPluginTest.kt diff --git a/save-plugins/warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugin/warn/sarif/SarifWarningAdapterTest.kt b/save-plugins/warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugin/warn/sarif/SarifWarningAdapterTest.kt similarity index 100% rename from save-plugins/warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugin/warn/sarif/SarifWarningAdapterTest.kt rename to save-plugins/warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugin/warn/sarif/SarifWarningAdapterTest.kt diff --git a/save-plugins/warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugin/warn/utils/ComparisonTest.kt b/save-plugins/warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugin/warn/utils/ComparisonTest.kt similarity index 100% rename from save-plugins/warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugin/warn/utils/ComparisonTest.kt rename to save-plugins/warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugin/warn/utils/ComparisonTest.kt diff --git a/save-plugins/warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugin/warn/utils/StringUtilsTest.kt b/save-plugins/warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugin/warn/utils/StringUtilsTest.kt similarity index 100% rename from save-plugins/warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugin/warn/utils/StringUtilsTest.kt rename to save-plugins/warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugin/warn/utils/StringUtilsTest.kt diff --git a/save-plugins/warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugin/warn/utils/UtilsTest.kt b/save-plugins/warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugin/warn/utils/UtilsTest.kt similarity index 100% rename from save-plugins/warn-plugin/src/commonNonJsTest/kotlin/com/saveourtool/save/plugin/warn/utils/UtilsTest.kt rename to save-plugins/warn-plugin/src/commonTest/kotlin/com/saveourtool/save/plugin/warn/utils/UtilsTest.kt