nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.36k stars 3.89k forks source link

Distribution folder structure for macOS changed in 0.40.x #7130

Closed arudnev closed 4 years ago

arudnev commented 5 years ago

It seems that folder structure of distribution packages has changed starting with 0.40.0, potentially causing various issues with build. It would be great to update Package and Distribute instructions and potentially contact some of the maintainers of the tools with details of the change, so that they could adjust their code accordingly.

In particular, for macOS distribution, this is what was in 0.39.x folder structure:

cd "./nwjs.app/Contents"
find . -maxdepth 2 | grep -v 'Resources//*'
.
./MacOS
./MacOS/nwjs
./Resources
./Versions
./Versions/x.x.x.x
./Info.plist
./PkgInfo

cd "./Versions/x.x.x.x"
find . | grep -v 'Resources//*'
.
./nwjs Helper.app
./nwjs Helper.app/Contents
./nwjs Helper.app/Contents/MacOS
./nwjs Helper.app/Contents/MacOS/nwjs Helper
./nwjs Helper.app/Contents/Info.plist
./nwjs Helper.app/Contents/PkgInfo
./nwjs Framework.framework
./nwjs Framework.framework/Resources
./nwjs Framework.framework/Versions
./nwjs Framework.framework/Versions/A
./nwjs Framework.framework/Versions/A/Resources
./nwjs Framework.framework/Versions/A/Libraries
./nwjs Framework.framework/Versions/A/Libraries/libEGL.dylib
./nwjs Framework.framework/Versions/A/Libraries/libswiftshader_libEGL.dylib
./nwjs Framework.framework/Versions/A/Libraries/MEIPreload
./nwjs Framework.framework/Versions/A/Libraries/MEIPreload/preloaded_data.pb
./nwjs Framework.framework/Versions/A/Libraries/MEIPreload/manifest.json
./nwjs Framework.framework/Versions/A/Libraries/libGLESv2.dylib
./nwjs Framework.framework/Versions/A/Libraries/libswiftshader_libGLESv2.dylib
./nwjs Framework.framework/Versions/A/nwjs Framework
./nwjs Framework.framework/Versions/A/XPCServices
./nwjs Framework.framework/Versions/A/XPCServices/AlertNotificationService.xpc
./nwjs Framework.framework/Versions/A/XPCServices/AlertNotificationService.xpc/Contents
./nwjs Framework.framework/Versions/A/XPCServices/AlertNotificationService.xpc/Contents/MacOS
./nwjs Framework.framework/Versions/A/XPCServices/AlertNotificationService.xpc/Contents/MacOS/AlertNotificationService
./nwjs Framework.framework/Versions/A/XPCServices/AlertNotificationService.xpc/Contents/Info.plist
./nwjs Framework.framework/Versions/A/Helpers
./nwjs Framework.framework/Versions/A/Helpers/chrome_crashpad_handler
./nwjs Framework.framework/Versions/A/Helpers/app_mode_loader
./nwjs Framework.framework/Versions/Current
./nwjs Framework.framework/Libraries
./nwjs Framework.framework/nwjs Framework
./nwjs Framework.framework/XPCServices
./nwjs Framework.framework/libnode.dylib
./nwjs Framework.framework/Helpers
./nwjs Framework.framework/libffmpeg.dylib

And this is what's there in 0.40.x:

cd "./nwjs.app/Contents"
find . -maxdepth 4 | grep -v 'Resources//*'
.
./MacOS
./MacOS/nwjs
./Resources
./Frameworks
./Frameworks/nwjs Framework.framework
./Frameworks/nwjs Framework.framework/Resources
./Frameworks/nwjs Framework.framework/Versions
./Frameworks/nwjs Framework.framework/Versions/Current
./Frameworks/nwjs Framework.framework/Versions/x.x.x.x
./Frameworks/nwjs Framework.framework/Libraries
./Frameworks/nwjs Framework.framework/nwjs Framework
./Frameworks/nwjs Framework.framework/XPCServices
./Frameworks/nwjs Framework.framework/Helpers
./Info.plist
./PkgInfo

