Closed hepcat72 closed 5 years ago
For 1), the dmg creation is done by hdiutil, and it has no options for not following symlinks. Sorry, but that is not something I have the ability to fix. The correct way to do the linking is to create it inside the dmg after it has been created. Then it will function as you want.
For 2) it would be nice to allow this, but using a "blank" background image seems a good workaround. I'll leave this issue open and try to add an option if I make another release, but not sure if or when that would happen.
So for 1), would it be a command-line call to hdiutil to add the alias to the dmg created by running the createDmg task? So, I would run gradle createDmg
, then run the new task you're proposing to add the alias? I'm not very familiar with hdiutil. This is the first mac app I've ever built. If this is how that would be handled, could I also define window locations for the README and sample data file I added? Because their default locations appear to be filling the window from top-left to right, above the .app and apps alias...
macAppBundle {
...
copyMacPkgFiles()
}
def copyMacPkgFiles() {
copy {
from file("${projectDir}/")
into file("${buildDir}/macApp")
include 'README.md'
rename('README.md','README.txt')
}
mkdir file("${buildDir}/macApp/Sample")
copy {
from file("${projectDir}/src/main/resources")
into file("${buildDir}/macApp/Sample")
include 'spellman.cdt'
}
}
You have to first create the dmg, then mount it, then do whatever extra stuff you want, then unmount it.
See https://github.com/crotwell/gradle-macappbundle/blob/master/src/main/groovy/edu/sc/seis/macAppBundle/MacAppBundlePlugin.groovy about line 296 for the dmg creation and about line 383 for how the linking it is done internally.
This page although old, maybe useful.
@hepcat72 opened a pull request which should add this functionality https://github.com/crotwell/gradle-macappbundle/pull/62
In v2.2.3
There's potentially 2 issues here. I tried creating my own /Applications alias using this code in macAppBundle:
but that leads to the error:
because it appears to be following the symbolic link when it creates the dmg.
So I was searching the code and discovered that macAppBundle will create a /Applications alias if I just set a background image.
I'm going to work around this by creating a single white pixel background image, but it seems that: