-
Notifications
You must be signed in to change notification settings - Fork 42
/
BuildLinuxPackages.sh
executable file
·76 lines (65 loc) · 2 KB
/
BuildLinuxPackages.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
68
69
70
71
72
73
74
75
76
APP_NAME="ULogViewer"
FRAMEWORK="net9.0"
RID_LIST=("linux-x64" "linux-arm64")
CONFIG="Release"
TRIM_ASSEMBLIES="true"
TESTING_MODE_BUILD="false"
PACKAGING_TOOL_PATH="PackagingTool/bin/Release/$FRAMEWORK/CarinaStudio.ULogViewer.Packaging.dll"
echo "********** Start building $APP_NAME **********"
# Build packaging tool
dotnet build PackagingTool -c Release -f $FRAMEWORK
if [ "$?" != "0" ]; then
exit
fi
# Get application version
VERSION=$(dotnet $PACKAGING_TOOL_PATH get-current-version $APP_NAME/$APP_NAME.csproj)
if [ "$?" != "0" ]; then
echo "Unable to get version of $APP_NAME"
exit
fi
echo "Version: $VERSION"
PREV_VERSION=$(dotnet $PACKAGING_TOOL_PATH get-previous-version $APP_NAME/$APP_NAME.csproj $VERSION)
if [ ! -z "$PREV_VERSION" ]; then
echo "Previous version: $PREV_VERSION"
fi
# Create output directory
if [[ ! -d "./Packages/$VERSION" ]]; then
echo "Create directory 'Packages/$VERSION'"
mkdir ./Packages/$VERSION
if [ "$?" != "0" ]; then
exit
fi
fi
# Build packages
for i in "${!RID_LIST[@]}"; do
RID=${RID_LIST[$i]}
echo " "
echo "[$RID]"
echo " "
# clean
rm -r ./$APP_NAME/bin/$CONFIG/$FRAMEWORK/$RID
dotnet restore $APP_NAME -r $RID
if [ "$?" != "0" ]; then
exit
fi
dotnet clean $APP_NAME -c $CONFIG -r $RID
if [ "$?" != "0" ]; then
exit
fi
# build
dotnet publish $APP_NAME -c $CONFIG -r $RID --self-contained true -p:PublishTrimmed=$TRIM_ASSEMBLIES -p:TestingModeBuild=$TESTING_MODE_BUILD
if [ "$?" != "0" ]; then
exit
fi
# zip package
ditto -c -k --sequesterRsrc "./$APP_NAME/bin/$CONFIG/$FRAMEWORK/$RID/publish/" "./Packages/$VERSION/$APP_NAME-$VERSION-$RID.zip"
if [ "$?" != "0" ]; then
exit
fi
done
# Generate diff packages
if [ ! -z "$PREV_VERSION" ]; then
dotnet $PACKAGING_TOOL_PATH create-diff-packages linux $PREV_VERSION $VERSION
fi
# Generate package manifest
# dotnet $PACKAGING_TOOL_PATH create-package-manifest linux $APP_NAME $VERSION