Skip to content

Commit dea3635

Browse files
committed
Merge branch 'master' into watcher_reporting_email_warning
2 parents 0acff82 + 20bc248 commit dea3635

File tree

953 files changed

+16852
-8696
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

953 files changed

+16852
-8696
lines changed

.ci/init.gradle

+6-3
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,18 @@ projectsLoaded {
7777
}
7878
}
7979

80-
if (System.env.GRADLE_BUILD_CACHE_URL != null) {
80+
final String buildCacheUrl = System.getProperty('org.elasticsearch.build.cache.url')
81+
final boolean buildCachePush = Boolean.valueOf(System.getProperty('org.elasticsearch.build.cache.push', 'false'))
82+
83+
if (buildCacheUrl) {
8184
final Map<String,String> buildCacheCredentials = vault.logical()
8285
.read("secret/elasticsearch-ci/gradle-build-cache")
8386
.getData();
8487
gradle.settingsEvaluated { settings ->
8588
settings.buildCache {
8689
remote(HttpBuildCache) {
87-
url = System.getenv('GRADLE_BUILD_CACHE_URL')
88-
push = Boolean.valueOf(System.getenv('GRADLE_BUILD_CACHE_PUSH') ?: 'false')
90+
url = buildCacheUrl
91+
push = buildCachePush
8992
credentials {
9093
username = buildCacheCredentials.get("username")
9194
password = buildCacheCredentials.get("password")

Vagrantfile

+12-7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ Vagrant.configure(2) do |config|
4141
# the elasticsearch project called vagrant....
4242
config.vm.synced_folder '.', '/vagrant', disabled: true
4343
config.vm.synced_folder '.', '/elasticsearch'
44+
# TODO: make these syncs work for windows!!!
45+
config.vm.synced_folder "#{Dir.home}/.vagrant/gradle/caches/jars-3", "/root/.gradle/caches/jars-3",
46+
create: true,
47+
owner: "vagrant"
48+
config.vm.synced_folder "#{Dir.home}/.vagrant/gradle/caches/modules-2", "/root/.gradle/caches/modules-2",
49+
create: true,
50+
owner: "vagrant"
51+
config.vm.synced_folder "#{Dir.home}/.gradle/wrapper", "/root/.gradle/wrapper",
52+
create: true,
53+
owner: "vagrant"
4454

4555
# Expose project directory. Note that VAGRANT_CWD may not be the same as Dir.pwd
4656
PROJECT_DIR = ENV['VAGRANT_PROJECT_DIR'] || Dir.pwd
@@ -376,22 +386,17 @@ export ZIP=/elasticsearch/distribution/zip/build/distributions
376386
export TAR=/elasticsearch/distribution/tar/build/distributions
377387
export RPM=/elasticsearch/distribution/rpm/build/distributions
378388
export DEB=/elasticsearch/distribution/deb/build/distributions
379-
export BATS=/project/build/bats
380-
export BATS_UTILS=/project/build/packaging/bats/utils
381-
export BATS_TESTS=/project/build/packaging/bats/tests
382-
export PACKAGING_ARCHIVES=/project/build/packaging/archives
383389
export PACKAGING_TESTS=/project/build/packaging/tests
384390
VARS
385391
cat \<\<SUDOERS_VARS > /etc/sudoers.d/elasticsearch_vars
386392
Defaults env_keep += "ZIP"
387393
Defaults env_keep += "TAR"
388394
Defaults env_keep += "RPM"
389395
Defaults env_keep += "DEB"
390-
Defaults env_keep += "BATS"
391-
Defaults env_keep += "BATS_UTILS"
392-
Defaults env_keep += "BATS_TESTS"
393396
Defaults env_keep += "PACKAGING_ARCHIVES"
394397
Defaults env_keep += "PACKAGING_TESTS"
398+
Defaults env_keep += "BATS_UTILS"
399+
Defaults env_keep += "BATS_TESTS"
395400
Defaults env_keep += "JAVA_HOME"
396401
Defaults env_keep += "SYSTEM_JAVA_HOME"
397402
SUDOERS_VARS

build.gradle

+26-38
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ import org.elasticsearch.gradle.Version
2424
import org.elasticsearch.gradle.BwcVersions
2525
import org.elasticsearch.gradle.VersionProperties
2626
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
27+
import org.elasticsearch.gradle.tool.Boilerplate
2728
import org.gradle.util.GradleVersion
2829
import org.gradle.util.DistributionLocator
2930
import org.gradle.plugins.ide.eclipse.model.SourceFolder
3031

32+
import static org.elasticsearch.gradle.tool.Boilerplate.maybeConfigure
33+
3134
plugins {
32-
id 'com.gradle.build-scan' version '2.3'
35+
id 'com.gradle.build-scan' version '2.4'
3336
id 'base'
3437
id 'elasticsearch.global-build-info'
3538
}
@@ -209,7 +212,7 @@ task branchConsistency {
209212

210213
allprojects {
211214
// ignore missing javadocs
212-
tasks.withType(Javadoc) { Javadoc javadoc ->
215+
tasks.withType(Javadoc).configureEach { Javadoc javadoc ->
213216
// the -quiet here is because of a bug in gradle, in that adding a string option
214217
// by itself is not added to the options. By adding quiet, both this option and
215218
// the "value" -quiet is added, separated by a space. This is ok since the javadoc
@@ -326,13 +329,9 @@ allprojects {
326329
}
327330
}
328331

329-
task cleanIdeaBuildDir(type: Delete) {
330-
delete 'build-idea'
332+
tasks.named('cleanIdea') {
333+
delete 'build-idea'
331334
}
332-
cleanIdeaBuildDir.setGroup("ide")
333-
cleanIdeaBuildDir.setDescription("Deletes the IDEA build directory.")
334-
335-
tasks.cleanIdea.dependsOn(cleanIdeaBuildDir)
336335
}
337336

338337
idea {
@@ -387,29 +386,20 @@ allprojects {
387386

388387
String lineSeparator = Os.isFamily(Os.FAMILY_WINDOWS) ? '\\\\r\\\\n' : '\\\\n'
389388
String licenseHeader = licenseHeaderFile.getText('UTF-8').replace(System.lineSeparator(), lineSeparator)
390-
task copyEclipseSettings(type: Copy) {
389+
tasks.register('copyEclipseSettings', Copy) {
390+
mustRunAfter 'wipeEclipseSettings'
391391
// TODO: "package this up" for external builds
392392
from new File(project.rootDir, 'buildSrc/src/main/resources/eclipse.settings')
393393
into '.settings'
394394
filter{ it.replaceAll('@@LICENSE_HEADER_TEXT@@', licenseHeader)}
395395
}
396396
// otherwise .settings is not nuked entirely
397-
task wipeEclipseSettings(type: Delete) {
397+
tasks.register('wipeEclipseSettings', Delete) {
398398
delete '.settings'
399399
}
400-
tasks.cleanEclipse.dependsOn(wipeEclipseSettings)
400+
tasks.named('cleanEclipse') { dependsOn 'wipeEclipseSettings' }
401401
// otherwise the eclipse merging is *super confusing*
402-
tasks.eclipse.dependsOn(cleanEclipse, copyEclipseSettings)
403-
404-
// work arround https://github.com/gradle/gradle/issues/6582
405-
tasks.eclipseProject.mustRunAfter tasks.cleanEclipseProject
406-
tasks.matching { it.name == 'eclipseClasspath' }.all {
407-
it.mustRunAfter { tasks.cleanEclipseClasspath }
408-
}
409-
tasks.matching { it.name == 'eclipseJdt' }.all {
410-
it.mustRunAfter { tasks.cleanEclipseJdt }
411-
}
412-
tasks.copyEclipseSettings.mustRunAfter tasks.wipeEclipseSettings
402+
tasks.named('eclipse') { dependsOn 'cleanEclipse', 'copyEclipseSettings' }
413403
}
414404

415405
allprojects {
@@ -474,13 +464,11 @@ gradle.projectsEvaluated {
474464
* need to publish artifacts for them.
475465
*/
476466
if (project.name.equals('qa') || project.path.contains(':qa:')) {
477-
Task assemble = project.tasks.findByName('assemble')
478-
if (assemble) {
479-
assemble.enabled = false
467+
maybeConfigure(project.tasks, 'assemble') {
468+
it.enabled = false
480469
}
481-
Task dependenciesInfo = project.tasks.findByName('dependenciesInfo')
482-
if (dependenciesInfo) {
483-
dependenciesInfo.enabled = false
470+
maybeConfigure(project.tasks, 'dependenciesInfo') {
471+
it.enabled = false
484472
}
485473
}
486474
}
@@ -502,7 +490,7 @@ gradle.projectsEvaluated {
502490
}
503491

504492
allprojects {
505-
task resolveAllDependencies {
493+
tasks.register('resolveAllDependencies') {
506494
dependsOn tasks.matching { it.name == "pullFixture"}
507495
doLast {
508496
configurations.findAll { it.isCanBeResolved() }.each { it.resolve() }
@@ -532,13 +520,13 @@ allprojects {
532520
}
533521
}
534522

535-
task checkPart1
536-
task checkPart2
537-
tasks.matching { it.name == "check" }.all { check ->
538-
if (check.path.startsWith(":x-pack:")) {
539-
checkPart2.dependsOn check
540-
} else {
541-
checkPart1.dependsOn check
542-
}
543-
}
523+
def checkPart1 = tasks.register('checkPart1')
524+
def checkPart2 = tasks.register('checkPart2')
525+
plugins.withId('lifecycle-base') {
526+
if (project.path.startsWith(":x-pack:")) {
527+
checkPart2.configure { dependsOn 'check' }
528+
} else {
529+
checkPart1.configure { dependsOn 'check' }
530+
}
531+
}
544532
}

buildSrc/build.gradle

+10-8
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ if (JavaVersion.current() < JavaVersion.VERSION_11) {
6767
}
6868

6969
allprojects {
70+
apply plugin: 'java'
7071
targetCompatibility = '11'
7172
sourceCompatibility = '11'
7273
}
@@ -76,20 +77,13 @@ sourceSets {
7677
minimumRuntime { }
7778
}
7879

79-
configurations {
80-
reaper
81-
}
82-
8380
compileMinimumRuntimeJava {
8481
targetCompatibility = 8
8582
sourceCompatibility = 8
8683
}
8784

8885
jar {
8986
from sourceSets.minimumRuntime.output
90-
into('META-INF') {
91-
from configurations.reaper
92-
}
9387
}
9488

9589
javadoc {
@@ -127,7 +121,6 @@ dependencies {
127121
testCompile "junit:junit:${props.getProperty('junit')}"
128122
testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${props.getProperty('randomizedrunner')}"
129123
testCompile 'com.github.tomakehurst:wiremock-jre8-standalone:2.23.2'
130-
reaper project('reaper')
131124
minimumRuntimeCompile "junit:junit:${props.getProperty('junit')}"
132125
minimumRuntimeCompile localGroovy()
133126
minimumRuntimeCompile gradleApi()
@@ -143,6 +136,10 @@ if (project == rootProject) {
143136
mavenLocal()
144137
}
145138
}
139+
dependencies {
140+
// add this so the runtime classpath so Gradle will properly track it as a build runtime classpath input
141+
runtimeOnly project('reaper')
142+
}
146143
// only run tests as build-tools
147144
test.enabled = false
148145
}
@@ -172,9 +169,11 @@ if (project != rootProject) {
172169

173170
configurations {
174171
distribution
172+
reaper
175173
}
176174

177175
dependencies {
176+
reaper project('reaper')
178177
distribution project(':distribution:archives:windows-zip')
179178
distribution project(':distribution:archives:oss-windows-zip')
180179
distribution project(':distribution:archives:darwin-tar')
@@ -186,6 +185,9 @@ if (project != rootProject) {
186185
// for external projects we want to remove the marker file indicating we are running the Elasticsearch project
187186
processResources {
188187
exclude 'buildSrc.marker'
188+
into('META-INF') {
189+
from configurations.reaper
190+
}
189191
}
190192

191193
String localDownloads = "${rootProject.buildDir}/local-downloads"

buildSrc/reaper/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
apply plugin: 'java'
2-
31
jar {
2+
archiveName = "${project.name}.jar"
43
manifest {
54
attributes 'Main-Class': 'org.elasticsearch.gradle.reaper.Reaper'
65
}

0 commit comments

Comments
 (0)