Add API JAR task to x-pack-core

This commit adds back the task for assembling the API JAR from the
x-pack-core JAR.

Original commit: elastic/x-pack-elasticsearch@10385ecf17
This commit is contained in:
Jason Tedor 2018-01-21 10:00:47 -05:00
parent 377bb53cca
commit a582acddf8
1 changed files with 36 additions and 34 deletions

View File

@ -1,5 +1,9 @@
import org.elasticsearch.gradle.MavenFilteringHack import org.elasticsearch.gradle.MavenFilteringHack
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.StandardCopyOption
apply plugin: 'elasticsearch.esplugin' apply plugin: 'elasticsearch.esplugin'
esplugin { esplugin {
name 'x-pack-core' name 'x-pack-core'
@ -96,40 +100,38 @@ sourceSets.test.java {
srcDir '../../license-tools/src/main/java' srcDir '../../license-tools/src/main/java'
} }
//// add api jar for extension authors to compile against // assemble the API JAR for the transport-client and extension authors; this JAR is the core JAR by another name
//// note this is just the normal x-pack jar for now, with a different name project.afterEvaluate {
//project.afterEvaluate { task apiJar {
// task apiJar { dependsOn('generatePomFileForApijarPublication', project.jar)
// dependsOn('generatePomFileForApijarPublication', project.jar) doFirst {
// doFirst { Path jarFile = project.jar.outputs.files.singleFile.toPath()
// Path jarFile = project.jar.outputs.files.singleFile.toPath() String apiFileName = jarFile.fileName.toString().replace("core-${project.version}", "api-${project.version}")
// String apiFileName = jarFile.fileName.toString().replace(project.version, "api-${project.version}") println apiFileName
// Files.copy(jarFile, jarFile.resolveSibling(apiFileName), StandardCopyOption.REPLACE_EXISTING) Files.copy(jarFile, jarFile.resolveSibling(apiFileName), StandardCopyOption.REPLACE_EXISTING)
//
// String pomFileName = jarFile.fileName.toString().replace('.jar', '.pom') String pomFileName = jarFile.fileName.toString().replace('.jar', '.pom')
// String apiPomFileName = apiFileName.replace('.jar', '.pom') String apiPomFileName = apiFileName.replace('.jar', '.pom')
// Files.copy(jarFile.resolveSibling(pomFileName), jarFile.resolveSibling(apiPomFileName), Files.copy(jarFile.resolveSibling(pomFileName), jarFile.resolveSibling(apiPomFileName),
// StandardCopyOption.REPLACE_EXISTING) StandardCopyOption.REPLACE_EXISTING)
// } }
// } }
// assemble.dependsOn(apiJar) assemble.dependsOn(apiJar)
// project.publishing { project.publishing {
// publications { publications {
// apijar(MavenPublication) { apijar(MavenPublication) {
// from project.components.java from project.components.java
// artifactId = 'x-pack-api' artifactId = 'x-pack-api'
// pom.withXml { XmlProvider xml -> pom.withXml { XmlProvider xml ->
// Node root = xml.asNode() Node root = xml.asNode()
// root.appendNode('name', project.pluginProperties.extension.name) root.appendNode('name', project.pluginProperties.extension.name)
// root.appendNode('description', project.pluginProperties.extension.description) root.appendNode('description', project.pluginProperties.extension.description)
// } }
// } }
// } }
// } }
// // Add an extra licenses directory to the combined notices }
// project.tasks.findByName('generateNotice').dependsOn extractNativeLicenses
// project.tasks.findByName('generateNotice').licensesDir new File("${project.buildDir}/platform/licenses")
//}
// //
// integTestRunner { // integTestRunner {
// // TODO: fix this rest test to not depend on a hardcoded port! // // TODO: fix this rest test to not depend on a hardcoded port!