OpenSearch/qa/vagrant/build.gradle

52 lines
1.8 KiB
Groovy

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
packaging project(path: xpackProject('plugin').path, configuration: 'zip')
// Inherit Bats test utils from :qa:vagrant project
packaging project(path: ':qa:vagrant', configuration: 'packaging')
}
Map<String, List<String>> metaPlugins = [:]
for (Project metaPlugin : project.rootProject.subprojects) {
if (metaPlugin.plugins.hasPlugin(MetaPluginBuildPlugin)) {
MetaPluginPropertiesExtension extension = metaPlugin.extensions.findByName('es_meta_plugin')
if (extension != null) {
List<String> 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())
}
}
}
setupPackagingTest {
doLast {
metaPlugins.each{ name, plugins ->
File expectedMetaPlugins = file("build/plugins/${name}.expected")
expectedMetaPlugins.parentFile.mkdirs()
expectedMetaPlugins.setText(plugins.join('\n'), 'UTF-8')
}
}
}