From d348efa4c1149bd39c18b0cc4769eab3c11bb36f Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Thu, 21 Oct 2021 15:58:16 +0300 Subject: [PATCH] Do not pack proguard and stripped jars for kotlin-reflect into compiler zip kotlin-reflect-proguard.jar has different timestamps and shows difference on each build for the same sources. The problem was introduced after migrating to Gradle 7.1 where `libsDir` parameter was removed (https://docs.gradle.org/current/userguide/upgrading_version_6.html#removal_of_basepluginconvention_libsdir_and_basepluginconvention_distsdir). After that the same variable started to be resolved to `dist` directory. So this commit reverts the old behaviour. ^KTI-672 Fixed --- build.gradle.kts | 1 - libraries/reflect/build.gradle.kts | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 13ee2dfc55b..3f1d7bd6280 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -96,7 +96,6 @@ extra["ktorExcludesForDaemon"] = listOf( // TODO: use "by extra()" syntax where possible extra["distLibDir"] = project.file(distLibDir) -extra["libsDir"] = project.file(distLibDir) extra["commonLocalDataDir"] = project.file(commonLocalDataDir) extra["ideaSandboxDir"] = project.file(ideaSandboxDir) extra["ideaPluginDir"] = project.file(ideaPluginDir) diff --git a/libraries/reflect/build.gradle.kts b/libraries/reflect/build.gradle.kts index b884c5ce090..74461f29ae7 100644 --- a/libraries/reflect/build.gradle.kts +++ b/libraries/reflect/build.gradle.kts @@ -20,13 +20,14 @@ plugins { `java-library` } +val jarBaseName = property("archivesBaseName") as String + configureJavaOnlyToolchain(JdkMajorVersion.JDK_1_6) publish() val core = "$rootDir/core" val relocatedCoreSrc = "$buildDir/core-relocated" -val libsDir = property("libsDir") val proguardDeps by configurations.creating val proguardAdditionalInJars by configurations.creating @@ -120,7 +121,7 @@ val reflectShadowJar by task { val stripMetadata by tasks.registering { dependsOn(reflectShadowJar) val inputJar = provider { reflectShadowJar.get().outputs.files.singleFile } - val outputJar = File("$libsDir/kotlin-reflect-stripped.jar") + val outputJar = fileFrom(base.libsDirectory.asFile.get(), "kotlin-reflect-stripped.jar") inputs.file(inputJar).withNormalizer(ClasspathNormalizer::class.java) @@ -138,14 +139,12 @@ val stripMetadata by tasks.registering { } } -val proguardOutput = "$libsDir/${property("archivesBaseName")}-proguard.jar" - val proguard by task { dependsOn(stripMetadata) injars(mapOf("filter" to "!META-INF/versions/**"), stripMetadata.get().outputs.files) injars(mapOf("filter" to "!META-INF/**,!**/*.kotlin_builtins"), proguardAdditionalInJars) - outjars(proguardOutput) + outjars(fileFrom(base.libsDirectory.asFile.get(), "$jarBaseName-$version-proguard.jar")) javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_6)) libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardDeps)