From f28f77f73ce02e28924a8b23be045a79115a909f Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Mon, 22 Aug 2016 15:40:46 -0700 Subject: [PATCH] Build: Add api jar and client jar for xpack This adds back (again) building a transport client plugin jar for x-pack, and also adds producing an "api" jar which extension authors can build against. For now, both these jars are exactly the same, but eventually they could differ, and be reduced to less than the real x-pack jar. see elastic/stackelastic/elasticsearch#7 Original commit: elastic/x-pack-elasticsearch@0a989de18bf65a98e78a49a2381ff082f9eb147b --- elasticsearch/x-pack/build.gradle | 37 ++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/elasticsearch/x-pack/build.gradle b/elasticsearch/x-pack/build.gradle index af87c22bbfc..aa766757784 100644 --- a/elasticsearch/x-pack/build.gradle +++ b/elasticsearch/x-pack/build.gradle @@ -1,6 +1,9 @@ +import java.nio.charset.StandardCharsets +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.StandardCopyOption import org.elasticsearch.gradle.MavenFilteringHack import org.elasticsearch.gradle.test.NodeInfo -import java.nio.charset.StandardCharsets group 'org.elasticsearch.plugin' @@ -9,6 +12,7 @@ esplugin { name 'x-pack' description 'Elasticsearch Expanded Pack Plugin' classname 'org.elasticsearch.xpack.XPackPlugin' + hasClientJar = true } ext.versions = [ @@ -128,6 +132,37 @@ bundlePlugin { } } +// add api jar for extension authors to compile against +// note this is just the normal x-pack jar for now, with a different name +project.afterEvaluate { + task apiJar { + dependsOn('generatePomFileForApijarPublication', project.jar) + doFirst { + Path jarFile = project.jar.outputs.files.singleFile.toPath() + String apiFileName = jarFile.fileName.toString().replace(project.version, "api-${project.version}") + Files.copy(jarFile, jarFile.resolveSibling(apiFileName), StandardCopyOption.REPLACE_EXISTING) + + String pomFileName = jarFile.fileName.toString().replace('.jar', '.pom') + String apiPomFileName = apiFileName.replace('.jar', '.pom') + Files.copy(jarFile.resolveSibling(pomFileName), jarFile.resolveSibling(apiPomFileName), + StandardCopyOption.REPLACE_EXISTING) + } + } + project.publishing { + publications { + apijar(MavenPublication) { + from project.components.java + artifactId = artifactId + '-api' + pom.withXml { XmlProvider xml -> + Node root = xml.asNode() + root.appendNode('name', project.pluginProperties.extension.name) + root.appendNode('description', project.pluginProperties.extension.description) + } + } + } + } +} + integTest { // TODO: fix this rest test to not depend on a hardcoded port! systemProperty 'tests.rest.blacklist', 'getting_started/10_monitor_cluster_health/*,bulk/10_basic/*'