Skip to content

Commit a4c9c2f

Browse files
authored
Make xpack modules instead of a meta plugin (#30589)
This commit removes xpack from being a meta-plugin-as-a-module. It also fixes a couple tests which were missing task dependencies, which failed once the gradle execution order changed.
1 parent e0ccd4b commit a4c9c2f

File tree

11 files changed

+13
-66
lines changed

11 files changed

+13
-66
lines changed

distribution/archives/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ subprojects {
224224
doLast {
225225
// this is just a small sample from the C++ notices, the idea being that if we've added these lines we've probably added all the required lines
226226
final List<String> expectedLines = Arrays.asList("Apache log4cxx", "Boost Software License - Version 1.0 - August 17th, 2003")
227-
final Path noticePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/modules/x-pack/x-pack-ml/NOTICE.txt")
227+
final Path noticePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/modules/x-pack-ml/NOTICE.txt")
228228
final List<String> actualLines = Files.readAllLines(noticePath)
229229
for (final String expectedLine : expectedLines) {
230230
if (actualLines.contains(expectedLine) == false) {

distribution/build.gradle

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,14 @@ project.rootProject.subprojects.findAll { it.parent.path == ':modules' }.each {
201201

202202
// use licenses from each of the bundled xpack plugins
203203
Project xpack = project(':x-pack:plugin')
204-
xpack.subprojects.findAll { it.name != 'bwc' }.each { Project xpackSubproject ->
205-
File licenses = new File(xpackSubproject.projectDir, 'licenses')
204+
xpack.subprojects.findAll { it.parent == xpack }.each { Project xpackModule ->
205+
File licenses = new File(xpackModule.projectDir, 'licenses')
206206
if (licenses.exists()) {
207207
buildDefaultNotice.licensesDir licenses
208208
}
209+
copyModule(processDefaultOutputs, xpackModule)
210+
copyLog4jProperties(buildDefaultLog4jConfig, xpackModule)
209211
}
210-
// but copy just the top level meta plugin to the default modules
211-
copyModule(processDefaultOutputs, xpack)
212-
copyLog4jProperties(buildDefaultLog4jConfig, xpack)
213-
214-
//
215212

216213
// make sure we have a clean task since we aren't a java project, but we have tasks that
217214
// put stuff in the build dir

x-pack/plugin/build.gradle

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@ import java.nio.file.Path
88
import java.nio.file.StandardCopyOption
99
import org.elasticsearch.gradle.test.RunTask;
1010

11-
apply plugin: 'elasticsearch.es-meta-plugin'
11+
apply plugin: 'elasticsearch.standalone-rest-test'
12+
apply plugin: 'elasticsearch.rest-test'
1213

1314
archivesBaseName = 'x-pack'
1415

15-
es_meta_plugin {
16-
name = 'x-pack'
17-
description = 'Elasticsearch Expanded Pack Plugin'
18-
plugins = ['core', 'deprecation', 'graph', 'logstash',
19-
'ml', 'monitoring', 'security', 'upgrade', 'watcher', 'sql', 'rollup']
20-
}
21-
2216
dependencies {
2317
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
2418
}

x-pack/plugin/core/src/main/bin/x-pack-env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# you may not use this file except in compliance with the Elastic License.
66

77
# include x-pack-core jars in classpath
8-
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/modules/x-pack/x-pack-core/*"
8+
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/modules/x-pack-core/*"

x-pack/plugin/core/src/main/bin/x-pack-env.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ rem Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
22
rem or more contributor license agreements. Licensed under the Elastic License;
33
rem you may not use this file except in compliance with the Elastic License.
44

5-
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/modules/x-pack/x-pack-core/*
5+
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/modules/x-pack-core/*

x-pack/plugin/security/src/main/bin/x-pack-security-env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
source "`dirname "$0"`"/x-pack-env
88

99
# include x-pack-security jars in classpath
10-
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/modules/x-pack/x-pack-security/*"
10+
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/modules/x-pack-security/*"

x-pack/plugin/security/src/main/bin/x-pack-security-env.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ rem you may not use this file except in compliance with the Elastic License.
44

55
call "%~dp0x-pack-env.bat" || exit /b 1
66

7-
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/modules/x-pack/x-pack-security/*
7+
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/modules/x-pack-security/*

x-pack/plugin/watcher/src/main/bin/x-pack-watcher-env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
source "`dirname "$0"`"/x-pack-env
88

99
# include x-pack-security jars in classpath
10-
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/modules/x-pack/x-pack-watcher/*"
10+
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/modules/x-pack-watcher/*"

x-pack/plugin/watcher/src/main/bin/x-pack-watcher-env.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ rem you may not use this file except in compliance with the Elastic License.
44

55
call "%~dp0x-pack-env.bat" || exit /b 1
66

7-
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/modules/x-pack/x-pack-watcher/*
7+
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/modules/x-pack-watcher/*

x-pack/qa/vagrant/build.gradle

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,6 @@ esvagrant {
1111
}
1212

1313
dependencies {
14-
// Packaging tests use the x-pack meta plugin
15-
packaging project(path: xpackProject('plugin').path, configuration: 'zip')
16-
1714
// Inherit Bats test utils from :qa:vagrant project
1815
packaging project(path: ':qa:vagrant', configuration: 'packaging')
1916
}
20-
21-
Map<String, List<String>> metaPlugins = [:]
22-
for (Project metaPlugin : project.rootProject.subprojects) {
23-
if (metaPlugin.plugins.hasPlugin(MetaPluginBuildPlugin)) {
24-
MetaPluginPropertiesExtension extension = metaPlugin.extensions.findByName('es_meta_plugin')
25-
if (extension != null) {
26-
List<String> plugins = []
27-
metaPlugin.subprojects.each {
28-
if (extension.plugins.contains(it.name)) {
29-
Project plugin = (Project) it
30-
if (plugin.plugins.hasPlugin(PluginBuildPlugin)) {
31-
PluginPropertiesExtension esplugin = plugin.extensions.findByName('esplugin')
32-
if (esplugin != null) {
33-
plugins.add(esplugin.name)
34-
}
35-
}
36-
}
37-
}
38-
metaPlugins.put(extension.name, plugins.toSorted())
39-
}
40-
}
41-
}
42-
43-
setupPackagingTest {
44-
doLast {
45-
metaPlugins.each{ name, plugins ->
46-
File expectedMetaPlugins = file("build/plugins/${name}.expected")
47-
expectedMetaPlugins.parentFile.mkdirs()
48-
expectedMetaPlugins.setText(plugins.join('\n'), 'UTF-8')
49-
}
50-
}
51-
}

x-pack/qa/vagrant/src/test/resources/packaging/utils/xpack.bash

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,6 @@ verify_xpack_installation() {
6969
done
7070
# nocommit: decide whether to check the files added by the distribution, not part of xpack...
7171
#assert_number_of_files "$ESCONFIG/" $configFilesCount
72-
73-
# Read the $name.expected file that contains all the expected
74-
# plugins for the meta plugin
75-
while read plugin; do
76-
assert_module_or_plugin_directory "$ESMODULES/$name/$plugin"
77-
assert_file_exist "$ESMODULES/$name/$plugin/$plugin"*".jar"
78-
assert_file_exist "$ESMODULES/$name/$plugin/plugin-descriptor.properties"
79-
assert_file_exist "$ESMODULES/$name/$plugin/plugin-security.policy"
80-
done </project/build/plugins/$name.expected
8172
}
8273

8374
assert_number_of_files() {

0 commit comments

Comments
 (0)