Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/Build.ps1 @ 18212

Last change on this file since 18212 was 18070, checked in by jkarder, 3 years ago

#3017: sign Build.ps1 and Test.ps1

File size: 10.1 KB
Line 
1# find ms build
2$programFilesX86Dir = ($Env:ProgramFiles, ${Env:ProgramFiles(x86)})[[bool]${Env:ProgramFiles(x86)}]
3$vsDir = [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio")
4$years = @("2019", "2017")
5$editions = @("Enterprise", "Professional", "Community", "BuildTools")
6$versions = @("Current", "15.0")
7
8$msBuildPath = $undefined
9:search Foreach ($year in $years) {
10  $loc = [System.IO.Path]::Combine($vsDir, $year)
11  Foreach ($edition in $editions) {
12    $edLoc = [System.IO.Path]::Combine($loc, $edition, "MSBuild")
13    Foreach ($version in $versions) {
14      $binLoc = [System.IO.Path]::Combine($edLoc, $version, "Bin")
15      $loc64 = [System.IO.Path]::Combine($binLoc, "amd64", "MSBuild.exe")
16      $loc32 = [System.IO.Path]::Combine($binLoc, "MSBuild.exe")
17
18      If ([System.IO.File]::Exists($loc64)) {
19        $msBuildPath = $loc64
20        Break search;
21      }
22      If ([System.IO.File]::Exists($loc32)) {
23        $msBuildPath = $loc32
24        Break search;
25      }
26    }
27  }
28}
29
30Try {
31  If ($msBuildPath -eq $undefined) {
32    "Could not locate MSBuild, ABORTING ..."
33    Return
34  }
35
36  "MSBuild located at `"{0}`"." -f $msBuildPath
37
38  $curPath = $MyInvocation.MyCommand.Path
39  $curDir = Split-Path $curPath
40
41  $slnFiles = Get-ChildItem $curDir -Filter *.sln
42
43  If ($slnFiles.Count -le 0) {
44    "No solutions found, ABORTING ..."
45    Return
46  }
47
48  $slnIndices = @()
49
50  If ($slnFiles.Count -eq 1) {
51    "Selecting the only solution found: `"{0}`"" -f $slnFiles[0].Name
52    $slnIndices += 0
53  } Else {
54    "Found the following solutions:"
55
56    ""
57
58    $slnFiles | % { $i = 0 } { ("  {0}. `"{1}`"" -f ($i + 1), $_.Name); $i++ }
59
60    ""
61
62    $success = $false
63
64    # query solution to build
65    $slnIndex = -1
66    Do {
67        $input = Read-Host "Which solution(s) to build? (e.g.: 1 2 3) { 1..$($slnFiles.Count) }"
68        $inputParts = $input -Split " "
69
70        Foreach ($part in $inputParts) {
71          If ($part -eq "") { Continue }
72
73          $success = [int]::TryParse($part, [ref]$slnIndex) -and ($slnIndex -gt 0) -and ($slnIndex -le $slnFiles.Count)
74
75          If ($success) {
76            $slnIndices += $slnIndex - 1
77          } Else {
78            $slnIndices = @()
79            Break
80          }
81        }
82    } While (-Not $success)
83
84    $slnIndices = $slnIndices | Select-Object -Unique
85  }
86
87
88  # query configuration to build
89  $config = "Release"
90  $input = Read-Host "Which configuration to build? [$($config)]"
91  $config = ($config, $input)[[bool]$input]
92
93  # query platform to build
94  $platform = "Any CPU"
95  $input = Read-Host "Which platform to build? [$($platform)]"
96  $platform = ($platform, $input)[[bool]$input]
97
98  # query clean desire
99  $clean = $false
100  Do {
101      $input = Read-Host "Would you like to clean before building? [y/N]"
102      $input = ([string]("n", $input)[[bool]$input]).ToLowerInvariant()
103      $success = $input -eq "n" -or ($clean = $input -eq "y")
104  } While (-Not $success)
105
106  ""
107
108  If ($clean) {
109    Foreach ($slnIndex in $slnIndices) {
110      $solution = $slnFiles[$slnIndex]
111      "Cleaning `"$($solution.Name)`" ..."
112      $args = @(
113        $solution.FullName,
114        "/t:Clean",
115        "/p:Configuration=`"$config`",Platform=`"$platform`"",
116        "/m", "/nologo", "/verbosity:q", "/clp:ErrorsOnly"
117      )
118      & $msBuildPath $args
119      "===== CLEAN FINISHED ====="
120    }
121  }
122
123  Foreach ($slnIndex in $slnIndices) {
124    $solution = $slnFiles[$slnIndex]
125    "Building `"$($solution.Name)`" ($config|$platform) ..."
126    $args = @(
127      $solution.FullName,
128      "/t:Restore,Build",
129      "/p:Configuration=`"$config`",Platform=`"$platform`"",
130      "/m", "/nologo", "/verbosity:q", "/clp:ErrorsOnly"
131    )
132    & $msBuildPath $args
133    "===== BUILD FINISHED ====="
134  }
135} Finally {
136  ""
137
138  Write-Host -NoNewline "Press any key to continue ... "
139
140  [void][System.Console]::ReadKey($true)
141}
142
143# SIG # Begin signature block
144# MIIRPwYJKoZIhvcNAQcCoIIRMDCCESwCAQExDzANBglghkgBZQMEAgEFADB5Bgor
145# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
146# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCkZQD98uHEu5cF
147# pqVi6UDP5wAnkH38IHKlZIY9T9KjMqCCDo4wggbaMIIEwqADAgECAhNoAAE6ILAh
148# JeBjaP8pAAEAATogMA0GCSqGSIb3DQEBCwUAMD4xEjAQBgoJkiaJk/IsZAEZFgJh
149# dDEVMBMGCgmSJomT8ixkARkWBWZob29lMREwDwYDVQQDEwhGSE9PZUNBMTAeFw0x
150# OTExMDYwOTI1NTJaFw0yNDExMDQwOTI1NTJaMD4xFjAUBgNVBAsTDUZ1RSBIYWdl
151# bmJlcmcxJDAiBgNVBAMTG0ZIIE9PRSBTdHVkaWVuYmV0cmllYnMgR21iSDCCASIw
152# DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANCook/YMdRq1PdL6DPB2ktDaZ5U
153# 5+fP9EwD+fjS5CgpsSy8U54tFwKwAohaBl4SAsobOEDwTHFqn0g2SWrj/Kct+pAB
154# a+1lFOFV6YsV5rj+ldPDpQde8bXO+XWTN/6+9zd//Xrxem6Zk1ObeDOrsOUr9PLT
155# JIYAWN5Iwp2ziKmsgxBxJHx5FU7pTgB/RhZ2gqu+w5uPZEg8rtUQqwvaNREmIEGg
156# XStODc1yLzcEx1VyWA1DUmdB6e4LLIh/NwYiOHrObdazS9IsI1DOD1jcTScBL5je
157# CAZF+smlJGw6GJXztgRoU5d2IcpVwpzCOBbNfkuxwbJRrjGyp0kPFxWm5zECAwEA
158# AaOCAs8wggLLMD0GCSsGAQQBgj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Fw/kX7hPwrjsfojZoMWT+17ogBB7LVLQG90DwzPVFtAmyPdIJ8/
175# tbu1nu+kRR6qyC3iPW8RZetjT5FAyxHSPNvyI1INXenHmShwkG1hjvjVOGiBECh3
176# bfrY95qbZNdBpYee9xqEGlOj/LkRokM+hTlj65MgkFHGwPkiR6AZhnC6tVg3j2wX
177# Y+0yaYiXc+iNWOLmQDVwxBmD5bEzToH7EoTsCNcxkatvNzwapdyyz8ycENqyVAGQ
178# DxcEf2xNKZQU6PV1xJC8ltfpL4fL2MVQQ35VazMKGm+FeY5Jw+z7tph7Yxseb7KP
179# wy4iKY9GAt7bEIJSSUNX0ni/MoWULsdU3EQDPedMS5v3I5C+7GfDJiThq+b2xSm3
180# UIImrG+saST3hmC0fM3iffoujzn1tFm2POnNtIwL1X165quLCRhs4YHm57CxRcei
181# LfETrOL3Qd08w1nJVnsEvppqe4NauzdO4jPbxsSFCse10xO/2TW1C/ugraXv1fSU
182# HlYpUtt+wGhFV75QspOgUgWGc3KBMYm1XwjTWRwBZUd3l7S3UP6IqHaRu3I7eBsF
183# OUArTCtXSK+szMW+1G1gIoT61ZyxemUjg9GuF7qIRwlt+Bax4Jy1aZ1TsmV0z1SS
184# nBxuiKeBO1MwggesMIIFlKADAgECAhMeAAAABpSzaQpcq/lwAAEAAAAGMA0GCSqG
185# SIb3DQEBCwUAMBcxFTATBgNVBAMTDEZIT09lUm9vdENBMTAeFw0xNTA1MDcxMjIy
186# MzFaFw0yNzA1MDcxMjMyMzFaMD4xEjAQBgoJkiaJk/IsZAEZFgJhdDEVMBMGCgmS
187# JomT8ixkARkWBWZob29lMREwDwYDVQQDEwhGSE9PZUNBMTCCAiIwDQYJKoZIhvcN
188# AQEBBQADggIPADCCAgoCggIBAMA7PbbPxLUYOLUThQt0UWtwpT5rT1ZIRinD/wXG
189# asjsvxTEsWDG6kf0tLyLlf64zNOhtXG5pbidu+rcmdnlut58h9So8QuZELdb8xbS
190# 9rM3oTC9wKGW57oRydxIo7WkQwX/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Bd9qdP6MbWEtFTj0d0LCPOA5Pw7p2m1p3HEMI6mcX
223# 4Fi+KO6CIvlX+SKrZwIattLO3VQZqV68/W3fmyC2FYwfVUU/InwIDGx3hXR3i+zr
224# t41t11bnp8B4Bhq7PXKgUEHuX0gcNE0o62HstYOf/U5HkCM+Ag43gFrR/RDwMq6L
225# 7VxKws52ao8xggIHMIICAwIBATBVMD4xEjAQBgoJkiaJk/IsZAEZFgJhdDEVMBMG
226# CgmSJomT8ixkARkWBWZob29lMREwDwYDVQQDEwhGSE9PZUNBMQITaAABOiCwISXg
227# Y2j/KQABAAE6IDANBglghkgBZQMEAgEFAKCBhDAYBgorBgEEAYI3AgEMMQowCKAC
228# gAChAoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsx
229# DjAMBgorBgEEAYI3AgEVMC8GCSqGSIb3DQEJBDEiBCBkKJAeYkI5WqZCigil5oKN
230# A/cYpXRiV+nHT9AINKF4HjANBgkqhkiG9w0BAQEFAASCAQCWxzzUAY2ruqDFVUHY
231# Zzifh1dpYkpzIidbJIVAiAKvlql14/pqLSsZ64GS+qAph0F43FHYodilL50zydnp
232# sv6WRC6GqE4ida5vwuWl22R7t4gZx5ZIG73HPySUzKawFigUZllT4CQfW7qEBf0g
233# N42mOR0MnkGTsJiFQSpD98UHpiUaSNWSMAEsWeEiw0eVxiDOIQGTc62RtAPg4EUt
234# fIOlbRUvQAgwC6yAdmqx0fA0ADAV0aO9c6h9jyf6kYA0TeAc8o/LtBtHULCLj5HT
235# YllKIp7BZCLGQKVbKvmdxsdIGT8ajElKowM1MTGcLQYaGdzGTRgDNnTjzVsmV1Q7
236# s7qn
237# SIG # End signature block
Note: See TracBrowser for help on using the repository browser.