-
-
Notifications
You must be signed in to change notification settings - Fork 558
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·110 lines (93 loc) · 3.81 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·110 lines (93 loc) · 3.81 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
# FluidVoice Build Profile Router
# Defaults to the public OSS build, which skips private Fluid Intelligence.
#
# Usage:
# ./build.sh # signed public OSS build
# ./build.sh public # signed public OSS build
# ./build.sh unsigned # unsigned public OSS build (CI/fallback)
# ./build.sh fi # private FI build
set -euo pipefail
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROFILE="${1:-${BUILD_PROFILE:-public}}"
PRIVATE_FI_BUILD_SCRIPT="${PROJECT_DIR}/build_with_FI_incremental.sh"
DERIVED_DATA_PATH="${FLUIDVOICE_DERIVED_DATA_PATH:-${PROJECT_DIR}/DerivedData}"
resolve_development_team() {
local identity
identity="$(security find-identity -v -p codesigning 2>/dev/null \
| sed -n 's/.*"\(Apple Development:[^"]*\)".*/\1/p' \
| awk 'NR == 1 { identity = $0 } END { print identity }')"
[ -n "${identity}" ] || return 0
if [ -n "${FLUIDVOICE_DEVELOPMENT_TEAM:-}" ]; then
printf '%s\n' "${FLUIDVOICE_DEVELOPMENT_TEAM}"
return
fi
security find-certificate -c "${identity}" -p 2>/dev/null \
| openssl x509 -noout -subject -nameopt RFC2253 2>/dev/null \
| sed -n 's/.*OU=\([^,]*\).*/\1/p'
}
run_public_build() {
local signing_mode="$1"
local development_team
local -a build_args=(
-project Fluid.xcodeproj
-scheme Fluid
-configuration Debug
-destination 'platform=macOS'
-derivedDataPath "${DERIVED_DATA_PATH}"
build
)
cd "${PROJECT_DIR}"
if [ "${signing_mode}" = "unsigned" ]; then
echo "Running unsigned public FluidVoice build..."
echo "Accessibility permission may need to be granted again after rebuilding."
exec xcodebuild "${build_args[@]}" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO
fi
development_team="$(resolve_development_team)"
if [ -z "${development_team}" ]; then
if [ -n "${FLUIDVOICE_DEVELOPMENT_TEAM:-}" ]; then
printf >&2 'FLUIDVOICE_DEVELOPMENT_TEAM is set to %s, but no Apple Development signing identity was found.\n\n' \
"${FLUIDVOICE_DEVELOPMENT_TEAM}"
printf >&2 '%s\n\n' \
"The team override selects an installed signing identity; it does not replace a certificate."
else
printf >&2 'No Apple Development signing identity was found.\n\n'
fi
cat >&2 <<'EOF'
For stable Accessibility permission across rebuilds, add any Apple Account in:
Xcode > Settings > Accounts
Then open Manage Certificates and create an Apple Development certificate.
A free Personal Team is sufficient for local development. If you have multiple
teams, set FLUIDVOICE_DEVELOPMENT_TEAM to the desired 10-character Team ID.
To build without signing instead, run:
./build.sh unsigned
Unsigned builds may require Accessibility permission again after rebuilding.
EOF
exit 1
fi
echo "Running signed public FluidVoice build..."
echo "Build product: ${DERIVED_DATA_PATH}/Build/Products/Debug/FluidVoice Debug.app"
exec xcodebuild "${build_args[@]}" DEVELOPMENT_TEAM="${development_team}"
}
case "${PROFILE}" in
public|oss|incremental|fast)
run_public_build signed
;;
unsigned|ci)
run_public_build unsigned
;;
fi|private|dev|full)
if [ ! -x "${PRIVATE_FI_BUILD_SCRIPT}" ]; then
echo "Private Fluid Intelligence build script is missing:"
echo " ${PRIVATE_FI_BUILD_SCRIPT}"
echo "Restore the private FI build setup, then run: sh build_with_FI_incremental.sh"
exit 1
fi
exec "${PRIVATE_FI_BUILD_SCRIPT}"
;;
*)
echo "Unknown build profile: ${PROFILE}"
echo "Valid profiles: public/oss/incremental/fast, unsigned/ci, fi/private/dev/full"
exit 1
;;
esac