RFR: 8351369: [macos] Use --install-dir option with DMG packaging
Alexey Semenyuk
asemenyuk at openjdk.org
Thu May 29 02:51:51 UTC 2025
On Wed, 28 May 2025 22:30:25 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:
>> - `--install-dir` option in DMG packaging is no longer ignored.
>> - Defaults are still the same: `/Applications` and `/Library/Java/JavaVirtualMachines`.
>> - If the installation directory doesn't exist, jpackage will try to create and delete it right after the DMG package is created.
>> - If jpackage was unable to create installation directory error will be thrown or if installation directory points to invalid location like file.
>> - It will be user responsibility to make sure installation directory exist on target machine, since DMG cannot create directories during drag and drop.
>> - Target directory in case of non-default installation dir will display full path. See image below for example.
>>
>> 
>
> src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgPackageBuilder.java line 101:
>
>> 99: Log.verbose(ex);
>> 100: throw new RuntimeException(ex);
>> 101: }
>
> This code should be in a separate function covered with unit tests.
>
> The core of this code is a general-purpose function that takes a path as input, finds the first nonexistent path component, and creates it as a directory. It should be a part of PathUtils. Probably without creating a directory part. Something like `Optional<Path> PathUtils.findFirstNonExistingComponent(Path path)`.
Another issue with this code is that it creates a directory during the configuration phase. Files/directories should be created at the packaging phase. Another reason to move it into MacDmgPackager.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25481#discussion_r2113071605
More information about the core-libs-dev
mailing list