dotnet-installer/build_projects/update-dependencies/update-dependencies.ps1
Matt Ellis eacc4d248c Don't pull down stage 0 from the internet
The composed build will set `PREBUILT_DOTNET_TOOL_DIR` to a location
where the dotnet tool can be copied from.

Long term we should get rid of the copy in favor of just using one
from a common location, but some of the Stage0 logic in the CLI build
system will need to change, I think.
2017-10-18 12:43:33 -07:00

51 lines
1.3 KiB
PowerShell

#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
param(
[switch]$Help,
[switch]$Update)
if($Help)
{
Write-Output "Usage: .\update-dependencies.ps1"
Write-Output ""
Write-Output "Options:"
Write-Output " -Help Display this help message"
Write-Output " -Update Update dependencies (but don't open a PR)"
exit 0
}
$Architecture='x64'
$RepoRoot = "$PSScriptRoot\..\.."
$ProjectPath = "$PSScriptRoot\update-dependencies.csproj"
$ProjectArgs = ""
if ($Update)
{
$ProjectArgs = "--Update"
}
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
if (!$env:DOTNET_INSTALL_DIR)
{
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\$Architecture"
}
# Install a stage 0
cp -r $env:DOTNET_TOOL_DIR $env:DOTNET_INSTALL_DIR
# Put the stage0 on the path
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
# Restore the app
Write-Output "Restoring $ProjectPath..."
dotnet restore "$ProjectPath"
if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
# Run the app
Write-Output "Invoking App $ProjectPath..."
dotnet run -p "$ProjectPath" "$ProjectArgs"
if($LASTEXITCODE -ne 0) { throw "Build failed" }