Skip to content

Commit bbd6c5c

Browse files
CristianGMSpace Team
authored andcommitted
Make :kotlin-dataframe-compiler-plugin:test cacheable
^KTI-2586
1 parent d6e10d6 commit bbd6c5c

File tree

8 files changed

+16
-13
lines changed

8 files changed

+16
-13
lines changed

analysis/analysis-test-framework/testFixtures/org/jetbrains/kotlin/analysis/test/framework/base/AbstractAnalysisApiBasedTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendK
3030
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.registerAllServices
3131
import org.jetbrains.kotlin.analysis.test.framework.utils.SkipTestException
3232
import org.jetbrains.kotlin.analysis.test.framework.utils.singleOrZeroValue
33+
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
3334
import org.jetbrains.kotlin.psi.KtElement
3435
import org.jetbrains.kotlin.psi.KtFile
3536
import org.jetbrains.kotlin.test.TestConfiguration
@@ -55,7 +56,6 @@ import org.junit.jupiter.api.TestInfo
5556
import org.junit.jupiter.api.extension.ExtendWith
5657
import java.io.IOException
5758
import java.nio.file.Path
58-
import java.nio.file.Paths
5959
import kotlin.io.path.exists
6060
import kotlin.io.path.nameWithoutExtension
6161

@@ -404,7 +404,7 @@ abstract class AbstractAnalysisApiBasedTest : TestWithDisposable() {
404404
}
405405

406406
protected fun runTest(@TestDataFile path: String, block: (TestServices) -> Unit) {
407-
testDataPath = configurator.computeTestDataPath(Paths.get(path))
407+
testDataPath = configurator.computeTestDataPath(ForTestCompileRuntime.transformTestDataPath(path).toPath())
408408
val testConfiguration = createTestConfiguration()
409409
testServices = testConfiguration.testServices
410410
createAndRegisterTestModuleStructure(testConfiguration)

plugins/kotlin-dataframe/build.gradle.kts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,19 @@ sourceSets {
3838
}
3939

4040
projectTests {
41+
testData(isolated, "testData")
42+
withJvmStdlibAndReflect()
43+
withScriptRuntime()
44+
withTestJar()
45+
withMockJdkAnnotationsJar()
46+
4147
testTask(jUnitMode = JUnitMode.JUnit5) {
42-
dependsOn(":dist")
43-
workingDir = rootDir
4448
val classpathProvider = objects.newInstance<DataFramePluginClasspathProvider>()
4549
classpathProvider.classpath.from(dataframeRuntimeClasspath)
4650
jvmArgumentProviders.add(classpathProvider)
4751
}
4852

4953
testGenerator("org.jetbrains.kotlin.fir.dataframe.TestGeneratorKt")
50-
51-
withJvmStdlibAndReflect()
5254
}
5355

5456
abstract class DataFramePluginClasspathProvider : CommandLineArgumentProvider {

plugins/kotlin-dataframe/testFixtures/org/jetbrains/kotlin/fir/dataframe/AbstractDataFrameBlackBoxCodegenTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ open class AbstractDataFrameBlackBoxCodegenTest : AbstractFirLightTreeBlackBoxCo
4343

4444
class SelectionDslUtilsSourceProvider(testServices: TestServices) : AdditionalSourceProvider(testServices) {
4545
companion object {
46-
const val SELECTION_DSL_UTILS = "plugins/kotlin-dataframe/testData/selectionDslTestUtils.kt"
46+
const val SELECTION_DSL_UTILS = "selectionDslTestUtils.kt"
4747
}
4848

4949
override fun produceAdditionalFiles(
5050
globalDirectives: RegisteredDirectives,
5151
module: TestModule,
5252
testModuleStructure: TestModuleStructure,
5353
): List<TestFile> {
54-
return listOf(File(SELECTION_DSL_UTILS).toTestFile())
54+
val classLoader = this::class.java.classLoader
55+
return listOf(classLoader.getResource(SELECTION_DSL_UTILS)!!.toTestFile())
5556
}
5657
}
5758
}

plugins/kotlin-dataframe/testFixtures/org/jetbrains/kotlin/fir/dataframe/services/TestUtilsSourceProvider.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ import org.jetbrains.kotlin.test.model.TestModule
1111
import org.jetbrains.kotlin.test.services.AdditionalSourceProvider
1212
import org.jetbrains.kotlin.test.services.TestModuleStructure
1313
import org.jetbrains.kotlin.test.services.TestServices
14-
import java.io.File
1514

1615
class TestUtilsSourceProvider(testServices: TestServices) : AdditionalSourceProvider(testServices) {
1716
companion object {
18-
const val COMMON_SOURCE_PATH = "plugins/kotlin-dataframe/testData/testUtils.kt"
17+
const val COMMON_SOURCE_PATH = "testUtils.kt"
1918
}
2019

2120
override fun produceAdditionalFiles(
@@ -24,10 +23,11 @@ class TestUtilsSourceProvider(testServices: TestServices) : AdditionalSourceProv
2423
testModuleStructure: TestModuleStructure,
2524
): List<TestFile> {
2625
return buildList {
27-
add(File(COMMON_SOURCE_PATH).toTestFile())
26+
add(this::class.java.classLoader.getResource(COMMON_SOURCE_PATH)!!.toTestFile())
27+
2828
if (DataFrameDirectives.WITH_SCHEMA_READER in module.directives) {
29-
add(File("plugins/kotlin-dataframe/testData/schemaReaderDeclaration.kt").toTestFile())
30-
add(File("plugins/kotlin-dataframe/testData/dataSchemaSourceDeclaration.kt").toTestFile())
29+
add(this::class.java.classLoader.getResource("schemaReaderDeclaration.kt")!!.toTestFile())
30+
add(this::class.java.classLoader.getResource("dataSchemaSourceDeclaration.kt")!!.toTestFile())
3131
}
3232
}
3333
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)