[kotlin] move devkit kt part to fir test module

KTIJ-36178

GitOrigin-RevId: bd79b99c516106b65749df254539c4058b3f3055
This commit is contained in:
Anna Kozlova
2025-12-09 21:53:04 +00:00
committed by intellij-monorepo-bot
parent 2cc5c87fd9
commit dfff1747ee
15 changed files with 15 additions and 8 deletions
@@ -1,5 +1,11 @@
### auto-generated section `build intellij.devkit.kotlin.fir.tests` start
load("@rules_jvm//:jvm.bzl", "jvm_library")
load("@rules_jvm//:jvm.bzl", "jvm_library", "resourcegroup")
resourcegroup(
name = "kotlin-fir-tests_test_resources",
srcs = glob(["testData/**/*"]),
strip_prefix = "testData"
)
jvm_library(
name = "kotlin-fir-tests",
@@ -12,6 +18,7 @@ jvm_library(
module_name = "intellij.devkit.kotlin.fir.tests",
visibility = ["//visibility:public"],
srcs = glob(["testSrc/**/*.kt", "testSrc/**/*.java", "testSrc/**/*.form"], allow_empty = True),
resources = [":kotlin-fir-tests_test_resources"],
deps = [
"@lib//:kotlin-stdlib",
"//platform/analysis-api:analysis",
@@ -3,6 +3,7 @@
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/testData" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
@@ -1,7 +1,7 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.devkit.kotlin.threadingModelHelper
package org.jetbrains.idea.devkit.k2.threadingModelHelper
import com.intellij.psi.PsiMethod
import com.intellij.openapi.application.PluginPathManager
import com.intellij.psi.JavaPsiFacade
import com.intellij.psi.SmartPointerManager
import com.intellij.psi.search.GlobalSearchScope
@@ -15,7 +15,6 @@ import org.jetbrains.idea.devkit.threadingModelHelper.ConstraintType
import org.jetbrains.idea.devkit.threadingModelHelper.LockReqAnalyzerParallelBFS
import java.util.EnumSet
@TestDataPath($$"$CONTENT_ROOT/testData/threadingModelHelper/")
class KtLockReqUnitTest : BasePlatformTestCase() {
@@ -61,7 +60,7 @@ class KtLockReqUnitTest : BasePlatformTestCase() {
""".trimIndent())
}
override fun getBasePath() = DevkitKtTestsUtil.TESTDATA_PATH + "threadingModelHelper/"
override fun getBasePath() = PluginPathManager.getPluginHomePathRelative("devkit") + "/devkit-kotlin-fir-tests/testData/threadingModelHelper/"
private fun formatResult(result: AnalysisResult): List<String> {
val actualPaths = result.paths.map { path ->
@@ -77,9 +76,9 @@ class KtLockReqUnitTest : BasePlatformTestCase() {
val className = relativeFileName.removeSuffix(".kt")
val psiClass = JavaPsiFacade.getInstance(project).findClass(className, GlobalSearchScope.projectScope(project))
val method = SmartPointerManager.createPointer(psiClass?.methods?.firstOrNull { m -> m.name == TEST_METHOD_NAME }!!)
val config = AnalysisConfig.forProject(project, EnumSet.allOf(ConstraintType::class.java))
val config = AnalysisConfig.Companion.forProject(project, EnumSet.allOf(ConstraintType::class.java))
return runBlocking {
analyzerBFS.analyzeMethod(method, config)
analyzerBFS.analyzeMethod(method, config)
}
}
@@ -184,4 +183,4 @@ class KtLockReqUnitTest : BasePlatformTestCase() {
companion object {
private const val TEST_METHOD_NAME = "testMethod"
}
}
}