RFR: 8352982: gradle TEST_SDK_PATH param doesn't work with relative paths [v2]
Kevin Rushforth
kcr at openjdk.org
Wed Apr 2 11:59:08 UTC 2025
On Wed, 2 Apr 2025 06:14:31 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:
>> Issue:
>> The test execution fails when a relative path is specified a relative path for `TEST_SDK_PATH`.
>> For example:
>> 1. gradle -PTEST_ONLY=true -PTEST_SDK_PATH=**..**/jfx1/build test
>> 2. gradle -PTEST_ONLY=true -PTEST_SDK_PATH=**~**/jfx1/build test
>>
>> Solution:
>> Convert the relative path to an absolute path.
>>
>> More about fix:
>> The property TEST_SDK_PATH belongs to the root project rt in build.gradle.
>> If we modify this property in build.gradle, it does not reflect in the child projects. The child projects for example graphics, controls would still have the value of TEST_SDK_PATH before modification.
>> To solve this, I Introduced a new variable in build.gradle `TEST_SDK_DIR`. It would hold the modified value of `TEST_SDK_PATH` and gets correctly reflected across all sub-projects.
>>
>> Verified that both relative paths and absolute path work fine after this change.
>
> Ambarish Rapte has updated the pull request incrementally with one additional commit since the last revision:
>
> review comment: remove handling of path with ~
Relative paths that start with a `.` now work for me. I noted one more case that should be handled and also left one minor comment.
build.gradle line 729:
> 727: }
> 728: String testSdkPath = "${TEST_SDK_PATH}"
> 729: if (testSdkPath.startsWith(".")) {
This will exclude relative paths underneath the jfx directory you are in unless you explicitly add `./` before the directory. It's a rare case, but seems worth handling. Perhaps you can remove the `if` test entirely and always use `file(testSdkPath).absolutePath`?
build.gradle line 745:
> 743: ext.TEST_SDK_DIR = "${rootProject.buildDir}"
> 744: }
> 745: println "TEST_SDK_PATH: " + TEST_SDK_DIR
Minor: Consider moving this down to the block where most other build properties like this are logged?
-------------
PR Review: https://git.openjdk.org/jfx/pull/1751#pullrequestreview-2735963827
PR Review Comment: https://git.openjdk.org/jfx/pull/1751#discussion_r2024651013
PR Review Comment: https://git.openjdk.org/jfx/pull/1751#discussion_r2024654305
More information about the openjfx-dev
mailing list