Skip to content

Commit 33347f5

Browse files
committed
Simplify the generateTestsCommandLine utility
1 parent 558f990 commit 33347f5

File tree

3 files changed

+5
-23
lines changed

3 files changed

+5
-23
lines changed

src/org/jetbrains/kotlin/test/helper/actions/GeneratedTestComboBoxAction.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class GeneratedTestComboBoxAction(val baseEditor: TextEditor) : AbstractComboBox
250250
object : AnAction("Generate Tests"), DumbAware {
251251
override fun actionPerformed(e: AnActionEvent) {
252252
val project = e.project ?: return
253-
val (commandLine, title) = generateTestsCommandLine(project, listOf(baseEditor.file))
253+
val (commandLine, title) = generateTestsCommandLine()
254254
val config =
255255
GradleRunConfig(commandLine, title, useProjectBasePath = true, runAsTest = false, debug = false)
256256
runGradleCommandLine(e, config)
Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
11
package org.jetbrains.kotlin.test.helper.gradle
22

3-
import com.intellij.openapi.project.Project
4-
import com.intellij.openapi.vfs.VfsUtil
5-
import com.intellij.openapi.vfs.VirtualFile
6-
import java.nio.file.Paths
7-
8-
fun generateTestsCommandLine(project: Project, files: List<VirtualFile>): Pair<String, String> {
9-
fun isAncestor(basePath: String, vararg strings: String): Boolean {
10-
val file = VfsUtil.findFile(Paths.get(basePath, *strings), false) ?: return false
11-
return files.all{ VfsUtil.isAncestor(file, it, false) }
12-
}
13-
14-
val basePath = project.basePath
15-
return if (basePath != null &&
16-
(isAncestor(basePath, "compiler", "testData", "diagnostics") ||
17-
isAncestor(basePath, "compiler", "fir", "analysis-tests", "testData"))
18-
) {
19-
"generateFrontendApiTests compiler:tests-for-compiler-generator:generateTests" to "Generate Diagnostic Tests"
20-
} else {
21-
"generateTests" to "Generate Tests"
22-
}
23-
}
3+
fun generateTestsCommandLine(): Pair<String, String> {
4+
return "generateTests" to "Generate Tests"
5+
}

src/org/jetbrains/kotlin/test/helper/gradle/gradleUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fun Project.hasGradleTestRunner(file: VirtualFile): Boolean {
4040
}
4141

4242
suspend fun generateTestsAndWait(project: Project, files: List<VirtualFile>) {
43-
val (commandLine, _) = generateTestsCommandLine(project, files)
43+
val (commandLine, _) = generateTestsCommandLine()
4444

4545
suspendCancellableCoroutine {
4646
runTask(

0 commit comments

Comments
 (0)