forked from icsharpcode/SharpDevelop
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlaunch.sh
More file actions
executable file
·44 lines (40 loc) · 1.77 KB
/
Copy pathlaunch.sh
File metadata and controls
executable file
·44 lines (40 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
#
# launch.sh — thin wrapper. All build/run logic lives in launch.ps1 so Windows and
# macOS share one implementation (see also dist.macos.sh / dist.ps1).
#
# Usage:
# ./launch.sh build OpenDevelop.Mvp.sln, then run OpenDevelop
# ./launch.sh --no-build skip the build, just (re)run the last build output
# ./launch.sh --build-only build but do NOT launch (used by rebuild-all.sh --build-only and
# by the integration tests, which start their own app instance)
# DEVFLOW_DISABLE=1 ./launch.sh run without the DevFlow debugging agent
#
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
pwsh_bin="$(command -v pwsh 2>/dev/null || true)"
if [[ -z "${pwsh_bin}" ]]; then
for c in /opt/homebrew/bin/pwsh /usr/local/bin/pwsh; do
if [[ -x "${c}" ]]; then pwsh_bin="${c}"; break; fi
done
fi
if [[ -z "${pwsh_bin}" ]]; then
echo "launch.sh: cannot find pwsh (PowerShell). Install it with: brew install --cask powershell" >&2
exit 1
fi
# Translate historical flag spellings to PowerShell parameters (PowerShell does NOT
# bind "-no-build" to "-NoBuild" - dashes must go). Unrecognized flags fall through to
# PowerShell's own strict binding error.
args=()
for a in "$@"; do
case "${a}" in
--no-build) args+=("-NoBuild") ;;
--build-only) args+=("-BuildOnly") ;;
--*) args+=("-${a#--}") ;;
*) args+=("${a}") ;;
esac
done
# macOS's default bash (3.2) treats "${arr[@]}" on an EMPTY array as an unbound-variable
# error under `set -u` - guard explicitly instead of relying on `${arr[@]:-}`-style
# workarounds that read oddly for an array (same trick as rebuild-all.sh).
exec "${pwsh_bin}" -NoProfile -File "${repo_root}/launch.ps1" ${args[@]+"${args[@]}"}