dotnet-installer/run-build.ps1
Livar Cunha 8da7efdf41 Merge remote-tracking branch 'dotnet/release/2.0.0' into merges/release/2.0.0-to-master-20170612-070041
* dotnet/release/2.0.0: (72 commits)
  Updating the signing project to reflect the new location of the resolver.
  Another update to MSBuild. To 15.3.0-preview-000385-01.
  Another update to msbuild. To 15.3.0-preview-000385-01.
  Update to SetupCrossgen 183 - Coherence 25615
  Don't include .NET Core MS.NET.Build.Extensions tasks for .NET Framework and vice versa
  Update version of SDK and MS.NET.Build.Extensions, adapt to layout change
  Updating MSBuild to 15.3.0-preview-000384-01
  Update MSBuild to 15.3.0-preview-000384-01
  test pack command
  Changing NuGet version to Preview3-4154
  Updating NuGet version to Preview3-4154
  Add Microsoft.NET.Build.Extensions files to package for VS insertion
  reenable smoke test of F# templates
  empty commit
  Don't try to CrossGen .NET Framework support DLLs
  Update test platform to 15.3.0-preview-20170609-02.
  Turning off implicit restore when publishing the build project.
  Updating the vstest.console to use the same runtime that is shipping with the CLI.
  Update to template build 256 to fix Web Auth scenarios
  Add test for consuming .NET Standard 2.0 library from .NET Framework 4.6.1 project
  ...
2017-06-12 17:23:20 -07:00

112 lines
3.9 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(
[string]$Configuration="Debug",
[string]$Architecture="x64",
# This is here just to eat away this parameter because CI still passes this in.
[string]$Targets="Default",
[switch]$NoPackage,
[switch]$NoBuild,
[switch]$Help,
[Parameter(Position=0, ValueFromRemainingArguments=$true)]
$ExtraParameters)
if($Help)
{
Write-Output "Usage: .\build.ps1 [-Configuration <CONFIGURATION>] [-Architecture <ARCHITECTURE>] [-NoPackage] [-Help]"
Write-Output ""
Write-Output "Options:"
Write-Output " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
Write-Output " -Architecture <ARCHITECTURE> Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)"
Write-Output " -NoPackage Skip packaging targets"
Write-Output " -NoBuild Skip building the product"
Write-Output " -Help Display this help message"
exit 0
}
$env:CONFIGURATION = $Configuration;
$RepoRoot = "$PSScriptRoot"
if(!$env:NUGET_PACKAGES){
$env:NUGET_PACKAGES = "$RepoRoot\.nuget\packages"
}
if($NoPackage)
{
$env:DOTNET_BUILD_SKIP_PACKAGING=1
}
else
{
$env:DOTNET_BUILD_SKIP_PACKAGING=0
}
# Use a repo-local install directory for stage0 (but not the artifacts directory because that gets cleaned a lot
if (!$env:DOTNET_INSTALL_DIR)
{
$env:DOTNET_INSTALL_DIR="$RepoRoot\.dotnet_stage0\$Architecture"
}
if (!(Test-Path $env:DOTNET_INSTALL_DIR))
{
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
}
# We also need to pull down a project.json based CLI that is used by some tests
# so create another directory for that.
if (!$env:DOTNET_INSTALL_DIR_PJ)
{
$env:DOTNET_INSTALL_DIR_PJ="$RepoRoot\.dotnet_stage0PJ\$Architecture"
}
if (!(Test-Path $env:DOTNET_INSTALL_DIR_PJ))
{
mkdir $env:DOTNET_INSTALL_DIR_PJ | Out-Null
}
# Disable first run since we want to control all package sources
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Don't resolve shared frameworks from user or global locations
$env:DOTNET_MULTILEVEL_LOOKUP=0
# Enable vs test console logging
$env:VSTEST_BUILD_TRACE=1
$env:VSTEST_TRACE_BUILD=1
# install a stage0
$dotnetInstallPath = Join-Path $RepoRoot "scripts\obtain\dotnet-install.ps1"
Write-Output "$dotnetInstallPath -Channel ""release/2.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"" -Version 2.0.0-preview2-006437"
Invoke-Expression "$dotnetInstallPath -Channel ""release/2.0.0"" -InstallDir $env:DOTNET_INSTALL_DIR -Architecture ""$Architecture"" -Version 2.0.0-preview2-006437"
if ($LastExitCode -ne 0)
{
Write-Output "The .NET CLI installation failed with exit code $LastExitCode"
exit $LastExitCode
}
Write-Output "$dotnetInstallPath -Channel ""master"" -InstallDir $env:DOTNET_INSTALL_DIR_PJ -Architecture ""$Architecture"" -Version 1.0.0-preview2-1-003177"
Invoke-Expression "$dotnetInstallPath -Channel ""master"" -InstallDir $env:DOTNET_INSTALL_DIR_PJ -Architecture ""$Architecture"" -Version 1.0.0-preview2-1-003177"
if ($LastExitCode -ne 0)
{
Write-Output "The .NET CLI installation failed with exit code $LastExitCode"
exit $LastExitCode
}
# Put the stage0 on the path
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
if ($NoBuild)
{
Write-Output "Not building due to --nobuild"
Write-Output "Command that would be run: 'dotnet msbuild build.proj /m /p:Architecture=$Architecture $ExtraParameters'"
}
else
{
dotnet msbuild build.proj /p:Architecture=$Architecture /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles
dotnet msbuild build.proj /m /v:normal /fl /flp:v=diag /p:Architecture=$Architecture $ExtraParameters
if($LASTEXITCODE -ne 0) { throw "Failed to build" }
}