Skip to content

Commit 8047924

Browse files
Merge branch 'repository-encrypted-client-side-reformated' into repository-encrypted-feature-flag
2 parents 5cd760b + c9c67ef commit 8047924

File tree

1,854 files changed

+49313
-12942
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,854 files changed

+49313
-12942
lines changed

.ci/bwcVersions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ BWC_VERSION:
2727
- "7.9.3"
2828
- "7.10.0"
2929
- "7.10.1"
30+
- "7.10.2"
3031
- "7.11.0"
32+
- "7.12.0"
3133
- "8.0.0"

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ indent_size = 2
1313

1414
[*.groovy]
1515
indent_size = 4
16+
max_line_length = 140
1617

1718
[*.java]
1819
indent_size = 4
20+
max_line_length = 140
1921

2022
[*.json]
2123
indent_size = 2

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ testfixtures_shared/
5656

5757
# These are generated from .ci/jobs.t
5858
.ci/jobs/
59+
60+
# Generated
61+
checkstyle_ide.xml

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,45 @@ You can import the Elasticsearch project into IntelliJ IDEA via:
164164
- In the subsequent dialog navigate to the root `build.gradle` file
165165
- In the subsequent dialog select **Open as Project**
166166

167+
#### Checkstyle
168+
169+
If you have the [Checkstyle] plugin installed, you can configure IntelliJ to
170+
check the Elasticsearch code. However, the Checkstyle configuration file does
171+
not work by default with the IntelliJ plugin, so instead an IDE-specific config
172+
file is generated automatically after IntelliJ finishes syncing. You can
173+
manually generate the file with `./gradlew configureIdeCheckstyle` in case
174+
it is removed due to a `./gradlew clean` or other action.
175+
176+
1. Open **Preferences > Tools > Checkstyle**
177+
2. Change the "Scan Scope" to "Only Java sources (including tests)"
178+
3. Check the "+" under "Configuration file"
179+
4. Set "Description" to "Elasticsearch" (or whatever you want)
180+
5. Select "Use a local Checkstyle file"
181+
6. For the "File", enter `checkstyle_ide.xml`
182+
7. Tick "Store relative to project location"
183+
8. Click "Next", then "Finish".
184+
9. Click the box next to the new configuration to make it "Active". Without doing this,
185+
you'll have to explicitly choose the "Elasticsearch" configuration in the Checkstyle
186+
tool window and run the check manually. You can still do this with an active config.
187+
10. Click "OK" to apply the new preferences
188+
189+
#### Formatting
190+
191+
We are in the process of migrating towards automatic formatting Java file
192+
using [spotless], backed by the Eclipse formatter. If you have the [Eclipse
193+
Code Formatter] installed, you can apply formatting directly in IntelliJ.
194+
195+
1. Open **Preferences > Other Settings > Eclipse Code Formatter**
196+
2. Click "Use the Eclipse Code Formatter"
197+
3. Under "Eclipse formatter config", select "Eclipse workspace/project
198+
folder or config file"
199+
4. Click "Browse", and navigate to the file `buildSrc/formatterConfig.xml`
200+
5. Click "OK"
201+
202+
Note that only some sub-projects in the Elasticsearch project are currently
203+
fully-formatted. You can see a list of project that **are not**
204+
automatically formatted in [gradle/formatting.gradle](gradle/formatting.gradle).
205+
167206
### Importing the project into Eclipse
168207

169208
Elasticsearch builds using Gradle and Java 14. When importing into Eclipse you
@@ -699,3 +738,6 @@ non-documentation contribution. This is mentioned above, but it is worth
699738
repeating in this section because it has come up in this context.
700739

701740
[intellij]: https://blog.jetbrains.com/idea/2017/07/intellij-idea-2017-2-is-here-smart-sleek-and-snappy/
741+
[Checkstyle]: https://plugins.jetbrains.com/plugin/1065-checkstyle-idea
742+
[spotless]: https://github.com/diffplug/spotless
743+
[Eclipse Code Formatter]: https://plugins.jetbrains.com/plugin/6546-eclipse-code-formatter

TESTING.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ Pass arbitrary jvm arguments.
248248
./gradlew test -Dtests.jvm.argline="-Djava.security.debug=access,failure"
249249
------------------------------
250250

251+
Pass build arguments.
252+
253+
------------------------------
254+
# Run tests against a release build. License key must be provided, but usually can be anything.
255+
./gradlew test -Dbuild.snapshot=false -Dlicense.key="x-pack/license-tools/src/test/resources/public.key"
256+
------------------------------
257+
251258
== Running verification tasks
252259

253260
To run all verification tasks, including static checks, unit tests, and integration tests:

