diff options
author | Tanner Gooding <tagoo@outlook.com> | 2020-09-26 17:43:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-26 17:43:03 +0300 |
commit | a95f59bd42ec5ce0eac9ca7e86ad7d8aa2a39551 (patch) | |
tree | c578dc15e89e23645812c733316fd9b292648041 /eng/build.ps1 | |
parent | cd4cc97e4c099f637061afe2b6c546483ffd3073 (diff) |
Update the build script to support opening S.P.Corelib (#42700)
* Update the build script to support opening S.P.Corelib
* Adding a RuntimeFlavor switch to the build scripts
Diffstat (limited to 'eng/build.ps1')
-rw-r--r-- | eng/build.ps1 | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/eng/build.ps1 b/eng/build.ps1 index 393ed8456de..6f030f298f7 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -15,6 +15,7 @@ Param( [Parameter(Position=0)][string][Alias('s')]$subset, [ValidateSet("Debug","Release","Checked")][string][Alias('rc')]$runtimeConfiguration, [ValidateSet("Debug","Release")][string][Alias('lc')]$librariesConfiguration, + [ValidateSet("CoreCLR","Mono")][string][Alias('rf')]$runtimeFlavor, [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties ) @@ -38,6 +39,8 @@ function Get-Help() { Write-Host " Checked is exclusive to the CLR runtime. It is the same as Debug, except code is" Write-Host " compiled with optimizations enabled." Write-Host " [Default: Debug]" + Write-Host " -runtimeFlavor (-rf) Runtime flavor: CoreCLR or Mono." + Write-Host " [Default: CoreCLR]" Write-Host " -subset (-s) Build a subset, print available subsets with -subset help." Write-Host " '-subset' can be omitted if the subset is given as the first argument." Write-Host " [Default: Builds the entire repo.]" @@ -118,18 +121,35 @@ if ($vs) { if (-Not (Test-Path $vs)) { $solution = $vs - # Search for the solution in libraries - $vs = Split-Path $PSScriptRoot -Parent | Join-Path -ChildPath "src\libraries" | Join-Path -ChildPath $vs | Join-Path -ChildPath "$vs.sln" + + if ($runtimeFlavor -eq "Mono") { + # Search for the solution in mono + $vs = Split-Path $PSScriptRoot -Parent | Join-Path -ChildPath "src\mono\netcore" | Join-Path -ChildPath $vs | Join-Path -ChildPath "$vs.sln" + } else { + # Search for the solution in coreclr + $vs = Split-Path $PSScriptRoot -Parent | Join-Path -ChildPath "src\coreclr\src" | Join-Path -ChildPath $vs | Join-Path -ChildPath "$vs.sln" + } + if (-Not (Test-Path $vs)) { $vs = $solution - # Search for the solution in installer - if (-Not ($vs.endswith(".sln"))) { - $vs = "$vs.sln" - } - $vs = Split-Path $PSScriptRoot -Parent | Join-Path -ChildPath "src\installer" | Join-Path -ChildPath $vs + + # Search for the solution in libraries + $vs = Split-Path $PSScriptRoot -Parent | Join-Path -ChildPath "src\libraries" | Join-Path -ChildPath $vs | Join-Path -ChildPath "$vs.sln" + if (-Not (Test-Path $vs)) { - Write-Error "Passed in solution cannot be resolved." - exit 1 + $vs = $solution + + # Search for the solution in installer + if (-Not ($vs.endswith(".sln"))) { + $vs = "$vs.sln" + } + + $vs = Split-Path $PSScriptRoot -Parent | Join-Path -ChildPath "src\installer" | Join-Path -ChildPath $vs + + if (-Not (Test-Path $vs)) { + Write-Error "Passed in solution cannot be resolved." + exit 1 + } } } } @@ -151,7 +171,7 @@ if ($vs) { # Respect the RuntimeConfiguration variable for building inside VS with different runtime configurations $env:RUNTIMECONFIGURATION=$runtimeConfiguration } - + # Restore the solution to workaround https://github.com/dotnet/runtime/issues/32205 Invoke-Expression "& dotnet restore $vs" @@ -177,6 +197,7 @@ foreach ($argument in $PSBoundParameters.Keys) switch($argument) { "runtimeConfiguration" { $arguments += " /p:RuntimeConfiguration=$((Get-Culture).TextInfo.ToTitleCase($($PSBoundParameters[$argument])))" } + "runtimeFlavor" { $arguments += " /p:RuntimeFlavor=$($PSBoundParameters[$argument].ToLowerInvariant())" } "librariesConfiguration" { $arguments += " /p:LibrariesConfiguration=$((Get-Culture).TextInfo.ToTitleCase($($PSBoundParameters[$argument])))" } "framework" { $arguments += " /p:BuildTargetFramework=$($PSBoundParameters[$argument].ToLowerInvariant())" } "os" { $arguments += " /p:TargetOS=$($PSBoundParameters[$argument])" } |