diff --git a/README.asciidoc b/README.asciidoc index 03fd29e8382..242dc1dd174 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -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. diff --git a/build.gradle b/build.gradle index 29a9ad69a78..559bf2f9c28 100644 --- a/build.gradle +++ b/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') } +/* elasticsearch-releases http://maven.elasticsearch.org/releases @@ -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") - } - } - } - } - } -} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 892df99d63c..00000000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -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') - } - } - } - } -} - diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle deleted file mode 100644 index 65f7417ae07..00000000000 --- a/buildSrc/settings.gradle +++ /dev/null @@ -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' - diff --git a/marvel/build.gradle b/marvel/build.gradle index 245f21fc837..df4f9675ed1 100644 --- a/marvel/build.gradle +++ b/marvel/build.gradle @@ -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 diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 666256810f7..00000000000 --- a/settings.gradle +++ /dev/null @@ -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') - diff --git a/shield/build.gradle b/shield/build.gradle index b3c7d085834..c314b390739 100644 --- a/shield/build.gradle +++ b/shield/build.gradle @@ -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' diff --git a/watcher/build.gradle b/watcher/build.gradle index 01eca7c392c..06b53faea89 100644 --- a/watcher/build.gradle +++ b/watcher/build.gradle @@ -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'