Skip to content

Conversation

silverjam
Copy link
Contributor

@silverjam silverjam commented Jun 4, 2022

Jira: https://swift-nav.atlassian.net/browse/CPP-770

Test installer build: https://github.com/swift-nav/swift-toolbox/releases/tag/v4.0.8-macos-bundle-cleanup

  • Clean out out the MacOS directory so that only the executable for the app is there, this is enabled by tweaking the loader paths for the linked Python libraries -- the use of @executable_path in the link line is supposedly not allowed according to https://developer.apple.com/forums/thread/129795

  • Increase verbosity of the signing / notarization process

  • Add more Info.plist keys to try to fix launch errors, pulling in keys from fbs: https://github.com/mherrmann/fbs/blob/master/fbs/_defaults/src/freeze/mac/Contents/Info.plist

  • At least one reference online suggested that assigning a bundle ID in the Info.plist resolved issues with launching via open on Catalina

  • Try to clean up a few more things inside the .app before we sign and notarize


macos-catalina-launch

Jason Mobarak and others added 11 commits June 4, 2022 01:10
@silverjam silverjam changed the title Clean-up macOS bundle [CPP-770] macOS bundle rehabilitation [CPP-770] Jun 5, 2022
@silverjam silverjam changed the title macOS bundle rehabilitation [CPP-770] macos: launch from finder in catalina [CPP-770] Jun 5, 2022
@silverjam silverjam requested review from RaiBearG and samvrlewis June 5, 2022 19:20
@silverjam
Copy link
Contributor Author

silverjam commented Jun 5, 2022

@RaiBearG Can you please this out on on Mojave and Monterey? Test build is here: https://github.com/swift-nav/swift-toolbox/releases/tag/v4.0.8-macos-bundle-cleanup -- I'll test on Windows / Linux briefly

@samvrlewis Could use your help with quick code review (on your Monday).

Copy link
Contributor

@samvrlewis samvrlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM though admittedly I'm not super clear on the Mac paths stuff

Comment on lines +52 to +54
let resources = parent.join("Resources/lib");
if resources.exists() {
Ok(parent.join("Resources"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What controls whether the path is Resources or Resources/lib?

Copy link
Contributor Author

@silverjam silverjam Jun 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is basically tweaking the heuristic that's used to detect if we're living inside of a macOS .app bundle -- before I was trying to use just "resources" but the heuristic was triggered when running a build from "py39-dist". The PYTHONHOME var wants a path that contains a "lib" directory (technically lib/python3.9) so we have to supply just the "Resources" path so that Python loads correctly.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at https://github.com/mherrmann/fbs/blob/d6dbde2bdff01907c4b83524f67a38df83fa0f2c/fbs/_defaults/src/freeze/mac/Contents/Info.plist looks like we're missing

    <key>LSBackgroundOnly</key>
    <string>0</string>

and

    <!-- Enable Retina support on OS X: -->
    <key>NSPrincipalClass</key>
    <string>NSApplication</string>

Were these intentionally skipped?

Copy link
Contributor Author

@silverjam silverjam Jun 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These looked like they could potentially change the behavior of the app (based on naming, didn't look up the docs), so I skipped them intentionally-- the new keys I did add felt more like metadata.

@silverjam silverjam merged commit ce0f989 into main Jun 7, 2022
@silverjam silverjam deleted the silverjam/macos-bundle-cleanup branch June 7, 2022 06:32
@silverjam
Copy link
Contributor Author

@RaiBearG just need to know if this launches on Mojave and Monterey-- I've went ahead and merged, but please let me know if there are issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants