Build: Remove project attachment and use ES extra-plugins instead
This change removes the project attachment support, and instead relies on x-plugins being checked out under extra-plugins/x-plugins within an elasticsearch checkout. The only real change, other than removing unnecessary code, was to rename the license/core project because gradle project substitution has a bug which causes it to try and use ES core as the substitution. (Unfortunately this is not reproduceable with a simple example, so I have not yet filed an issue with gradle). Original commit: elastic/x-pack-elasticsearch@fa315ffcb5
This commit is contained in:
parent
d4fe344be1
commit
8119451a7b
|
@ -7,12 +7,6 @@ A set of Elastic's commercial plugins:
|
|||
- Watcher
|
||||
- Marvel
|
||||
|
||||
= Testing with Elasticsearch
|
||||
Sometimes it is useful to use your local elasticsearch checkout with x-plugins. To do this, run the following commands:
|
||||
cd buildSrc
|
||||
gradle attach --name elasticsearch --path /path/to/elasticsearch/buildSrc
|
||||
cd ..
|
||||
gradle attach --name elasticsearch --path /path/to/elasticsearch
|
||||
|
||||
This will cause building x-plugins to reflect any changes in your elasticsearch repo. For example, if you make a change to elasticsearch core, building x-plugins will first re-build elasticsearch core, and use that when building x-plugins.
|
||||
|
||||
= Setup
|
||||
You must checkout x-plugins within an elasticsearch checkout. It must be
|
||||
called x-plugins, and must be inside the extra-plugins directory.
|
||||
|
|
53
build.gradle
53
build.gradle
|
@ -1,30 +1,14 @@
|
|||
apply plugin: 'elasticsearch.project-attachment'
|
||||
|
||||
allprojects {
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
}
|
||||
|
||||
subprojects {
|
||||
group = 'org.elasticsearch'
|
||||
version = org.elasticsearch.gradle.VersionProperties.elasticsearch
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy.cacheChangingModulesFor(0, 'seconds')
|
||||
}
|
||||
}
|
||||
|
||||
if (hasProperty('projectsPrefix') == false) {
|
||||
allprojects {
|
||||
project.ext['projectsPrefix'] = ''
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: GradleBuild) {
|
||||
buildFile = 'buildSrc/build.gradle'
|
||||
tasks = ['clean']
|
||||
if (project.name != 'x-plugins') {
|
||||
throw new GradleException('You must checkout x-plugins to a directory named x-plugins')
|
||||
}
|
||||
if (project.projectDir.parentFile.name != 'extra-plugins') {
|
||||
throw new GradleException('You must place the x-plugins checkout in a directory named extra-plugins')
|
||||
}
|
||||
if (project.rootProject.projectDir != project.projectDir.parentFile.parentFile) {
|
||||
throw new GradleException('You must place the extra-plugins directory inside the root of an elasticsearch checkout')
|
||||
}
|
||||
|
||||
/*
|
||||
<repository>
|
||||
<id>elasticsearch-releases</id>
|
||||
<url>http://maven.elasticsearch.org/releases</url>
|
||||
|
@ -64,22 +48,3 @@ subprojects {
|
|||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// ================= Local Elasticsearch attachment ===============
|
||||
if (hasProperty('attachments') && 'elasticsearch' in attachments) {
|
||||
subprojects {
|
||||
configurations {
|
||||
all {
|
||||
resolutionStrategy {
|
||||
dependencySubstitution {
|
||||
substitute module("org.elasticsearch:rest-api-spec:${version}") with project(":elasticsearch:rest-api-spec")
|
||||
substitute module("org.elasticsearch:elasticsearch:${version}") with project(":elasticsearch:core")
|
||||
substitute module("org.elasticsearch:test-framework:${version}") with project(":elasticsearch:test-framework")
|
||||
substitute module("org.elasticsearch.distribution.zip:elasticsearch:${version}") with project(":elasticsearch:distribution:zip")
|
||||
substitute module("org.elasticsearch.distribution.tar:elasticsearch:${version}") with project(":elasticsearch:distribution:tar")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
apply plugin: 'groovy'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
name 'sonatype-snapshots'
|
||||
url 'http://oss.sonatype.org/content/repositories/snapshots/'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.elasticsearch.gradle:project-attachment-plugin:1.0.0-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
apply plugin: 'elasticsearch.project-attachment'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name 'sonatype-snapshots'
|
||||
url "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
runtime 'org.elasticsearch.gradle:project-attachment-plugin:1.0.0-SNAPSHOT'
|
||||
runtime 'org.elasticsearch.gradle:build-tools:3.0.0-SNAPSHOT'
|
||||
}
|
||||
|
||||
if ('elasticsearch' in attachments) {
|
||||
configurations {
|
||||
all {
|
||||
resolutionStrategy {
|
||||
dependencySubstitution {
|
||||
substitute module('org.elasticsearch.gradle:build-tools') with project(':elasticsearch')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
name 'sonatype-snapshots'
|
||||
url 'http://oss.sonatype.org/content/repositories/snapshots/'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.elasticsearch.gradle:project-attachment-plugin:1.0.0-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
apply plugin: 'elasticsearch.project-settings-attachment'
|
||||
|
|
@ -17,9 +17,9 @@ ext.versions = [
|
|||
]
|
||||
|
||||
dependencies {
|
||||
licensePluginZip project(path: "${projectsPrefix}:license:plugin") // zip
|
||||
provided project(path: "${projectsPrefix}:license:plugin", configuration: 'runtime')
|
||||
provided project(path: "${projectsPrefix}:shield", configuration: 'runtime')
|
||||
licensePluginZip project(path: ':x-plugins:license:plugin') // zip
|
||||
provided project(path: ':x-plugins:license:plugin', configuration: 'runtime')
|
||||
provided project(path: ':x-plugins:shield', configuration: 'runtime')
|
||||
testCompile 'org.elasticsearch:securemock:1.1'
|
||||
|
||||
// mock web server
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
rootProject.name = 'x-plugins'
|
||||
apply plugin: 'elasticsearch.project-settings-attachment'
|
||||
|
||||
String prefix = ''
|
||||
if (rootProject.children.isEmpty() == false) {
|
||||
// we are attached to another project, make a fake root
|
||||
rootProject.name = 'x-plugins and attachments'
|
||||
rootProject.projectDir = new File(settingsDir, 'build/fake-root')
|
||||
if (rootProject.projectDir.exists()) {
|
||||
rootProject.projectDir.delete()
|
||||
}
|
||||
rootProject.projectDir.mkdirs()
|
||||
|
||||
// the fake root's build file just needs to know about attachments
|
||||
File rootBuild = new File(rootProject.projectDir, 'build.gradle')
|
||||
rootBuild.setText('apply plugin: "elasticsearch.project-attachment"', 'UTF-8')
|
||||
String attachPrefix = org.elasticsearch.gradle.attachment.ProjectAttachmentPlugin.ATTACHMENT_PREFIX
|
||||
settingsDir.eachFile { file ->
|
||||
if (file.getName().startsWith(org.elasticsearch.gradle.attachment.ProjectAttachmentPlugin.ATTACHMENT_PREFIX)) {
|
||||
new File(rootProject.projectDir, file.getName()).setText(file.getText('UTF-8'), 'UTF-8')
|
||||
}
|
||||
}
|
||||
|
||||
// add x-plugins as an attachment
|
||||
File xpluginsAttachment = new File(rootProject.projectDir, "${attachPrefix}x-plugins")
|
||||
xpluginsAttachment.setText(settingsDir.getPath(), 'UTF-8')
|
||||
|
||||
// and add x-plugins root project
|
||||
prefix = 'x-plugins:'
|
||||
include 'x-plugins'
|
||||
project(':x-plugins').projectDir = settingsDir
|
||||
}
|
||||
|
||||
String[] projects = [
|
||||
'license:core2',
|
||||
'license:licensor',
|
||||
'license:plugin-api',
|
||||
'license:plugin',
|
||||
'license:found-plugin',
|
||||
'shield',
|
||||
'watcher',
|
||||
'marvel'
|
||||
]
|
||||
if (prefix.isEmpty() == false) {
|
||||
projects = projects.collect { "${prefix}${it}" }
|
||||
}
|
||||
include projects
|
||||
|
||||
project(":${prefix}license:core2").projectDir = new File(project(":${prefix}license").projectDir, 'core')
|
||||
|
|
@ -11,9 +11,9 @@ configurations {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
licensePluginZip project(path: "${projectsPrefix}:license:plugin") // zip
|
||||
provided project(path: "${projectsPrefix}:license:plugin", configuration: 'runtime')
|
||||
compile project("${projectsPrefix}:license:plugin-api")
|
||||
licensePluginZip project(path: ':x-plugins:license:plugin') // zip
|
||||
provided project(path: ':x-plugins:license:plugin', configuration: 'runtime')
|
||||
compile project(':x-plugins:license:plugin-api')
|
||||
compile 'dk.brics.automaton:automaton:1.11-8'
|
||||
compile 'com.unboundid:unboundid-ldapsdk:2.3.8'
|
||||
testCompile 'org.slf4j:slf4j-log4j12:1.6.2'
|
||||
|
|
|
@ -17,9 +17,9 @@ ext.versions = [
|
|||
]
|
||||
|
||||
dependencies {
|
||||
licensePluginZip project(path: "${projectsPrefix}:license:plugin") // zip
|
||||
provided project(path: "${projectsPrefix}:license:plugin", configuration: 'runtime')
|
||||
provided project(path: "${projectsPrefix}:shield", configuration: 'runtime')
|
||||
licensePluginZip project(path: ':x-plugins:license:plugin') // zip
|
||||
provided project(path: ':x-plugins:license:plugin', configuration: 'runtime')
|
||||
provided project(path: ':x-plugins:shield', configuration: 'runtime')
|
||||
|
||||
compile 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:r239'
|
||||
compile 'com.google.guava:guava:19.0-rc2'
|
||||
|
|
Loading…
Reference in New Issue