Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Hofer <viktor.hofer@microsoft.com>2020-04-06 12:54:10 +0300
committerGitHub <noreply@github.com>2020-04-06 12:54:10 +0300
commit42183b1b86656a348e0b6af7fa7c75072865f759 (patch)
treef178d9b245efa810cbd23597c92429d873c46032 /eng/build.ps1
parent59ca590949ade88c712e4ca8c6835acd0e9cbf46 (diff)
Enable restore for ref and src projects in libs (#33553)
- Use RestoreUseStaticGraphEvaluation which improves no-op restore by 10-15x down to 10-20 seconds. - .builds msbuild files renamed to .proj as RestoreUseStaticGraphEvaluation throws for non .proj files without an env var set. - Introducing subsets for libraries and mono and replacing -buildtests switch which was only working for libraries in favor of the subset switch -subset tests which works consistently. - Fixing the Microsoft.DotNet.CodeAnalysis analyzer which wasn't running and adding missing exclusions. - Separating restore and build phases in different parts in the repo (ie for installer.tasks) as generated props and targets need to be imported which requires a reevaluation in the build phase. - Fix eng/docker/build-docker-sdk.ps1 by using the official build entrypoints (cc @alnikola) - Remove a few depprojs in favor of project restore (faster restore :)) - Fix root code coverage measurement not working correctly - Traversal support instead of dir.traversal.targets or manual build target defines. - Introduce a root Build.proj entrypoint which is responsible for building and restoring the repository. This is necessary to enable the new NuGet fast restore which works best and fastest with a single entrypoint. - Avoid binclashes in libraries and between libraries and installer (netstandard.depproj vs netstandard.csproj) - Upgrading the SDK to 5.0 latest - Code cleanup
Diffstat (limited to 'eng/build.ps1')
-rw-r--r--eng/build.ps151
1 files changed, 25 insertions, 26 deletions
diff --git a/eng/build.ps1 b/eng/build.ps1
index 3e2f07a8d19..17c61ae492d 100644
--- a/eng/build.ps1
+++ b/eng/build.ps1
@@ -1,9 +1,7 @@
[CmdletBinding(PositionalBinding=$false)]
Param(
[switch][Alias('h')]$help,
- [switch][Alias('b')]$build,
[switch][Alias('t')]$test,
- [switch]$buildtests,
[string[]][Alias('c')]$configuration = @("Debug"),
[string][Alias('f')]$framework,
[string]$vs,
@@ -11,10 +9,11 @@ Param(
[switch]$allconfigurations,
[switch]$coverage,
[string]$testscope,
+ [switch]$testnobuild,
[string[]][Alias('a')]$arch = @([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()),
[string]$subsetCategory,
[string]$subset,
- [ValidateSet("Debug","Release","Checked")][string]$runtimeConfiguration = "Debug",
+ [ValidateSet("Debug","Release","Checked")][string]$runtimeConfiguration,
[ValidateSet("Debug","Release")][string]$librariesConfiguration,
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
)
@@ -37,7 +36,6 @@ function Get-Help() {
Write-Host "Actions (defaults to -restore -build):"
Write-Host " -restore Restore dependencies (short: -r)"
Write-Host " -build Build all source projects (short: -b)"
- Write-Host " -buildtests Build all test projects"
Write-Host " -rebuild Rebuild all source projects"
Write-Host " -test Build and run tests (short: -t)"
Write-Host " -pack Package build outputs into NuGet packages"
@@ -50,6 +48,7 @@ function Get-Help() {
Write-Host " -framework Build framework: netcoreapp5.0 or net472 (short: -f)"
Write-Host " -coverage Collect code coverage when testing"
Write-Host " -testscope Scope tests, allowed values: innerloop, outerloop, all"
+ Write-Host " -testnobuild Skip building tests when invoking -test"
Write-Host " -allconfigurations Build packages for all build configurations"
Write-Host ""
@@ -102,8 +101,11 @@ if ($vs) {
# Put our local dotnet.exe on PATH first so Visual Studio knows which one to use
$env:PATH=($env:DOTNET_ROOT + ";" + $env:PATH);
- # Respect the RuntimeConfiguration variable for building inside VS with different runtime configurations
- $env:RUNTIMECONFIGURATION=$runtimeConfiguration
+ if ($runtimeConfiguration)
+ {
+ # Respect the RuntimeConfiguration variable for building inside VS with different runtime configurations
+ $env:RUNTIMECONFIGURATION=$runtimeConfiguration
+ }
# Launch Visual Studio with the locally defined environment variables
."$vs"
@@ -112,7 +114,7 @@ if ($vs) {
}
# Check if an action is passed in
-$actions = "r","restore","b","build","buildtests","rebuild","t","test","pack","sign","publish","clean"
+$actions = "b","build","r","restore","rebuild","sign","testnobuild","publish","clean"
$actionPassedIn = @(Compare-Object -ReferenceObject @($PSBoundParameters.Keys) -DifferenceObject $actions -ExcludeDifferent -IncludeEqual).Length -ne 0
if ($null -ne $properties -and $actionPassedIn -ne $true) {
$actionPassedIn = @(Compare-Object -ReferenceObject $properties -DifferenceObject $actions.ForEach({ "-" + $_ }) -ExcludeDifferent -IncludeEqual).Length -ne 0
@@ -122,17 +124,16 @@ if (!$actionPassedIn) {
$arguments = "-restore -build"
}
-$possibleDirToBuild = if($properties.Length -gt 0) { $properties[0]; } else { $null }
+$solutionLeaf = if($properties.Length -gt 0) { $properties[0]; } else { $null }
-if ($null -ne $possibleDirToBuild -and $subsetCategory -eq "libraries") {
- $dtb = $possibleDirToBuild.TrimEnd('\')
- if (Test-Path $dtb) {
- $properties[0] = "/p:DirectoryToBuild=$(Resolve-Path $dtb)"
+if ($null -ne $solutionLeaf) {
+ if (Test-Path $solutionLeaf) {
+ $properties[0] = "-projects $(Resolve-Path $solutionLeaf)"
}
else {
- $dtb = Join-Path "$PSSCriptRoot\..\src\libraries" $dtb
- if (Test-Path $dtb) {
- $properties[0] = "/p:DirectoryToBuild=$(Resolve-Path $dtb)"
+ $dtb = Join-Path "$PSSCriptRoot\..\src\libraries" $solutionLeaf | Join-Path -ChildPath "$solutionLeaf.sln"
+ if (Test-Path $dtb) {
+ $properties[0] = "-projects $(Resolve-Path $dtb)"
}
}
}
@@ -141,18 +142,16 @@ foreach ($argument in $PSBoundParameters.Keys)
{
switch($argument)
{
- "build" { $arguments += " -build" }
- "buildtests" { if ($build -eq $true) { $arguments += " /p:BuildTests=true" } else { $arguments += " -build /p:BuildTests=only" } }
- "test" { $arguments += " -test" }
- "runtimeConfiguration" { $arguments += " /p:RuntimeConfiguration=$((Get-Culture).TextInfo.ToTitleCase($($PSBoundParameters[$argument])))" }
- "framework" { $arguments += " /p:BuildTargetFramework=$($PSBoundParameters[$argument].ToLowerInvariant())" }
- "os" { $arguments += " /p:TargetOS=$($PSBoundParameters[$argument])" }
- "allconfigurations" { $arguments += " /p:BuildAllConfigurations=true" }
- "properties" { $arguments += " " + $properties }
+ "runtimeConfiguration" { $arguments += " /p:RuntimeConfiguration=$((Get-Culture).TextInfo.ToTitleCase($($PSBoundParameters[$argument])))" }
+ "librariesConfiguration" { $arguments += " /p:LibrariesConfiguration=$((Get-Culture).TextInfo.ToTitleCase($($PSBoundParameters[$argument])))" }
+ "framework" { $arguments += " /p:BuildTargetFramework=$($PSBoundParameters[$argument].ToLowerInvariant())" }
+ "os" { $arguments += " /p:TargetOS=$($PSBoundParameters[$argument])" }
+ "allconfigurations" { $arguments += " /p:BuildAllConfigurations=true" }
+ "properties" { $arguments += " " + $properties }
# configuration and arch can be specified multiple times, so they should be no-ops here
- "configuration" {}
- "arch" {}
- default { $arguments += " /p:$argument=$($PSBoundParameters[$argument])" }
+ "configuration" {}
+ "arch" {}
+ default { $arguments += " /p:$argument=$($PSBoundParameters[$argument])" }
}
}