@@ -257,6 +257,44 @@ task buildElasticsearchLocalDistro(dependsOn: unzipDownloadedElasticsearchSource
257257 }
258258}
259259
260+ task buildElasticsearchLogstashBridge (type : Exec ) {
261+ description " builds logstash-bridge lib module"
262+
263+ dependsOn buildElasticsearchLocalDistro
264+
265+ def logFile = project. file(" ${ buildDir} /logstash-bridge-build.log" )
266+ doFirst {
267+ def funneler = new OutputStreamFunneler (new LazyFileOutputStream (logFile))
268+ standardOutput = funneler. funnelInstance
269+ errorOutput = funneler. funnelInstance
270+ }
271+
272+ def esSource = " ${ buildDir} /elasticsearch-source/"
273+ def esBuildDir = " ${ esSource} /build"
274+
275+ inputs. dir esSource
276+ outputs. dir " ${ esBuildDir} /libs/logstash-bridge"
277+
278+ ext. buildRoot = esBuildDir
279+ workingDir esSource
280+ commandLine " ./gradlew" , " :lib:logstash-bridge:build"
281+
282+ ignoreExitValue true // handled in doLast
283+ doLast {
284+ def exitValue = executionResult. get(). exitValue
285+ if (exitValue != 0 ) {
286+ if (logFile. exists()) {
287+ println " \n ===== Elasticsearch logstash-bridge build Log ====="
288+ println logFile. text
289+ println " ===== End of Elasticsearch logstash-bridge build Log =====\n "
290+ } else {
291+ " Elasticsearch logstash-bridge build failed and ${ logFile.path} log does not exist"
292+ }
293+ throw new GradleException (" Elasticsearch logstash-bridge build failed, see the logs for details." )
294+ }
295+ }
296+ }
297+
260298task shadeElasticsearchIngestGeoIpModule (type : com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar ) {
261299 description " Shades embedded dependencies of the Elasticsearch Ingest GeoIP module"
262300
@@ -316,13 +354,30 @@ task shadeElasticsearchRedactPlugin(type: com.github.jengelman.gradle.plugins.sh
316354 exclude ' **/module-info.class'
317355}
318356
357+ task shadeElasticsearchLogstashBridge (type : com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar ) {
358+ description " Shades the Elasticsearch logstash-bridge jar"
359+
360+ dependsOn buildElasticsearchLogstashBridge
361+
362+ from(" ${ buildDir} /elasticsearch-source/libs/logstash-bridge/build/distributions" ) {
363+ include " elasticsearch-logstash-bridge-*.jar"
364+ }
365+
366+ archiveFileName = " elasticsearch-logstash-bridge-shaded.jar"
367+ destinationDirectory = file(" ${ buildDir} /shaded" )
368+
369+ exclude ' **/module-info.class'
370+ }
371+
319372task importMinimalElasticsearch () {
320373 description " Imports minimal portions of Elasticsearch localDistro"
321374
322375 dependsOn buildElasticsearchLocalDistro
376+ dependsOn buildElasticsearchLogstashBridge
323377 dependsOn shadeElasticsearchIngestGeoIpModule
324378 dependsOn shadeElasticsearchGrokImplementation
325379 dependsOn shadeElasticsearchRedactPlugin
380+ dependsOn shadeElasticsearchLogstashBridge
326381
327382 ext. jars = " ${ buildDir} /elasticsearch-minimal-jars"
328383
@@ -341,6 +396,7 @@ task importMinimalElasticsearch() {
341396 include jarPackageNamed(" lucene-core" )
342397 include jarPackageNamed(" lucene-analysis-common" )
343398 }
399+ from(shadeElasticsearchLogstashBridge)
344400 from(shadeElasticsearchGrokImplementation)
345401 from(buildElasticsearchLocalDistro. module(" x-pack-core" ))
346402
0 commit comments