2016-03-07 20:24:36 +00:00
|
|
|
#
|
|
|
|
# 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(
|
|
|
|
[string[]]$Targets=@("Default"),
|
|
|
|
[switch]$Help)
|
|
|
|
|
|
|
|
if($Help)
|
|
|
|
{
|
|
|
|
Write-Host "Usage: .\update-dependencies.ps1 [-Targets <TARGETS...>]"
|
|
|
|
Write-Host ""
|
|
|
|
Write-Host "Options:"
|
|
|
|
Write-Host " -Targets <TARGETS...> Comma separated build targets to run (UpdateFiles, PushPR; Default is everything)"
|
|
|
|
Write-Host " -Help Display this help message"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2016-05-26 03:04:26 +00:00
|
|
|
$RepoRoot = "$PSScriptRoot\..\.."
|
|
|
|
$AppPath = "$PSScriptRoot"
|
|
|
|
|
2016-03-07 20:24:36 +00:00
|
|
|
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
|
|
|
if (!$env:DOTNET_INSTALL_DIR)
|
|
|
|
{
|
2016-05-26 03:04:26 +00:00
|
|
|
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\Windows\$Architecture"
|
2016-03-07 20:24:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Install a stage 0
|
|
|
|
Write-Host "Installing .NET Core CLI Stage 0"
|
2016-05-26 03:04:26 +00:00
|
|
|
& "$RepoRoot\scripts\obtain\dotnet-install.ps1" -Architecture x64
|
|
|
|
if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
|
2016-03-07 20:24:36 +00:00
|
|
|
|
|
|
|
# Put the stage0 on the path
|
2016-03-25 21:47:59 +00:00
|
|
|
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
|
2016-03-07 20:24:36 +00:00
|
|
|
|
2016-05-25 13:45:18 +00:00
|
|
|
# Restore the build_projects
|
2016-05-26 03:04:26 +00:00
|
|
|
Write-Host "Restoring Build projects..."
|
|
|
|
pushd "$RepoRoot\build_projects"
|
|
|
|
dotnet restore
|
2016-03-07 20:24:36 +00:00
|
|
|
if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Publish the app
|
2016-05-26 03:04:26 +00:00
|
|
|
Write-Host "Compiling App..."
|
|
|
|
dotnet publish "$AppPath" -o "$AppPath\bin" --framework netcoreapp1.0
|
2016-03-07 20:24:36 +00:00
|
|
|
if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" }
|
|
|
|
|
|
|
|
# Run the app
|
2016-05-26 03:04:26 +00:00
|
|
|
Write-Host "Invoking App $AppPath..."
|
2016-03-07 20:24:36 +00:00
|
|
|
Write-Host " Configuration: $env:CONFIGURATION"
|
2016-05-26 03:04:26 +00:00
|
|
|
& "$AppPath\bin\update-dependencies.exe" @Targets
|
2016-03-07 20:24:36 +00:00
|
|
|
if($LASTEXITCODE -ne 0) { throw "Build failed" }
|