Fix main Gradle plugins variants were published unshadowed

The problem comes from "com.gradle.plugin-publish" plugin. It asks to
run 'jar' task even if this tasks outputs are removed from artifacts.
As 'jar' and shadow 'embeddedJar' tasks outputs has the same name and
'jar' task runs after shadow one - this leads to jar file overwrite.
And eventually publishing unshadowed artifact.
This commit is contained in:
Yahor Berdnikau
2022-05-24 14:32:23 +02:00
parent 93cb4d71d8
commit 8b17a42866
@@ -46,6 +46,14 @@ tasks {
val commonSourceSet = createGradleCommonSourceSet()
reconfigureMainSourcesSetForGradlePlugin(commonSourceSet)
publishShadowedJar(sourceSets[SourceSet.MAIN_SOURCE_SET_NAME], commonSourceSet)
// Disabling this task, so "com.gradle.plugin-publish" will not publish unshadowed jar into Gradle Plugin Portal
// Without it 'jar' task is asked to run by "com.gradle.plugin-publish" even if artifacts are removed. The problem
// is that 'jar' task runs after shadow task plus their outputs has the same name leading to '.jar' file overwrite.
tasks.named("jar") {
enabled = false
}
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
// Used for Gradle 7.0+ versions
val gradle70SourceSet = createGradlePluginVariant(