build.gradle

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -287,23 +287,17 @@ gradle.projectsEvaluated {
287287
// :test:framework:test cannot run before and after :server:test
288288
return
289289
}
290-
tasks.matching {it.name.equals('integTest')}.configureEach {integTestTask ->
290+
tasks.matching { it.name.equals('integTest')}.configureEach {integTestTask ->
291291
integTestTask.mustRunAfter tasks.matching { it.name.equals("test") }
292292
}
293293

294294
configurations.matching { it.canBeResolved }.all { Configuration configuration ->
295295
dependencies.matching { it instanceof ProjectDependency }.all { ProjectDependency dep ->
296296
Project upstreamProject = dep.dependencyProject
297-
if (upstreamProject != null) {
298-
if (project.path == upstreamProject.path) {
299-
// TODO: distribution integ tests depend on themselves (!), fix that
300-
return
301-
}
297+
if (project.path != upstreamProject?.path) {
302298
for (String taskName : ['test', 'integTest']) {
303-
Task task = project.tasks.findByName(taskName)
304-
Task upstreamTask = upstreamProject.tasks.findByName(taskName)
305-
if (task != null && upstreamTask != null) {
306-
task.shouldRunAfter(upstreamTask)
299+
project.tasks.matching { it.name == taskName }.configureEach {task ->
300+
task.shouldRunAfter(upstreamProject.tasks.matching { upStreamTask -> upStreamTask.name == taskName })
307301
}
308302
}
309303
}
@@ -487,7 +481,7 @@ allprojects {
487481
subprojects {
488482
project.ext.disableTasks = { String... tasknames ->
489483
for (String taskname : tasknames) {
490-
project.tasks.named(taskname).configure { onlyIf { false } }
484+
project.tasks.named(taskname).configure { enabled = false }
491485
}
492486
}
493487
}

buildSrc/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ dependencies {
103103
api 'com.avast.gradle:gradle-docker-compose-plugin:0.13.4'
104104
api 'org.apache.maven:maven-model:3.6.2'
105105
api 'com.networknt:json-schema-validator:1.0.36'
106+
api 'org.ow2.asm:asm:9.0'
107+
api 'org.ow2.asm:asm-tree:9.0'
106108
api "org.apache.httpcomponents:httpclient:${props.getProperty('httpclient')}"
107109
api "org.apache.httpcomponents:httpcore:${props.getProperty('httpcore')}"
108110
compileOnly "com.puppycrawl.tools:checkstyle:${props.getProperty('checkstyle')}"

buildSrc/reaper/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
jar {
1+
tasks.named("jar").configure {
22
archiveFileName = "${project.name}.jar"
33
manifest {
44
attributes 'Main-Class': 'org.elasticsearch.gradle.reaper.Reaper'

buildSrc/src/integTest/groovy/org/elasticsearch/gradle/fixtures/AbstractGitAwareGradleFuncTest.groovy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ abstract class AbstractGitAwareGradleFuncTest extends AbstractGradleFuncTest {
4141
File setupGitRemote() {
4242
URL fakeRemote = getClass().getResource("fake_git/remote")
4343
File workingRemoteGit = new File(remoteRepoDirs.root, 'remote')
44-
FileUtils.copyDirectory(new File(fakeRemote.file), workingRemoteGit)
44+
FileUtils.copyDirectory(new File(fakeRemote.toURI()), workingRemoteGit)
4545
fakeRemote.file + "/.git"
4646
gradleRunner(workingRemoteGit, "wrapper").build()
4747

@@ -50,12 +50,10 @@ abstract class AbstractGitAwareGradleFuncTest extends AbstractGradleFuncTest {
5050
execute('git config user.name "Build tool"', workingRemoteGit)
5151
execute("git add .", workingRemoteGit)
5252
execute('git commit -m"Initial"', workingRemoteGit)
53-
execute("git checkout -b origin/8.0", workingRemoteGit)
5453
return workingRemoteGit;
5554
}
5655

5756
GradleRunner gradleRunner(String... arguments) {
5857
gradleRunner(new File(testProjectDir.root, "cloned"), arguments)
5958
}
60-
6159
}

buildSrc/src/integTest/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ abstract class AbstractGradleFuncTest extends Specification {
9090
return jarFile;
9191
}
9292

93-
File internalBuild(File buildScript = buildFile) {
93+
File internalBuild(File buildScript = buildFile, String major = "7.9.1", String minor = "7.10.0", String bugfix = "7.11.0") {
9494
buildScript << """plugins {
9595
id 'elasticsearch.global-build-info'
9696
}
@@ -102,11 +102,13 @@ abstract class AbstractGradleFuncTest extends Specification {
102102
import org.elasticsearch.gradle.BwcVersions
103103
import org.elasticsearch.gradle.Version
104104
105-
Version currentVersion = Version.fromString("9.0.0")
106-
BwcVersions versions = new BwcVersions(new TreeSet<>(
107-
Arrays.asList(Version.fromString("8.0.0"), Version.fromString("8.0.1"), Version.fromString("8.1.0"), currentVersion)),
108-
currentVersion)
109-
105+
Version currentVersion = Version.fromString("8.0.0")
106+
def versionList = []
107+
versionList.addAll(
108+
Arrays.asList(Version.fromString("$major"), Version.fromString("$minor"), Version.fromString("$bugfix"), currentVersion)
109+
)
110+
111+
BwcVersions versions = new BwcVersions(new TreeSet<>(versionList), currentVersion)
110112
BuildParams.init { it.setBwcVersions(versions) }
111113
"""
112114
}

0 commit comments

Comments
 (0)