Skip to content

Commit 067fb59

Browse files
author
Jim Crowley
authored
Merge pull request #1 from elastic/master
Merge Remote Tracking Branch
2 parents b8ca70b + e593f3e commit 067fb59

File tree

356 files changed

+8434
-2084
lines changed

Some content is hidden

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

356 files changed

+8434
-2084
lines changed

.ci/dockerOnLinuxExclusions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# (as is the case on centos-6, for example) then that OS will again be
66
# excluded.
77
debian-8
8-
opensuse-15-1
8+
opensuse-leap-15.1
99
ol-7.7
1010
sles-12.3 # older version used in Vagrant image
1111
sles-12.5

.ci/java-versions.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
# build and test Elasticsearch for this branch. Valid Java versions
55
# are 'java' or 'openjdk' followed by the major release number.
66

7-
ES_BUILD_JAVA=openjdk13
7+
ES_BUILD_JAVA=openjdk14
88
ES_RUNTIME_JAVA=openjdk11
99
GRADLE_TASK=build

.ci/jobs.t/defaults.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
JAVA11_HOME=$HOME/.java/java11
5050
JAVA12_HOME=$HOME/.java/openjdk12
5151
JAVA13_HOME=$HOME/.java/openjdk13
52+
JAVA14_HOME=$HOME/.java/openjdk14
5253
GRADLE_OPTS=-XX:+HeapDumpOnOutOfMemoryError -Xmx128m -Xms128m
5354
properties:
5455
- github:

.ci/packer_cache.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ export JAVA8_HOME="${HOME}"/.java/java8
2222
export JAVA11_HOME="${HOME}"/.java/java11
2323
export JAVA12_HOME="${HOME}"/.java/openjdk12
2424
export JAVA13_HOME="${HOME}"/.java/openjdk13
25+
export JAVA14_HOME="${HOME}"/.java/openjdk14
2526
./gradlew --parallel clean -s resolveAllDependencies
2627

.idea/runConfigurations/Debug_Elasticsearch.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CONTRIBUTING.md

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ Contributing to the Elasticsearch codebase
9292

