From 8547cb0afde5e61e874730a757df14e57fb458f7 Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Wed, 27 Jul 2022 13:13:45 +0200 Subject: [PATCH] 5/5 Replace source dependency on kotlin-reflect with binary dependency Review: https://jetbrains.team/p/kt/reviews/6753 Meaningful semantic change was splitted into 5 commits to simplify the change review. Sinle commit would be too big. Why replace source to binary: to get rid of kotlin-reflect in Kotlin plugin artifact KTIJ-22276 Tests that would break if we put reflect from the minimum supported IDEA into dist: * Java11ModulesIntegrationTest * Java17ModulesIntegrationTest ^ Actually, a lot of tests would fail, but I specifically highlight those two because the "a lot of tests" can be easily fixed by changing `ForTestCompileRuntime.reflectJarForTests` to: ``` @NotNull public static File reflectJarForTests() { return assertExists(new File("libraries/reflect/build/libs/kotlin-reflect-1.7.255-SNAPSHOT.jar")); } ``` `Java11ModulesIntegrationTest` & `Java11ModulesIntegrationTest` cannot be fixed in principle because those tests use reflect from dist with help of `JvmArgumentsKt.configureStandardLibs` (not with help of `ForTestCompileRuntime`). `JvmArgumentsKt.configureStandardLibs` is about `-no-stdlib` & `-no-reflect` compiler flags. That's why we have to pack SNAPSHOT reflect into dist. --- prepare/compiler/build.gradle.kts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prepare/compiler/build.gradle.kts b/prepare/compiler/build.gradle.kts index d258a14e4f7..21b4396202b 100644 --- a/prepare/compiler/build.gradle.kts +++ b/prepare/compiler/build.gradle.kts @@ -89,6 +89,9 @@ val distLibraryProjects = listOfNotNull( ":kotlin-imports-dumper-compiler-plugin", ":kotlin-main-kts", ":kotlin-preloader", + // Although, Kotlin compiler is compiled against reflect of an older version (which is bundled into minimal supported IDEA). We put + // SNAPSHOT reflect into the dist because we use reflect dist in user code compile classpath (see JvmArgumentsKt.configureStandardLibs). + // We can use reflect of a bigger version in Kotlin compiler runtime, because kotlin-reflect follows backwards binary compatibility ":kotlin-reflect", ":kotlin-runner", ":kotlin-script-runtime",