Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: Remove pom generation for plugin zip files #32180

Merged
merged 1 commit into from
Jul 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public class PluginBuildPlugin extends BuildPlugin {
// and generate a different pom for the zip
addClientJarPomGeneration(project)
addClientJarTask(project)
} else {
// no client plugin, so use the pom file from nebula, without jar, for the zip
project.ext.set("nebulaPublish.maven.jar", false)
}
// while the jar isn't normally published, we still at least build a pom of deps
// in case it is published, for instance when other plugins extend this plugin
configureJarPom(project)

project.integTestCluster.dependsOn(project.bundlePlugin)
project.tasks.run.dependsOn(project.bundlePlugin)
Expand All @@ -94,7 +94,6 @@ public class PluginBuildPlugin extends BuildPlugin {
}

if (isModule == false || isXPackModule) {
addZipPomGeneration(project)
addNoticeGeneration(project)
}

Expand Down Expand Up @@ -239,36 +238,15 @@ public class PluginBuildPlugin extends BuildPlugin {
}
}

/** Adds a task to generate a pom file for the zip distribution. */
public static void addZipPomGeneration(Project project) {
/** Configure the pom for the main jar of this plugin */
protected static void configureJarPom(Project project) {
project.plugins.apply(ScmInfoPlugin.class)
project.plugins.apply(MavenPublishPlugin.class)

project.publishing {
publications {
zip(MavenPublication) {
artifact project.bundlePlugin
}
/* HUGE HACK: the underlying maven publication library refuses to deploy any attached artifacts
* when the packaging type is set to 'pom'. But Sonatype's OSS repositories require source files
* for artifacts that are of type 'zip'. We already publish the source and javadoc for Elasticsearch
* under the various other subprojects. So here we create another publication using the same
* name that has the "real" pom, and rely on the fact that gradle will execute the publish tasks
* in alphabetical order. This lets us publish the zip file and even though the pom says the
* type is 'pom' instead of 'zip'. We cannot setup a dependency between the tasks because the
* publishing tasks are created *extremely* late in the configuration phase, so that we cannot get
* ahold of the actual task. Furthermore, this entire hack only exists so we can make publishing to
* maven local work, since we publish to maven central externally. */
zipReal(MavenPublication) {
artifactId = project.pluginProperties.extension.name
pom.withXml { XmlProvider xml ->
Node root = xml.asNode()
root.appendNode('name', project.pluginProperties.extension.name)
root.appendNode('description', project.pluginProperties.extension.description)
root.appendNode('url', urlFromOrigin(project.scminfo.origin))
Node scmNode = root.appendNode('scm')
scmNode.appendNode('url', project.scminfo.origin)
}
nebula(MavenPublication) {
artifactId project.pluginProperties.extension.name
}
}
}
Expand Down