This repository has been archived by the owner on Sep 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
/
build_dotnetcore_bindist.sh
executable file
·121 lines (104 loc) · 3.7 KB
/
build_dotnetcore_bindist.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
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
#!/bin/bash
set -euo pipefail
cd `dirname $0`
# --------------------------------------------------------------------
# A simple script that builds the core Ambrosia binary distribution.
# This script is REDUNDANT with the steps in `Dockerfile`. The
# Dockerfile *could* just call this script, but then it would have one
# big build step instead of granular ones.
# --------------------------------------------------------------------
echo "********* Running build_dotnetcore_bindist.sh ********************"
echo "Args: "$@
echo "*******************************************************************"
# Should be "net461" or "netcoreapp3.1". Set a default if not set:
export AMBROSIA_DOTNET_FRAMEWORK="${AMBROSIA_DOTNET_FRAMEWORK:-netcoreapp3.1}"
# Release or Debug:
export AMBROSIA_DOTNET_CONF="${AMBROSIA_DOTNET_CONF:-Release}"
UNAME=`uname`
if [ $AMBROSIA_DOTNET_FRAMEWORK == "net461" ]; then
PLAT=win10-x64
OS=Windows_NT
else
if [ "$UNAME" == Linux ];
then PLAT=linux-x64
elif [ "$UNAME" == Darwin ];
then PLAT=osx-x64
else PLAT=win10-x64
OS=Windows_NT
fi
fi
OUTDIR=`pwd`/bin
echo "Output Directory:" $OUTDIR
# Do not want to publish self contained due to security reasons that .net security patches aren't applied
# Since not self contained, any non windows scripts using this needs to make sure install .netcore
# Shorthands:
FMWK="${AMBROSIA_DOTNET_FRAMEWORK}"
CONF="${AMBROSIA_DOTNET_CONF}"
function buildit() {
dir=$1
shift
dotnet publish --no-self-contained -o $dir -c $CONF -f $FMWK -r $PLAT $*
}
echo "Cleaning publish directory."
rm -rf $OUTDIR
mkdir -p $OUTDIR
echo "Output of 'dotnet --info':"
dotnet --info
# echo "Building with command: $BUILDIT"
echo
echo "Building AMBROSIA libraries/binaries"
echo "------------------------------------"
set -x
buildit $OUTDIR Ambrosia/Ambrosia/Ambrosia.csproj
buildit $OUTDIR ImmortalCoordinator/ImmortalCoordinator.csproj
buildit $OUTDIR DevTools/UnsafeDeregisterInstance/UnsafeDeregisterInstance.csproj
pushd $OUTDIR
# ln -s Ambrosia Ambrosia
# ln -s ImmortalCoordinator
# ln -s UnsafeDeregisterInstance
popd
set +x
echo
echo "Building C# client tools"
echo "----------------------------------------"
set -x
buildit $OUTDIR Clients/CSharp/AmbrosiaCS/AmbrosiaCS.csproj
pushd $OUTDIR
# ln -s AmbrosiaCS
popd
set +x
echo
echo "Copying deployment script and other included resources."
cp -a Scripts/runAmbrosiaService.sh bin/
# (cd bin; ln -s Ambrosia ambrosia || echo ok)
# We currently use this as a baseline source of dependencies for generated code:
cp -a Clients/CSharp/AmbrosiaCS/AmbrosiaCS.csproj bin/AmbrosiaCS.csproj
echo
echo "Building Native-code client library"
echo "----------------------------------------"
if [ "$UNAME" == Linux ]; then
pushd Clients/C
make publish || \
echo "WARNING: Non-fatal error." && \
echo "Successfully built a dotnet core distribution, but the native code wrapper failed to build."
popd
elif [ "$UNAME" == Darwin ]; then
echo "WARNING: not building native client for Mac OS."
else
echo "WARNING: this script doesn't build the native client for Windows yet (FINISHME)"
fi
# echo
# echo "Removing unnecessary execute permissions"
# echo "----------------------------------------"
# chmod -x ./bin/*.dll ./bin/*.so ./bin/*.dylib ./bin/*.a 2>/dev/null || echo
# No longer needed because all output going to one folder
#echo
#echo "Deduplicating output produced by separate dotnet publish calls"
#echo "--------------------------------------------------------------"
#if [ ${OS:+defined} ] && [ "$OS" == "Windows_NT" ];
#then ./Scripts/dedup_bindist.sh squish
#elif [ "$UNAME" == Darwin ];
#then ./Scripts/dedup_bindist.sh symlink
#else ./Scripts/dedup_bindist.sh symlink
#fi
echo "$0 Finished"