Changeset 16754 for stable/Build.ps1


Ignore:
Timestamp:
04/03/19 16:42:58 (2 years ago)
Author:
jkarder
Message:

#2951: merged r16221, r16223:16224 r16381 and r16624 into stable

Location:
stable
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/Build.ps1

    r16221 r16754  
    1919}
    2020
    21 if ($msBuildPath -eq $undefined) {
    22   "Could not locate MSBuild, ABORTING ..."
    23 } else {
     21Try {
     22  If ($msBuildPath -eq $undefined) {
     23    "Could not locate MSBuild, ABORTING ..."
     24    Return
     25  }
     26
    2427  $curPath = $MyInvocation.MyCommand.Path
    2528  $curDir = Split-Path $curPath
     
    2730  $slnFiles = Get-ChildItem $curDir -Filter *.sln
    2831
    29   "Found the following solutions:"
     32  If ($slnFiles.Count -le 0) {
     33    "No solutions found, ABORTING ..."
     34    Return
     35  }
    3036
    31   ""
     37  $slnIndices = @()
    3238
    33   $slnFiles | % { $i = 0 } { ("  {0}. `"{1}`"" -f ($i + 1), $_.Name); $i++ }
     39  If ($slnFiles.Count -eq 1) {
     40    "Selecting the only solution found: `"{0}`"" -f $slnFiles[0].Name
     41    $slnIndices += 0
     42  } Else {
     43    "Found the following solutions:"
    3444
    35   ""
     45    ""
    3646
    37   $success = $false
     47    $slnFiles | % { $i = 0 } { ("  {0}. `"{1}`"" -f ($i + 1), $_.Name); $i++ }
    3848
    39   # query solution to build
    40   $slnIndex = -1
    41   $slnIndices = @()
    42   Do {
    43       $input = Read-Host "Which solution(s) to build? {1..$($slnFiles.Count)}"
    44       $inputParts = $input -Split " "
     49    ""
    4550
    46       Foreach ($part in $inputParts) {
    47         If ($part -eq "") { Continue }
     51    $success = $false
    4852
    49         $success = [int]::TryParse($part, [ref]$slnIndex) -and ($slnIndex -gt 0) -and ($slnIndex -le $slnFiles.Count)
     53    # query solution to build
     54    $slnIndex = -1
     55    Do {
     56        $input = Read-Host "Which solution(s) to build? (e.g.: 1 2 3) { 1..$($slnFiles.Count) }"
     57        $inputParts = $input -Split " "
    5058
    51         If ($success) {
    52           $slnIndices += $slnIndex - 1
    53         } Else {
    54           $slnIndices = @()
    55           Break
     59        Foreach ($part in $inputParts) {
     60          If ($part -eq "") { Continue }
     61
     62          $success = [int]::TryParse($part, [ref]$slnIndex) -and ($slnIndex -gt 0) -and ($slnIndex -le $slnFiles.Count)
     63
     64          If ($success) {
     65            $slnIndices += $slnIndex - 1
     66          } Else {
     67            $slnIndices = @()
     68            Break
     69          }
    5670        }
    57       }
    58   } While (-Not $success)
     71    } While (-Not $success)
    5972
    60   $slnIndices = $slnIndices | Select-Object -Unique
     73    $slnIndices = $slnIndices | Select-Object -Unique
     74  }
     75
    6176
    6277  # query configuration to build
     
    8095  ""
    8196
    82   if ($clean) {
     97  If ($clean) {
    8398    Foreach ($slnIndex in $slnIndices) {
    8499      $solution = $slnFiles[$slnIndex]
     
    87102        $solution.FullName,
    88103        "/t:Clean",
    89         "/p:Configuration=`"$config`",Platform=`"$([uri]::EscapeDataString($platform))`"",
     104        "/p:Configuration=`"$config`",Platform=`"$platform`"",
    90105        "/m", "/nologo", "/verbosity:q", "/clp:ErrorsOnly"
    91106      )
     
    97112  Foreach ($slnIndex in $slnIndices) {
    98113    $solution = $slnFiles[$slnIndex]
    99     "Building `"$($solution.Name)`" ..."
     114    "Building `"$($solution.Name)`" ($config|$platform) ..."
    100115    $args = @(
    101116      $solution.FullName,
    102       "/t:Build",
    103       "/p:Configuration=`"$config`",Platform=`"$([uri]::EscapeDataString($platform))`"",
     117      "/t:Restore,Build",
     118      "/p:Configuration=`"$config`",Platform=`"$platform`"",
    104119      "/m", "/nologo", "/verbosity:q", "/clp:ErrorsOnly"
    105120    )
     
    107122    "===== BUILD FINISHED ====="
    108123  }
     124} Finally {
     125  ""
     126
     127  Write-Host -NoNewline "Press any key to continue ... "
     128
     129  [void][System.Console]::ReadKey($true)
    109130}
    110 
    111 ""
    112 
    113 Write-Host -NoNewline "Press any key to continue ... "
    114 [void][System.Console]::ReadKey($true)
Note: See TracChangeset for help on using the changeset viewer.