From e42e2b28db0833a2a99c38980d7ebecd1b374f6e Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Mon, 6 Mar 2023 13:37:21 +0100 Subject: [PATCH] Remove bunch tool chunks --- .bunch | 1 - .space/CODEOWNERS | 1 - .../kotlin/test/mutes/MutedTestsSync.kt | 35 --------------- .../kotlin/code/CodeConformanceTest.kt | 43 ------------------- 4 files changed, 80 deletions(-) delete mode 100644 .bunch diff --git a/.bunch b/.bunch deleted file mode 100644 index bb2ee191e85..00000000000 --- a/.bunch +++ /dev/null @@ -1 +0,0 @@ -203 diff --git a/.space/CODEOWNERS b/.space/CODEOWNERS index d614a7dd810..7143e003128 100644 --- a/.space/CODEOWNERS +++ b/.space/CODEOWNERS @@ -379,7 +379,6 @@ *Generated.java "Kotlin" "Kotlin IDE" # Singular files -/.bunch "Kotlin Build Infrastructure" /.gitattributes "Kotlin Build Infrastructure" /.space.kts "Kotlin Build Infrastructure" /ChangeLog.md "Kotlin Release" diff --git a/compiler/tests-mutes/tc-integration/src/org/jetbrains/kotlin/test/mutes/MutedTestsSync.kt b/compiler/tests-mutes/tc-integration/src/org/jetbrains/kotlin/test/mutes/MutedTestsSync.kt index 252f655c5fb..9084581adf4 100644 --- a/compiler/tests-mutes/tc-integration/src/org/jetbrains/kotlin/test/mutes/MutedTestsSync.kt +++ b/compiler/tests-mutes/tc-integration/src/org/jetbrains/kotlin/test/mutes/MutedTestsSync.kt @@ -19,17 +19,8 @@ fun main() { fun syncMutedTestsOnTeamCityWithDatabase() { val remotelyMutedTests = RemotelyMutedTests() val locallyMutedTests = LocallyMutedTests() - val bunches = Bunches.parseRulesToBunches(locallyMutedTests.tests.keys) syncMutedTests(remotelyMutedTests.projectTests, locallyMutedTests.projectTests) - - for ((originalBunchId, foundBunchId) in bunches) { - getBuildTypeIds(originalBunchId)?.let { buildTypeIds -> - for (buildTypeId in buildTypeIds.split(",")) { - syncMutedTests(remotelyMutedTests.getTestsJson(buildTypeId), locallyMutedTests.getTestsJson(foundBunchId, buildTypeId)) - } - } - } } private fun syncMutedTests( @@ -45,34 +36,8 @@ private fun syncMutedTests( internal fun getMandatoryProperty(propertyName: String) = (System.getProperty(propertyName) ?: throw Exception("Property $propertyName must be set")) -object Bunches { - private val bunchRules: List = readAllRulesFromFile() - internal val baseBunchId = bunchRules.first() - - internal fun parseRulesToBunches(platforms: Set): Map { - return bunchRules - .map { it.split('_') } - .map { rule -> - rule.first() to (rule.find { platforms.contains(it) } ?: baseBunchId) - }.toMap() - } - - private fun readAllRulesFromFile(): List { - val file = File("../../..", ".bunch") - if (!file.exists()) { - throw BunchException("Can't build list of rules. File '${file.canonicalPath}' doesn't exist") - } - return file.readLines() - .map { it.trim() } - .filter { it.isNotEmpty() } - } - - private class BunchException(msg: String? = null) : Exception(msg) -} - private const val mutesPackageName = "org.jetbrains.kotlin.test.mutes" internal val projectId = getMandatoryProperty("$mutesPackageName.tests.project.id") -internal fun getBuildTypeIds(bunchId: String) = System.getProperty("$mutesPackageName.$bunchId") class RemotelyMutedTests { val tests = getMutedTestsOnTeamcityForRootProject(projectId) diff --git a/repo/codebase-tests/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt b/repo/codebase-tests/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt index 75fcd5dec94..1625f5b2b7d 100644 --- a/repo/codebase-tests/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt +++ b/repo/codebase-tests/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt @@ -154,49 +154,6 @@ class CodeConformanceTest : TestCase() { } } - private fun isCorrectExtension(filename: String, extensions: Set): Boolean { - val additionalExtensions = listOf( - "after", "new", "before", "expected", - "todo", "delete", "touch", "prefix", "postfix", "map", - "fragment", "after2", "result", "log", "messages", "conflicts", "match", "imports", "txt", "xml" - ) - val possibleAdditionalExtensions = extensions.plus(additionalExtensions) - val fileExtensions = filename.split("\\.").drop(1) - if (fileExtensions.size < 2) { - return true - } - val extension = fileExtensions.last() - - return !((extension !in possibleAdditionalExtensions && (extension.toIntOrNull() ?: MAX_STEPS_COUNT) >= MAX_STEPS_COUNT)) - } - - fun testForgottenBunchDirectivesAndFiles() { - val sourceBunchFilePattern = Pattern.compile("(.+\\.java|.+\\.kt|.+\\.js)(\\.\\w+)?") - val root = nonSourcesMatcher.root - val extensions = File(root, ".bunch").readLines().map { it.split("_") }.flatten().toSet() - val failBuilder = mutableListOf() - nonSourcesMatcher.excludeWalkTopDown(sourceBunchFilePattern).forEach { sourceFile -> - val matches = Regex("BUNCH (\\w+)") - .findAll(sourceFile.readText()) - .map { it.groupValues[1] } - .toSet() - .filterNot { it in extensions } - for (bunch in matches) { - val filename = FileUtil.toSystemIndependentName(sourceFile.toRelativeString(root)) - failBuilder.add("$filename has unregistered $bunch bunch directive") - } - - if (!isCorrectExtension(sourceFile.name, extensions)) { - val filename = FileUtil.toSystemIndependentName(sourceFile.toRelativeString(root)) - failBuilder.add("$filename has unknown bunch extension") - } - } - - if (failBuilder.isNotEmpty()) { - fail("\n" + failBuilder.joinToString("\n")) - } - } - fun testNoBadSubstringsInProjectCode() { class TestData(val message: String, val filter: (File, String) -> Boolean) { val result: MutableList = ArrayList()