Skip to content

Commit 7017951

Browse files
committed
Merge branch 'master' into rest_spec_update
2 parents 257fc77 + 024f1a5 commit 7017951

File tree

1,675 files changed

+26258
-29644
lines changed

Some content is hidden

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

1,675 files changed

+26258
-29644
lines changed

.ci/build-cache.gradle

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
if (System.getenv('GRADLE_BUILD_CACHE_URL')) {
2+
gradle.settingsEvaluated { settings ->
3+
settings.buildCache {
4+
remote(HttpBuildCache) {
5+
url = System.getenv('GRADLE_BUILD_CACHE_URL')
6+
push = Boolean.valueOf(System.getenv('GRADLE_BUILD_CACHE_PUSH') ?: 'false')
7+
if (System.getenv('GRADLE_BUILD_CACHE_USERNAME') && System.getenv('GRADLE_BUILD_CACHE_PASSWORD')) {
8+
credentials {
9+
username = System.getenv('GRADLE_BUILD_CACHE_USERNAME')
10+
password = System.getenv('GRADLE_BUILD_CACHE_PASSWORD')
11+
}
12+
}
13+
}
14+
}
15+
}
16+
} else {
17+
throw new GradleException("You must supply a value for GRADLE_BUILD_CACHE_URL environment variable when applying build-cache.gradle init script")
18+
}

.ci/java-versions.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ ES_BUILD_JAVA=openjdk12
88
ES_RUNTIME_JAVA=java11
99
GRADLE_TASK=build
1010

11+

.ci/matrix-runtime-javas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ES_RUNTIME_JAVA:
99
- java11
1010
- java12
1111
- openjdk12
12+
- openjdk13
1213
- zulu11
1314
- zulu12
1415
- corretto11

.ci/packer_cache.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ export JAVA8_HOME="${HOME}"/.java/java8
2222
export JAVA11_HOME="${HOME}"/.java/java11
2323
export JAVA12_HOME="${HOME}"/.java/openjdk12
2424
./gradlew --parallel clean --scan -Porg.elasticsearch.acceptScanTOS=true -s resolveAllDependencies
25+

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ Commercially licensed code that integrates with the rest of Elasticsearch. The
325325
`docs` subdirectory functions just like the top level `docs` subdirectory and
326326
the `qa` subdirectory functions just like the top level `qa` subdirectory. The
327327
`plugin` subdirectory contains the x-pack module which runs inside the
328-
Elasticsearch process. The `transport-client` subdirectory contains extensions
329-
to Elasticsearch's standard transport client to work properly with x-pack.
328+
Elasticsearch process.
330329

331330
### Gradle Build
332331

TESTING.asciidoc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,6 @@ e.g. -Dtests.rest.suite=index,get,create/10_with_id
305305
blacklisted and need to be skipped
306306
e.g. -Dtests.rest.blacklist=index/*/Index document,get/10_basic/*
307307

308-
Note that the REST tests, like all the integration tests, can be run against an external
309-
cluster by specifying the `tests.cluster` property, which if present needs to contain a
310-
comma separated list of nodes to connect to (e.g. localhost:9300). A transport client will
311-
be created based on that and used for all the before|after test operations, and to extract
312-
the http addresses of the nodes so that REST requests can be sent to them.
313-
314308
== Testing packaging
315309

316310
The packaging tests use Vagrant virtual machines to verify that installing

benchmarks/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ archivesBaseName = 'elasticsearch-benchmarks'
2727
test.enabled = false
2828

2929
dependencies {
30-
compile("org.elasticsearch:elasticsearch:${version}") {
30+
compile(project(":server")) {
3131
// JMH ships with the conflicting version 4.6. This prevents us from using jopt-simple in benchmarks (which should be ok) but allows
3232
// us to invoke the JMH uberjar as usual.
3333
exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'

build.gradle

Lines changed: 7 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
3131
plugins {
3232
id 'com.gradle.build-scan' version '2.2.1'
3333
id 'base'
34+
id 'elasticsearch.global-build-info'
3435
}
3536
if (Boolean.valueOf(project.findProperty('org.elasticsearch.acceptScanTOS') ?: "false")) {
3637
buildScan {
@@ -103,10 +104,7 @@ subprojects {
103104

104105
/* Introspect all versions of ES that may be tested against for backwards
105106
* compatibility. It is *super* important that this logic is the same as the
106-
* logic in VersionUtils.java, throwing out alphas because they don't have any
107-
* backwards compatibility guarantees and only keeping the latest beta or rc
108-
* in a branch if there are only betas and rcs in the branch so we have
109-
* *something* to test against. */
107+
* logic in VersionUtils.java. */
110108
BwcVersions versions = new BwcVersions(file('server/src/main/java/org/elasticsearch/Version.java').readLines('UTF-8'))
111109

