mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-24 17:28:40 +00:00
make bundle script incremental when using debug or local builds
This commit is contained in:
parent
13192fa03c
commit
31062d424f
4 changed files with 24 additions and 21 deletions
|
@ -10,14 +10,8 @@
|
|||
<true/>
|
||||
<key>com.apple.security.device.camera</key>
|
||||
<true/>
|
||||
<key>com.apple.security.personal-information.addressbook</key>
|
||||
<true/>
|
||||
<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.keychain-access-groups</key>
|
||||
<array><string>MQ55VZLNZQ.dev.zed.Shared</string></array>
|
||||
<!-- <key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/> -->
|
||||
</dict>
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue