From ac5fbd408023ef78806eb7a524a84a19a5659d24 Mon Sep 17 00:00:00 2001 From: Sergey Rostov Date: Mon, 10 Sep 2018 15:09:24 +0300 Subject: [PATCH] JPS tests: support `_dependencies.txt` and `_steps.txt` for better files sorting Original commit: 313c27859a252d1256a81e07061a91750c10c2a7 --- .../kotlin/jps/build/AbstractIncrementalJpsTest.kt | 13 ++++++++++--- .../build/dependeciestxt/MppJpsIncTestsGenerator.kt | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt index e567706a92a..a2a01d07dae 100644 --- a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt +++ b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt @@ -281,8 +281,15 @@ abstract class AbstractIncrementalJpsTest( get() = File(testDataDir, "dependencies.txt") private fun readModulesTxt(): ModulesTxt? { - if (!modulesTxtFile.exists()) return null - return ModulesTxtBuilder().readFile(modulesTxtFile) + var actualModulesTxtFile = modulesTxtFile + + if (!actualModulesTxtFile.exists()) { + // also try `"_${fileName}.txt"`. Useful for sorting files in IDE. + actualModulesTxtFile = modulesTxtFile.parentFile.resolve("_" + modulesTxtFile.name) + if (!actualModulesTxtFile.exists()) return null + } + + return ModulesTxtBuilder().readFile(actualModulesTxtFile) } protected open fun createBuildLog(incrementalMakeResults: List): String = @@ -416,7 +423,7 @@ abstract class AbstractIncrementalJpsTest( TouchPolicy.TIMESTAMP ) - val stepsTxt = File(testDataSrc, "steps.txt") + val stepsTxt = File(testDataSrc, "_steps.txt") val modificationNames = if (stepsTxt.exists()) stepsTxt.readLines() else null modifications.forEachIndexed { index, step -> diff --git a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/MppJpsIncTestsGenerator.kt b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/MppJpsIncTestsGenerator.kt index f1a3fbbeacc..696d60a5eb9 100644 --- a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/MppJpsIncTestsGenerator.kt +++ b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/MppJpsIncTestsGenerator.kt @@ -273,7 +273,7 @@ class MppJpsIncTestsGenerator(val txt: ModulesTxt, val testCaseDirProvider: (Tes } protected fun generateStepsTxt() { - File(dir, "steps.txt").setFileContent(steps.joinToString("\n")) + File(dir, "_steps.txt").setFileContent(steps.joinToString("\n")) } fun generateBaseContent() {