summaryrefslogtreecommitdiff
path: root/Build-ProjectSet.ps1
diff options
context:
space:
mode:
authorAdonais Romero Gonzalez <[email protected]>2022-09-26 16:04:27 -0700
committerAdonais Romero Gonzalez <[email protected]>2022-09-26 16:04:27 -0700
commitb6812b8d510dd8f23da7703506cb67cefc985533 (patch)
tree83057821801d7f9a9c274834a973e9abd8c07aa0 /Build-ProjectSet.ps1
parent78a4097df51c69947516fff09abf1444eebe70c2 (diff)
parent239361d9ab5c4b2098896f7a29451b99b71d9063 (diff)
Merge branch 'main' into develop
Diffstat (limited to 'Build-ProjectSet.ps1')
-rw-r--r--Build-ProjectSet.ps165
1 files changed, 65 insertions, 0 deletions
diff --git a/Build-ProjectSet.ps1 b/Build-ProjectSet.ps1
new file mode 100644
index 00000000..2557b5b9
--- /dev/null
+++ b/Build-ProjectSet.ps1
@@ -0,0 +1,65 @@
+param(
+ [hashtable]$ProjectSet,
+ [string]$Configuration = $env:Configuration,
+ [string]$Platform = $env:Platform
+)
+
+if ([string]::IsNullOrEmpty($Configuration))
+{
+ $Configuration = "Debug"
+}
+
+if ([string]::IsNullOrEmpty($Platform))
+{
+ $Platform = "x64"
+}
+
+$oldPreference = $ErrorActionPreference
+$ErrorActionPreference = "stop"
+try
+{
+ # Check that msbuild can be called before trying anything.
+ Get-Command "msbuild" | Out-Null
+}
+catch
+{
+ Write-Host "`u{274C} msbuild cannot be called from current environment. Check that msbuild is set in current path (for example, that it is called from a Visual Studio developer command)."
+ Write-Error "msbuild cannot be called from current environment."
+ exit 1
+}
+finally
+{
+ $ErrorActionPreference = $oldPreference
+}
+
+
+$exclusionsSet = @{}
+$failSet = @()
+Import-Csv 'exclusions.csv' | ForEach-Object {
+ $exclusionsSet[$_.Path.Replace($root, '').Trim('\').Replace('\', '.').ToLower()] = $_.Reason
+}
+
+$ProjectSet.GetEnumerator() | ForEach-Object {
+ $projectName = $_.Key
+ if ($exclusionsSet.ContainsKey($projectName))
+ {
+ Write-Output "[$projectName] `u{23E9} Excluded and skipped. Reason: $($exclusionsSet[$projectName])"
+ return;
+ }
+ $directory = $_.Value
+ .\Build-Project -Directory $directory -ProjectName $ProjectName -Configuration $Configuration -Platform $Platform
+ if ($LASTEXITCODE -ne 0)
+ {
+ $failSet += $ProjectName
+ }
+}
+
+if ($failSet.Count -gt 0)
+{
+ Write-Output "Some projects were built with errors:"
+ foreach ($failedProject in $failSet)
+ {
+ Write-Output "$failedProject"
+ }
+ Write-Error "Some projects were built with errors."
+} \ No newline at end of file