-
Notifications
You must be signed in to change notification settings - Fork 139
Description
Description
When the Maven build is run in our Jenkins DMG creation fails. This results from the fact that an OSA script is run that uses Finder to arrange the size of the DMG image and the position of the icons. This leads to creating a .DS_Store file on the volume.
Unfortunately there is no way to arrange the icons in the DMG volume other than using the Finder. At the end this leads to the decision to
- create no DMG image when running in headless mode (Jenkins build) or
- create a simple DMG image that looks a little bit ugly.
We would like to allow the latter and I inspected the code of this plugin.
I made a small modification in GenerateDmg and put the code in charge to run the OSA script into an if clause
if (!GraphicsEnvironment.isHeadless()) {
// renders applescript
Logger.info("Rendering DMG customization applescript ... ");
File applescriptFile = new File(assetsFolder, "customize-dmg.applescript");
VelocityUtils.render("/mac/customize-dmg.applescript.vtl", applescriptFile, packager);
Logger.info("Applescript rendered in " + applescriptFile.getAbsolutePath() + "!");
// runs applescript
Logger.info("Running applescript");
execute("/usr/bin/osascript", applescriptFile, volumeName);
}
I did a test run with this invocation: mvn -Djava.awt.headless=true clean package
Maybe there are better options? It could be also possible to pass an argument like a headless flag to the OSA script and do not run the Finder commands when headless mode is encountered? Or maybe you have even better ideas?
Versions
Javapackager: 1.7.6
Java: 18.0.2.1
Maven: 3.8.1
Pull request
If you like I can create a pull request when we have discussed and found the best way to handle this situation. I am open for your proposals.
Thanks
Thorsten