Skip to content

Commit 950ddc3

Browse files
committed
Merge remote-tracking branch 'es/6.x' into ccr-6.x
* es/6.x: In the field capabilities API, deprecate support for providing fields in the request body. (#30157) Set JAVA_HOME before forking setup commands (#29647) Remove animal sniffer from low-level REST client (#29646) Cleanup .gitignore (#30145) Do not add noop from local translog to translog again (#29637) Painless: Docs Clean Up (#29592) Build: Assert jar LICENSE and NOTICE files match Correct transport compression algorithm in docs (#29645) AwaitsFix for testGradleVersionsMatchVersionUtils [Test] Fix docs check for DEB package in packaging tests (#30126) Remove reference to `not_analyzed`. [Docs] Add community analysis plugin (#29612) [DOCS] Removed differencies between text and code (#27993)
2 parents 85c7cdc + d8d884b commit 950ddc3

File tree

36 files changed

+393
-229
lines changed

36 files changed

+393
-229
lines changed

.gitignore

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ nbactions.xml
2020
.gradle/
2121
build/
2222

23-
# maven stuff (to be removed when trunk becomes 4.x)
24-
*-execution-hints.log
25-
target/
26-
dependency-reduced-pom.xml
23+
# vscode stuff
24+
.vscode/
2725

2826
# testing stuff
2927
**/.local*
@@ -43,4 +41,3 @@ html_docs
4341
# random old stuff that we should look at the necessity of...
4442
/tmp/
4543
eclipse-build
46-

build.gradle

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.apache.tools.ant.taskdefs.condition.Os
2222
import org.elasticsearch.gradle.BuildPlugin
23+
import org.elasticsearch.gradle.LoggedExec
2324
import org.elasticsearch.gradle.Version
2425
import org.elasticsearch.gradle.VersionCollection
2526
import org.elasticsearch.gradle.VersionProperties
@@ -30,6 +31,7 @@ import org.gradle.api.tasks.wrapper.Wrapper.DistributionType
3031
import org.gradle.util.GradleVersion
3132
import org.gradle.util.DistributionLocator
3233

34+
import java.nio.file.Files
3335
import java.nio.file.Path
3436
import java.security.MessageDigest
3537

@@ -463,6 +465,59 @@ gradle.projectsEvaluated {
463465

464466
}
465467

468+
static void assertLinesInFile(final Path path, final List<String> expectedLines) {
469+
final List<String> actualLines = Files.readAllLines(path)
470+
int line = 0
471+
for (final String expectedLine : expectedLines) {
472+
final String actualLine = actualLines.get(line)
473+
if (expectedLine != actualLine) {
474+
throw new GradleException("expected line [${line + 1}] in [${path}] to be [${expectedLine}] but was [${actualLine}]")
475+
}
476+
line++
477+
}
478+
}
479+
480+
/*
481+
* Check that all generated JARs have our NOTICE.txt and an appropriate
482+
* LICENSE.txt in them. We configurate this in gradle but we'd like to
483+
* be extra paranoid.
484+
*/
485+
subprojects { project ->
486+
project.tasks.withType(Jar).whenTaskAdded { jarTask ->
487+
final Task extract = project.task("extract${jarTask.name.capitalize()}", type: LoggedExec) {
488+
dependsOn jarTask
489+
ext.destination = project.buildDir.toPath().resolve("jar-extracted/${jarTask.name}")
490+
commandLine "${->new File(rootProject.compilerJavaHome, 'bin/jar')}",
491+
'xf', "${-> jarTask.outputs.files.singleFile}", 'META-INF/LICENSE.txt', 'META-INF/NOTICE.txt'
492+
workingDir destination
493+
doFirst {
494+
project.delete(destination)
495+
Files.createDirectories(destination)
496+
}
497+
}
498+
499+
final Task checkNotice = project.task("verify${jarTask.name.capitalize()}Notice") {
500+
dependsOn extract
501+
doLast {
502+
final List<String> noticeLines = Files.readAllLines(project.noticeFile.toPath())
503+
final Path noticePath = extract.destination.resolve('META-INF/NOTICE.txt')
504+
assertLinesInFile(noticePath, noticeLines)
505+
}
506+
}
507+
project.check.dependsOn checkNotice
508+
509+
final Task checkLicense = project.task("verify${jarTask.name.capitalize()}License") {
510+
dependsOn extract
511+
doLast {
512+
final List<String> licenseLines = Files.readAllLines(project.licenseFile.toPath())
513+
final Path licensePath = extract.destination.resolve('META-INF/LICENSE.txt')
514+
assertLinesInFile(licensePath, licenseLines)
515+
}
516+
}
517+
project.check.dependsOn checkLicense
518+
}
519+
}
520+
466521
/* Remove assemble on all qa projects because we don't need to publish
467522
* artifacts for them. */
468523
gradle.projectsEvaluated {

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -567,16 +567,17 @@ class ClusterFormationTasks {
567567

568568
/** Adds a task to execute a command to help setup the cluster */
569569
static Task configureExecTask(String name, Project project, Task setup, NodeInfo node, Object[] execArgs) {
570-
return project.tasks.create(name: name, type: LoggedExec, dependsOn: setup) {
571-
workingDir node.cwd
570+
return project.tasks.create(name: name, type: LoggedExec, dependsOn: setup) { Exec exec ->
571+
exec.workingDir node.cwd
572+
exec.environment 'JAVA_HOME', node.getJavaHome()
572573
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
573-
executable 'cmd'
574-
args '/C', 'call'
574+
exec.executable 'cmd'
575+
exec.args '/C', 'call'
575576
// On Windows the comma character is considered a parameter separator:
576577
// argument are wrapped in an ExecArgWrapper that escapes commas
577-
args execArgs.collect { a -> new EscapeCommaWrapper(arg: a) }
578+
exec.args execArgs.collect { a -> new EscapeCommaWrapper(arg: a) }
578579
} else {
579-
commandLine execArgs
580+
exec.commandLine execArgs
580581
}
581582
}
582583
}

client/rest/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.elasticsearch.gradle.precommit.PrecommitTasks
2121

2222
apply plugin: 'elasticsearch.build'
23-
apply plugin: 'ru.vyarus.animalsniffer'
2423
apply plugin: 'nebula.maven-base-publish'
2524
apply plugin: 'nebula.maven-scm'
2625

@@ -52,8 +51,6 @@ dependencies {
5251
testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}"
5352
testCompile "org.elasticsearch:securemock:${versions.securemock}"
5453
testCompile "org.elasticsearch:mocksocket:${versions.mocksocket}"
55-
testCompile "org.codehaus.mojo:animal-sniffer-annotations:1.15"
56-
signature "org.codehaus.mojo.signature:java17:1.0@signature"
5754
}
5855

5956
forbiddenApisMain {

client/rest/src/test/java/org/elasticsearch/client/RestClientBuilderIntegTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.sun.net.httpserver.HttpsConfigurator;
2525
import com.sun.net.httpserver.HttpsServer;
2626
import org.apache.http.HttpHost;
27-
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
2827
import org.elasticsearch.mocksocket.MockHttpServer;
2928
import org.junit.AfterClass;
3029
import org.junit.BeforeClass;
@@ -46,8 +45,6 @@
4645
/**
4746
* Integration test to validate the builder builds a client with the correct configuration
4847
*/
49-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
50-
@IgnoreJRERequirement
5148
public class RestClientBuilderIntegTests extends RestClientTestCase {
5249

5350
private static HttpsServer httpsServer;
@@ -60,8 +57,6 @@ public static void startHttpServer() throws Exception {
6057
httpsServer.start();
6158
}
6259

63-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
64-
@IgnoreJRERequirement
6560
private static class ResponseHandler implements HttpHandler {
6661
@Override
6762
public void handle(HttpExchange httpExchange) throws IOException {

client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.sun.net.httpserver.HttpHandler;
2424
import com.sun.net.httpserver.HttpServer;
2525
import org.apache.http.HttpHost;
26-
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
2726
import org.elasticsearch.mocksocket.MockHttpServer;
2827
import org.junit.AfterClass;
2928
import org.junit.Before;
@@ -48,8 +47,6 @@
4847
* Integration test to check interaction between {@link RestClient} and {@link org.apache.http.client.HttpClient}.
4948
* Works against real http servers, multiple hosts. Also tests failover by randomly shutting down hosts.
5049
*/
51-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
52-
@IgnoreJRERequirement
5350
public class RestClientMultipleHostsIntegTests extends RestClientTestCase {
5451

5552
private static HttpServer[] httpServers;
@@ -90,8 +87,6 @@ private static HttpServer createHttpServer() throws Exception {
9087
return httpServer;
9188
}
9289

93-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
94-
@IgnoreJRERequirement
9590
private static class ResponseHandler implements HttpHandler {
9691
private final int statusCode;
9792

client/rest/src/test/java/org/elasticsearch/client/RestClientSingleHostIntegTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.apache.http.impl.client.BasicCredentialsProvider;
3434
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
3535
import org.apache.http.util.EntityUtils;
36-
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
3736
import org.elasticsearch.mocksocket.MockHttpServer;
3837
import org.junit.AfterClass;
3938
import org.junit.BeforeClass;
@@ -64,8 +63,6 @@
6463
* Integration test to check interaction between {@link RestClient} and {@link org.apache.http.client.HttpClient}.
6564
* Works against a real http server, one single host.
6665
*/
67-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
68-
@IgnoreJRERequirement
6966
public class RestClientSingleHostIntegTests extends RestClientTestCase {
7067

7168
private static HttpServer httpServer;
@@ -91,8 +88,6 @@ private static HttpServer createHttpServer() throws Exception {
9188
return httpServer;
9289
}
9390

94-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
95-
@IgnoreJRERequirement
9691
private static class ResponseHandler implements HttpHandler {
9792
private final int statusCode;
9893

distribution/archives/build.gradle

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ subprojects {
201201
}
202202
final List<String> licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename))
203203
final Path licensePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/LICENSE.txt")
204-
final List<String> actualLines = Files.readAllLines(licensePath)
205-
assertLinesInFile(licensePath, actualLines, licenseLines)
204+
assertLinesInFile(licensePath, licenseLines)
206205
}
207206
}
208207
check.dependsOn checkLicense
@@ -213,8 +212,7 @@ subprojects {
213212
doLast {
214213
final List<String> noticeLines = Arrays.asList("Elasticsearch", "Copyright 2009-2018 Elasticsearch")
215214
final Path noticePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/NOTICE.txt")
216-
final List<String> actualLines = Files.readAllLines(noticePath)
217-
assertLinesInFile(noticePath, actualLines, noticeLines)
215+
assertLinesInFile(noticePath, noticeLines)
218216
}
219217
}
220218
check.dependsOn checkNotice
@@ -304,4 +302,3 @@ configure(subprojects.findAll { it.name.contains('zip') }) {
304302
}
305303
}
306304
}
307-

distribution/build.gradle

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,3 @@ subprojects {
460460
return result
461461
}
462462
}
463-
464-
static void assertLinesInFile(final Path path, final List<String> actualLines, final List<String> expectedLines) {
465-
int line = 0
466-
for (final String expectedLine : expectedLines) {
467-
final String actualLine = actualLines.get(line)
468-
if (expectedLine != actualLine) {
469-
throw new GradleException("expected line [${line + 1}] in [${path}] to be [${expectedLine}] but was [${actualLine}]")
470-
}
471-
line++
472-
}
473-
}

distribution/packages/build.gradle

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,7 @@ subprojects {
415415
"License: " + expectedLicense)
416416
final List<String> licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename))
417417
final List<String> expectedLines = header + licenseLines.collect { " " + it }
418-
final List<String> actualLines = Files.readAllLines(copyrightPath)
419-
assertLinesInFile(copyrightPath, actualLines, expectedLines)
418+
assertLinesInFile(copyrightPath, expectedLines)
420419
}
421420
}
422421
} else {
@@ -432,8 +431,7 @@ subprojects {
432431
}
433432
final List<String> licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename))
434433
final Path licensePath = packageExtractionDir.toPath().resolve("usr/share/elasticsearch/LICENSE.txt")
435-
final List<String> actualLines = Files.readAllLines(licensePath)
436-
assertLinesInFile(licensePath, actualLines, licenseLines)
434+
assertLinesInFile(licensePath, licenseLines)
437435
}
438436
}
439437
}
@@ -444,8 +442,7 @@ subprojects {
444442
doLast {
445443
final List<String> noticeLines = Arrays.asList("Elasticsearch", "Copyright 2009-2018 Elasticsearch")
446444
final Path noticePath = packageExtractionDir.toPath().resolve("usr/share/elasticsearch/NOTICE.txt")
447-
final List<String> actualLines = Files.readAllLines(noticePath)
448-
assertLinesInFile(noticePath, actualLines, noticeLines)
445+
assertLinesInFile(noticePath, noticeLines)
449446
}
450447
}
451448
check.dependsOn checkNotice

