-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
70 lines (60 loc) · 1.79 KB
/
Copy pathbuild.sh
File metadata and controls
70 lines (60 loc) · 1.79 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
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<EOF
Usage: $(basename "$0") [OPTION]
Build and publish the project.
Options:
--linux, -l Build Linux (linux-x64)
--windows, -w Build Windows (win-x64)
linux Same as --linux
windows Same as --windows
--help, -h Show this help message
If no option is provided, builds both Linux and Windows.
EOF
}
build_linux() {
echo "🔧 Building Linux (linux-x64)..."
dotnet publish -c Release -o publish -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true src/SshAgentEcho.Cli/SshAgentEcho.Cli.csproj
dotnet publish -c Release -o publish -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true src/SshAgentEcho.Gui/SshAgentEcho.Gui.csproj
}
build_windows() {
echo "🔧 Building Windows (win-x64)..."
dotnet publish -c Release -o publish -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true src/SshAgentEcho.Cli/SshAgentEcho.Cli.csproj
dotnet publish -c Release -o publish -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true src/SshAgentEcho.Gui/SshAgentEcho.Gui.csproj
}
if [ "$#" -eq 0 ]; then
build_linux
build_windows
exit 0
fi
build_any=false
while [ "$#" -gt 0 ]; do
case "$1" in
-l|--linux|linux)
build_linux
build_any=true
shift
;;
-w|--windows|windows)
build_windows
build_any=true
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "⚠️ Unknown option: $1"
usage
exit 2
;;
esac
done
if [ "$build_any" = false ]; then
echo "⚠️ No valid build target selected."
usage
exit 2
fi
exit 0