Added support to add files to jpackage resources argument - #3647
Open
alchitry wants to merge 1 commit into
Open
Conversation
Author
|
I ended up writing a task to modify the generated deb instead as I think it is the more correct solution. I do think this addition could still be helpful for some use cases. |
Amaan Marfatia (CloudyDino)
added a commit
to CloudyDino/compose-multiplatform
that referenced
this pull request
May 28, 2026
jpackage's --resource-dir is the documented override mechanism for packaging resources (DMG volume icon via <name>-volume.icns, DMG background, Linux preinst/postinst scripts, WiX templates, ...), but Compose fully owns that directory: AbstractJPackageTask clears it and repopulates it with the generated Info.plist on every run, so users have no supported way to contribute their own files to it. Add a packagingResourcesRootDir DSL property, mirroring appResourcesRootDir (with common/<os>/<os>-<arch> subdirectories). Its files are copied into the jpackage resource dir after it is cleared but before the generated Info.plist/product-def.plist are written, so the Compose-managed plists always take precedence over user-supplied files. This revives the approach a maintainer suggested on JetBrains#1843 and supersedes the abandoned JetBrains#3647. Unlike JetBrains#1843 -- which repointed jpackageResources at a Sync output and so had its files removed by clearDirs -- the files are copied in after the clear, so nothing is wiped. Addresses CMP-2042, CMP-6411, CMP-1972, CMP-9837. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I wanted to add a driver (udev rule) file to my Linux install and to do this I needed to override the
postinstscript that jpackage generates. This can be done by providing apostinstscript in the directory pointed to by the--resource-dirflag.This is currently not exposed and is used only by the MacOS target.
I added an override that allows a directory to be supplied to each OS target. It may be better if this could be specified for each
TargetFormattype instead of per OS but I don't think it matters as I think jpackage will ignore the files it doesn't recognize.See https://docs.oracle.com/en/java/javase/20/jpackage/override-jpackage-resources.html for the relavant reasons to override this.