-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathlayout.sh
More file actions
executable file
·145 lines (129 loc) · 3.15 KB
/
layout.sh
File metadata and controls
executable file
·145 lines (129 loc) · 3.15 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
die () {
echo "$*" >&2
exit 1
}
make_absolute () {
case "$1" in
/*)
echo "$1"
;;
*)
echo "$PWD/$1"
;;
esac
}
# Directories
THISDIR="$( cd "$(dirname "$0")" ; pwd -P )"
ROOT="$( cd "$THISDIR"/../../.. ; pwd -P )"
SRC="$ROOT/src"
OUT="$ROOT/out"
INSTALLER_SRC="$SRC/osx/Installer.Mac"
GCM_SRC="$SRC/shared/Git-Credential-Manager"
BITBUCKET_UI_SRC="$SRC/shared/Atlassian.Bitbucket.UI.Avalonia"
GITHUB_UI_SRC="$SRC/shared/GitHub.UI.Avalonia"
GITLAB_UI_SRC="$SRC/shared/GitLab.UI.Avalonia"
# Build parameters
FRAMEWORK=net6.0
# Parse script arguments
for i in "$@"
do
case "$i" in
--configuration=*)
CONFIGURATION="${i#*=}"
shift # past argument=value
;;
--output=*)
PAYLOAD="${i#*=}"
shift # past argument=value
;;
--runtime=*)
RUNTIME="${i#*=}"
shift # past argument=value
;;
--symbol-output=*)
SYMBOLOUT="${i#*=}"
;;
*)
# unknown option
;;
esac
done
# Determine a runtime if one was not provided
if [ -z "$RUNTIME" ]; then
TEST_ARCH=`uname -m`
case $TEST_ARCH in
"x86_64")
RUNTIME="osx-x64"
;;
"arm64")
RUNTIME="osx-arm64"
;;
*)
die "Unknown architecture '$TEST_ARCH'"
;;
esac
fi
echo "Building for runtime '$RUNTIME'"
# Perform pre-execution checks
CONFIGURATION="${CONFIGURATION:=Debug}"
if [ -z "$PAYLOAD" ]; then
die "--output was not set"
fi
if [ -z "$SYMBOLOUT" ]; then
SYMBOLOUT="$PAYLOAD.sym"
fi
# Cleanup any old payload directory
if [ -d "$PAYLOAD" ]; then
echo "Cleaning old payload directory '$PAYLOAD'..."
rm -rf "$PAYLOAD"
fi
# Ensure payload and symbol directories exists
mkdir -p "$PAYLOAD" "$SYMBOLOUT"
# Copy uninstaller script
echo "Copying uninstall script..."
cp "$INSTALLER_SRC/uninstall.sh" "$PAYLOAD" || exit 1
# Publish core application executables
echo "Publishing core application..."
dotnet publish "$GCM_SRC" \
--no-restore \
-m:1 \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
--output="$(make_absolute "$PAYLOAD")" || exit 1
echo "Publishing Bitbucket UI helper..."
dotnet publish "$BITBUCKET_UI_SRC" \
--no-restore \
-m:1 \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
--output="$(make_absolute "$PAYLOAD")" || exit 1
echo "Publishing GitHub UI helper..."
dotnet publish "$GITHUB_UI_SRC" \
--no-restore \
-m:1 \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
--output="$(make_absolute "$PAYLOAD")" || exit 1
echo "Publishing GitLab UI helper..."
dotnet publish "$GITLAB_UI_SRC" \
--no-restore \
-m:1 \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
--output="$(make_absolute "$PAYLOAD")" || exit 1
# Collect symbols
echo "Collecting managed symbols..."
mv "$PAYLOAD"/*.pdb "$SYMBOLOUT" || exit 1
# Remove any unwanted .DS_Store files
echo "Removing unnecessary files..."
find "$PAYLOAD" -name '*.DS_Store' -type f -delete || exit 1
echo "Layout complete."