IDEA-383419 Gradle: add support alternativeJrePath RunConfiguration option for gradle-idea-ext
#3354
+136
−99
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
YouTrack: https://youtrack.jetbrains.com/issue/IDEA-383419/IDEA-EXT-Alternative-JRE-Path-in-JarApplication
Releated PR: JetBrains/gradle-idea-ext-plugin#140
Purpose
To support configuring the JRE option for IntelliJ IDEA Run Configurations — JarApplication / Application — via gradle-idea-ext.
Implementation
I opened the PR to make gradle-idea-ext export
alternativeJrePath, and implemented the code and tests to read it from each IntelliJ IDEA importer and apply it.Main changes
I removed deprecated
consumeIfCastusage in each importer and updated it to use pattern variables.Fields related to the JRE path are in:
If the input
alternativeJrePathis present and not empty, set (alternativeJrePath, true).otherwise, set (null, false).
What I want to emphasize here is that it is also set to (null, false) when the value is empty. Would it be a problem that there is no case where it becomes ("", true)?
Also, in each test, I used
JavaApplicationRunConfigurationImporter/JarApplicationRunConfigurationImporterinstead ofTestRunConfigurationImporterto verify that the configuration was applied correctly.Extra changes
MAIN_CLASS_NAME: ApplicationModulePathTest#L111