~~~~ store some ideas
diff --git a/compiler/fir/analysis-tests/legacy-fir-tests/build.gradle.kts b/compiler/fir/analysis-tests/legacy-fir-tests/build.gradle.kts index 24b7c1f..964e32c 100644 --- a/compiler/fir/analysis-tests/legacy-fir-tests/build.gradle.kts +++ b/compiler/fir/analysis-tests/legacy-fir-tests/build.gradle.kts
@@ -1,3 +1,5 @@ +import TestCompilePaths.KOTLIN_STDLIB_SOURCES_ROOT_PATH + /* * Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. @@ -39,6 +41,7 @@ projectTests { testTask(parallel = true, maxHeapSizeMb = 3072, jUnitMode = JUnitMode.JUnit4) { dependsOn(":dist") + addClasspathProperty(stdlibSourceRootForTests, KOTLIN_STDLIB_SOURCES_ROOT_PATH) inputs.files(rootDir.resolve("libraries/stdlib/src"), rootDir.resolve("libraries/stdlib/jvm")) .withPathSensitivity(PathSensitivity.RELATIVE) }
diff --git a/compiler/test-infrastructure-utils/testFixtures/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java b/compiler/test-infrastructure-utils/testFixtures/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java index 3ce16ae..465cbdd 100644 --- a/compiler/test-infrastructure-utils/testFixtures/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java +++ b/compiler/test-infrastructure-utils/testFixtures/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java
@@ -135,6 +135,16 @@ } @NotNull + public static File stdlibSourceRootForTests() { + String path = getProperty(KOTLIN_STDLIB_SOURCES_ROOT_PATH, "libraries/stdlib"); + File file = new File(path); + assert (file.exists()) : path + " doesn't exist; property: " + + KOTLIN_STDLIB_SOURCES_ROOT_PATH + "; distPath: " + + "libraries/stdlib"; + return file; + } + + @NotNull public static File stdlibCommonForTests() { return propertyOrDist(KOTLIN_COMMON_STDLIB_PATH, "dist/common/kotlin-stdlib-common.klib"); }
diff --git a/compiler/test-infrastructure-utils/testFixtures/org/jetbrains/kotlin/codegen/forTestCompile/TestCompilePaths.kt b/compiler/test-infrastructure-utils/testFixtures/org/jetbrains/kotlin/codegen/forTestCompile/TestCompilePaths.kt index 8bb57da..9f4da12 100644 --- a/compiler/test-infrastructure-utils/testFixtures/org/jetbrains/kotlin/codegen/forTestCompile/TestCompilePaths.kt +++ b/compiler/test-infrastructure-utils/testFixtures/org/jetbrains/kotlin/codegen/forTestCompile/TestCompilePaths.kt
@@ -9,6 +9,7 @@ object TestCompilePaths { const val KOTLIN_FULL_STDLIB_PATH: String = "kotlin.full.stdlib.path" const val KOTLIN_FULL_STDLIB_SOURCES_PATH: String = "kotlin.full.stdlib.sources.path" + const val KOTLIN_STDLIB_SOURCES_ROOT_PATH: String = "kotlin.stdlib.sources.root.path" const val KOTLIN_MINIMAL_STDLIB_PATH: String = "kotlin.minimal.stdlib.path" const val KOTLIN_TEST_JAR_PATH: String = "kotlin.test.jar.path" const val KOTLIN_REFLECT_JAR_PATH: String = "kotlin.reflect.jar.path"
diff --git a/compiler/tests-common/testFixtures/org/jetbrains/kotlin/serialization/builtins/BuiltinsTestUtils.kt b/compiler/tests-common/testFixtures/org/jetbrains/kotlin/serialization/builtins/BuiltinsTestUtils.kt index 089e5875..4604fcf 100644 --- a/compiler/tests-common/testFixtures/org/jetbrains/kotlin/serialization/builtins/BuiltinsTestUtils.kt +++ b/compiler/tests-common/testFixtures/org/jetbrains/kotlin/serialization/builtins/BuiltinsTestUtils.kt
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.analyzer.TrackableModuleInfo import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment +import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime import org.jetbrains.kotlin.container.get import org.jetbrains.kotlin.context.ProjectContext import org.jetbrains.kotlin.descriptors.ModuleDescriptor @@ -36,10 +37,11 @@ object BuiltinsTestUtils { fun compileBuiltinsModule(environment: KotlinCoreEnvironment, stdlibPath: String): ModuleDescriptor { + val stdlibSourceRoot = ForTestCompileRuntime.stdlibSourceRootForTests() val files = KotlinTestUtils.loadToKtFiles( environment, ContainerUtil.concat<File>( - allFilesUnder("$stdlibPath/jvm/"), - allFilesUnder("$stdlibPath/src/") + allFilesUnder(stdlibSourceRoot.resolve("jvm").path), + allFilesUnder(stdlibSourceRoot.resolve("src").path) ) ).filter { it.annotationEntries.any { annotation ->
diff --git a/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/ProjectTestsExtension.kt b/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/ProjectTestsExtension.kt index fdf83db..a74fbde 100644 --- a/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/ProjectTestsExtension.kt +++ b/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/ProjectTestsExtension.kt
@@ -50,6 +50,9 @@ val stdlibRuntimeSourcesForTests: Configuration = project.configurations.create("stdlibRuntimeSourcesForTests") { isTransitive = false } + val stdlibSourceRootForTests: Configuration = project.configurations.create("stdlibSourceRootForTests") { + isTransitive = false + } val stdlibMinimalRuntimeForTests: Configuration = project.configurations.create("stdlibMinimalRuntimeForTests") { isTransitive = false }
diff --git a/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/TestCompilePaths.kt b/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/TestCompilePaths.kt index 22e7c12..3bda667 100644 --- a/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/TestCompilePaths.kt +++ b/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/TestCompilePaths.kt
@@ -7,6 +7,7 @@ object TestCompilePaths { const val KOTLIN_FULL_STDLIB_PATH: String = "kotlin.full.stdlib.path" const val KOTLIN_FULL_STDLIB_SOURCES_PATH: String = "kotlin.full.stdlib.sources.path" + const val KOTLIN_STDLIB_SOURCES_ROOT_PATH: String = "kotlin.stdlib.sources.root.path" const val KOTLIN_MINIMAL_STDLIB_PATH: String = "kotlin.minimal.stdlib.path" const val KOTLIN_TEST_JAR_PATH: String = "kotlin.test.jar.path" const val KOTLIN_REFLECT_JAR_PATH: String = "kotlin.reflect.jar.path"
diff --git a/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/TestCompilerRuntimeArgumentProvider.kt b/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/TestCompilerRuntimeArgumentProvider.kt index 1065aee..6b26cab 100644 --- a/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/TestCompilerRuntimeArgumentProvider.kt +++ b/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/TestCompilerRuntimeArgumentProvider.kt
@@ -18,6 +18,7 @@ import TestCompilePaths.KOTLIN_REFLECT_JAR_PATH import TestCompilePaths.KOTLIN_SCRIPTING_PLUGIN_CLASSPATH import TestCompilePaths.KOTLIN_SCRIPT_RUNTIME_PATH +import TestCompilePaths.KOTLIN_STDLIB_SOURCES_ROOT_PATH import TestCompilePaths.KOTLIN_TESTDATA_ROOTS import TestCompilePaths.KOTLIN_TEST_JAR_PATH import TestCompilePaths.KOTLIN_TEST_SCRIPT_DEFINITION_CLASSPATH @@ -54,6 +55,10 @@ @get:InputFiles @get:Classpath + abstract val stdlibSourceRootForTests: ConfigurableFileCollection + + @get:InputFiles + @get:Classpath abstract val stdlibMinimalRuntimeForTests: ConfigurableFileCollection @get:InputFiles @@ -194,6 +199,7 @@ // JVM libs argument(KOTLIN_FULL_STDLIB_PATH, stdlibRuntimeForTests), argument(KOTLIN_FULL_STDLIB_SOURCES_PATH, stdlibRuntimeSourcesForTests), + argument(KOTLIN_STDLIB_SOURCES_ROOT_PATH, stdlibSourceRootForTests), argument(KOTLIN_MINIMAL_STDLIB_PATH, stdlibMinimalRuntimeForTests), argument(KOTLIN_REFLECT_JAR_PATH, kotlinReflectJarForTests), ifNotEmpty(KOTLIN_COMMON_STDLIB_PATH, stdlibCommonRuntimeForTests),
diff --git a/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/project-tests-convention.gradle.kts b/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/project-tests-convention.gradle.kts index 10f2d65..35fc18c 100644 --- a/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/project-tests-convention.gradle.kts +++ b/repo/gradle-build-conventions/project-tests-convention/src/main/kotlin/project-tests-convention.gradle.kts
@@ -3,6 +3,7 @@ val provider = objects.newInstance<TestCompilerRuntimeArgumentProvider>().apply { stdlibRuntimeForTests.from(extension.stdlibRuntimeForTests) stdlibRuntimeSourcesForTests.from(extension.stdlibRuntimeSourcesForTests) + stdlibSourceRootForTests.from(extension.stdlibSourceRootForTests) stdlibMinimalRuntimeForTests.from(extension.stdlibMinimalRuntimeForTests) kotlinReflectJarForTests.from(extension.kotlinReflectJarForTests) stdlibCommonRuntimeForTests.from(extension.stdlibCommonRuntimeForTests)