import org.elasticsearch.gradle.plugin.MetaPluginBuildPlugin import org.elasticsearch.gradle.plugin.MetaPluginPropertiesExtension import org.elasticsearch.gradle.plugin.PluginBuildPlugin import org.elasticsearch.gradle.plugin.PluginPropertiesExtension apply plugin: 'elasticsearch.vagrantsupport' apply plugin: 'elasticsearch.vagrant' esvagrant { inheritTestUtils true } dependencies { // Packaging tests use the x-pack meta plugin bats project(path: xpackProject('plugin').path, configuration: 'zip') // Inherit Bats test utils from :qa:vagrant project bats project(path: ':qa:vagrant', configuration: 'bats') } Map> metaPlugins = [:] for (Project metaPlugin : project.rootProject.subprojects) { if (metaPlugin.plugins.hasPlugin(MetaPluginBuildPlugin)) { MetaPluginPropertiesExtension extension = metaPlugin.extensions.findByName('es_meta_plugin') if (extension != null) { List plugins = [] metaPlugin.subprojects.each { if (extension.plugins.contains(it.name)) { Project plugin = (Project) it if (plugin.plugins.hasPlugin(PluginBuildPlugin)) { PluginPropertiesExtension esplugin = plugin.extensions.findByName('esplugin') if (esplugin != null) { plugins.add(esplugin.name) } } } } metaPlugins.put(extension.name, plugins.toSorted()) } } } setupBats { doLast { metaPlugins.each{ name, plugins -> File expectedMetaPlugins = file("build/plugins/${name}.expected") expectedMetaPlugins.parentFile.mkdirs() expectedMetaPlugins.setText(plugins.join('\n'), 'UTF-8') } } }