From e302420197acfd51c6ffe53866d69fcb5b2bb5c7 Mon Sep 17 00:00:00 2001 From: "Alexander.Likhachev" Date: Thu, 7 Mar 2024 20:42:25 +0100 Subject: [PATCH] [BTA tests] Use arbitrary named versions instead of just numbered ones ^KT-61860 In Progress --- .../main/kotlin/compilation/scenario/ScenarioModule.kt | 10 +++++----- .../main/kotlin/compilation/scenario/scenarioDsl.kt | 4 ++-- .../{bar.kt.1 => bar.kt.add-default-argument} | 0 .../jvm-module-1/{secret.kt.1 => secret.kt.new-file} | 0 .../kotlin/ExampleIncrementalScenarioTest.kt | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) rename compiler/build-tools/kotlin-build-tools-api-tests/src/main/resources/modules/jvm-module-1/{bar.kt.1 => bar.kt.add-default-argument} (100%) rename compiler/build-tools/kotlin-build-tools-api-tests/src/main/resources/modules/jvm-module-1/{secret.kt.1 => secret.kt.new-file} (100%) diff --git a/compiler/build-tools/kotlin-build-tools-api-tests/src/main/kotlin/compilation/scenario/ScenarioModule.kt b/compiler/build-tools/kotlin-build-tools-api-tests/src/main/kotlin/compilation/scenario/ScenarioModule.kt index 01b4ca85f43..54642fb8b21 100644 --- a/compiler/build-tools/kotlin-build-tools-api-tests/src/main/kotlin/compilation/scenario/ScenarioModule.kt +++ b/compiler/build-tools/kotlin-build-tools-api-tests/src/main/kotlin/compilation/scenario/ScenarioModule.kt @@ -13,7 +13,7 @@ interface ScenarioModule { /** * Performs registered existing file modification. * - * Prefer the overload with versioned file modification if it's possible + * Prefer using [replaceFileWithVersion] if it's possible */ fun changeFile( fileName: String, @@ -26,9 +26,9 @@ interface ScenarioModule { * * Check the example `ExampleIncrementalScenarioTest.testScenario4` out */ - fun changeFile( + fun replaceFileWithVersion( fileName: String, - version: UInt, + version: String, ) /** @@ -39,7 +39,7 @@ interface ScenarioModule { /** * Performs registered new file creation. * - * Prefer the overload with versioned file modification if it's possible + * Prefer using [createPredefinedFile] if it's possible */ fun createFile(fileName: String, content: String) @@ -47,7 +47,7 @@ interface ScenarioModule { * Performs registered new file creation by copying a revision from * the file located by path "[fileName].[version]" in the module sources directory. */ - fun createFile(fileName: String, version: UInt) + fun createPredefinedFile(fileName: String, version: String) fun compile( forceOutput: LogLevel? = null, diff --git a/compiler/build-tools/kotlin-build-tools-api-tests/src/main/kotlin/compilation/scenario/scenarioDsl.kt b/compiler/build-tools/kotlin-build-tools-api-tests/src/main/kotlin/compilation/scenario/scenarioDsl.kt index 9504765e67b..1ee2b5ceb89 100644 --- a/compiler/build-tools/kotlin-build-tools-api-tests/src/main/kotlin/compilation/scenario/scenarioDsl.kt +++ b/compiler/build-tools/kotlin-build-tools-api-tests/src/main/kotlin/compilation/scenario/scenarioDsl.kt @@ -32,7 +32,7 @@ internal class ScenarioModuleImpl( writeFile(fileName, transform(file.readText())) } - override fun changeFile(fileName: String, version: UInt) { + override fun replaceFileWithVersion(fileName: String, version: String) { val file = module.sourcesDirectory.resolve(fileName) val chosenRevision = module.sourcesDirectory.resolve("$fileName.$version") Files.delete(file) @@ -50,7 +50,7 @@ internal class ScenarioModuleImpl( writeFile(fileName, content) } - override fun createFile(fileName: String, version: UInt) { + override fun createPredefinedFile(fileName: String, version: String) { val file = module.sourcesDirectory.resolve(fileName) val chosenRevision = module.sourcesDirectory.resolve("$fileName.$version") Files.copy(chosenRevision, file) diff --git a/compiler/build-tools/kotlin-build-tools-api-tests/src/main/resources/modules/jvm-module-1/bar.kt.1 b/compiler/build-tools/kotlin-build-tools-api-tests/src/main/resources/modules/jvm-module-1/bar.kt.add-default-argument similarity index 100% rename from compiler/build-tools/kotlin-build-tools-api-tests/src/main/resources/modules/jvm-module-1/bar.kt.1 rename to compiler/build-tools/kotlin-build-tools-api-tests/src/main/resources/modules/jvm-module-1/bar.kt.add-default-argument diff --git a/compiler/build-tools/kotlin-build-tools-api-tests/src/main/resources/modules/jvm-module-1/secret.kt.1 b/compiler/build-tools/kotlin-build-tools-api-tests/src/main/resources/modules/jvm-module-1/secret.kt.new-file similarity index 100% rename from compiler/build-tools/kotlin-build-tools-api-tests/src/main/resources/modules/jvm-module-1/secret.kt.1 rename to compiler/build-tools/kotlin-build-tools-api-tests/src/main/resources/modules/jvm-module-1/secret.kt.new-file diff --git a/compiler/build-tools/kotlin-build-tools-api-tests/src/testExample/kotlin/ExampleIncrementalScenarioTest.kt b/compiler/build-tools/kotlin-build-tools-api-tests/src/testExample/kotlin/ExampleIncrementalScenarioTest.kt index aa4ddbb3080..ef598b71767 100644 --- a/compiler/build-tools/kotlin-build-tools-api-tests/src/testExample/kotlin/ExampleIncrementalScenarioTest.kt +++ b/compiler/build-tools/kotlin-build-tools-api-tests/src/testExample/kotlin/ExampleIncrementalScenarioTest.kt @@ -129,7 +129,7 @@ class ExampleIncrementalScenarioTest : BaseCompilationTest() { val module1 = module("jvm-module-1") // replaces bar.kt with bar.kt.1 - module1.changeFile("bar.kt", 1U) + module1.replaceFileWithVersion("bar.kt", "add-default-argument") module1.compile { assertCompiledSources("bar.kt") @@ -146,7 +146,7 @@ class ExampleIncrementalScenarioTest : BaseCompilationTest() { val module1 = module("jvm-module-1") // creates secret.kt from secret.kt.1 - module1.createFile("secret.kt", 1U) + module1.createPredefinedFile("secret.kt", "new-file") module1.compile { assertCompiledSources("secret.kt")