Skip to content

Commit

Permalink
Merge remote-tracking branch 'es/master' into ccr
Browse files Browse the repository at this point in the history
* es/master:
  Watcher: Fold two smoke test projects into smoke-test-watcher (#30137)
  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)
  Build: Assert jar LICENSE and NOTICE files match
  Correct transport compression algorithm in docs (#29645)
  [Test] Fix docs check for DEB package in packaging tests (#30126)
  Painless: Docs Clean Up (#29592)
  Fixes Eclipse build for sql jdbc project (#30114)
  Remove reference to `not_analyzed`.
  [Docs] Add community analysis plugin (#29612)
  • Loading branch information
martijnvg committed Apr 26, 2018
2 parents b126ffa + fadcce8 commit 4bcecd3
Show file tree
Hide file tree
Showing 53 changed files with 504 additions and 409 deletions.
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ nbactions.xml
.gradle/
build/

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

# testing stuff
**/.local*
Expand All @@ -43,4 +41,3 @@ html_docs
# random old stuff that we should look at the necessity of...
/tmp/
eclipse-build

55 changes: 55 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import org.apache.tools.ant.taskdefs.condition.Os
import org.elasticsearch.gradle.BuildPlugin
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionCollection
import org.elasticsearch.gradle.VersionProperties
Expand All @@ -30,6 +31,7 @@ import org.gradle.api.tasks.wrapper.Wrapper.DistributionType
import org.gradle.util.GradleVersion
import org.gradle.util.DistributionLocator

import java.nio.file.Files
import java.nio.file.Path
import java.security.MessageDigest

Expand Down Expand Up @@ -459,6 +461,59 @@ gradle.projectsEvaluated {

}

static void assertLinesInFile(final Path path, final List<String> expectedLines) {
final List<String> actualLines = Files.readAllLines(path)
int line = 0
for (final String expectedLine : expectedLines) {
final String actualLine = actualLines.get(line)
if (expectedLine != actualLine) {
throw new GradleException("expected line [${line + 1}] in [${path}] to be [${expectedLine}] but was [${actualLine}]")
}
line++
}
}

/*
* Check that all generated JARs have our NOTICE.txt and an appropriate
* LICENSE.txt in them. We configurate this in gradle but we'd like to
* be extra paranoid.
*/
subprojects { project ->
project.tasks.withType(Jar).whenTaskAdded { jarTask ->
final Task extract = project.task("extract${jarTask.name.capitalize()}", type: LoggedExec) {
dependsOn jarTask
ext.destination = project.buildDir.toPath().resolve("jar-extracted/${jarTask.name}")
commandLine "${->new File(rootProject.compilerJavaHome, 'bin/jar')}",
'xf', "${-> jarTask.outputs.files.singleFile}", 'META-INF/LICENSE.txt', 'META-INF/NOTICE.txt'
workingDir destination
doFirst {
project.delete(destination)
Files.createDirectories(destination)
}
}

final Task checkNotice = project.task("verify${jarTask.name.capitalize()}Notice") {
dependsOn extract
doLast {
final List<String> noticeLines = Files.readAllLines(project.noticeFile.toPath())
final Path noticePath = extract.destination.resolve('META-INF/NOTICE.txt')
assertLinesInFile(noticePath, noticeLines)
}
}
project.check.dependsOn checkNotice

final Task checkLicense = project.task("verify${jarTask.name.capitalize()}License") {
dependsOn extract
doLast {
final List<String> licenseLines = Files.readAllLines(project.licenseFile.toPath())
final Path licensePath = extract.destination.resolve('META-INF/LICENSE.txt')
assertLinesInFile(licensePath, licenseLines)
}
}
project.check.dependsOn checkLicense
}
}

/* Remove assemble on all qa projects because we don't need to publish
* artifacts for them. */
gradle.projectsEvaluated {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,16 +563,17 @@ class ClusterFormationTasks {

/** Adds a task to execute a command to help setup the cluster */
static Task configureExecTask(String name, Project project, Task setup, NodeInfo node, Object[] execArgs) {
return project.tasks.create(name: name, type: LoggedExec, dependsOn: setup) {
workingDir node.cwd
return project.tasks.create(name: name, type: LoggedExec, dependsOn: setup) { Exec exec ->
exec.workingDir node.cwd
exec.environment 'JAVA_HOME', node.getJavaHome()
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
executable 'cmd'
args '/C', 'call'
exec.executable 'cmd'
exec.args '/C', 'call'
// On Windows the comma character is considered a parameter separator:
// argument are wrapped in an ExecArgWrapper that escapes commas
args execArgs.collect { a -> new EscapeCommaWrapper(arg: a) }
exec.args execArgs.collect { a -> new EscapeCommaWrapper(arg: a) }
} else {
commandLine execArgs
exec.commandLine execArgs
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions client/rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.elasticsearch.gradle.precommit.PrecommitTasks

apply plugin: 'elasticsearch.build'
apply plugin: 'ru.vyarus.animalsniffer'
apply plugin: 'nebula.maven-base-publish'
apply plugin: 'nebula.maven-scm'

Expand Down Expand Up @@ -52,8 +51,6 @@ dependencies {
testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}"
testCompile "org.elasticsearch:securemock:${versions.securemock}"
testCompile "org.elasticsearch:mocksocket:${versions.mocksocket}"
testCompile "org.codehaus.mojo:animal-sniffer-annotations:1.15"
signature "org.codehaus.mojo.signature:java17:1.0@signature"
}

forbiddenApisMain {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
import org.apache.http.HttpHost;
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
import org.elasticsearch.mocksocket.MockHttpServer;
import org.junit.AfterClass;
import org.junit.BeforeClass;
Expand All @@ -46,8 +45,6 @@
/**
* Integration test to validate the builder builds a client with the correct configuration
*/
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
@IgnoreJRERequirement
public class RestClientBuilderIntegTests extends RestClientTestCase {

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

//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
@IgnoreJRERequirement
private static class ResponseHandler implements HttpHandler {
@Override
public void handle(HttpExchange httpExchange) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import org.apache.http.HttpHost;
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
import org.elasticsearch.mocksocket.MockHttpServer;
import org.junit.AfterClass;
import org.junit.Before;
Expand All @@ -48,8 +47,6 @@
* Integration test to check interaction between {@link RestClient} and {@link org.apache.http.client.HttpClient}.
* Works against real http servers, multiple hosts. Also tests failover by randomly shutting down hosts.
*/
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
@IgnoreJRERequirement
public class RestClientMultipleHostsIntegTests extends RestClientTestCase {

private static HttpServer[] httpServers;
Expand Down Expand Up @@ -90,8 +87,6 @@ private static HttpServer createHttpServer() throws Exception {
return httpServer;
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.apache.http.util.EntityUtils;
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
import org.elasticsearch.mocksocket.MockHttpServer;
import org.junit.AfterClass;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -64,8 +63,6 @@
* Integration test to check interaction between {@link RestClient} and {@link org.apache.http.client.HttpClient}.
* Works against a real http server, one single host.
*/
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
@IgnoreJRERequirement
public class RestClientSingleHostIntegTests extends RestClientTestCase {

private static HttpServer httpServer;
Expand All @@ -91,8 +88,6 @@ private static HttpServer createHttpServer() throws Exception {
return httpServer;
}

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

Expand Down
7 changes: 2 additions & 5 deletions distribution/archives/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ subprojects {
}
final List<String> licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename))
final Path licensePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/LICENSE.txt")
final List<String> actualLines = Files.readAllLines(licensePath)
assertLinesInFile(licensePath, actualLines, licenseLines)
assertLinesInFile(licensePath, licenseLines)
}
}
check.dependsOn checkLicense
Expand All @@ -213,8 +212,7 @@ subprojects {
doLast {
final List<String> noticeLines = Arrays.asList("Elasticsearch", "Copyright 2009-2018 Elasticsearch")
final Path noticePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/NOTICE.txt")
final List<String> actualLines = Files.readAllLines(noticePath)
assertLinesInFile(noticePath, actualLines, noticeLines)
assertLinesInFile(noticePath, noticeLines)
}
}
check.dependsOn checkNotice
Expand Down Expand Up @@ -304,4 +302,3 @@ configure(subprojects.findAll { it.name.contains('zip') }) {
}
}
}

11 changes: 0 additions & 11 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -460,14 +460,3 @@ subprojects {
return result
}
}

static void assertLinesInFile(final Path path, final List<String> actualLines, final List<String> expectedLines) {
int line = 0
for (final String expectedLine : expectedLines) {
final String actualLine = actualLines.get(line)
if (expectedLine != actualLine) {
throw new GradleException("expected line [${line + 1}] in [${path}] to be [${expectedLine}] but was [${actualLine}]")
}
line++
}
}
9 changes: 3 additions & 6 deletions distribution/packages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,7 @@ subprojects {
"License: " + expectedLicense)
final List<String> licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename))
final List<String> expectedLines = header + licenseLines.collect { " " + it }
final List<String> actualLines = Files.readAllLines(copyrightPath)
assertLinesInFile(copyrightPath, actualLines, expectedLines)
assertLinesInFile(copyrightPath, expectedLines)
}
}
} else {
Expand All @@ -432,8 +431,7 @@ subprojects {
}
final List<String> licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename))
final Path licensePath = packageExtractionDir.toPath().resolve("usr/share/elasticsearch/LICENSE.txt")
final List<String> actualLines = Files.readAllLines(licensePath)
assertLinesInFile(licensePath, actualLines, licenseLines)
assertLinesInFile(licensePath, licenseLines)
}
}
}
Expand All @@ -444,8 +442,7 @@ subprojects {
doLast {
final List<String> noticeLines = Arrays.asList("Elasticsearch", "Copyright 2009-2018 Elasticsearch")
final Path noticePath = packageExtractionDir.toPath().resolve("usr/share/elasticsearch/NOTICE.txt")
final List<String> actualLines = Files.readAllLines(noticePath)
assertLinesInFile(noticePath, actualLines, noticeLines)
assertLinesInFile(noticePath, noticeLines)
}
}
check.dependsOn checkNotice
Expand Down
22 changes: 11 additions & 11 deletions docs/painless/painless-comments.asciidoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[[painless-comments]]
=== Comments

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

*Grammar*
[source,ANTLR4]
Expand All @@ -17,17 +17,17 @@ MULTI_LINE_COMMENT: '/*' .*? '*/';

*Examples*

Single-line comments.

* Single-line comments.
+
[source,Painless]
----
// single-line comment
int value; // single-line comment
----

Multi-line comments.

+
* Multi-line comments.
+
[source,Painless]
----
/* multi-
Expand Down
29 changes: 29 additions & 0 deletions docs/painless/painless-identifiers.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[[painless-identifiers]]
=== Identifiers

Specify identifiers to <<declaration, declare>>, <<assignment, assign>>, and
<<painless-operators, use>> variables, <<dot-operator, access fields>>, and
<<dot-operator, call methods>>. <<painless-keywords, Keywords>> and
<<painless-types, types>> cannot be used as identifiers.

*Grammar*
[source,ANTLR4]
----
ID: [_a-zA-Z] [_a-zA-Z-0-9]*;
----

*Examples*

* Variations of identifiers.
+
[source,Painless]
----
a
Z
id
list
list0
MAP25
_map25
Map_25
----
4 changes: 2 additions & 2 deletions docs/painless/painless-keywords.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
=== Keywords

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

[cols="^1,^1,^1,^1,^1"]
|====
Expand Down
2 changes: 2 additions & 0 deletions docs/painless/painless-lang-spec.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ include::painless-keywords.asciidoc[]

include::painless-literals.asciidoc[]

include::painless-identifiers.asciidoc[]

include::painless-variables.asciidoc[]

include::painless-types.asciidoc[]
Expand Down
Loading

0 comments on commit 4bcecd3

Please sign in to comment.