cd "./Frameworks/nwjs Framework.framework/Versions/x.x.x.x"
find .| grep -v 'Resources//*'
.
./Resources
./Libraries
./Libraries/libEGL.dylib
./Libraries/libswiftshader_libEGL.dylib
./Libraries/MEIPreload
./Libraries/MEIPreload/preloaded_data.pb
./Libraries/MEIPreload/manifest.json
./Libraries/libGLESv2.dylib
./Libraries/libswiftshader_libGLESv2.dylib
./nwjs Framework
./XPCServices
./XPCServices/AlertNotificationService.xpc
./XPCServices/AlertNotificationService.xpc/Contents
./XPCServices/AlertNotificationService.xpc/Contents/MacOS
./XPCServices/AlertNotificationService.xpc/Contents/MacOS/AlertNotificationService
./XPCServices/AlertNotificationService.xpc/Contents/Info.plist
./libnode.dylib
./Helpers
./Helpers/nwjs Helper.app
./Helpers/nwjs Helper.app/Contents
./Helpers/nwjs Helper.app/Contents/MacOS
./Helpers/nwjs Helper.app/Contents/MacOS/nwjs Helper
./Helpers/nwjs Helper.app/Contents/Info.plist
./Helpers/nwjs Helper.app/Contents/PkgInfo
./Helpers/chrome_crashpad_handler
./Helpers/app_mode_loader
./Helpers/nwjs Helper (Plugin).app
./Helpers/nwjs Helper (Plugin).app/Contents
./Helpers/nwjs Helper (Plugin).app/Contents/MacOS
./Helpers/nwjs Helper (Plugin).app/Contents/MacOS/nwjs Helper (Plugin)
./Helpers/nwjs Helper (Plugin).app/Contents/Info.plist
./Helpers/nwjs Helper (Plugin).app/Contents/PkgInfo
./Helpers/nwjs Helper (Renderer).app
./Helpers/nwjs Helper (Renderer).app/Contents
./Helpers/nwjs Helper (Renderer).app/Contents/MacOS
./Helpers/nwjs Helper (Renderer).app/Contents/MacOS/nwjs Helper (Renderer)
./Helpers/nwjs Helper (Renderer).app/Contents/Info.plist
./Helpers/nwjs Helper (Renderer).app/Contents/PkgInfo
./Helpers/nwjs Helper (GPU).app
./Helpers/nwjs Helper (GPU).app/Contents
./Helpers/nwjs Helper (GPU).app/Contents/MacOS
./Helpers/nwjs Helper (GPU).app/Contents/MacOS/nwjs Helper (GPU)
./Helpers/nwjs Helper (GPU).app/Contents/Info.plist
./Helpers/nwjs Helper (GPU).app/Contents/PkgInfo
./libffmpeg.dylib

According to Build and Distribute / Quick Start

nwjs-builder-phoenix (recommended)

Most likely it's going to be broken as it tries to resolve location of nwjs Helper based on old folder structure

https://github.com/evshiron/nwjs-builder-phoenix/blob/e9c26b61669589e599da95ee82ac3bb489c6dd04/src/lib/Builder.ts#L410

And then it will try renaming nwjs Helper to have application specific name

https://github.com/evshiron/nwjs-builder-phoenix/blob/e9c26b61669589e599da95ee82ac3bb489c6dd04/src/lib/Builder.ts#L379

The parent folder of nwjs Helper.app has changed from ./nwjs.app/Contents/Versions/x.x.x.x/ to ./nwjs.app/Contents/Frameworks/nwjs Framework.framework/Versions/x.x.x.x./Helpers/. Also, other helper apps (nwjs Helper (Plugin).app, nwjs Helper (Renderer).app, nwjs Helper (GPU).app) are now available in the same location and probably should be subject to the same treatment as nwjs Helper.app The changes that are supposed to happen for helper app are described in Build and Distribute / Platform Specific Steps / Mac OS X, so perhaps this section should be updated with new locations and new helper apps.

Not sure if there are any official docs on nwjs app signing and scripts for it, or if people use something that is based on https://github.com/nwjs/nw.js/issues/4267, but most likely set of files that need to be signed and their locations should be updated in those docs / scripts.

wiki: MAS: Signing the app wiki: Signing your app but NOT for Mac Apple Store (MAS) docs: Support for Mac App Store

arudnev commented 5 years ago

It seems that latest version of build_mas.py references even older distribution package structure than what 0.39.x had and https://github.com/nwjs/nw.js/issues/6325 has more links to code signing related issues. It does not seems that PR with code signing support referenced in that issue has ever been merged into nwjs-builder-phoenix, so still not sure how people typically sign the app and if there are any up-to-date instructions of what and how needs to be signed for MAS or custom distribution via dmg. While something like this produces and validates signed app, it probably should be split into individual sign / verify calls with separate entitlements file for each file / bundle:

codesign --force --deep --sign --verbose=4 "${identity}" "${app}"
codesign --verify --verbose=4 "${app}"
spctl --assess --verbose=4 "${app}"

In case of MAS use of --deep most likely would cause issues if combined with--entitlements ${entitlements_plist}" due to recursive application of those entitlements, so the following set of files / folders should be used instead for sign and verify:

${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/libffmpeg.dylib
${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/libnode.dylib
${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/chrome_crashpad_handler
${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/app_mode_loader
${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/XPCServices/AlertNotificationService.xpc
${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/nwjs Helper.app
${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/nwjs Helper (GPU).app
${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/nwjs Helper (Plugin).app
${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/nwjs Helper (Renderer).app
# ${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/nwjs Framework
# ${app}/Contents/Frameworks/nwjs Framework.framework/Versions/Current
${app}/Contents/Frameworks/nwjs Framework.framework
${app}
gpetrov commented 5 years ago

See also https://github.com/nwjs/nw.js/issues/7117#issuecomment-520456999 for recursive signing script

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.