Skip to content

Commit bfedbbb

Browse files
committed
Merge remote-tracking branch 'elastic/master' into geosql
2 parents 76be286 + a3cb741 commit bfedbbb

File tree

274 files changed

+10835
-778
lines changed

Some content is hidden

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

274 files changed

+10835
-778
lines changed

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
2828

2929
plugins {
3030
id 'com.gradle.build-scan' version '1.13.2'
31+
id 'base'
3132
}
3233
if (properties.get("org.elasticsearch.acceptScanTOS", "false") == "true") {
3334
buildScan {
@@ -37,7 +38,7 @@ if (properties.get("org.elasticsearch.acceptScanTOS", "false") == "true") {
3738
}
3839

3940
// common maven publishing configuration
40-
subprojects {
41+
allprojects {
4142
group = 'org.elasticsearch'
4243
version = VersionProperties.elasticsearch
4344
description = "Elasticsearch subproject ${project.path}"
@@ -185,7 +186,7 @@ task branchConsistency {
185186
dependsOn verifyVersions, verifyBwcTestsEnabled
186187
}
187188

188-
subprojects {
189+
allprojects {
189190
// ignore missing javadocs
190191
tasks.withType(Javadoc) { Javadoc javadoc ->
191192
// the -quiet here is because of a bug in gradle, in that adding a string option
@@ -288,7 +289,7 @@ subprojects {
288289
if (dep.group == null || false == dep.group.startsWith('org.elasticsearch')) {
289290
return
290291
}
291-
Project upstreamProject = dependencyToProject(dep)
292+
Project upstreamProject = project.ext.dependencyToProject(dep)
292293
if (upstreamProject == null) {
293294
return
294295
}

buildSrc/build.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ compileMinimumRuntimeGroovy {
8989
sourceCompatibility = minimumRuntimeVersion
9090
}
9191
dependencies {
92-
compile sourceSets.minimumRuntime.output
92+
if (project.ext.has("isEclipse") == false || project.ext.isEclipse == false) {
93+
// eclipse is confused if this is set explicitly
94+
compile sourceSets.minimumRuntime.output
95+
}
9396
minimumRuntimeCompile "junit:junit:${props.getProperty('junit')}"
9497
minimumRuntimeCompile localGroovy()
9598
}
@@ -142,7 +145,6 @@ if (project == rootProject) {
142145
if (System.getProperty("repos.mavenLocal") != null) {
143146
mavenLocal()
144147
}
145-
mavenCentral()
146148
}
147149
test {
148150
include "**/*Tests.class"
@@ -193,6 +195,7 @@ if (project != rootProject) {
193195
).asPath,
194196
)
195197
systemProperty 'test.local-test-repo-path', "${rootProject.buildDir}/local-test-repo"
198+
systemProperty 'test.version_under_test', version
196199
systemProperty 'test.lucene-snapshot-revision', (versions.lucene =~ /\w+-snapshot-([a-z0-9]+)/)[0][1]
197200
}
198201
check.dependsOn(integTest)
@@ -245,7 +248,7 @@ class VersionPropertiesLoader {
245248
elasticsearch
246249
)
247250
}
248-
String qualifier = systemProperties.getProperty("build.version_qualifier", "alpha1");
251+
String qualifier = systemProperties.getProperty("build.version_qualifier", "");
249252
if (qualifier.isEmpty() == false) {
250253
if (qualifier.matches("(alpha|beta|rc)\\d+") == false) {
251254
throw new IllegalStateException("Invalid qualifier: " + qualifier)
@@ -257,4 +260,4 @@ class VersionPropertiesLoader {
257260
}
258261
loadedProps.put("elasticsearch", elasticsearch)
259262
}
260-
}
263+
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class BuildPlugin implements Plugin<Project> {
6666
void apply(Project project) {
6767
if (project.pluginManager.hasPlugin('elasticsearch.standalone-rest-test')) {
6868
throw new InvalidUserDataException('elasticsearch.standalone-test, '
69-
+ 'elasticearch.standalone-rest-test, and elasticsearch.build '
69+
+ 'elasticsearch.standalone-rest-test, and elasticsearch.build '
7070
+ 'are mutually exclusive')
7171
}
7272
final String minimumGradleVersion
@@ -442,7 +442,7 @@ class BuildPlugin implements Plugin<Project> {
442442
// such that we don't have to pass hardcoded files to gradle
443443
repos.mavenLocal()
444444
}
445-
repos.mavenCentral()
445+
repos.jcenter()
446446
repos.maven {
447447
name "elastic"
448448
url "https://artifacts.elastic.co/maven"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ class ClusterFormationTasks {
343343
if (minimumMasterNodes > 0) {
344344
esConfig['discovery.zen.minimum_master_nodes'] = minimumMasterNodes
345345
}
346-
if (node.config.numNodes > 1) {
346+
if (minimumMasterNodes > 1) {
347347
// don't wait for state.. just start up quickly
348348
// this will also allow new and old nodes in the BWC case to become the master
349349
esConfig['discovery.initial_state_timeout'] = '0s'
@@ -719,7 +719,7 @@ class ClusterFormationTasks {
719719
unicastHosts.addAll(node.config.otherUnicastHostAddresses.call())
720720
String unicastHost = node.config.unicastTransportUri(node, null, project.ant)
721721
if (unicastHost != null) {
722-
unicastHosts.addAll(Arrays.asList(unicastHost.split(",")))
722+
unicastHosts.add(unicastHost)
723723
}
724724
}
725725
String unicastHostsTxt = String.join("\n", unicastHosts)

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ class VagrantTestPlugin implements Plugin<Project> {
159159
private static void configurePackagingArchiveRepositories(Project project) {
160160
RepositoryHandler repos = project.repositories
161161

162-
// Try maven central first, it'll have releases before 5.0.0
163-
repos.mavenCentral()
162+
repos.jcenter() // will have releases before 5.0.0
164163

165164
/* Setup a repository that tries to download from
166165
https://artifacts.elastic.co/downloads/elasticsearch/[module]-[revision].[ext]

buildSrc/src/main/java/org/elasticsearch/GradleServicesAdapter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.gradle.api.Action;
2222
import org.gradle.api.Project;
2323
import org.gradle.api.file.CopySpec;
24+
import org.gradle.api.file.FileCollection;
2425
import org.gradle.api.file.FileTree;
2526
import org.gradle.api.tasks.WorkResult;
2627
import org.gradle.process.ExecResult;
@@ -29,7 +30,7 @@
2930
import java.io.File;
3031

3132
/**
32-
* Facilitate access to Gradle services without a direct dependency on Project.
33+
* Bridge a gap until Gradle offers service injection for plugins.
3334
*
3435
* In a future release Gradle will offer service injection, this adapter plays that role until that time.
3536
* It exposes the service methods that are part of the public API as the classes implementing them are not.
@@ -65,4 +66,8 @@ public ExecResult javaexec(Action<? super JavaExecSpec> action) {
6566
public FileTree zipTree(File zipPath) {
6667
return project.zipTree(zipPath);
6768
}
69+
70+
public FileCollection fileTree(File dir) {
71+
return project.fileTree(dir);
72+
}
6873
}

buildSrc/src/main/java/org/elasticsearch/gradle/Distribution.java

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

2121
public enum Distribution {
2222

23-
INTEG_TEST("integ-test-zip"),
24-
ZIP("zip"),
25-
ZIP_OSS("zip-oss");
23+
INTEG_TEST("integ-test"),
24+
ZIP("elasticsearch"),
25+
ZIP_OSS("elasticsearch-oss");
2626

27-
private final String name;
27+
private final String fileName;
2828

2929
Distribution(String name) {
30-
this.name = name;
30+
this.fileName = name;
3131
}
3232

33-
public String getName() {
34-
return name;
33+
public String getFileName() {
34+
return fileName;
3535
}
3636
}

buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java

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

2121
import org.elasticsearch.GradleServicesAdapter;
2222
import org.elasticsearch.gradle.Distribution;
23-
import org.elasticsearch.gradle.Version;
2423
import org.gradle.api.logging.Logger;
2524
import org.gradle.api.logging.Logging;
2625

@@ -35,7 +34,7 @@ public class ElasticsearchNode {
3534
private final Logger logger = Logging.getLogger(ElasticsearchNode.class);
3635

3736
private Distribution distribution;
38-
private Version version;
37+
private String version;
3938

4039
public ElasticsearchNode(String name, GradleServicesAdapter services) {
4140
this.name = name;
@@ -46,11 +45,11 @@ public String getName() {
4645
return name;
4746
}
4847

49-
public Version getVersion() {
48+
public String getVersion() {
5049
return version;
5150
}
5251

53-
public void setVersion(Version version) {
52+
public void setVersion(String version) {
5453
checkFrozen();
5554
this.version = version;
5655
}
@@ -75,6 +74,7 @@ void stop(boolean tailLogs) {
7574
public void freeze() {
7675
logger.info("Locking configuration of `{}`", this);
7776
configurationFrozen.set(true);
77+
Objects.requireNonNull(version, "Version of test cluster `" + this + "` can't be null");
7878
}
7979

8080
private void checkFrozen() {
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.elasticsearch.gradle.testclusters;
20+
21+
import org.gradle.api.DefaultTask;
22+
import org.gradle.api.Project;
23+
import org.gradle.api.file.FileCollection;
24+
import org.gradle.api.tasks.InputFiles;
25+
import org.gradle.api.tasks.OutputDirectory;
26+
import org.gradle.api.tasks.TaskAction;
27+
28+
import java.io.File;
29+
import java.util.Set;
30+
import java.util.stream.Collectors;
31+
32+
public class SyncTestClustersConfiguration extends DefaultTask {
33+
34+
@InputFiles
35+
public FileCollection getDependencies() {
36+
Set<File> nonZip = getProject().getConfigurations()
37+
.getByName(TestClustersPlugin.HELPER_CONFIGURATION_NAME)
38+
.getFiles()
39+
.stream()
40+
.filter(file -> file.getName().endsWith(".zip") == false)
41+
.collect(Collectors.toSet());
42+
if(nonZip.isEmpty() == false) {
43+
throw new IllegalStateException("Expected only zip files in configuration : " +
44+
TestClustersPlugin.HELPER_CONFIGURATION_NAME + " but found " +
45+
nonZip
46+
);
47+
}
48+
return getProject().files(
49+
getProject().getConfigurations()
50+
.getByName(TestClustersPlugin.HELPER_CONFIGURATION_NAME)
51+
.getFiles()
52+
);
53+
}
54+
55+
@OutputDirectory
56+
public File getOutputDir() {
57+
return getTestClustersConfigurationExtractDir(getProject());
58+
}
59+
60+
@TaskAction
61+
public void doExtract() {
62+
File outputDir = getOutputDir();
63+
getProject().delete(outputDir);
64+
outputDir.mkdirs();
65+
getDependencies().forEach(dep ->
66+
getProject().copy(spec -> {
67+
spec.from(getProject().zipTree(dep));
68+
spec.into(new File(outputDir, "zip"));
69+
})
70+
);
71+
}
72+
73+
static File getTestClustersConfigurationExtractDir(Project project) {
74+
return new File(TestClustersPlugin.getTestClustersBuildDir(project), "extract");
75+
}
76+
77+
}

0 commit comments

Comments
 (0)