Skip to content

Commit

Permalink
add architecture-agnostic dmg
Browse files Browse the repository at this point in the history
this dmg does not include JRE but rather uses the JRE
that is available on the machine.

to achieve this, we added gradle-macappbundle back with
the changes in:
crotwell/gradle-macappbundle#76
  • Loading branch information
ahadas committed Sep 26, 2024
1 parent 54a8222 commit b23f849
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
os: macos-14
- arch: x86_64
os: macos-12
- arch: noarch
os: macos-14
runs-on: ${{ matrix.os }}
needs: get-version
steps:
Expand Down Expand Up @@ -64,6 +66,11 @@ jobs:

- name: Build dmg
run: ./gradlew dmg -Parch=${{ matrix.arch }} -Pidentity="${{ secrets.MACOS_IDENTITY }}"
if: ${{ matrix.arch }} != 'noarch'

- name: Build dmg
run: ./gradlew createDmg -Pidentity="${{ secrets.MACOS_IDENTITY }}"
if: ${{ matrix.arch }} == 'noarch'

- name: Sign dmg
run: /usr/bin/codesign --entitlements package/osx/mucommander-entitlements --timestamp --options runtime --deep --force -s "${{ secrets.MACOS_IDENTITY }}" "./build/distributions/mucommander-${{ needs.get-version.outputs.full_version }}-${{ matrix.arch }}.dmg" -v
Expand Down
103 changes: 103 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0'
classpath files('libs/mucommander-gradle-macappbundle.jar')
}
}

Expand All @@ -14,6 +15,10 @@ plugins {
id 'edu.sc.seis.launch4j' version '2.5.4'
}

// This is the only syntax that appears to work for a local plugin
// TODO: replace this with an official release of gradle-macappbundle
apply plugin: 'edu.sc.seis.macAppBundle'

allprojects {
tasks.withType(JavaCompile).configureEach {
options.fork = true
Expand Down Expand Up @@ -645,3 +650,101 @@ task msi(dependsOn: 'winAppImage', type: Exec) {
'--vendor', 'Arik Hadas'
}

configurations.default.canBeResolved=true

macAppBundle {
appName = "muCommander"
dmgName = 'mucommander-'+project.version+'-'+project.ext.release+'-noarch'
mainClassName = "com.mucommander.main.muCommander"
appStyle = "universalJavaApplicationStub"
bundleJRE = false
bundleIdentifier = "com.mucommander.muCommander"
jvmVersion = "1.6+"
icon = "package/osx/icon.icns"
bundleAllowMixedLocalizations = "true"
bundleExtras.put("NSHighResolutionCapable", "true")
bundleExtras.put("NSSupportsAutomaticGraphicsSwitching", "true")
backgroundImage = "package/osx/bg.gif"
backgroundImageWidth = 450
backgroundImageHeight = 475
appIconX = 225
appIconY = 75
appFolderX = 225
appFolderY = 350
backgroundScript = """
tell application "Finder"
tell disk "\${VOL_NAME}"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to { 0, 0, \${IMAGE_WIDTH}, \${IMAGE_HEIGHT} }
set the position of the container window to {400, 100}
set viewOptions to the icon view options of container window
set arrangement of viewOptions to not arranged
set icon size of viewOptions to 72
set background picture of viewOptions to file ".background:\${DMG_BACKGROUND_IMG}"
set position of item "\${APP_NAME}.app" of container window to { \${APPICONX}, \${APPICONY} }
set position of item "Applications" of container window to { \${APPFOLDERX}, \${APPFOLDERY} }
close
open
update without registering applications
delay 2
end tell
end tell
"""

if (!project.hasProperty('skipDmgSign') && project.ext.identity?.trim()) {
certIdentity = project.ext.identity
}
javaProperties.put("com.apple.smallTabs", "true")
javaProperties.put("com.apple.hwaccel", "true")
javaProperties.put("apple.laf.useScreenMenuBar", "true")
javaProperties.put("file.encoding", "UTF-8")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.desktop/com.apple.eawt=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.desktop/com.apple.laf=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.desktop/com.apple.laf=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.desktop/com.apple.eio=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.desktop/com.apple.eawt=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.desktop/javax.swing.plaf.basic=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.base/java.io=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.base/java.net=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.transaction.xa/javax.transaction.xa=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.management/javax.management=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.rmi/java.rmi=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.security.jgss/org.ietf.jgss=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.sql/java.sql=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.base/sun.net.www.protocol.http=ALL-UNNAMED")
javaExtrasList.add("--add-exports")
javaExtrasList.add("java.base/sun.net.www.protocol.https=ALL-UNNAMED")
}

copyToResourcesJava.dependsOn createBundlesDir
copyToResourcesJava.doLast {
copy {
from "build/osgi"
include 'app/**'
include 'bundle/**'
include 'conf/**'
exclude 'bundle/osgiaas*'
exclude 'bundle/jline*'
exclude 'bundle/mucommander-os-linux*'
exclude 'bundle/mucommander-os-openvms*'
exclude 'bundle/mucommander-os-win*'
into project.file("${->project.buildDir}/${->project.macAppBundle.appOutputDir}/${->project.macAppBundle.appName}.app/Contents/${->project.macAppBundle.jarSubdir}")
}
}
Binary file added libs/mucommander-gradle-macappbundle.jar
Binary file not shown.

0 comments on commit b23f849

Please sign in to comment.