Build: Convert xplugins to use new extra projects setup (elastic/elasticsearch#4175)

* Build: Convert xplugins to use new extra projects setup

This change makes the gradle initialization for xplugins look in the
correct location for elasticsearch, which is now as a sibling of an
elasticsearch-extra directory, with x-plugins as a child of the extra
directory.

The elasticsearch side of this change is
elastic/elasticsearchelastic/elasticsearch#21773. This change will enable renaming x-plugins
to x-pack, see elastic/elasticsearch#3643.

Original commit: elastic/x-pack-elasticsearch@09398aea5a
This commit is contained in:
Ryan Ernst 2016-12-14 15:02:28 -08:00 committed by GitHub
parent 597ca9275e
commit 6d4d599f91
24 changed files with 77 additions and 68 deletions

View File

@ -1,7 +1,7 @@
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.precommit.LicenseHeadersTask
if (project.projectDir.name != 'x-plugins') {
if (project.projectDir.name != 'x-pack') {
throw new GradleException('You must checkout x-plugins in a directory named x-plugins next to elasticsearch')
}
@ -71,5 +71,5 @@ subprojects {
approvedLicenses = ['Elasticsearch Confidential']
additionalLicense 'ESCON', 'Elasticsearch Confidential', 'ELASTICSEARCH CONFIDENTIAL'
}
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-api:${version}": ':x-plugins:elasticsearch' ]
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-api:${version}": ':x-pack:elasticsearch' ]
}

View File

@ -1,6 +1,10 @@
File elasticsearchDir = new File(settingsDir, '../../elasticsearch')
File extrasDir = new File(settingsDir, '../..').getCanonicalFile()
if (extrasDir.name.endsWith('-extra') == false) {
throw new GradleException("x-pack must be checked out under an elasticsearch-extra directory, found ${extrasDir.name}")
}
File elasticsearchDir = new File(extrasDir.parentFile, extrasDir.name[0..-7])
if (elasticsearchDir.exists() == false) {
throw new GradleException('Elasticsearch must be checked out as a sibling directory of x-plugins')
throw new GradleException("${elasticsearchDir.name} is missing as a sibling to ${extrasDir.name}")
}
project(':').projectDir = new File(elasticsearchDir, 'buildSrc')

View File

@ -1,5 +1,5 @@
#!/bin/bash
# This script is used as a single command to run the x-plugins tests.
# This script is used as a single command to run the x-pack tests.
#
# It will attempt to check out 'elasticsearch' into a sibling directory
# unless the environment variable `USE_EXISTING_ES` has a value. The
@ -26,7 +26,7 @@ set -o pipefail
key=${1-check}
case $key in
packagingTest)
GRADLE_OPT_STRING="--info -Pvagrant.boxes=all :x-plugins:qa:vagrant:packagingTest"
GRADLE_OPT_STRING="--info -Pvagrant.boxes=all :x-pack:qa:vagrant:packagingTest"
;;
check)
GRADLE_OPT_STRING="--info check -Dtests.network=true -Dtests.badapples=true"
@ -56,7 +56,7 @@ BASE_DIR=$(dirname "$SCRIPT")/..
# make BASE_DIR absolute
BASE_DIR=$(cd "$BASE_DIR"; pwd)
PARENT_DIR=$(cd "$BASE_DIR"/..; pwd)
PARENT_DIR=$(cd "$BASE_DIR"/../..; pwd)
# go to the parent directory
cd $PARENT_DIR

View File

@ -91,7 +91,7 @@ forbiddenPatterns {
// TODO: standardize packaging config for plugins
bundlePlugin {
from(project(':x-plugins').projectDir) {
from(project(':x-pack').projectDir) {
include 'LICENSE.txt'
}
from(projectDir) {

View File

@ -1,7 +1,7 @@
apply plugin: 'elasticsearch.build'
dependencies {
compile project(':x-plugins:elasticsearch')
compile project(':x-pack:elasticsearch')
compile "org.elasticsearch:elasticsearch:${version}"
testCompile "org.elasticsearch.test:framework:${version}"
}

View File

@ -1,20 +1,20 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
}
String outputDir = "generated-resources/${project.name}"
task copyXPackPluginProps(type: Copy) {
from project(':x-plugins:elasticsearch').file('src/main/plugin-metadata')
from project(':x-plugins:elasticsearch').tasks.pluginProperties
from project(':x-pack:elasticsearch').file('src/main/plugin-metadata')
from project(':x-pack:elasticsearch').tasks.pluginProperties
into outputDir
}
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)
integTest {
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setting 'xpack.security.audit.enabled', 'true'
setting 'xpack.security.audit.outputs', 'index'
setting 'logger.level', 'DEBUG'

View File

@ -1,7 +1,7 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
}
integTest {
@ -16,7 +16,7 @@ integTest {
].join(',')
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setupCommand 'setupDummyUser',

View File

@ -1,15 +1,15 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'testArtifacts')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'testArtifacts')
testCompile project(path: ':modules:reindex')
}
integTest {
cluster {
setting 'script.inline', 'true'
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
// Whitelist reindexing from the local node so we can test it.
setting 'reindex.remote.whitelist', '127.0.0.1:*'
extraConfigFile 'x-pack/roles.yml', 'roles.yml'

View File

@ -50,7 +50,7 @@ Closure waitWithAuth = { NodeInfo node, AntBuilder ant ->
task oldClusterTest(type: RestIntegTestTask) {
mustRunAfter(precommit)
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
distribution = 'zip'
bwcVersion = '6.0.0-alpha1-SNAPSHOT' // TODO: either randomize, or make this settable with sysprop
numBwcNodes = 2
@ -65,7 +65,7 @@ task oldClusterTest(type: RestIntegTestTask) {
task mixedClusterTest(type: RestIntegTestTask) {
dependsOn(oldClusterTest, 'oldClusterTest#node1.stop')
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
distribution = 'zip'
clusterName = 'rolling-upgrade'
unicastTransportUri = { seedNode, node, ant -> oldClusterTest.nodes.get(0).transportUri() }
@ -79,7 +79,7 @@ task mixedClusterTest(type: RestIntegTestTask) {
task upgradedClusterTest(type: RestIntegTestTask) {
dependsOn(mixedClusterTest, 'oldClusterTest#node0.stop')
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
distribution = 'zip'
clusterName = 'rolling-upgrade'
unicastTransportUri = { seedNode, node, ant -> mixedClusterTest.nodes.get(0).transportUri() }
@ -100,14 +100,14 @@ test.enabled = false // no unit tests for rolling upgrades, only the rest integr
check.dependsOn(integTest)
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
}
// copy x-pack plugin info so it is on the classpath and security manager has the right permissions
String outputDir = "generated-resources/${project.name}"
task copyXPackPluginProps(type: Copy) {
from project(':x-plugins:elasticsearch').file('src/main/plugin-metadata')
from project(':x-plugins:elasticsearch').tasks.pluginProperties
from project(':x-pack:elasticsearch').file('src/main/plugin-metadata')
from project(':x-pack:elasticsearch').tasks.pluginProperties
into outputDir
}
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)

View File

@ -1,21 +1,21 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-plugins:elasticsearch-transport-client', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch-transport-client', configuration: 'runtime')
}
String outputDir = "generated-resources/${project.name}"
task copyXPackPluginProps(type: Copy) {
from project(':x-plugins:elasticsearch').file('src/main/plugin-metadata')
from project(':x-plugins:elasticsearch').tasks.pluginProperties
from project(':x-pack:elasticsearch').file('src/main/plugin-metadata')
from project(':x-pack:elasticsearch').tasks.pluginProperties
into outputDir
}
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)
integTest {
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setupCommand 'setupDummyUser',
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser'
setupCommand 'setupTransportClientUser',

View File

@ -5,10 +5,10 @@ apply plugin: 'elasticsearch.build'
dependencies {
provided "org.elasticsearch:elasticsearch:${versions.elasticsearch}"
provided project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
provided project(path: ':x-pack:elasticsearch', configuration: 'runtime')
testCompile "org.elasticsearch.test:framework:${project.versions.elasticsearch}"
testCompile project(path: ':x-plugins:elasticsearch-transport-client', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch-transport-client', configuration: 'runtime')
}
Map generateSubstitutions() {
@ -27,8 +27,8 @@ Map generateSubstitutions() {
String outputDir = "generated-resources/${project.name}"
task copyXPackPluginProps(type: Copy) {
from project(':x-plugins:elasticsearch').file('src/main/plugin-metadata')
from project(':x-plugins:elasticsearch').tasks.pluginProperties
from project(':x-pack:elasticsearch').file('src/main/plugin-metadata')
from project(':x-pack:elasticsearch').tasks.pluginProperties
into outputDir
}
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)
@ -45,7 +45,7 @@ task buildZip(type:Zip, dependsOn: [jar]) {
task integTest(type: org.elasticsearch.gradle.test.RestIntegTestTask, dependsOn: buildZip) {
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setting 'xpack.security.authc.realms.custom.order', '0'
setting 'xpack.security.authc.realms.custom.type', 'custom'
setting 'xpack.security.authc.realms.custom.filtered_setting', 'should be filtered'

View File

@ -1,14 +1,14 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-plugins:elasticsearch-transport-client', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch-transport-client', configuration: 'runtime')
}
integTest {
cluster {
setting 'script.inline', 'true'
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
extraConfigFile 'x-pack/roles.yml', 'roles.yml'
[
test_admin: 'superuser',

View File

@ -1,13 +1,13 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
}
// bring in graph rest test suite
task copyGraphRestTests(type: Copy) {
into project.sourceSets.test.output.resourcesDir
from project(':x-plugins:elasticsearch').sourceSets.test.resources.srcDirs
from project(':x-pack:elasticsearch').sourceSets.test.resources.srcDirs
include 'rest-api-spec/test/graph/**'
}
@ -15,7 +15,7 @@ integTest {
dependsOn copyGraphRestTests
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
extraConfigFile 'x-pack/roles.yml', 'roles.yml'
setupCommand 'setupTestAdminUser',
'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser'

View File

@ -2,13 +2,13 @@ subprojects {
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
}
// bring in monitoring rest test suite
task copyMonitoringRestTests(type: Copy) {
into project.sourceSets.test.output.resourcesDir
from project(':x-plugins:elasticsearch').sourceSets.test.resources.srcDirs
from project(':x-pack:elasticsearch').sourceSets.test.resources.srcDirs
include 'rest-api-spec/test/monitoring/**'
}
@ -17,7 +17,7 @@ subprojects {
cluster {
systemProperty 'es.logger.level', 'TRACE'
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setting 'xpack.monitoring.collection.interval', '3s'
extraConfigFile 'x-pack/roles.yml', '../roles.yml'
setupCommand 'setupTestAdminUser',

View File

@ -13,13 +13,13 @@ import java.security.SecureRandom
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
}
String outputDir = "generated-resources/${project.name}"
task copyXPackPluginProps(type: Copy) {
from project(':x-plugins:elasticsearch').file('src/main/plugin-metadata')
from project(':x-plugins:elasticsearch').tasks.pluginProperties
from project(':x-pack:elasticsearch').file('src/main/plugin-metadata')
from project(':x-pack:elasticsearch').tasks.pluginProperties
into outputDir
}
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)
@ -175,7 +175,7 @@ integTest {
setting 'xpack.ssl.keystore.path', nodeKeystore.name
setting 'xpack.ssl.keystore.password', 'keypass'
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
// copy keystores into config/
extraConfigFile nodeKeystore.name, nodeKeystore

View File

@ -3,7 +3,7 @@ import org.elasticsearch.gradle.MavenFilteringHack
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
}
ext.pluginsCount = 1 // we install xpack explicitly
@ -15,7 +15,7 @@ project.rootProject.subprojects.findAll { it.path.startsWith(':plugins:') }.each
integTest {
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setupCommand 'setupDummyUser',
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser'

View File

@ -1,13 +1,13 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
testCompile project(path: ':modules:lang-mustache', configuration: 'runtime')
}
integTest {
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'path.scripts', "${project.buildDir}/resources/test/templates"

View File

@ -1,7 +1,7 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
testCompile project(path: ':modules:lang-mustache', configuration: 'runtime')
}
@ -11,7 +11,7 @@ integTest {
systemProperty 'tests.rest.blacklist', 'actions/20_jira/*'
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'http.port', '9400'

View File

@ -1,13 +1,13 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
testCompile project(path: ':modules:lang-painless', configuration: 'runtime')
}
integTest {
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setting 'script.inline', 'true'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'

View File

@ -1,13 +1,13 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
}
// bring in watcher rest test suite
task copyWatcherRestTests(type: Copy) {
into project.sourceSets.test.output.resourcesDir
from project(':x-plugins:elasticsearch').sourceSets.test.resources.srcDirs
from project(':x-pack:elasticsearch').sourceSets.test.resources.srcDirs
include 'rest-api-spec/test/watcher/**'
}
@ -18,7 +18,7 @@ integTest {
'getting_started/10_monitor_cluster_health/Getting started - Monitor cluster health'].join(',')
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
extraConfigFile 'x-pack/roles.yml', 'roles.yml'
setupCommand 'setupTestAdminUser',
'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'changeme', '-r', 'superuser'

View File

@ -1,12 +1,12 @@
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
}
integTest {
cluster {
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'http.port', '9400'

View File

@ -5,8 +5,8 @@ import org.elasticsearch.gradle.test.NodeInfo
apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-plugins:elasticsearch', configuration: 'testArtifacts')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'runtime')
testCompile project(path: ':x-pack:elasticsearch', configuration: 'testArtifacts')
}
List<NodeInfo> cluster1Nodes
@ -17,7 +17,7 @@ task setupClusterOne(type: DefaultTask) {
cluster1Config.clusterName = 'cluster1'
cluster1Config.setting('node.name', 'cluster1-node1')
// x-pack
cluster1Config.plugin(':x-plugins:elasticsearch')
cluster1Config.plugin(':x-pack:elasticsearch')
cluster1Config.setting('xpack.monitoring.enabled', false)
cluster1Config.setting('xpack.security.enabled', false)
cluster1Config.setting('xpack.watcher.enabled', false)
@ -34,7 +34,7 @@ task setupClusterTwo(type: DefaultTask) {
cluster2Config.clusterName = 'cluster2'
cluster2Config.setting('node.name', 'cluster2-node1')
// x-pack
cluster2Config.plugin(':x-plugins:elasticsearch')
cluster2Config.plugin(':x-pack:elasticsearch')
cluster2Config.setting('xpack.monitoring.enabled', false)
cluster2Config.setting('xpack.monitoring.enabled', false)
cluster2Config.setting('xpack.security.enabled', false)
@ -66,7 +66,7 @@ integTest {
setting 'tribe.cluster2.xpack.watcher.enabled', false
setting 'tribe.cluster2.xpack.graph.enabled', false
// x-pack
plugin ':x-plugins:elasticsearch'
plugin ':x-pack:elasticsearch'
setting 'xpack.monitoring.enabled', false
setting 'xpack.monitoring.enabled', false
setting 'xpack.security.enabled', false

View File

@ -5,7 +5,7 @@ esvagrant {
}
dependencies {
bats project(path: ':x-plugins:elasticsearch', configuration: 'zip')
bats project(path: ':x-pack:elasticsearch', configuration: 'zip')
// Inherit Bats test utils from :qa:vagrant project
bats project(path: ':qa:vagrant', configuration: 'bats')

View File

@ -1,2 +1,7 @@
project(':').projectDir = new File('../elasticsearch')
apply from: '../elasticsearch/settings.gradle'
File extrasDir = new File(settingsDir, '..').getCanonicalFile()
if (extrasDir.name.endsWith('-extra') == false) {
throw new GradleException("x-pack must be checked out under an elasticsearch-extra directory, found ${extrasDir.name}")
}
File elasticsearchDir = new File(extrasDir.parentFile, extrasDir.name[0..-7])
project(':').projectDir = elasticsearchDir
apply from: "${elasticsearchDir}/settings.gradle"