Commit graph

51 commits

Author SHA1 Message Date
Rene Groeschke
03dc8edaf2
[7.17] Allow resolving runtime java via Gradle tool chain provider (#105916)
* [7.17] Resolve runtime java via Gradle tool chain provider #95319
* Cleanup VersionPropertiesPlugin
2024-03-05 11:17:44 +01:00
Mark Vieira
e7dabf066b
Disable incremental compilation in CI environments (#103346) (#103349) 2023-12-12 17:07:11 -05:00
Rene Groeschke
5afd06ae57
[7.17] Update Gradle Wrapper to 8.2 (#96686) (#97484)
* Update Gradle Wrapper to 8.2 (#96686)

- Convention usage has been deprecated and was fixed in our build files
- Fix test dependencies and deprecation
2023-09-27 08:46:44 +02:00
Rene Groeschke
5103a514f1
Ensure all sourceSets are compiled as part of Gradle precommit (#91897) (#91937) 2022-11-24 16:24:11 -05:00
Rory Hunter
50dc8ae8b9 Add Checkstyle rule for broken switch cases (#88739)
We use `between(x, y)` calls with `switch` statements in tests to
randomize test behaviour. However, some usages define `case` statements
that can never execute, because the `case` value is outside the range
defined by the `between` call.

Write a rule that inspects the switches and the cases, and fails on the
broken cases. This rule checks `between`, `randomIntBetween` and
`randomInt`.
2022-07-27 09:59:36 +01:00
Rory Hunter
5d242ff33e
Fix checkstyle version drift and API change (#88283) (#88293)
Fix checkstyle version drift and API change.
2022-07-05 17:28:02 -04:00
Rene Groeschke
98d18185ae
[7.17] Setup elasticsearch dependency monitoring with Snyk for production code (#88036) (#88223)
Backports the following commits to 7.17:
 - Setup elasticsearch dependency monitoring with Snyk for production code (#88036)
2022-07-04 08:36:35 +02:00
Mark Vieira
659e81807c
Add support for building elasticsearch source on macos before monterey (#87430) (#87434)
Closes #87426

Co-authored-by: Juan Camilo Bages <jcbages@users.noreply.github.com>
2022-06-06 18:04:21 -04:00
Rene Groeschke
e44106b3dc
Port build dependencies to gradle version catalogue (#86548) (#86599)
Backports the following commits to 7.17:
 - Port build dependencies to gradle version catalogue (#86548)
2022-05-11 10:04:52 +02:00
Rene Groeschke
506c08aab6
[7.17] Port javadoc configuration logic into a binary plugin (#86471) (#86593)
* Port javadoc configuration logic into a binary plugin (#86471)

Also adding test coverage and fixing certain issues we stumbled into

when resolving project dependencies of compileClasspath we need to use allDependencies instead of dependencies as usually no dependencies are added directly to compileClasspath but via implementation, compileonly and api and friends
Fixed javadoc setup for projects using shadowed dependencies via shadow plugin
Fixed dealing with skipped javadoc tasks in referenced dependent projects.
In general this PR only fixes expected javadoc generation as it was intended before this PR.

This also contains some tweaks to our gradle integration test fixtures for setting up and debugging test projects
# Conflicts:
#	build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/fixtures/AbstractRestResourcesFuncTest.groovy
#	build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/InternalYamlRestTestPluginFuncTest.groovy
#	build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/YamlRestCompatTestPluginFuncTest.groovy
#	build-tools/src/integTest/groovy/org/elasticsearch/gradle/TestClustersPluginFuncTest.groovy
#	build-tools/src/testFixtures/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy

* Fix merge conflicts for backporting
2022-05-10 06:14:55 -04:00
Rene Groeschke
ddcf22ee39
Update build convention dependencies (#85444) (#85486)
- Update spotless to potentially fix invalid git worktree handling
- Update shadow plugin to be in sync with version used in build-tools
2022-03-31 15:13:33 +02:00
Mark Vieira
3cee793850
Fall back to naive parallel forks calculation in non-standard cases (#85410) (#85421)
Some architectures provide non-standard output in /proc/cpuinfo.
Specifically, AWS graviton. In case we can't properly calculate physical
cpu cores via the standard method just fallback to using the JDK-backed
implementation.
2022-03-28 18:34:26 -04:00
Mark Vieira
e9b1a1e093
Fix calculation of max parallel forks for test execution (#85360) (#85404) 2022-03-28 11:35:53 -07:00
Rene Groeschke
1e808de8ff
[7.17] Replace getProject() references with injected services in task implementations where possible (#81681) (#84332)
* Replace getProject() references with injected services in task implementations where possible (#81681)

- Rework task implementations to avoid project usage at execution time
- In general usages of getProject() within a task should be avoided as it is not compatible
with gradle configuration cache. Related to #57918

Co-authored-by: Mark Vieira <portugee@gmail.com>
2022-02-24 16:52:38 +01:00
Rene Groeschke
4de3fb5eaf
Remove usage of deprecated Provider#forUseAtConfigurationTime (#83932) (#83947)
Remove gradle api usage that has been deprecated with Gradle 7.4
2022-02-15 16:45:24 +01:00
Rene Groeschke
2d6d830c86
Update gradle wrapper to 7.4 (#81963) (#83886)
* Make ForbiddenApisPrecommitPlugin plugin Gradle 8.0 compatible
* Fix deprecations on ignoring empty folders for task inputs
* Update Gradle wrapper to 7.4 GA
2022-02-15 11:15:54 +01:00
Rory Hunter
1721d1af49 Upgrade Checkstyle to 9.3 (#83314)
Checkstyle 9.3 has been released, and contains a fix for the memory
problems we saw in previous versions. Upgrade to this version.

Note that the IDEA config has also been updated, but the plugin
doesn't yet have 9.3 as an option according to the release notes.
This shouldn't be a problem.
2022-02-07 10:36:25 +00:00
Rene Groeschke
e4188ce1b5
Update checkstyle to latest 8.x release (#82186) (#82262)
- Updates checkstyle to 8.45.1

- This was update was triggered by us running into checkstyle/checkstyle#9897 We do not update to latest 9.x release yet as we see a performance decrease when running precommit with this. likely related to checkstyle/checkstyle#10934
2022-01-10 09:54:14 +01:00
Rory Hunter
358cd80d34 Formatting escape hatch (#81806)
Thanks to https://bugs.eclipse.org/bugs/show_bug.cgi?id=574437,
we've run into a situation where Spotless is incorrectly formatting
a particular piece of syntax (due the underlying Eclipse bug). We
were able to turn off formatting of this syntax using `// @formatter:off`
and `// @formatter:on`, but there was a further problem. We configure
IntelliJ to use the Eclipse formatter plugin, but this doesn't
respect the `@formatter` tags since these are set at the Spotless
level, not the Eclipse formatter level. Note that these tags aren't
set in the Eclipse formatter config, because there we use `// tag::`
and `// end::` in order to avoid reformatting docs snippets, which
have a much narrower line width.

What a mess.

So, to get around all this, drop the `@formatter` tags and tweak
our custom `SnippetLengthCheck` Checkstyle rule so that
`// tag:noformat` regions are not subject to the narrower line length
check, but are still exempt from formatting.
2021-12-16 16:28:17 +00:00
Rory Hunter
d9f8fca492 Revert some EQL shadowed var changes and improve HiddenField rule (#81317)
Change our fork of `HiddenFieldCheck` rule to allow it to ignore
shadowed variables for methods shorter than a configured minimim line
count. While this technically defeats the point of the rule, in practice
short methods are easier to verify by eye, compared to longer methods
where accidentally referencing the wrong variable is harder to spot.

Following this, revert some changes in the EQL code which were required
to pass the `HiddenField` check before the `minLineCount` change.

Additionally, introduce a mechanism for ignoring shadowed variables when
used created a new object. This allowed us to ignore variables in usages
of e.g. `ConstructingObjectParser` whose purpose, as the name suggests,
is to build objects, and object shadows variables in the course of
building objects.
2021-12-03 19:36:15 +00:00
Rory Hunter
6fc8166231
Checkstyle shadows vars pt8 (#81147) (#81250)
Part of #19752. Fix more instances where local variable names were
shadowing field names. Also expand the possible method names that are
skipped when checking for shadowed vars, and allow shadowed vars in
builder classes.
2021-12-02 08:04:26 -05:00
Rory Hunter
c23f8f6226
Fix shadowed vars pt7 (#80996) (#81144)
Part of #19752. Fix more instances where local variable names were
shadowing field names.

Also modify our fork of HiddenFieldCheck to add the ignoreConstructorBody
and ignoredMethodNames parameters, so that the check can ignore
more matches.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-12-02 07:53:12 -05:00
Rory Hunter
0a7392a1e8
Fix shadowed vars pt5 (#80855) (#80869)
* Fix shadowed vars pt4 (#80842)

Part of #19752. Fix more instances where local variable names were shadowing field names.

* Fix shadowed vars pt5 (#80855)

Part of #19752. Fix more instances where local variable names were shadowing field names.

* Formatting

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-11-22 05:00:17 -05:00
Mark Vieira
db23d45348
Don't apply the spotless plugin to non-applicable projects (#80679) (#80681)
This is an attempt at resolving, or at least reducing the prevalence of
#77837. A more robust solution is probably required, but this should
help reduce this problem since we now apply spotless to about 90 fewer
subprojects.
2021-11-11 19:08:21 -05:00
Mark Vieira
89bcde3540
Update Gradle wrapper to 7.3 (#80633) (#80642) 2021-11-10 17:45:26 -05:00
Mark Vieira
be5ed8d00f
Upgrade spotless gradle plugin to 6.0.0 (#80560) (#80630) 2021-11-10 15:41:23 -05:00
Rory Hunter
c2da6b1223 Fix HiddenField checkstyle problems in client/ (#80549)
Part of #19752.

Fix a number of cases of shadows vars under `client/rest-high-level`. As
part of this, fork the Checkstyle `HiddeFieldCheck` class so that it
understand the pattern of settings with no "set" prefix.
2021-11-10 13:50:43 +00:00
Mark Vieira
bcfbf00074 Reformat Elasticsearch source 2021-10-27 15:23:15 -07:00
Rene Groeschke
62f73e574a
Fix formatting bwc project excludes (#79743) (#79753)
This fixes a typo still causing #79606 to fail
2021-10-25 16:27:51 -04:00
Rene Groeschke
f9f8a1ad2b
Do not build bwc artifacts when running build task (#79639) (#79644)
The spotless plugin applies the gradle base plugin which results in
building all artifacts in the bwc projects when just running build. This
is not intended and happened as part of work on #78910 The correct fix
is to not apply the base plugin in the spotless plugin IMO. We will work
on getting that fix upstream to the third party gradle plugin Meanwhile
we just ignore bwc projects for our formatting as they also have no
source available anyhow. This fixes #79606 when backported to 7.x
2021-10-21 13:51:00 -04:00
Rene Groeschke
91671f753b
Fail on SSPL licensed x-pack sources (#79348) (#79425)
This tweaks the license headers task to fail on sspl licensed sources in
x-pack modules and plugins
2021-10-19 12:02:07 -04:00
Nik Everett
44ea58fa27
[7.x] Move xcontent filtering tests (#79298) (#79389)
* Move xcontent filtering tests (#79298)

* Move xcontent filtering tests

Moves the xcontent filtering tests to the xcontent project because its
testing code *in* the xcontent project.

* More clear

* Spotless

* Fixup
2021-10-18 17:56:14 -04:00
Tim Brooks
55185fcd18
Add LZ4 compressor with Java9 perf improvements (#78476)
Java9 added a number of features that are useful to improve compression
and decompression. These include the Arrays#mismatch method and
VarHandles. This commit adds compression tools forked from the java-lz4
library which include these improvements. We hope to contribute these
changes back to the original project, however the project currently
supports Java7 so this is not possible at the moment.
2021-10-18 15:25:16 -06:00
Mark Vieira
6fcc618835
[7.x] Separate minimum compiler and runtime Java version properties (#79108) (#79183) 2021-10-14 12:26:56 -07:00
Rory Hunter
b86bb15c29 Fix exclude list 2021-10-14 10:19:22 +01:00
Rory Hunter
562440a950 Format build-tools and build-tools-internal (#78910)
Our spotless configuration wasn't being applied to `build-tools`
and `build-tools-internal`. Move the Spotless configuration to a
Java plugin in `build-conventions`, and apply it everywhere.

This resulted in a lot more Java files being subject to formatting,
so I added more exclusions to the list.

Also remove the `paddedCell` stuff, we've never needed it.
2021-10-14 10:08:46 +01:00
Rene Groeschke
6a78523283
[7.x] Fix minimum runtime version for build tools (#78998) (#79002)
* Fix minimum runtime version for build tools (#78998)

Resolve version from minimumRuntimeVersion file

* Use java 11 compatibility for build tool projects
2021-10-12 13:05:12 -04:00
Rene Groeschke
09dc4a4c60
Wrap VersionPropertiesLoader in a BuildService to decouple build logic projects (#78704) (#78842)
Backporting #78704 to 7.x
2021-10-11 09:42:27 +02:00
Rene Groeschke
736a1255c9
Simplify build plugin license handling (#77009) (#78820)
- Use file property and conventions to avoid afterEvaluate hook
- Simplify root build script
- One little step closer to configuration cache compliance
2021-10-07 14:39:18 +02:00
Rene Groeschke
d7c7eaef8b
[7.x] Fix system property resolution at configuration time (#78682)
* Resolve system properties in build scripts via provider factory (#76199)

This allows tracking system properties used in the build configuration and brings us
one step closer to be gradle configuration cache compliant.

* Fix system property resolution at configuration time (#78669)

This fixes system property resolution when running the build with --configuration-cache

One step closer to make use of configuration cache
2021-10-05 07:33:13 -04:00
Rene Groeschke
334eadfdc1
Avoid configuration time task creation (#76245) (#76339)
Fix publish plugin
2021-08-11 12:42:58 +02:00
Rene Groeschke
8ad7307dba
Make PublishPlugin gradle configuration cache compliant (#74828) (#75772)
* Make PublishPlugin gradle configuration cache compliant

for using --configuration-cache we need to remove some usages of the mutable project instance

* Polishing
2021-07-28 11:24:36 +02:00
elasticsearchmachine
671e76c560
Remove usage of deprecated JavaPluginConvention (#75106) (#75740)
this has been deprecated and will be removed in Gradle 8.0. We use
JavaPluginExtension instead from now on.

Co-authored-by: Rene Groeschke <rene@elastic.co>
2021-07-28 09:07:15 +02:00
elasticsearchmachine
d96bd54636
Fix gradle func tests running in idea (#74811) (#74818)
* Fix gradle func tests running in idea

* Tweak wrapper task

Co-authored-by: Rene Groeschke <rene@elastic.co>
2021-07-01 07:16:22 -04:00
Rene Groeschke
6cce8f1006
Introduce ElasticsearchJavaBasePlugin to simplify YamlRestTestPlugin (7.x backport) (#74485)
backports #74411 and #74492 to 7.x branch
2021-06-29 09:34:49 +02:00
Rene Groeschke
db11dc6237
Simplify applying build tools conventions (#73877) (#74484)
Share common conventions for build tools in one plugin.
e.g. we always apply the license headers check for build tools too
2021-06-23 16:16:10 +02:00
Mark Vieira
c8fae49cd8
Move custom checkstyle rule implementations to build-conventions project (#74017) (#74033) 2021-06-10 16:57:56 -07:00
Rene Groeschke
f5ec26d891
Revert "Revert "Fix eclipse for build tools (#73699) (7.x backport) (#73904)""
This reverts commit edd9597968.
2021-06-09 21:30:22 +02:00
Mark Vieira
edd9597968 Revert "Fix eclipse for build tools (#73699) (7.x backport) (#73904)"
This reverts commit 3799abc9
2021-06-08 18:41:40 -07:00
Rene Groeschke
3799abc912
Fix eclipse for build tools (#73699) (7.x backport) (#73904)
apply common eclipse config to all projects across the elasticsearch workspace
including build tools projects
2021-06-08 16:35:04 +02:00