From 8ad7eb7598a770b6b77afe1d7565099e8983e8b3 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 13 Jun 2023 18:01:51 -0700 Subject: [PATCH 1/2] Switch to using new version of cargo bundle with more capabilities --- crates/zed/Cargo.toml | 6 ++++- .../info/DocumentTypes.plist} | 0 crates/zed/resources/info/Permissions.plist | 24 +++++++++++++++++++ script/bundle | 17 +++++-------- 4 files changed, 35 insertions(+), 12 deletions(-) rename crates/zed/{BundleDocumentTypes.plist => resources/info/DocumentTypes.plist} (100%) create mode 100644 crates/zed/resources/info/Permissions.plist diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index c30c30f17d..e33dd7acbd 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -142,20 +142,24 @@ workspace = { path = "../workspace", features = ["test-support"] } unindent.workspace = true -[package.metadata.bundle-dev] +[package.metadata.bundle] icon = ["resources/app-icon-preview@2x.png", "resources/app-icon-preview.png"] identifier = "dev.zed.Zed-Dev" name = "Zed Dev" osx_minimum_system_version = "10.15.7" +osx_info_plist_exts = ["resources/info/*"] [package.metadata.bundle-preview] icon = ["resources/app-icon-preview@2x.png", "resources/app-icon-preview.png"] identifier = "dev.zed.Zed-Preview" name = "Zed Preview" osx_minimum_system_version = "10.15.7" +osx_info_plist_exts = ["resources/info/*"] + [package.metadata.bundle-stable] icon = ["resources/app-icon@2x.png", "resources/app-icon.png"] identifier = "dev.zed.Zed" name = "Zed" osx_minimum_system_version = "10.15.7" +osx_info_plist_exts = ["resources/info/*"] diff --git a/crates/zed/BundleDocumentTypes.plist b/crates/zed/resources/info/DocumentTypes.plist similarity index 100% rename from crates/zed/BundleDocumentTypes.plist rename to crates/zed/resources/info/DocumentTypes.plist diff --git a/crates/zed/resources/info/Permissions.plist b/crates/zed/resources/info/Permissions.plist new file mode 100644 index 0000000000..bded5a82e2 --- /dev/null +++ b/crates/zed/resources/info/Permissions.plist @@ -0,0 +1,24 @@ +NSSystemAdministrationUsageDescription +The operation being performed by a program in Zed requires elevated permission. +NSAppleEventsUsageDescription +An application in Zed wants to use AppleScript. +NSBluetoothAlwaysUsageDescription +An application in Zed wants to use Bluetooth. +NSCalendarsUsageDescription +An application in Zed wants to use Calendar data. +NSCameraUsageDescription +An application in Zed wants to use the camera. +NSContactsUsageDescription +An application in Zed wants to use your contacts. +NSLocationAlwaysUsageDescription +An application in Zed wants to use your location information, even in the background. +NSLocationUsageDescription +An application in Zed wants to use your location information. +NSLocationWhenInUseUsageDescription +An application in Zed wants to use your location information while active. +NSMicrophoneUsageDescription +An application in Zed wants to use your microphone. +NSSpeechRecognitionUsageDescription +An application in Zed wants to use speech recognition. +NSRemindersUsageDescription +An application in Zed wants to use your reminders. diff --git a/script/bundle b/script/bundle index 2f69d4e67e..38bc26188d 100755 --- a/script/bundle +++ b/script/bundle @@ -23,7 +23,11 @@ done export ZED_BUNDLE=true export MACOSX_DEPLOYMENT_TARGET=10.15.7 -which cargo-bundle > /dev/null || cargo install cargo-bundle --version 0.5.0 +cargo_bundle_version=$(cargo -q bundle --help 2>&1 | head -n 1 || echo "") +if [ "$cargo_bundle_version" != "cargo-bundle v0.6.0-zed" ]; then + cargo install cargo-bundle --git https://github.com/zed-industries/cargo-bundle.git --branch zed-deploy +fi + rustup target add wasm32-wasi # Deal with versions of macOS that don't include libstdc++ headers @@ -46,9 +50,7 @@ sed \ -i .backup \ "s/package.metadata.bundle-${channel}/package.metadata.bundle/" \ Cargo.toml -app_path=$(cargo bundle ${build_flag} --target x86_64-apple-darwin | xargs) - -echo app_path +app_path=$(cargo bundle ${build_flag} --target x86_64-apple-darwin --select-workspace-root | xargs) mv Cargo.toml.backup Cargo.toml popd @@ -70,13 +72,6 @@ echo "Copying WebRTC.framework into the frameworks folder" mkdir "${app_path}/Contents/Frameworks" cp -R target/x86_64-apple-darwin/${target_dir}/WebRTC.framework "${app_path}/Contents/Frameworks/" -mv "${app_path}/Contents/Info.plist" "${app_path}/Contents/WithoutDocumentTypes.plist" -awk \ - "/<\/dict>/{while(getline line<\"./crates/zed/BundleDocumentTypes.plist\"){print line}}1" \ - "${app_path}/Contents/WithoutDocumentTypes.plist" \ - > "${app_path}/Contents/Info.plist" -rm "${app_path}/Contents/WithoutDocumentTypes.plist" - if [[ -n $MACOS_CERTIFICATE && -n $MACOS_CERTIFICATE_PASSWORD && -n $APPLE_NOTARIZATION_USERNAME && -n $APPLE_NOTARIZATION_PASSWORD ]]; then echo "Signing bundle with Apple-issued certificate" security create-keychain -p "$MACOS_CERTIFICATE_PASSWORD" zed.keychain || echo "" From adc8337ad49f9274d5bdfbbf348306c69a960f0a Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 13 Jun 2023 18:08:33 -0700 Subject: [PATCH 2/2] Restore misconfigured Cargo.toml --- crates/zed/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index e33dd7acbd..c8b47626e2 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -142,7 +142,7 @@ workspace = { path = "../workspace", features = ["test-support"] } unindent.workspace = true -[package.metadata.bundle] +[package.metadata.bundle-dev] icon = ["resources/app-icon-preview@2x.png", "resources/app-icon-preview.png"] identifier = "dev.zed.Zed-Dev" name = "Zed Dev"