docs/painless/painless-comments.asciidoc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[[painless-comments]]
22
=== Comments
33

4-
Painless supports both single-line and multi-line comments. Comments can be
5-
included anywhere within a script. Use the `//` token anywhere on a line to
6-
specify a single-line comment. All characters from the `//` token to the end
7-
of the line are ignored. Use an opening `/*` token and a closing `*/` token
8-
to specify a multi-line comment. Multi-line comments can start anywhere on a
9-
line, and all characters in between the `/*` token and `*/` token are ignored.
4+
Use the `//` token anywhere on a line to specify a single-line comment. All
5+
characters from the `//` token to the end of the line are ignored. Use an
6+
opening `/*` token and a closing `*/` token to specify a multi-line comment.
7+
Multi-line comments can start anywhere on a line, and all characters in between
8+
the `/*` token and `*/` token are ignored. Comments can be included anywhere
9+
within a script.
1010

1111
*Grammar*
1212
[source,ANTLR4]
@@ -17,17 +17,17 @@ MULTI_LINE_COMMENT: '/*' .*? '*/';
1717

1818
*Examples*
1919

20-
Single-line comments.
21-
20+
* Single-line comments.
21+
+
2222
[source,Painless]
2323
----
2424
// single-line comment
2525
2626
int value; // single-line comment
2727
----
28-
29-
Multi-line comments.
30-
28+
+
29+
* Multi-line comments.
30+
+
3131
[source,Painless]
3232
----
3333
/* multi-
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[[painless-identifiers]]
2+
=== Identifiers
3+
4+
Specify identifiers to <<declaration, declare>>, <<assignment, assign>>, and
5+
<<painless-operators, use>> variables, <<dot-operator, access fields>>, and
6+
<<dot-operator, call methods>>. <<painless-keywords, Keywords>> and
7+
<<painless-types, types>> cannot be used as identifiers.
8+
9+
*Grammar*
10+
[source,ANTLR4]
11+
----
12+
ID: [_a-zA-Z] [_a-zA-Z-0-9]*;
13+
----
14+
15+
*Examples*
16+
17+
* Variations of identifiers.
18+
+
19+
[source,Painless]
20+
----
21+
a
22+
Z
23+
id
24+
list
25+
list0
26+
MAP25
27+
_map25
28+
Map_25
29+
----

docs/painless/painless-keywords.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
=== Keywords
33

44
The keywords in the table below are reserved for built-in language
5-
features. These keywords cannot be used as <<identifiers, identifiers>> or
6-
<<painless-types, types>>.
5+
features. These keywords cannot be used as
6+
<<painless-identifiers, identifiers>> or <<painless-types, types>>.
77

88
[cols="^1,^1,^1,^1,^1"]
99
|====

docs/painless/painless-lang-spec.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ include::painless-keywords.asciidoc[]
2323

2424
include::painless-literals.asciidoc[]
2525

26+
include::painless-identifiers.asciidoc[]
27+
2628
include::painless-variables.asciidoc[]
2729

2830
include::painless-types.asciidoc[]

0 commit comments

Comments
 (0)