90 lines
3.7 KiB
Bash
Executable file
90 lines
3.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
SOURCE="${BASH_SOURCE[0]}"
|
|
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
|
SOURCE="$(readlink "$SOURCE")"
|
|
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
|
done
|
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
|
REPOROOT="$( cd -P "$DIR/.." && pwd )"
|
|
|
|
echo "Bootstrapping dotnet.exe using DNX"
|
|
|
|
if [ -z "$RID" ]; then
|
|
UNAME=$(uname)
|
|
if [ "$UNAME" == "Darwin" ]; then
|
|
RID=osx.10.10-x64
|
|
elif [ "$UNAME" == "Linux" ]; then
|
|
# Detect Distro?
|
|
RID=ubuntu.14.04-x64
|
|
else
|
|
echo "Unknown OS: $UNAME" 1>&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
OUTPUT_ROOT=$REPOROOT/artifacts/$RID
|
|
STAGE0_DIR=$OUTPUT_ROOT/stage0
|
|
STAGE1_DIR=$OUTPUT_ROOT/stage1
|
|
STAGE2_DIR=$OUTPUT_ROOT/stage2
|
|
|
|
STAGE0_PUBLISH=$REPOROOT/scripts/stage0/dotnet-publish
|
|
|
|
export DOTNET_CLR_HOSTS_PATH=$REPOROOT/ext/CLRHost/$RID
|
|
export DOTNET_CSC_PATH=$REPOROOT/src/cscthingy/bin/Debug/dnxcore50/publish
|
|
|
|
if ! type dnvm > /dev/null 2>&1; then
|
|
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
|
|
fi
|
|
|
|
echo "Installing and use-ing the latest CoreCLR x64 DNX ..."
|
|
dnvm install latest -u -r coreclr -alias dotnet_bootstrap
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|
|
|
|
dnvm use dotnet_bootstrap -r coreclr -arch x64
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|
|
|
|
type -p dnx >/dev/null
|
|
if [ ! $? ]; then
|
|
echo "DNX is required to bootstrap stage1" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Running 'dnu restore' to restore packages for DNX-hosted projects"
|
|
|
|
dnu restore "$REPOROOT" --runtime osx.10.10-x64 --runtime ubuntu.14.04-x64 --runtime osx.10.11-x64
|
|
|
|
# symlink mcs to csc for bootstrapping (requires mono :()
|
|
mkdir -p $STAGE0_DIR
|
|
ln -s `(which mcs)` $STAGE0_DIR/csc
|
|
export PATH=$PATH:$STAGE0_DIR
|
|
|
|
# Clean up stage1
|
|
[ -d "$STAGE1_DIR" ] && rm -Rf "$STAGE1_DIR"
|
|
|
|
echo "Building basic dotnet tools using Stage 0 (DNX hosted)"
|
|
$STAGE0_PUBLISH --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Cli"
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|
|
$STAGE0_PUBLISH --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler"
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|
|
$STAGE0_PUBLISH --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler.Csc"
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|
|
$STAGE0_PUBLISH --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Publish"
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|
|
$STAGE0_PUBLISH --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Resgen"
|
|
|
|
# Add stage1 to the path and use it to build stage2
|
|
export PATH=$STAGE1_DIR:$PATH
|
|
|
|
echo "Building stage2 dotnet using stage1 ..."
|
|
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Cli"
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|
|
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler"
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|
|
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler.Csc"
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|
|
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Publish"
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|
|
dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Resgen"
|
|
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
|