summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdonais Romero González <[email protected]>2022-09-06 16:36:33 -0700
committerGitHub <[email protected]>2022-09-06 16:36:33 -0700
commit110e8c201d5a929fc01e333ceac0dc71b0267237 (patch)
treead236c3bcd9cdca7511753950ea60db417160d56
parentd504c54cf595e9185617a3e611e417617be8c0b8 (diff)
Miscellaneous build scripts fixes (#779)
Fix actions: escape emoji characters; add small validations to build scripts
-rw-r--r--.github/scripts/Build-ChangedProjects.ps16
-rw-r--r--Build-AllProjects.ps12
-rw-r--r--Build-Project.ps16
-rw-r--r--Build-ProjectSet.ps131
4 files changed, 36 insertions, 9 deletions
diff --git a/.github/scripts/Build-ChangedProjects.ps1 b/.github/scripts/Build-ChangedProjects.ps1
index e163e5f9..a13e3501 100644
--- a/.github/scripts/Build-ChangedProjects.ps1
+++ b/.github/scripts/Build-ChangedProjects.ps1
@@ -9,7 +9,7 @@ $projectSet = @{}
foreach ($file in $ChangedFiles)
{
if (-not (Test-Path $file)) {
- Write-Output "❔ Changed file $file cannot be found"
+ Write-Output "`u{2754} Changed file $file cannot be found"
continue
}
$dir = (Get-Item $file).DirectoryName
@@ -19,11 +19,11 @@ foreach ($file in $ChangedFiles)
}
if ($dir -eq $root)
{
- Write-Output "❔ Changed file $file does not match a project."
+ Write-Output "`u{2754} Changed file $file does not match a project."
continue
}
$projectName = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower()
- Write-Output "🔎 Found project [$projectName] at $dir from changed file $file"
+ Write-Output "`u{1F50E} Found project [$projectName] at $dir from changed file $file"
if (-not ($projectSet.ContainsKey($projectName)))
{
$projectSet[$projectName] = $dir
diff --git a/Build-AllProjects.ps1 b/Build-AllProjects.ps1
index 4738907c..1c35d884 100644
--- a/Build-AllProjects.ps1
+++ b/Build-AllProjects.ps1
@@ -7,7 +7,7 @@ foreach ($file in $solutionFiles)
{
$dir = (Get-Item $file).DirectoryName
$dir_norm = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower()
- echo "🔎 Found project [$dir_norm] at $dir"
+ Write-Output "`u{1F50E} Found project [$dir_norm] at $dir"
$projectSet[$dir_norm] = $dir
}
diff --git a/Build-Project.ps1 b/Build-Project.ps1
index 1f79b679..b01d13a8 100644
--- a/Build-Project.ps1
+++ b/Build-Project.ps1
@@ -49,16 +49,16 @@ foreach ($line in Get-Content -Path $solutionFile)
if (-not $configurationIsSupported)
{
- Write-Output "[$ProjectName] ⏩ Skipped. Configuration $Configuration|$Platform not supported."
+ Write-Output "[$ProjectName] `u{23E9} Skipped. Configuration $Configuration|$Platform not supported."
exit 0
}
$errorLogFilePath = "$LogFilesDirectory\$ProjectName.err"
$warnLogFilePath = "$LogFilesDirectory\$ProjectName.wrn"
-Write-Output "[$ProjectName] ⚒️ Building project..."
+Write-Output "[$ProjectName] `u{2692} Building project..."
msbuild $solutionFile -clp:Verbosity=m -t:clean,build -property:Configuration=$Configuration -property:Platform=$Platform -p:TargetVersion=Windows10 -p:InfVerif_AdditionalOptions="/msft /sw1205 /sw1324 /sw1420 /sw1421" -p:SignToolWS=/fdws -p:DriverCFlagAddOn=/wd4996 -flp1:errorsonly`;logfile=$errorLogFilePath -flp2:WarningsOnly`;logfile=$warnLogFilePath -noLogo
if ($LASTEXITCODE -ne 0)
{
- Write-Warning "❌ Build failed. Log available at $errorLogFilePath"
+ Write-Warning "`u{274C} Build failed. Log available at $errorLogFilePath"
exit 1
}
diff --git a/Build-ProjectSet.ps1 b/Build-ProjectSet.ps1
index 57c4ac32..2557b5b9 100644
--- a/Build-ProjectSet.ps1
+++ b/Build-ProjectSet.ps1
@@ -4,7 +4,34 @@ param(
[string]$Platform = $env:Platform
)
-#TODO validate params
+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 = @()
@@ -16,7 +43,7 @@ $ProjectSet.GetEnumerator() | ForEach-Object {
$projectName = $_.Key
if ($exclusionsSet.ContainsKey($projectName))
{
- Write-Output "[$projectName] ⏩ Excluded and skipped. Reason: $($exclusionsSet[$projectName])"
+ Write-Output "[$projectName] `u{23E9} Excluded and skipped. Reason: $($exclusionsSet[$projectName])"
return;
}
$directory = $_.Value