Build: Fix subdirectories in meta plugins to be copied correctly (#28282)

This commit fixes the copying of files from bundled plugin zips.
Previously all files within each zip would be flattened under the
bundled plugin name, and the original directories would exist at the top
level of the plugin.
This commit is contained in:
Ryan Ernst 2018-01-17 21:27:59 -08:00 committed by GitHub
parent c15ae7eb20
commit ac1c509844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -40,8 +40,7 @@ class MetaPluginBuildPlugin implements Plugin<Project> {
project.integTestCluster { project.integTestCluster {
dependsOn(project.bundlePlugin) dependsOn(project.bundlePlugin)
distribution = 'zip' distribution = 'zip'
setupCommand 'installMetaPlugin', setupCommand('installMetaPlugin', 'bin/elasticsearch-plugin', 'install', 'file:' + project.bundlePlugin.archivePath)
'bin/elasticsearch-plugin', 'install', 'file:' + project.bundlePlugin.archivePath
} }
} }
@ -57,6 +56,9 @@ class MetaPluginBuildPlugin implements Plugin<Project> {
include(buildProperties.descriptorOutput.name) include(buildProperties.descriptorOutput.name)
} }
} }
// due to how the renames work for each bundled plugin, we must exclude empty dirs or every subdir
// within bundled plugin zips will show up at the root as an empty dir
includeEmptyDirs = false
} }
project.assemble.dependsOn(bundle) project.assemble.dependsOn(bundle)
@ -71,7 +73,10 @@ class MetaPluginBuildPlugin implements Plugin<Project> {
dependsOn bundledPluginProject.bundlePlugin dependsOn bundledPluginProject.bundlePlugin
from(project.zipTree(bundledPluginProject.bundlePlugin.outputs.files.singleFile)) { from(project.zipTree(bundledPluginProject.bundlePlugin.outputs.files.singleFile)) {
eachFile { FileCopyDetails details -> eachFile { FileCopyDetails details ->
details.relativePath = new RelativePath(true, 'elasticsearch', bundledPluginProjectName, details.name) // paths in the individual plugins begin with elasticsearch, and we want to add in the
// bundled plugin name between that and each filename
details.relativePath = new RelativePath(true, 'elasticsearch', bundledPluginProjectName,
details.relativePath.toString().replace('elasticsearch/', ''))
} }
} }
} }