Download stage0 when DOTNET_TOOL_DIR is not set

This commit is contained in:
Nick Guerrera 2017-10-17 08:10:22 -07:00
parent eacc4d248c
commit 218b887d87
4 changed files with 51 additions and 4 deletions

View file

@ -35,7 +35,17 @@ if (!$env:DOTNET_INSTALL_DIR)
}
# Install a stage 0
cp -r $env:DOTNET_TOOL_DIR $env:DOTNET_INSTALL_DIR
Write-Output "Installing .NET Core CLI Stage 0"
if (!$env:DOTNET_TOOL_DIR)
{
& "$RepoRoot\scripts\obtain\dotnet-install.ps1" -Channel "master" -Architecture $Architecture
if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
}
else
{
cp -r $env:DOTNET_TOOL_DIR $env:DOTNET_INSTALL_DIR
}
# Put the stage0 on the path
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"

View file

@ -33,8 +33,19 @@ fi
if [ ! -d "$DOTNET_INSTALL_DIR" ]; then
mkdir -p $DOTNET_INSTALL_DIR
fi
# Install a stage 0
echo "Installing .NET Core CLI Stage 0"
cp -r $DOTNET_TOOL_DIR/* $DOTNET_INSTALL_DIR/
if [ -z "$DOTNET_TOOL_DIR" ]; then
$REPO_ROOT/scripts/obtain/dotnet-install.sh -Channel master -Architecture x64
if [ $? -ne 0 ]; then
echo "Failed to install stage 0"
exit 1
fi
else
cp -r $DOTNET_TOOL_DIR/* $DOTNET_INSTALL_DIR/
fi
# Put the stage 0 on the path
export PATH=$DOTNET_INSTALL_DIR:$PATH

View file

@ -66,7 +66,22 @@ $env:VSTEST_BUILD_TRACE=1
$env:VSTEST_TRACE_BUILD=1
# install a stage0
cp -r $env:DOTNET_TOOL_DIR $env:DOTNET_INSTALL_DIR
if (!$env:DOTNET_TOOL_DIR)
{
$dotnetInstallPath = Join-Path $RepoRoot "scripts\obtain\dotnet-install.ps1"
Write-Output "$dotnetInstallPath -Channel ""release/2.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"""
Invoke-Expression "$dotnetInstallPath -Channel ""release/2.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"""
if ($LastExitCode -ne 0)
{
Write-Output "The .NET CLI installation failed with exit code $LastExitCode"
exit $LastExitCode
}
}
else
{
cp -r $env:DOTNET_TOOL_DIR $env:DOTNET_INSTALL_DIR
}
# Put the stage0 on the path
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"

View file

@ -150,7 +150,18 @@ export VSTEST_TRACE_BUILD=1
export DOTNET_MULTILEVEL_LOOKUP=0
# Install a stage 0
cp -r $DOTNET_TOOL_DIR/* $DOTNET_INSTALL_DIR/
if [ -z "$DOTNET_TOOL_DIR" ]; then
(set -x ; "$REPOROOT/scripts/obtain/dotnet-install.sh" --channel "release/2.0.0" --install-dir "$DOTNET_INSTALL_DIR" --architecture "$ARCHITECTURE" $LINUX_PORTABLE_INSTALL_ARGS)
EXIT_CODE=$?
if [ $EXIT_CODE != 0 ]; then
echo "run-build: Error: installing stage0 with exit code $EXIT_CODE." >&2
exit $EXIT_CODE
fi
else
cp -r $DOTNET_TOOL_DIR/* $DOTNET_INSTALL_DIR/
fi
# Put stage 0 on the PATH (for this shell only)
PATH="$DOTNET_INSTALL_DIR:$PATH"