-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·67 lines (52 loc) · 1.9 KB
/
build.sh
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
#!/bin/sh
# Build the programs on all the publish profiles for all runtimes,
# unless specific programs/profiles/runtimes are specified via environment variables
# (see how RUNTIMES, PROGRAMS and BUILD_TYPES are set).
#
# The built programs are placed in <project root>/Release/<build type>/<runtime>,
# where <project root> is N80, LK80 and LB80.
output() {
echo "$(tput setaf "$1")$2$(tput sgr0)"
}
publish() {
dotnet publish Nestor80.sln /p:PublishProfile=$1 /p:DebugType=None -c Release
}
banner() {
echo
output 6 "----- $1 -----"
echo
}
set -e
RUNTIMES="${RUNTIMES:=linux-arm linux-arm64 linux-x64 osx-arm64 osx-x64 win-arm win-x64 win-x86}"
PROGRAMS="${PROGRAMS:=N80 LK80 LB80}"
BUILD_TYPES="${BUILD_TYPES:=portable FrameworkDependant SelfContained}"
if [ -z "$(which dotnet > /dev/null && dotnet --list-sdks | grep ^7.0.)" ]; then
output 1 "*** .NET SDK 7.0 is not installed! See https://docs.microsoft.com/dotnet/core/install/linux"
exit 1
fi
for PROGRAM in $PROGRAMS; do
mkdir -p $PROGRAM/Release
for BUILD_TYPE in $BUILD_TYPES; do
if [ $BUILD_TYPE = "portable" ]; then
banner "$PROGRAM Portable"
dotnet publish $PROGRAM/$PROGRAM.csproj /p:PublishProtocol=FileSystem /p:DebugType=None -c Release /p:TargetFramework=net6.0 \
-o $PROGRAM/Release/Portable
rm -f $PROGRAM/Release/Portable/*.exe
else
for RUNTIME in $RUNTIMES; do
if [ $BUILD_TYPE = "SelfContained" ]; then
SELF_CONTAINED=true
else
SELF_CONTAINED=false
fi
banner "$PROGRAM $BUILD_TYPE $RUNTIME"
dotnet publish $PROGRAM/$PROGRAM.csproj /p:PublishProtocol=FileSystem /p:DebugType=None -c Release /p:TargetFramework=net6.0 \
/p:PublishSingleFile=true --self-contained $SELF_CONTAINED /p:RuntimeIdentifier=$RUNTIME \
-o $PROGRAM/Release/$BUILD_TYPE/$RUNTIME
done
fi
done
find $PROGRAM/Release -name *.pdb -type f -delete
done
echo
output 3 "Build succeeded!"