9393
**Repository:** [https://github.com/elastic/elasticsearch](https://github.com/elastic/elasticsearch)
9494

95-
JDK 13 is required to build Elasticsearch. You must have a JDK 13 installation
95+
JDK 14 is required to build Elasticsearch. You must have a JDK 14 installation
9696
with the environment variable `JAVA_HOME` referencing the path to Java home for
97-
your JDK 13 installation. By default, tests use the same runtime as `JAVA_HOME`.
97+
your JDK 14 installation. By default, tests use the same runtime as `JAVA_HOME`.
9898
However, since Elasticsearch supports JDK 11, the build supports compiling with
99-
JDK 13 and testing on a JDK 11 runtime; to do this, set `RUNTIME_JAVA_HOME`
99+
JDK 14 and testing on a JDK 11 runtime; to do this, set `RUNTIME_JAVA_HOME`
100100
pointing to the Java home of a JDK 11 installation. Note that this mechanism can
101101
be used to test against other JDKs as well, this is not only limited to JDK 11.
102102

@@ -109,8 +109,7 @@ script on Windows in the root of the repository. The examples below show the
109109
usage on Unix.
110110

111111
We support development in IntelliJ versions IntelliJ 2019.2 and
112-
onwards. We would like to support Eclipse, but few of us use it and has fallen
113-
into [disrepair][eclipse].
112+
onwards and Eclipse 2020-3 and onwards.
114113

115114
[Docker](https://docs.docker.com/install/) is required for building some Elasticsearch artifacts and executing certain test suites. You can run Elasticsearch without building all the artifacts with:
116115

@@ -122,9 +121,9 @@ You can access Elasticsearch with:
122121

123122
### Importing the project into IntelliJ IDEA
124123

125-
Elasticsearch builds using Java 13. When importing into IntelliJ you will need
124+
Elasticsearch builds using Java 14. When importing into IntelliJ you will need
126125
to define an appropriate SDK. The convention is that **this SDK should be named
127-
"13"** so that the project import will detect it automatically. For more details
126+
"14"** so that the project import will detect it automatically. For more details
128127
on defining an SDK in IntelliJ please refer to [their documentation](https://www.jetbrains.com/help/idea/sdk.html#define-sdk).
129128
SDK definitions are global, so you can add the JDK from any project, or after
130129
project import. Importing with a missing JDK will still work, IntelliJ will
@@ -136,6 +135,62 @@ You can import the Elasticsearch project into IntelliJ IDEA via:
136135
- In the subsequent dialog navigate to the root `build.gradle` file
137136
- In the subsequent dialog select **Open as Project**
138137

138+
### Importing the project into Eclipse
139+
140+
Elasticsearch builds using Gradle and Java 13. When importing into Eclipse you
141+
will either need to use an appropriate JDK to run Eclipse itself (e.g. by
142+
specifying the VM in [eclipse.ini](https://wiki.eclipse.org/Eclipse.ini) or by
143+
defining the JDK Gradle uses by setting **Prefercences** > **Gradle** >
144+
**Advanced Options** > **Java home** to an appropriate version.
145+
146+
IMPORTANT: If you have previously imported the project by running `./gradlew eclipse`
147+
then you must build an entirely new workspace and `git clean -xdf` to
148+
blow away *everything* that the gradle eclipse plugin made.
149+
150+
- Select **File > Import...**
151+
- Select **Existing Gradle Project**
152+
- Select **Next** then **Next** again
153+
- Set the **Project root directory** to the root of your elasticsearch clone
154+
- Click **Finish**
155+
156+
This will spin for a long, long time but you'll see many errors about circular
157+
dependencies. Fix them:
158+
159+
- Select **Window > Preferences**
160+
- Select **Java > Compiler > Building**
161+
- Look under **Build Path Problems**
162+
- Set **Circular dependencies** to **Warning**
163+
- Apply that and let the build spin away for a while
164+
165+
Next you'll want to import our auto-formatter:
166+
167+
- Select **Window > Preferences**
168+
- Select **Java > Code Style > Formater**
169+
- Click **Import**
170+
- Import the file at **buildSrc/formatterConfig.xml**
171+
- Make sure it is the **Active profile**
172+
173+
Finally, set up import order:
174+
175+
- Select **Window > Preferences**
176+
- Select **Java > Code Style > Organize Imports**
177+
- Click **Import...**
178+
- Import the file at **buildSrc/elastic.importorder**
179+
- Set the **Number of imports needed for `.*`** to ***9999***
180+
- Set the **Number of static imports needed for `.*`** to ***9999*** as well
181+
- Apply that
182+
183+
IMPORTANT: There is an option in **Gradle** for **Automatic Project Synchronization**.
184+
As convenient as it'd be for the projects to always be perfect this
185+
tends to add many many seconds to every branch change. Instead, you
186+
should manually right click on a project and
187+
**Gradle > Refresh Gradle Project** if the configuration is out of
188+
date.
189+
190+
As we add more subprojects you might have to re-import the gradle project (the
191+
first step) again. There is no need to blow away the existing projects before
192+
doing that.
193+
139194
### REST Endpoint Conventions
140195

141196
Elasticsearch typically uses singular nouns rather than plurals in URLs.
@@ -551,4 +606,3 @@ non-documentation contribution. This is mentioned above, but it is worth
551606
repeating in this section because it has come up in this context.
552607

553608
[intellij]: https://blog.jetbrains.com/idea/2017/07/intellij-idea-2017-2-is-here-smart-sleek-and-snappy/
554-
[eclipse]: https://github.com/elastic/elasticsearch/issues/53664

build.gradle

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import org.elasticsearch.gradle.BuildPlugin
2525
import org.elasticsearch.gradle.BwcVersions
2626
import org.elasticsearch.gradle.Version
2727
import org.elasticsearch.gradle.VersionProperties
28+
import org.elasticsearch.gradle.info.BuildParams
2829
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
2930
import org.gradle.plugins.ide.eclipse.model.AccessRule
3031
import org.gradle.plugins.ide.eclipse.model.SourceFolder
@@ -37,10 +38,9 @@ plugins {
3738
id 'lifecycle-base'
3839
id 'elasticsearch.docker-support'
3940
id 'elasticsearch.global-build-info'
40-
id "com.diffplug.gradle.spotless" version "3.24.2" apply false
41+
id "com.diffplug.gradle.spotless" version "3.28.0" apply false
4142
}
4243

43-
apply plugin: 'nebula.info-scm'
4444
apply from: 'gradle/build-scan.gradle'
4545
apply from: 'gradle/build-complete.gradle'
4646
apply from: 'gradle/runtime-jdk-provision.gradle'
@@ -59,7 +59,7 @@ BuildPlugin.configureRepositories(project)
5959

6060
String licenseCommit
6161
if (VersionProperties.elasticsearch.toString().endsWith('-SNAPSHOT')) {
62-
licenseCommit = scminfo.change ?: "master" // leniency for non git builds
62+
licenseCommit = BuildParams.gitRevision ?: "master" // leniency for non git builds
6363
} else {
6464
licenseCommit = "v${version}"
6565
}
@@ -405,6 +405,14 @@ class Run extends DefaultTask {
405405
public void setDataDir(String dataDirStr) {
406406
project.project(':distribution').run.dataDir = dataDirStr
407407
}
408+
409+
@Option(
410+
option = "keystore-password",
411+
description = "Set the elasticsearch keystore password"
412+
)
413+
public void setKeystorePassword(String password) {
414+
project.project(':distribution').run.keystorePassword = password
415+
}
408416
}
409417

410418
task run(type: Run) {

buildSrc/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ dependencies {
114114

115115
compile 'com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3'
116116
compile 'com.netflix.nebula:nebula-publishing-plugin:4.4.4'
117-
compile 'com.netflix.nebula:gradle-info-plugin:5.1.0'
118-
compile 'org.eclipse.jgit:org.eclipse.jgit:5.5.0.201909110433-r'
119-
compile 'com.netflix.nebula:gradle-info-plugin:3.0.3'
120-
compile 'com.perforce:p4java:2012.3.551082' // THIS IS SUPPOSED TO BE OPTIONAL IN THE FUTURE....
117+
compile 'com.netflix.nebula:gradle-info-plugin:7.1.3'
121118
compile 'org.apache.rat:apache-rat:0.11'
122119
compile "org.elasticsearch:jna:4.5.1"
123120
compile 'com.github.jengelman.gradle.plugins:shadow:5.1.0'

buildSrc/elastic.importorder

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#Eclipse configuration for import order for Elasticsearch
2+
0=
3+
1=com
4+
2=org
5+
3=java
6+
4=javax
7+
5=\#

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

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.github.jengelman.gradle.plugins.shadow.ShadowExtension
2323
import com.github.jengelman.gradle.plugins.shadow.ShadowJavaPlugin
2424
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2525
import groovy.transform.CompileStatic
26+
import nebula.plugin.info.InfoBrokerPlugin
2627
import org.apache.commons.io.IOUtils
2728
import org.elasticsearch.gradle.info.BuildParams
2829
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin
@@ -114,13 +115,8 @@ class BuildPlugin implements Plugin<Project> {
114115
}
115116
project.pluginManager.apply('java')
116117
configureConfigurations(project)
117-
configureJars(project) // jar config must be added before info broker
118-
// these plugins add lots of info to our jars
119-
project.pluginManager.apply('nebula.info-broker')
120-
project.pluginManager.apply('nebula.info-basic')
121-
project.pluginManager.apply('nebula.info-java')
122-
project.pluginManager.apply('nebula.info-scm')
123-
project.pluginManager.apply('nebula.info-jar')
118+
configureJars(project)
119+
configureJarManifest(project)
124120

125121
// apply global test task failure listener
126122
project.rootProject.pluginManager.apply(TestFailureReportingPlugin)
@@ -483,7 +479,7 @@ class BuildPlugin implements Plugin<Project> {
483479
}
484480
// ensure javadoc task is run with 'check'
485481
project.pluginManager.withPlugin('lifecycle-base') {
486-
project.tasks.getByName(LifecycleBasePlugin.CHECK_TASK_NAME).dependsOn(project.tasks.withType(Javadoc))
482+
project.tasks.named(LifecycleBasePlugin.CHECK_TASK_NAME).configure { it.dependsOn(project.tasks.withType(Javadoc)) }
487483
}
488484
configureJavadocJar(project)
489485
}
@@ -520,19 +516,15 @@ class BuildPlugin implements Plugin<Project> {
520516
ext.set('noticeFile', null)
521517
project.tasks.withType(Jar).configureEach { Jar jarTask ->
522518
// we put all our distributable files under distributions
523-
jarTask.destinationDir = new File(project.buildDir, 'distributions')
519+
jarTask.destinationDirectory.set(new File(project.buildDir, 'distributions'))
524520
// fixup the jar manifest
525521
jarTask.doFirst {
526522
// this doFirst is added before the info plugin, therefore it will run
527523
// after the doFirst added by the info plugin, and we can override attributes
528524
JavaVersion compilerJavaVersion = BuildParams.compilerJavaVersion
529525
jarTask.manifest.attributes(
530-
'Change': BuildParams.gitRevision,
531-
'X-Compile-Elasticsearch-Version': VersionProperties.elasticsearch,
532-
'X-Compile-Lucene-Version': VersionProperties.lucene,
533-
'X-Compile-Elasticsearch-Snapshot': VersionProperties.isElasticsearchSnapshot(),
534526
'Build-Date': BuildParams.buildDate,
535-
'Build-Java-Version': compilerJavaVersion)
527+
'Build-Java-Version': BuildParams.compilerJavaVersion)
536528
}
537529
}
538530
// add license/notice files
@@ -581,9 +573,22 @@ class BuildPlugin implements Plugin<Project> {
581573
}
582574
}
583575

584-
static void configureTestTasks(Project project) {
585-
ExtraPropertiesExtension ext = project.extensions.getByType(ExtraPropertiesExtension)
576+
static void configureJarManifest(Project project) {
577+
project.pluginManager.apply('nebula.info-broker')
578+
project.pluginManager.apply('nebula.info-basic')
579+
project.pluginManager.apply('nebula.info-java')
580+
project.pluginManager.apply('nebula.info-jar')
586581

582+
project.plugins.withId('nebula.info-broker') { InfoBrokerPlugin manifestPlugin ->
583+
manifestPlugin.add('Module-Origin') { BuildParams.gitOrigin }
584+
manifestPlugin.add('Change') { BuildParams.gitRevision }
585+
manifestPlugin.add('X-Compile-Elasticsearch-Version') { VersionProperties.elasticsearch }
586+
manifestPlugin.add('X-Compile-Lucene-Version') { VersionProperties.lucene }
587+
manifestPlugin.add('X-Compile-Elasticsearch-Snapshot') { VersionProperties.isElasticsearchSnapshot() }
588+
}
589+
}
590+
591+
static void configureTestTasks(Project project) {
587592
// Default test task should run only unit tests
588593
maybeConfigure(project.tasks, 'test', Test) { Test task ->
589594
task.include '**/*Tests.class'

0 commit comments

Comments
 (0)