Commit Graph

81 Commits

Author SHA1 Message Date
Rene Groeschke b210af8389
Update Gradle configurations section in CONTRIBUTING (#59906) 2020-07-22 09:15:32 +02:00
David Turner df555bb470 Add section on reviews to CONTRIBUTING.md (#57046)
The review phase is an important part of contributing to Elasticsearch, but we
do not mention it in our instructions to contributors. This commit adds some
notes on how contributions are reviewed and describes some common reasons for
rejection.

Co-authored-by: Colin Goodheart-Smithe <colings86@users.noreply.github.com>
2020-07-03 08:03:47 +01:00
Rene Groeschke 01e9126588
Remove deprecated usage of testCompile configuration (#57921) (#58083)
* Remove usage of deprecated testCompile configuration
* Replace testCompile usage by testImplementation
* Make testImplementation non transitive by default (as we did for testCompile)
* Update CONTRIBUTING about using testImplementation for test dependencies
* Fail on testCompile configuration usage
2020-06-14 22:30:44 +02:00
Nik Everett b15a304155 Expain when `gradle run` is ready
It isn't obvious.

Closes #57097
2020-05-29 14:56:50 -04:00
Mark Vieira 12f056b833
Update IDE integration to reflect Java 14 requirement (#54990) 2020-04-09 12:27:57 -07:00
Mark Vieira 70cfedf542
Refactor global build info plugin to leverage JavaInstallationRegistry (#54026)
This commit removes the configuration time vs execution time distinction
with regards to certain BuildParms properties. Because of the cost of
determining Java versions for configuration JDK locations we deferred
this until execution time. This had two main downsides. First, we had
to implement all this build logic in tasks, which required a bunch of
additional plumbing and complexity. Second, because some information
wasn't known during configuration time, we had to nest any build logic
that depended on this in awkward callbacks.

We now defer to the JavaInstallationRegistry recently added in Gradle.
This utility uses a much more efficient method for probing Java
installations vs our jrunscript implementation. This, combined with some
optimizations to avoid probing the current JVM as well as deferring
some evaluation via Providers when probing installations for BWC builds
we can maintain effectively the same configuration time performance
while removing a bunch of complexity and runtime cost (snapshotting
inputs for the GenerateGlobalBuildInfoTask was very expensive). The end
result should be a much more responsive build execution in almost all
scenarios.

(cherry picked from commit ecdbd37f2e0f0447ed574b306adb64c19adc3ce1)
2020-03-23 15:30:10 -07:00
Mark Vieira f0a015cae7
Clarify IntelliJ import instructions 2020-03-23 13:31:55 -07:00
Mark Vieira 3b2b564c91
Improve IntelliJ IDE integration (#53747)
This commit makes a number of improvements when importing the
Elasticsearch project into IntelliJ IDEA. Specifically:

- Contributing documentation has been updated to reflect that the
  'idea' task should no long be used and Gradle project import is
  instead the officially supported way of setting up the project.
- Attempts to run the 'idea' task will result in a failure with a
  message directing folks to our CONTRIBUTING.md document.
- The project JDK is explicit set rather that using whatever JAVA_HOME
  is.
- Gradle build operation delegation is disabled, and test execution is
  configured to 'choose per test'.
- Gradle is configured to inherit the project JDK.
- Some code style conventions are automatically configured.
- File encoding is explicitly set to UTF-8.
- Parallel module compilation is enabled and deprecated feature
  warnings are disabled.
- A remote debug run configuration using listen mode is created.
- JUnit runner is configured with required system properties.
- License headers are configured such that Apache 2 is the default
  notice added to all source files with exception of source in /x-pack
  which will use the Elastic license.
2020-03-19 11:43:33 -07:00
Jason Tedor 23ab9e0204
Require JDK 13 for compilation (#50004)
We have a long history of advancing the required compiler to the newest
JDK. JDK 13 has been with us for awhile, but we were blocked from
upgrading since Gradle was not compatible with JDK 13. With the
advancement in our project to Gradle 6 which supports JDK 13, we can now
advance our minimum compiler version. This commit updates the minimum
compiler version to JDK 13.
2019-12-11 16:29:15 -05:00
Christoph Büscher 04ace7a6da Add note how to run locale sensitive unit test (#49491)
Some unit test checking locale sensitive functionality require the
-Djava.locale.providers=SPI,COMPAT flag to be set. When running tests though
gradle we pass this already to the BuildPlugin, but running from the IDE this
might need to be set manually. Adding a note explaining this to the
CONTRIBUTING.md doc and leaving a note in the test comment of
SearchQueryIT.testRangeQueryWithLocaleMapping which is a test we know
that suffers from this issue.
2019-12-02 11:21:56 +01:00
Daniel Mitterdorfer 8c374014ae Add note about Gradle wrapper on Windows (#49528)
With this commit we add a clarifying note in the contribution guidelines
that our examples show the usage on Unix and also explain how to invoke
the Gradle wrapper script on Windows.

Closes #49521
2019-11-25 13:41:26 +01:00
Christoph Büscher dc50d3fc46 Add negative boolean expression note to CONTRIBUTING.md (#49033)
The team sometimes get questions around the use of `!foo` vs. `foo == false` in
PRs and reviews (e.g.  #48615). This change adds a bullet point to CONTRIBUTING.md
to make expectations here clearer and gives us something to point to in case of
discussion.
2019-11-13 14:33:41 +01:00
Rory Hunter 61a4e24ecf
Refine the auto-formatting settings (#48618)
Backport of #48446. Update the Eclipse formatter settings as follows:

* Split arguments for methods, constructors etc into separate lines when
  they wrap
* Enable "joined wrapped lines", which basically means the formatter
  will ignore existing line breaks and join and re-wrap statements. I
  had originally hesitated about enabling this, but without it the
  codebase's style won't be as consistent as it should be, defeating the
  point of all this formatting business.
* Disable formatting between `// tag::` and `// end::` comments, which
  are the code snippet markers for the docs. They need a different line
  length, which isn't possible to configure separately.
* Detect and preserve aligned line comments at the end of consecutive
  lines.
* And a bunch of other tweaks.

Also update the contribution guidelines.
2019-10-29 10:40:03 +00:00
David Turner 6a97aef8ac Clarify contribution instructions re. license hdrs (#48067)
Today our instructions in `CONTRIBUTING.md` regarding license headers are a
little unclear. This commit clarifies the exact headers that are required for
contributions.
2019-10-18 14:45:03 +01:00
Alpar Torok 0a14bb174f Remove eclipse conditionals (#44075)
* Remove eclipse conditionals

We used to have some meta projects with a `-test` prefix because
historically eclipse could not distinguish between test and main
source-sets and could only use a single classpath.
This is no longer the case for the past few Eclipse versions.

This PR adds the necessary configuration to correctly categorize source
folders and libraries.
With this change eclipse can import projects, and the visibility rules
are correct e.x. auto compete doesn't offer classes from test code or
`testCompile` dependencies when editing classes in `main`.

Unfortunately the cyclic dependency detection in Eclipse doesn't seem to
take the difference between test and non test source sets into account,
but since we are checking this in Gradle anyhow, it's safe to set to
`warning` in the settings. Unfortunately there is no setting to ignore
it.

This might cause problems when building since Eclipse will probably not
know the right order to build things in so more wirk might be necesarry.
2019-10-03 11:55:00 +03:00
Rory Hunter 1c7dc3a5bf Format Java source files automatically (#46745)
This commit adds a Java source formatter and checker into the build process.
This is not yet enabled for any sub-projects - to format and check a
sub-project, add its Gradle path into `build.gradle` and run:

    ./gradlew spotlessApply

to format, and:

    ./gradlew spotlessJavaCheck
    # or:
    ./gradlew precommit

to verify formatting.
2019-09-30 10:35:47 +03:00
Jason Tedor 9acd20874b
Update contributing docs to JDK 12
JDK 12 is now required for compilation. This commit updates the docs to
reflect this.
2019-03-22 08:51:18 -04:00
CJ Cenizal 1520ddc8b6
Update distribution build instructions to reflect file names with OS/architecture classifiers. (#39762) (#39812) 2019-03-07 14:08:47 -08:00
Heather McCartney fc1c47649a Document the need for JAVA11_HOME (#37589)
This commit updates the contribution docs to include java11 as a requirement for building and testing Elasticsearch.
2019-01-18 11:16:50 -08:00
CJ Cenizal 1614107d59
Docs: Update CONTRIBUTING.md with shortcut command for assembling only the tar distribution (#35276)
* Add --parallel flag.
2018-11-06 17:22:50 -08:00
Nik Everett 5e0b524aa5
Contributing: Clarify width of snippets (#34910)
Clarifies the width rules for snippets.
2018-10-26 14:58:50 -04:00
王振荟 d6dc62ef03 [Docs] Add explanation for code snippets line width (#34796)
Add "Line width for code snippets is 76 characters" to  Java Language Formatting Guidelines
2018-10-25 10:55:14 +02:00
Jason Tedor dca452f043
Fix JDK references in contributing docs (#34669)
After we bumped the JDK compiler minimum requirements to JDK 11, we
missed updating the contributing docs to point to JDK 11 instead of JDK
10. This commit fixes that.

Additionally, when we stopped requiring JDK 7 to run the reindex from
old tests, we did not update the contributing docs to reflect this. This
commit also fixes that.
2018-10-20 16:01:32 -04:00
Ryan Ernst a6e8fb33c0
Docs: Remove unnecessary qualifier from wildcard import note (#34419)
This commit removes the suggestions to send a PR with instructions for
more IDEs on disabling wildcard imports. This is not explicitly needed
both because the main IDEs instructions already exist, and any part of
the docs are welcome for PRs to add more clarity.

closes #34415
2018-10-14 21:32:36 +01:00
Kazuhiro Sera d45fe43a68 Fix a variety of typos and misspelled words (#32792) 2018-10-03 18:11:38 +01:00
Jason Tedor c41c614527
Fix grammar in contributing docs
This commit fixes an instance of odd comma placement in the contributing
docs.
2018-08-27 10:17:42 -04:00
Nik Everett 2c81d7f77e
Build: Rework shadow plugin configuration (#32409)
This reworks how we configure the `shadow` plugin in the build. The major
change is that we no longer bundle dependencies in the `compile` configuration,
instead we bundle dependencies in the new `bundle` configuration. This feels
more right because it is a little more "opt in" rather than "opt out" and the
name of the `bundle` configuration is a little more obvious.

As an neat side effect of this, the `runtimeElements` configuration used when
one project depends on another now contains exactly the dependencies needed
to run the project so you no longer need to reference projects that use the
shadow plugin like this:

```
testCompile project(path: ':client:rest-high-level', configuration: 'shadow')
```

You can instead use the much more normal:

```
testCompile "org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}"
```
2018-08-21 20:03:28 -04:00
aaronoah b2c2c94741 Docs: Add all JDKs to CONTRIBUTING.md 2018-07-31 17:04:31 -04:00
Nik Everett e6b9f59e4e
Build: Shadow x-pack:protocol into x-pack:plugin:core (#32240)
This bundles the x-pack:protocol project into the x-pack:plugin:core
project because we'd like folks to consider it an implementation detail
of our build rather than a separate artifact to be managed and depended
on. It is now bundled into both x-pack:plugin:core and
client:rest-high-level. To make this work I had to fix a few things.

Firstly, I had to make PluginBuildPlugin work with the shadow plugin.
In that case we have to bundle only the `shadow` dependencies and the
shadow jar.

Secondly, every reference to x-pack:plugin:core has to use the `shadow`
configuration. Without that the reference is missing all of the
un-shadowed dependencies. I tried to make it so that applying the shadow
plugin automatically redefines the `default` configuration to mirror the
`shadow` configuration which would allow us to use bare project references
to the x-pack:plugin:core project but I couldn't make it work. It'd *look*
like it works but then fail for transitive dependencies anyway. I think
it is still a good thing to do but I don't have the willpower to do it
now.

Finally, I had to fix an issue where Eclipse and IntelliJ didn't properly
reference shadowed transitive dependencies. Neither IDE supports shadowing
natively so they have to reference the shadowed projects. We fix this by
detecting `shadow` dependencies when in "Intellij mode" or "Eclipse mode"
and adding `runtime` dependencies to the same target. This convinces
IntelliJ and Eclipse to play nice.
2018-07-24 11:53:04 -04:00
Lisa Cawley 3960a7a310
[DOCS] Update readme for testing x-pack code snippets (#30696) 2018-05-31 09:32:22 -07:00
Nik Everett 6884b79128
Add a quick tour of the project to CONTRIBUTING (#30187)
Adds a description of the most important subdirectories to
`CONTRIBUTING.md` to help folks that are less familiar with the project
get their bearings. It reflects that state of the project right now so
it will inevitably go out of date. But I'll try and keep it up to date.
2018-05-07 19:43:18 -04:00
Tal Levy 5785245ae1
add copyright/scope configuration for intellij to Contributing Guide (#29688)
* add copyright/scope configuration for intellij

This commit introduces a section discussing the ability to define
copyright rules in intellij for inserting the appropriate copyright
headers into files across both apache2-Elasticsearch, as well as the
commercial code under `x-pack`.

Some other re-organization was made to create more sub-structure

* update to reflect reviewer comments
2018-04-26 08:19:17 -07:00
Jason Tedor 38fd9998e7
Require JDK 10 to build Elasticsearch (#29174)
This commit bumps the minimum compiler version required to build
Elasticsearch from JDK 9 to JDK 10.
2018-03-27 19:45:13 -04:00
Mikal 5cbafa4eba Updated distribution outputs in contributing docs
This commit updates the path to the output of building distributions
from source in the contributing docs.

Relates #28722
2018-02-20 12:08:11 -05:00
Tal Levy c122a6d4a0
remove recommended junit intellij setting change (#28274)
The "Shorten Command Line" setting in Intellij's JUnit test configuration
was recommended to change to `classpath file`. This setting has been
causing issues with JDK9 where some modules were not being found at
runtime. This PR removes the recommendation to change this setting and
instead asks that users verify that it is set to `user-local default:none`.
2018-01-17 15:01:02 -08:00
Jason Tedor 0a79555a12
Require JDK 9 for compilation (#28071)
This commit modifies the build to require JDK 9 for
compilation. Henceforth, we will compile with a JDK 9 compiler targeting
JDK 8 as the class file format. Optionally, RUNTIME_JAVA_HOME can be set
as the runtime JDK used for running tests. To enable this change, we
separate the meaning of the compiler Java home versus the runtime Java
home. If the runtime Java home is not set (via RUNTIME_JAVA_HOME) then
we fallback to using JAVA_HOME as the runtime Java home. This enables:
 - developers only have to set one Java home (JAVA_HOME)
 - developers can set an optional Java home (RUNTIME_JAVA_HOME) to test
   on the minimum supported runtime
 - we can test compiling with JDK 9 running on JDK 8 and compiling with
   JDK 9 running on JDK 9 in CI
2018-01-16 13:45:13 -05:00
hyeonyoung na 27bbec0c19 Update contributing docs to use the Gradle wrapper
This commit updates the contributing docs to reference the introduction
of the Gradle wrapper.

Relates #28103
2018-01-05 12:16:15 -05:00
Jason Tedor 480aeb7eb7
Introduce Gradle wrapper
We have agreed to introduce the Gradle wrapper to simplify workflows for
developers, and managing infrastructure (e.g., CI, release builds, etc.)
as well as consideration for the fact that other projects in our stack
use Gradle and do not necessarily want to be tied to our Gradle version.

Relates #28065
2018-01-04 16:36:13 -05:00
Doug Turnbull 507aac4424 Update CONTRIBUTING.md to indicate Gradle >= 4.3 is required (#27980)
Relates #27885.
2017-12-26 12:46:44 +00:00
Avneesh Chadha 58b4d6c5fc [Issue-27716]: CONTRIBUTING.md IntelliJ configurations settings are confusing. (#27717)
* Improved paragraph describing how to run unit tests from Intellij.
* Added information about how to run a local copy of elasticsearch from the source.
2017-12-08 14:31:45 +01:00
Catalin Ursachi e584c52017 Clarify IntelliJ IDEA Jar Hell fix (#27635) 2017-12-05 14:39:01 -08:00
David Roberts f123785d34
Add note on how to avoid Jar Hell in IntelliJ 2017.3 to contributing guide (#27614)
When running unit tests direct from the IDE this setting change is needed
in addition to the idea.no.launcher property that previous versions of IntelliJ
needed.
2017-12-01 12:42:09 +00:00
Yu 57da9dc57f Clarify setting IntelliJ preferences
This commit clarifies that the preferences menu in IntelliJ can differ
by OS (IntelliJ -> Preferences on macOS and Settings on Linux/Windows).

Relates #27575
2017-11-28 19:46:24 -05:00
Ryan Ernst a6ae6b5a9a Docs: Add note to contributing docs warning against tool based refactoring (#26936)
This commit adds a warning to deter contributers from creating PRs
generated by tools to do large refactors just for the sake of
refactoring.
2017-10-09 14:49:24 -07:00
David Turner 37453eef6f Add more instructions about jar hell (#26837)
Including the fact that IntelliJ 2017.2 seems to have a spurious jar on its
classpath.
2017-09-29 15:27:57 +01:00
Jason Tedor 628685a712 Clarify IDE versions
This commit clarifies the minimum IDE versions that we support for
development. We need to formally state that the minimum that we support
for Eclipse is Eclipse Oxygen because Eclipse Neon and prior releases
have type inference bugs that lead to compilation issues that cause us
to have to contort our code to support Eclipse and it appears that
Eclipse Oxygen is less-prone to these issue. And the recent high-level
REST shading work seems to work best in Intellij 2017.2. Therefore, we
state these versions explicitly.

Relates #26194
2017-08-14 22:19:23 +09:00
Igor Motov 7e437f2366 Document work-around for jar hell in idea_rt.jar file (#24523) 2017-05-08 07:34:36 -04:00
Simon Willnauer 8cfb9e446c Move back to 140 chars line length (#24013)
This reverts the line limit change in #23623 - this PR doesn't touch the suppression file since we are moving towards automatic code formatting which makes it mainly obsolete.
2017-04-10 17:07:18 +02:00
Jason Tedor df67f83834 Update contributing docs for line-length change
The line-length standard has changed from 140 columns to 100
columns. This commit updates the contributing docs to reflect this
change.
2017-03-27 20:01:52 -04:00
Boaz Leskes 38a18db81e Revert "Revert "Build: Upgrade min gradle to 3.3 (#23544)""
This reverts commit f926a717ed.
2017-03-21 11:20:04 +01:00