make bundle script incremental when using debug or local builds

This commit is contained in:
Mikayla 2023-10-05 16:41:08 -07:00
parent 13192fa03c
commit 31062d424f
No known key found for this signature in database
4 changed files with 24 additions and 21 deletions

View file

@ -10,14 +10,8 @@
<true/> <true/>
<key>com.apple.security.device.camera</key> <key>com.apple.security.device.camera</key>
<true/> <true/>
<key>com.apple.security.personal-information.addressbook</key> <key>com.apple.security.keychain-access-groups</key>
<true/> <array><string>MQ55VZLNZQ.dev.zed.Shared</string></array>
<key>com.apple.security.personal-information.calendars</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
<key>com.apple.security.personal-information.photos-library</key>
<true/>
<!-- <key>com.apple.security.cs.disable-library-validation</key> <!-- <key>com.apple.security.cs.disable-library-validation</key>
<true/> --> <true/> -->
</dict> </dict>

View file

@ -32,12 +32,10 @@ use std::{
ffi::OsStr, ffi::OsStr,
fs::OpenOptions, fs::OpenOptions,
io::{IsTerminal, Write as _}, io::{IsTerminal, Write as _},
os::unix::prelude::OsStrExt,
panic, panic,
path::{Path, PathBuf}, path::{Path, PathBuf},
str,
sync::{ sync::{
atomic::{AtomicBool, AtomicU32, Ordering}, atomic::{AtomicU32, Ordering},
Arc, Weak, Arc, Weak,
}, },
thread, thread,
@ -45,7 +43,7 @@ use std::{
}; };
use sum_tree::Bias; use sum_tree::Bias;
use util::{ use util::{
channel::{ReleaseChannel, URL_SCHEME_PREFIX}, channel::ReleaseChannel,
http::{self, HttpClient}, http::{self, HttpClient},
paths::PathLikeWithPosition, paths::PathLikeWithPosition,
}; };

View file

@ -9,7 +9,7 @@ use std::{path::PathBuf, sync::atomic::AtomicBool};
use util::channel::URL_SCHEME_PREFIX; use util::channel::URL_SCHEME_PREFIX;
use util::ResultExt; use util::ResultExt;
use crate::{connect_to_cli, handle_cli_connection}; use crate::connect_to_cli;
pub enum OpenRequest { pub enum OpenRequest {
Paths { Paths {

View file

@ -5,6 +5,7 @@ set -e
build_flag="--release" build_flag="--release"
target_dir="release" target_dir="release"
open_result=false open_result=false
local_arch=false
local_only=false local_only=false
overwrite_local_app=false overwrite_local_app=false
bundle_name="" bundle_name=""
@ -16,8 +17,8 @@ Usage: ${0##*/} [options] [bundle_name]
Build the application bundle. Build the application bundle.
Options: Options:
-d Compile in debug mode (doesn't currently work without -l) -d Compile in debug mode
-l Compile for local architecture only and copy bundle to /Applications. -l Compile for local architecture and copy bundle to /Applications, implies -d.
-o Open the resulting DMG or the app itself in local mode. -o Open the resulting DMG or the app itself in local mode.
-f Overwrite the local app bundle if it exists. -f Overwrite the local app bundle if it exists.
-h Display this help and exit. -h Display this help and exit.
@ -32,10 +33,20 @@ do
case "${flag}" in case "${flag}" in
o) open_result=true;; o) open_result=true;;
d) d)
export CARGO_INCREMENTAL=true
export CARGO_BUNDLE_SKIP_BUILD=true
build_flag=""; 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" target_dir="debug"
;; ;;
l) local_only=true;;
f) overwrite_local_app=true;; f) overwrite_local_app=true;;
h) h)
help_info help_info
@ -67,7 +78,7 @@ version_info=$(rustc --version --verbose)
host_line=$(echo "$version_info" | grep host) host_line=$(echo "$version_info" | grep host)
local_target_triple=${host_line#*: } local_target_triple=${host_line#*: }
if [ "$local_only" = true ]; then if [ "$local_arch" = true ]; then
echo "Building for local target only." echo "Building for local target only."
cargo build ${build_flag} --package zed cargo build ${build_flag} --package zed
cargo build ${build_flag} --package cli cargo build ${build_flag} --package cli
@ -91,8 +102,8 @@ sed \
"s/package.metadata.bundle-${channel}/package.metadata.bundle/" \ "s/package.metadata.bundle-${channel}/package.metadata.bundle/" \
Cargo.toml Cargo.toml
if [ "$local_only" = true ]; then if [ "$local_arch" = true ]; then
app_path=$(cargo bundle ${build_flag} --target "$local_target_triple" --select-workspace-root | xargs) app_path=$(cargo bundle ${build_flag} --select-workspace-root | xargs)
else else
app_path=$(cargo bundle ${build_flag} --target x86_64-apple-darwin --select-workspace-root | xargs) app_path=$(cargo bundle ${build_flag} --target x86_64-apple-darwin --select-workspace-root | xargs)
fi fi
@ -101,7 +112,7 @@ mv Cargo.toml.backup Cargo.toml
popd popd
echo "Bundled ${app_path}" echo "Bundled ${app_path}"
if [ "$local_only" = false ]; then if [ "$local_arch" = false ]; then
echo "Creating fat binaries" echo "Creating fat binaries"
lipo \ lipo \
-create \ -create \
@ -136,7 +147,7 @@ else
codesign --force --deep --entitlements crates/zed/resources/zed.entitlements --sign - "${app_path}" -v codesign --force --deep --entitlements crates/zed/resources/zed.entitlements --sign - "${app_path}" -v
fi fi
if [ "$target_dir" = "debug" ]; then if [[ "$target_dir" = "debug" && "$local_only" = false ]]; then
if [ "$open_result" = true ]; then if [ "$open_result" = true ]; then
open "$app_path" open "$app_path"
else else