112110
// build metadata from previous build, contains eg hashes for bwc builds
@@ -208,69 +206,7 @@ allprojects {
208206
javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet')
209207
}
210208

211-
/* Sets up the dependencies that we build as part of this project but
212-
register as though they were external to resolve internally. We register
213-
them as external dependencies so the build plugin that we use can be used
214-
to build elasticsearch plugins outside of the elasticsearch source tree. */
215-
ext.projectSubstitutions = [
216-
"org.elasticsearch.gradle:build-tools:${version}": ':build-tools',
217-
"org.elasticsearch:rest-api-spec:${version}": ':rest-api-spec',
218-
"org.elasticsearch:elasticsearch:${version}": ':server',
219-
"org.elasticsearch:elasticsearch-cli:${version}": ':libs:elasticsearch-cli',
220-
"org.elasticsearch:elasticsearch-core:${version}": ':libs:core',
221-
"org.elasticsearch:elasticsearch-nio:${version}": ':libs:nio',
222-
"org.elasticsearch:elasticsearch-x-content:${version}": ':libs:x-content',
223-
"org.elasticsearch:elasticsearch-geo:${version}": ':libs:elasticsearch-geo',
224-
"org.elasticsearch:elasticsearch-secure-sm:${version}": ':libs:secure-sm',
225-
"org.elasticsearch:elasticsearch-ssl-config:${version}": ':libs:elasticsearch-ssl-config',
226-
"org.elasticsearch.client:elasticsearch-rest-client:${version}": ':client:rest',
227-
"org.elasticsearch.client:elasticsearch-rest-client-sniffer:${version}": ':client:sniffer',
228-
"org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}": ':client:rest-high-level',
229-
"org.elasticsearch.client:test:${version}": ':client:test',
230-
"org.elasticsearch.client:transport:${version}": ':client:transport',
231-
"org.elasticsearch.plugin:elasticsearch-scripting-painless-spi:${version}": ':modules:lang-painless:spi',
232-
"org.elasticsearch.test:framework:${version}": ':test:framework',
233-
"org.elasticsearch.test:logger-usage:${version}": ':test:logger-usage',
234-
"org.elasticsearch.xpack.test:feature-aware:${version}": ':x-pack:test:feature-aware',
235-
// for transport client
236-
"org.elasticsearch.plugin:transport-netty4-client:${version}": ':modules:transport-netty4',
237-
"org.elasticsearch.plugin:reindex-client:${version}": ':modules:reindex',
238-
"org.elasticsearch.plugin:lang-mustache-client:${version}": ':modules:lang-mustache',
239-
"org.elasticsearch.plugin:parent-join-client:${version}": ':modules:parent-join',
240-
"org.elasticsearch.plugin:aggs-matrix-stats-client:${version}": ':modules:aggs-matrix-stats',
241-
"org.elasticsearch.plugin:percolator-client:${version}": ':modules:percolator',
242-
"org.elasticsearch.plugin:rank-eval-client:${version}": ':modules:rank-eval',
243-
// for security example plugins
244-
"org.elasticsearch.plugin:x-pack-core:${version}": ':x-pack:plugin:core',
245-
"org.elasticsearch.client:x-pack-transport:${version}": ':x-pack:transport-client'
246-
]
247-
248-
/*
249-
* Gradle only resolve project substitutions during dependency resolution but
250-
* we sometimes want to do the resolution at other times. This creates a
251-
* convenient method we can call to do it.
252-
*/
253-
ext.dependencyToProject = { Dependency dep ->
254-
if (dep instanceof ProjectDependency) {
255-
return dep.dependencyProject
256-
} else {
257-
String substitution = projectSubstitutions.get("${dep.group}:${dep.name}:${dep.version}")
258-
if (substitution != null) {
259-
return findProject(substitution)
260-
}
261-
return null
262-
}
263-
}
264-
265209
project.afterEvaluate {
266-
configurations.all {
267-
resolutionStrategy.dependencySubstitution { DependencySubstitutions subs ->
268-
projectSubstitutions.each { k,v ->
269-
subs.substitute(subs.module(k)).with(subs.project(v))
270-
}
271-
}
272-
}
273-
274210
// Handle javadoc dependencies across projects. Order matters: the linksOffline for
275211
// org.elasticsearch:elasticsearch must be the last one or all the links for the
276212
// other packages (e.g org.elasticsearch.client) will point to server rather than
@@ -279,10 +215,10 @@ allprojects {
279215
String artifactsHost = VersionProperties.elasticsearch.endsWith("-SNAPSHOT") ? "https://snapshots.elastic.co" : "https://artifacts.elastic.co"
280216
Closure sortClosure = { a, b -> b.group <=> a.group }
281217
Closure depJavadocClosure = { shadowed, dep ->
282-
if (dep.group == null || false == dep.group.startsWith('org.elasticsearch')) {
218+
if ((dep instanceof ProjectDependency) == false) {
283219
return
284220
}
285-
Project upstreamProject = project.ext.dependencyToProject(dep)
221+
Project upstreamProject = dep.dependencyProject
286222
if (upstreamProject == null) {
287223
return
288224
}
@@ -337,9 +273,9 @@ gradle.projectsEvaluated {
337273
if (tasks.findByPath('test') != null && tasks.findByPath('integTest') != null) {
338274
integTest.mustRunAfter test
339275
}
340-
configurations.all { Configuration configuration ->
341-
dependencies.all { Dependency dep ->
342-
Project upstreamProject = dependencyToProject(dep)
276+
configurations.matching { it.canBeResolved }.all { Configuration configuration ->
277+
dependencies.matching { it instanceof ProjectDependency }.all { ProjectDependency dep ->
278+
Project upstreamProject = dep.dependencyProject
343279
if (upstreamProject != null) {
344280
if (project.path == upstreamProject.path) {
345281
// TODO: distribution integ tests depend on themselves (!), fix that
@@ -552,31 +488,6 @@ gradle.projectsEvaluated {
552488
}
553489
}
554490

555-
if (System.properties.get("build.compare") != null) {
556-
apply plugin: 'compare-gradle-builds'
557-
compareGradleBuilds {
558-
ext.referenceProject = System.properties.get("build.compare")
559-
doFirst {
560-
if (file(referenceProject).exists() == false) {
561-
throw new GradleException(
562-
"Use git worktree to check out a version to compare against to ../elasticsearch_build_reference"
563-
)
564-
}
565-
}
566-
sourceBuild {
567-
gradleVersion = gradle.getGradleVersion()
568-
projectDir = referenceProject
569-
tasks = ["clean", "assemble"]
570-
arguments = ["-Dbuild.compare_friendly=true"]
571-
}
572-
targetBuild {
573-
tasks = ["clean", "assemble"]
574-
// use -Dorg.gradle.java.home= to alter jdk versions
575-
arguments = ["-Dbuild.compare_friendly=true"]
576-
}
577-
}
578-
}
579-
580491
allprojects {
581492
task resolveAllDependencies {
582493
dependsOn tasks.matching { it.name == "pullFixture"}
@@ -618,22 +529,3 @@ allprojects {
618529
}
619530
}
620531
}
621-
622-
subprojects {
623-
// Common config when running with a FIPS-140 runtime JVM
624-
if (project.ext.has("inFipsJvm") && project.ext.inFipsJvm) {
625-
tasks.withType(Test) {
626-
systemProperty 'javax.net.ssl.trustStorePassword', 'password'
627-
systemProperty 'javax.net.ssl.keyStorePassword', 'password'
628-
}
629-
project.pluginManager.withPlugin("elasticsearch.testclusters") {
630-
project.testClusters.all {
631-
systemProperty 'javax.net.ssl.trustStorePassword', 'password'
632-
systemProperty 'javax.net.ssl.keyStorePassword', 'password'
633-
}
634-
}
635-
}
636-
}
637-
638-
639-

buildSrc/build.gradle

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,17 @@ if (project == rootProject) {
4545
// we update the version property to reflect if we are building a snapshot or a release build
4646
// we write this back out below to load it in the Build.java which will be shown in rest main action
4747
// to indicate this being a snapshot build or a release build.
48-
File propsFile = project.file('version.properties')
49-
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(propsFile)
48+
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(project.file('version.properties'))
5049
version = props.getProperty("elasticsearch")
50+
51+
task generateVersionProperties(type: WriteProperties) {
52+
outputFile = "${buildDir}/version.properties"
53+
comment = 'Generated version properties'
54+
properties(props)
55+
}
56+
5157
processResources {
52-
inputs.file(propsFile)
53-
// We need to be explicit with the version because we add snapshot and qualifier to it based on properties
54-
inputs.property("dynamic_elasticsearch_version", props.getProperty("elasticsearch"))
55-
doLast {
56-
Writer writer = file("$destinationDir/version.properties").newWriter()
57-
try {
58-
props.store(writer, "Generated version properties")
59-
} finally {
60-
writer.close()
61-
}
62-
}
58+
from(generateVersionProperties)
6359
}
6460

6561
/*****************************************************************************
@@ -69,37 +65,10 @@ processResources {
6965
if (JavaVersion.current() < JavaVersion.VERSION_11) {
7066
throw new GradleException('At least Java 11 is required to build elasticsearch gradle tools')
7167
}
72-
// Gradle 4.10 does not support setting this to 11 yet
73-
targetCompatibility = "10"
74-
sourceCompatibility = "10"
75-
76-
// We have a few classes that need to be compiled for older java versions because these are used to run checks against
77-
// those
78-
sourceSets {
79-
minimumRuntime {
80-
// We only want Java here, but the Groovy doesn't configure javadoc correctly if we don't define this as groovy
81-
groovy {
82-
srcDirs = ['src/main/minimumRuntime']
83-
}
84-
}
85-
}
86-
compileMinimumRuntimeGroovy {
87-
targetCompatibility = 8
88-
sourceCompatibility = 8
89-
}
90-
dependencies {
91-
if (project.ext.has("isEclipse") == false || project.ext.isEclipse == false) {
92-
// eclipse is confused if this is set explicitly
93-
compile sourceSets.minimumRuntime.output
94-
}
95-
minimumRuntimeCompile "junit:junit:${props.getProperty('junit')}"
96-
minimumRuntimeCompile localGroovy()
97-
minimumRuntimeCompile gradleApi()
98-
}
99-
jar {
100-
from sourceSets.minimumRuntime.output
101-
}
10268

69+
// Keep compatibility with Java 8 for external users of build-tools that haven't migrated to Java 11
70+
targetCompatibility = '8'
71+
sourceCompatibility = '8'
10372

10473
/*****************************************************************************
10574
* Dependencies used by the entire build *
@@ -164,7 +133,6 @@ if (project != rootProject) {
164133
dependenciesInfo.enabled = false
165134
forbiddenApisMain.enabled = false
166135
forbiddenApisTest.enabled = false
167-
forbiddenApisMinimumRuntime.enabled = false
168136
jarHell.enabled = false
169137
thirdPartyAudit.enabled = false
170138

@@ -180,6 +148,11 @@ if (project != rootProject) {
180148
distribution project(':distribution:archives:linux-tar')
181149
distribution project(':distribution:archives:oss-linux-tar')
182150
}
151+
152+
// for external projects we want to remove the marker file indicating we are running the Elasticsearch project
153+
processResources {
154+
exclude 'buildSrc.marker'
155+
}
183156

184157
String localDownloads = "${rootProject.buildDir}/local-downloads"
185158
task setupLocalDownloads(type:Copy) {
@@ -209,7 +182,7 @@ if (project != rootProject) {
209182
if (isLuceneSnapshot) {
210183
systemProperty 'test.lucene-snapshot-revision', isLuceneSnapshot[0][1]
211184
}
212-
maxParallelForks System.getProperty('tests.jvms', project.rootProject.ext.defaultParallel.toString()) as Integer
185+
maxParallelForks System.getProperty('tI', project.rootProject.ext.defaultParallel.toString()) as Integer
213186
}
214187
check.dependsOn(integTest)
215188

0 commit comments

Comments
 (0)