Skip to content

Add new option to allow full delegation of IntelliJ tests to Gradle #126772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 18, 2025

Conversation

lukewhiting
Copy link
Contributor

Low priority

This PR adds a new option to our Gradle build that lets the user specify they would like all runs and test runs created by IntelliJ through clicking gutter icons etc to use Gradle as the execution engine rather than IntelliJs own runner.

Currently, we use the IntelliJ plugin for Gradle to override these settings in the IDE every time we import the ES repo. This means the user has no way to express their preference for how tests should be run in the IDE as any change made to IntelliJ's settings is overridden next import.

This is especially frustrating as running test with the IntelliJ test runner is generally not possible so it just adds extra clicks when running tests.

Users can enable this delegation of all runs by setting org.elasticsearch.idea-delegate-to-gradle=true in ~/.gradle/gradle.settings. Default's to existing behaviour (Prompt user for test runner choice)

This PR also contains documentation for this setting and the currently undocumented setting that appends --configuration-cache to all generated run configs.

I tagged @mark-vieira in this one as he created the initial config. Also open to just making this the default behaviour and prompting be the override.

@lukewhiting lukewhiting requested review from mark-vieira and a team April 14, 2025 10:15
@lukewhiting lukewhiting added the Team:Delivery Meta label for Delivery team label Apr 14, 2025
Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me but I think @breskeby should have eyes on this as well.

@mark-vieira mark-vieira requested a review from breskeby April 23, 2025 18:29
@breskeby breskeby self-assigned this May 9, 2025
CONTRIBUTING.md Outdated
| `org.elasticsearch.idea-configuration-cache` | Should IntelliJ enable the Gradle Configuration cache to speed up builds when generating run configs | *`ture`, `false` |
| `org.elasticsearch.idea-delegate-to-gradle` | Should IntelliJ use Gradle for all generated run / test configs or prompt each time | `true`, *`false` |

These options can be set anywhere on the Gradle config path including in `~/.gradle/gradle.settings`
Copy link
Contributor

@breskeby breskeby May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just use ~/.gradle/gradle.properties for this as there's build-in support to read props in gradle from that file. I'm surprised gradle.settings even works. I guess a typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope not a typo. Stuff in ~/.gradle/gradle.settings applies globally for the current user but the repo specific file would work too. I guess it comes down to if we think it would be useful for it to apply to multiple projects or not (IE would I like to to just globally apply to stateful and serverless assuming they share this build code?).

I could be convinced either way or, perhaps we just document the options here and leave it up to the user if they want it applied globally or just per repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realised this is totally a typo -.- Updating now

@lukewhiting lukewhiting added auto-backport Automatically create backport pull requests when merged and removed backport labels Jun 17, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

Fix typo in settings file name in docs
Copy link
Contributor

github-actions bot commented Jun 17, 2025

🔍 Preview links for changed docs:

🔔 The preview site may take up to 3 minutes to finish building. These links will become live once it completes.

@lukewhiting lukewhiting merged commit 996c99b into elastic:main Jun 18, 2025
27 checks passed
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.19
9.0

lukewhiting added a commit to lukewhiting/elasticsearch that referenced this pull request Jun 18, 2025
…lastic#126772)

* Add new option to allow full delegation of tests to gradle in IntelliJ plus docs

* Update CONTRIBUTING.md

Co-authored-by: Rene Groeschke <[email protected]>

* Update CONTRIBUTING.md

Fix typo in settings file name in docs

---------

Co-authored-by: Rene Groeschke <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Jun 18, 2025
…126772) (#129620)

* Add new option to allow full delegation of tests to gradle in IntelliJ plus docs

* Update CONTRIBUTING.md



* Update CONTRIBUTING.md

Fix typo in settings file name in docs

---------

Co-authored-by: Rene Groeschke <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Jun 18, 2025
…126772) (#129619)

* Add new option to allow full delegation of tests to gradle in IntelliJ plus docs

* Update CONTRIBUTING.md



* Update CONTRIBUTING.md

Fix typo in settings file name in docs

---------

Co-authored-by: Rene Groeschke <[email protected]>
@lukewhiting lukewhiting deleted the delegate-builds-to-gradle branch June 18, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged :Delivery/Build Build or test infrastructure >enhancement Team:Delivery Meta label for Delivery team v8.19.0 v9.0.3 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants