-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdotnet-build
More file actions
executable file
·131 lines (120 loc) · 3.98 KB
/
dotnet-build
File metadata and controls
executable file
·131 lines (120 loc) · 3.98 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
#!/bin/bash
# shellcheck disable=SC2154
set -e -u -x -o pipefail
shopt -s extglob
pushd "$(dirname "$0")"
# shellcheck disable=SC1091
. dotnet-versions
popd
BASEDIR=$(pwd)
PACKAGESDIR=$BASEDIR/local-packages
DOWNLOADDIR=$BASEDIR/local-downloads
OUTPUTDIR=$BASEDIR/output
DOTNETDIR="$BASEDIR/dotnet"
mkdir -p "$PACKAGESDIR"
mkdir -p "$DOWNLOADDIR"
mkdir -p "$OUTPUTDIR"
ARCH=${ARCH-s390x}
case "$ARCH on $(uname -m)" in
"ppc64le on ppc64le" | "s390x on s390x" | "x64 on x86_64")
CROSS=false
;;
*)
CROSS=true
;;
esac
use_custom_packages=false
use_custom_sdk=false
run_prep=true
while [[ $# -gt 0 ]]; do
case "$1" in
--with-packages)
use_custom_packages=true
CUSTOMPACKAGESDIR="$(cd "$2" && pwd)"
if [ ! -d "$CUSTOMPACKAGESDIR" ]; then
echo "Custom previously built packages directory '$CUSTOMPACKAGESDIR' does not exist"
exit 1
fi
shift 2
;;
--with-sdk)
use_custom_sdk=true
SDKTARPATH="$(cd "$(dirname "$2")" && pwd)/$(basename "$2")"
shift 2
;;
--no-prep)
run_prep=false
shift
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
build_sdk() {
local sdk_build_flags=(
--source-only
--configuration Release
--use-mono-runtime
--source-repository "https://github.com/dotnet/dotnet"
--source-version "$(git -C "$DOTNETDIR" rev-parse HEAD)"
-p:PortableBuild=true
-p:UseSystemLibs=all
)
if "$CROSS"; then
sdk_build_flags+=(
--rid "linux-${ARCH}"
--arch "$ARCH"
)
fi
if [[ -z "${OFFICIAL_BUILD_ID:-}" ]]; then
pushd dotnet
if git merge-base --is-ancestor 44525024595742ebe09023abe709df51de65009b HEAD; then
sdk_build_flags+=(--branding release)
else
sdk_build_flags+=(--branding rtm)
fi
popd
fi
if [[ -n "${OFFICIAL_BUILD_ID:-}" ]]; then
sdk_build_flags+=(-p:OfficialBuildId="$OFFICIAL_BUILD_ID")
fi
if [[ "$use_custom_packages" == true ]]; then
sdk_build_flags+=(--with-packages "$CUSTOMPACKAGESDIR")
fi
if [[ "$use_custom_sdk" == true ]]; then
SDKDIR="$BASEDIR/.bootstrap-sdk"
if [[ ! -x "$SDKDIR/dotnet" ]]; then
echo "Extracting bootstrap SDK..."
rm -rf "$SDKDIR"
mkdir -p "$SDKDIR"
tar -xzf "$SDKTARPATH" -C "$SDKDIR"
fi
sdk_build_flags+=(--with-sdk "$SDKDIR")
fi
if [[ "$run_prep" == true && "$use_custom_sdk" == false ]]; then
pushd "$DOTNETDIR"
ROOTFS_DIR=$(pwd) ./prep-source-build.sh
popd
fi
pushd "$DOTNETDIR"
mv .git .git.bak
ROOTFS_DIR=/ ./build.sh "${sdk_build_flags[@]}"
mv .git .git.dir.bak
mv .git.bak .git
cp ./artifacts/assets/Release/Runtime/*/dotnet-runtime-"$runtime_version"-linux-"$ARCH".tar.gz "$OUTPUTDIR"
cp ./artifacts/assets/Release/Sdk/*/dotnet-sdk-"$sdk_version"-linux-"$ARCH".tar.gz "$OUTPUTDIR"
cp ./artifacts/packages/Release/Shipping/runtime/Microsoft.NETCore.App.Host.linux-"$ARCH"."$runtime_version".nupkg "$OUTPUTDIR"
cp ./artifacts/packages/Release/Shipping/runtime/Microsoft.NETCore.App.Runtime.linux-"$ARCH"."$runtime_version".nupkg "$OUTPUTDIR"
cp ./artifacts/packages/Release/Shipping/runtime/runtime.linux-"$ARCH".Microsoft.NETCore.ILDAsm."$runtime_version".nupkg "$OUTPUTDIR"
cp ./artifacts/packages/Release/Shipping/runtime/runtime.linux-"$ARCH".Microsoft.NETCore.ILDAsm."$runtime_version".nupkg "$OUTPUTDIR"
cp ./artifacts/packages/Release/Shipping/aspnetcore/Microsoft.AspNetCore.App.Runtime.linux-"$ARCH"."$runtime_version".nupkg "$OUTPUTDIR"
cp ./artifacts/assets/Release/Private.SourceBuilt.Artifacts."$sdk_version"*.linux-"$ARCH".tar.gz "$OUTPUTDIR"
cp ./prereqs/packages/archive/Private.SourceBuilt.Artifacts.Bootstrap.tar.gz "$PACKAGESDIR"
popd
}
projects=(sdk)
for project in "${projects[@]}"; do
eval "build_${project}"
done