From 31062d424f385c34ccc3496e74dbd0d57978cf90 Mon Sep 17 00:00:00 2001 From: Mikayla Date: Thu, 5 Oct 2023 16:41:08 -0700 Subject: [PATCH] make bundle script incremental when using debug or local builds --- crates/zed/resources/zed.entitlements | 10 ++-------- crates/zed/src/main.rs | 6 ++---- crates/zed/src/open_url.rs | 2 +- script/bundle | 27 +++++++++++++++++++-------- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/crates/zed/resources/zed.entitlements b/crates/zed/resources/zed.entitlements index f40a8a253a..dca0ff6766 100644 --- a/crates/zed/resources/zed.entitlements +++ b/crates/zed/resources/zed.entitlements @@ -10,14 +10,8 @@ com.apple.security.device.camera - com.apple.security.personal-information.addressbook - - com.apple.security.personal-information.calendars - - com.apple.security.personal-information.location - - com.apple.security.personal-information.photos-library - + com.apple.security.keychain-access-groups + MQ55VZLNZQ.dev.zed.Shared diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index c491d406af..9d0451ecfa 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -32,12 +32,10 @@ use std::{ ffi::OsStr, fs::OpenOptions, io::{IsTerminal, Write as _}, - os::unix::prelude::OsStrExt, panic, path::{Path, PathBuf}, - str, sync::{ - atomic::{AtomicBool, AtomicU32, Ordering}, + atomic::{AtomicU32, Ordering}, Arc, Weak, }, thread, @@ -45,7 +43,7 @@ use std::{ }; use sum_tree::Bias; use util::{ - channel::{ReleaseChannel, URL_SCHEME_PREFIX}, + channel::ReleaseChannel, http::{self, HttpClient}, paths::PathLikeWithPosition, }; diff --git a/crates/zed/src/open_url.rs b/crates/zed/src/open_url.rs index f421633d5b..1c741a02c8 100644 --- a/crates/zed/src/open_url.rs +++ b/crates/zed/src/open_url.rs @@ -9,7 +9,7 @@ use std::{path::PathBuf, sync::atomic::AtomicBool}; use util::channel::URL_SCHEME_PREFIX; use util::ResultExt; -use crate::{connect_to_cli, handle_cli_connection}; +use crate::connect_to_cli; pub enum OpenRequest { Paths { diff --git a/script/bundle b/script/bundle index 4882189c22..94741d290f 100755 --- a/script/bundle +++ b/script/bundle @@ -5,6 +5,7 @@ set -e build_flag="--release" target_dir="release" open_result=false +local_arch=false local_only=false overwrite_local_app=false bundle_name="" @@ -16,8 +17,8 @@ Usage: ${0##*/} [options] [bundle_name] Build the application bundle. Options: - -d Compile in debug mode (doesn't currently work without -l) - -l Compile for local architecture only and copy bundle to /Applications. + -d Compile in debug mode + -l Compile for local architecture and copy bundle to /Applications, implies -d. -o Open the resulting DMG or the app itself in local mode. -f Overwrite the local app bundle if it exists. -h Display this help and exit. @@ -32,10 +33,20 @@ do case "${flag}" in o) open_result=true;; d) + export CARGO_INCREMENTAL=true + export CARGO_BUNDLE_SKIP_BUILD=true build_flag=""; + local_arch=true + target_dir="debug" + ;; + l) + export CARGO_INCREMENTAL=true + export CARGO_BUNDLE_SKIP_BUILD=true + build_flag="" + local_arch=true + local_only=true target_dir="debug" ;; - l) local_only=true;; f) overwrite_local_app=true;; h) help_info @@ -67,7 +78,7 @@ version_info=$(rustc --version --verbose) host_line=$(echo "$version_info" | grep host) local_target_triple=${host_line#*: } -if [ "$local_only" = true ]; then +if [ "$local_arch" = true ]; then echo "Building for local target only." cargo build ${build_flag} --package zed cargo build ${build_flag} --package cli @@ -91,8 +102,8 @@ sed \ "s/package.metadata.bundle-${channel}/package.metadata.bundle/" \ Cargo.toml -if [ "$local_only" = true ]; then - app_path=$(cargo bundle ${build_flag} --target "$local_target_triple" --select-workspace-root | xargs) +if [ "$local_arch" = true ]; then + app_path=$(cargo bundle ${build_flag} --select-workspace-root | xargs) else app_path=$(cargo bundle ${build_flag} --target x86_64-apple-darwin --select-workspace-root | xargs) fi @@ -101,7 +112,7 @@ mv Cargo.toml.backup Cargo.toml popd echo "Bundled ${app_path}" -if [ "$local_only" = false ]; then +if [ "$local_arch" = false ]; then echo "Creating fat binaries" lipo \ -create \ @@ -136,7 +147,7 @@ else codesign --force --deep --entitlements crates/zed/resources/zed.entitlements --sign - "${app_path}" -v fi -if [ "$target_dir" = "debug" ]; then +if [[ "$target_dir" = "debug" && "$local_only" = false ]]; then if [ "$open_result" = true ]; then open "$app_path" else