RFR: 8288838: jpackage: file association additional arguments [v4]
Alex Kasko
akasko at openjdk.org
Tue Jul 5 21:54:38 UTC 2022
On Mon, 4 Jul 2022 23:38:08 GMT, Alex Kasko <akasko at openjdk.org> wrote:
>> jpackage implementation of file association on Windows currently passes a selected filename as an only argument to associated executable.
>>
>> It is proposed to introduce additional option in file association property file to allow optionally support additional arguments using `%*` batch wildcard.
>>
>> Note, current implementation, while fully functional, is only a **DRAFT** one, it is not ready for integration in this form. I would appreciate any guidance on the following points:
>>
>> - option naming inside a properties file, currently `pass-all-args` is used
>> - option naming in a bundler parameter implementation, it is not clear if it should introduce a new group of "file association windows specific options" next to the existing "file association mac specific options" group
>> - test organization to cover the new option: currently it is included inside `FileAssociationTest` and piggybacks on the existing (and unrelated) `includeDescription` parameter; it is not clear whether it should be done in a separate test and whether to include runs for every parameter combination
>> - test run implementation: currently arguments are checked when a file with associated extension is invoked from command line; it is not clear whether it would be more appropriate instead to create a desktop shortcut with the same command as a target and to invoke it with `java.awt.Desktop`
>>
>> Also please note, that full install/uninstall run is currently enabled in `FileAssociationTest`, it is intended to be used only in a draft code during the development and to be removed (to use the same "install or unpack" logic as other tests) in a final version.
>>
>> Testing:
>>
>> - [x] test to cover new logic is included
>> - [x] ran jtreg:jdk/tools/jpackage with no new failures
>
> Alex Kasko has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
>
> - enable passing args, add test coverage
> - Added input params validation
> - Proposed test changes to make FA testing of jpackage more flexible
About the non-ASCII args: in `FileAssociations.TestRun::openFiles` non-ASCII argument can be supplied along with other arguments (in `WinCommandLine` and `WinDesktopOpenShortcut` runs). The arguments passing and the check in the output file works correctly for such arguments, but only when the `Language for non-Unicode programs` system setting in Windows is set to the corresponding language. Otherwise the argument is received by java app in `?????????` form and the test expectedly fails. I've checked that this behaviour of jpackage launcher is the same as in the main `java.exe` launcher. I've added the note comment and the concrete example of an arg to `FileAssociations.TestRun::openFiles`.
If it is desired to be able to run such non-ASCII test manually (without changing the test code), I assume this can be done by making the test to read arguments from filesystem, or to add some kind of a test option to run the branch with predefined non-ASCII arguments only when requested.
-------------
PR: https://git.openjdk.org/jdk/pull/9224
More information about the core-libs-dev
mailing list