forked from dotnet/source-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·66 lines (53 loc) · 2.24 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
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)"
export SDK_VERSION=$(cat $SCRIPT_ROOT/DotnetCLIVersion.txt)
export SDK3_VERSION=$(cat $SCRIPT_ROOT/Dotnet3CLIVersion.txt)
arcadeLine=`grep -m 1 'Microsoft\.DotNet\.Arcade\.Sdk' "$SCRIPT_ROOT/global.json"`
pattern="\"Microsoft\.DotNet\.Arcade\.Sdk\" *: *\"(.*)\""
if [[ $arcadeLine =~ $pattern ]]; then
export ARCADE_BOOTSTRAP_VERSION=${BASH_REMATCH[1]}
fi
echo "Found 2.x SDK $SDK_VERSION, 3.x SDK $SDK3_VERSION, Arcade bootstrap $ARCADE_BOOTSTRAP_VERSION"
if [ -z "${HOME:-}" ]; then
export HOME="$SCRIPT_ROOT/.home"
mkdir "$HOME"
fi
if grep -q '\(/docker/\|/docker-\)' "/proc/1/cgroup"; then
export DotNetRunningInDocker=1
fi
test=false
for arg do
shift
opt="$(echo "$arg" | awk '{print tolower($0)}')"
case $opt in
(-test) set -- "$@" "/t:RunTests"
test=true
;;
(*) set -- "$@" "$arg" ;;
esac
done
if [ "$test" == "false" ] && [[ "${SOURCE_BUILD_SKIP_SUBMODULE_CHECK:-default}" == "default" || $SOURCE_BUILD_SKIP_SUBMODULE_CHECK == "0" || $SOURCE_BUILD_SKIP_SUBMODULE_CHECK == "false" ]]; then
source "$SCRIPT_ROOT/check-submodules.sh"
fi
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_MULTILEVEL_LOOKUP=0
export NUGET_PACKAGES="$SCRIPT_ROOT/packages/"
source "$SCRIPT_ROOT/init-tools.sh"
# While Arcade works as an SDK so we can use our SourceBuiltSdkOverride, BuildTools does not.
# Additionally, a few repos expect BuildTools and Arcade to be in the same directories.
# We don't build BuildTools, so we copy the existing BuildTools into the source-built folder so it can live with Arcade.
# This source-built folder is only used during the build and thrown away after that, so there's no rish of contaminating
# the shipping product with BuildTools binaries.
if [[ ! -d "$SCRIPT_ROOT/Tools/source-built" ]]; then
mkdir "$SCRIPT_ROOT/Tools/source-built"
cp -r "$SCRIPT_ROOT/Tools" /tmp/
mv /tmp/Tools /tmp/source-built/
mv /tmp/source-built "$SCRIPT_ROOT/Tools/"
fi
CLIPATH="$SCRIPT_ROOT/Tools/dotnetcli"
SDKPATH="$CLIPATH/sdk/$SDK_VERSION"
set -x
$CLIPATH/dotnet $SDKPATH/MSBuild.dll $SCRIPT_ROOT/build.proj /bl:build.binlog /flp:v=diag /clp:v=m "$@"