From e5ce800a7679675f9ba9835960fc5a75f007862d Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 24 Jun 2025 14:38:51 +0200 Subject: [PATCH] Improved log output of build-repo.ps1 --- scripts/build-repo.ps1 | 57 ++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/scripts/build-repo.ps1 b/scripts/build-repo.ps1 index 79e541d1..9ce990e9 100755 --- a/scripts/build-repo.ps1 +++ b/scripts/build-repo.ps1 @@ -8,9 +8,9 @@ Specifies the file path to the Git repository (default: current working directory) .EXAMPLE PS> ./build-repo.ps1 C:\Repos\ninja - ⏳ Building πŸ“‚ninja by using CMake... + ⏳ Building 'ninja' by executing cmake... ... - βœ… Build of πŸ“‚ninja succeeded in 47s, results at: πŸ“‚C:\Repos\ninja\_results + βœ… Build of 'ninja' succeeded in 47s, results in: πŸ“‚C:\Repos\ninja\_results .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -22,117 +22,120 @@ param([string]$path = "$PWD") function BuildFolder([string]$path) { $dirName = (Get-Item "$path").Name if (Test-Path "$path/CMakeLists.txt" -pathType leaf) { - "⏳ (1/4) Building πŸ“‚$dirName by using CMake..." + "⏳ (1/3) Building '$dirName' by executing cmake..." $global:results = "$path/_results/" if (-not(Test-Path $global:results -pathType container)) { & mkdir $global:results } Set-Location $global:results - - "⏳ (2/4) Executing 'cmake' to generate the Makefile..." & cmake .. if ($lastExitCode -ne 0) { throw "Executing 'cmake ..' failed with exit code $lastExitCode" } - "⏳ (3/4) Executing 'make -j4' to compile and link..." + "⏳ (2/3) Executing 'make -j4' to compile and link..." & make -j4 if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } - "⏳ (4/4) Executing 'ctest -V'... (if tests are provided)" + "⏳ (3/3) Checking '$dirName' by executing 'ctest -V'... (if tests are provided)" & ctest -V if ($lastExitCode -ne 0) { throw "Executing 'ctest -V' failed with exit code $lastExitCode" } } elseif (Test-Path "$path/.cargo/release.toml" -pathType leaf) { - "⏳ (1/4) Building πŸ“‚$dirName by using Cargo..." - Set-Location "$path/" + "⏳ Building '$dirName' by executing 'cargo build'..." + Set-Location "$path/" & cargo build --config .cargo/release.toml --release if ($lastExitCode -ne 0) { throw "Executing 'cargo build' failed with exit code $lastExitCode" } } elseif (Test-Path "$path/autogen.sh" -pathType leaf) { - "⏳ Building πŸ“‚$dirName by executing 'autogen.sh'..." + + "⏳ (1/3) Building '$dirName' by executing 'autogen.sh'..." Set-Location "$path/" & ./autogen.sh --force if ($lastExitCode -ne 0) { throw "Executing './autogen.sh --force' failed with exit code $lastExitCode" } - "⏳ Executing './configure'..." - + "⏳ (2/3) Executing './configure'..." & ./configure if ($lastExitCode -ne 0) { throw "Executing './configure' failed with exit code $lastExitCode" } + "⏳ (3/3) Executing 'make -j4' to compile and link..." & make -j4 if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } } elseif (Test-Path "$path/configure" -pathType leaf) { - "⏳ Building πŸ“‚$dirName by executing './configure' and 'make'..." - Set-Location "$path/" + "⏳ (1/3) Building '$dirName' by executing './configure'..." + Set-Location "$path/" & ./configure #if ($lastExitCode -ne 0) { throw "Executing './configure' exited with error code $lastExitCode" } + "⏳ (2/3) Compiling and linking '$dirName' by executing 'make -j4'..." & make -j4 if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } + "⏳ (3/3) Checking '$dirName' by executing 'make test'..." & make test if ($lastExitCode -ne 0) { throw "Executing 'make test' failed with exit code $lastExitCode" } } elseif (Test-Path "$path/build.gradle" -pathType leaf) { - "⏳ Building πŸ“‚$dirName by using Gradle..." - Set-Location "$path" + "⏳ (1/2) Building '$dirName' by executing 'gradle build'..." + Set-Location "$path" & gradle build if ($lastExitCode -ne 0) { throw "Executing 'gradle build' failed with exit code $lastExitCode" } + "⏳ (2/2) Checking '$dirName' by executing 'gradle test'..." & gradle test if ($lastExitCode -ne 0) { throw "Executing 'gradle test' failed with exit code $lastExitCode" } } elseif (Test-Path "$path/meson.build" -pathType leaf) { - "⏳ Building πŸ“‚$dirName by using Meson..." + "⏳ Building '$dirName' by using Meson..." Set-Location "$path" & meson . build --prefix=/usr/local if ($lastExitCode -ne 0) { throw "Executing 'meson . build' failed with exit code $lastExitCode" } } elseif (Test-Path "$path/Imakefile" -pathType leaf) { - "⏳ Building πŸ“‚$dirName by using Imakefile..." + "⏳ Building '$dirName' by using Imakefile..." Set-Location "$path/" - & xmkmf if ($lastExitCode -ne 0) { throw "Executing 'xmkmf' failed with exit code $lastExitCode" } + "⏳ Executing 'make -j4' to compile and link..." & make -j4 if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } } elseif (Test-Path "$path/Makefile" -pathType leaf) { - "⏳ Building πŸ“‚$dirName by using Makefile..." - Set-Location "$path" + "⏳ Building '$dirName' by using Makefile..." + Set-Location "$path" & make -j4 if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } } elseif (Test-Path "$path/makefile" -pathType leaf) { - "⏳ Building πŸ“‚$dirName by using makefile..." + "⏳ Building '$dirName' by using makefile..." Set-Location "$path" & make -j4 if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } } elseif (Test-Path "$path/compile.sh" -pathType leaf) { - "⏳ Building πŸ“‚$dirName by executing 'compile.sh'..." - Set-Location "$path/" + "⏳ Building '$dirName' by executing 'compile.sh'..." + Set-Location "$path/" & ./compile.sh if ($lastExitCode -ne 0) { throw "Executing './compile.sh' failed with exit code $lastExitCode" } + "⏳ Executing 'make -j4' to compile and link..." & make -j4 if ($lastExitCode -ne 0) { throw "Executing 'make -j4' failed with exit code $lastExitCode" } } elseif (Test-Path "$path/attower/src/build/DevBuild/build.bat" -pathType leaf) { - Write-Host "⏳ Building πŸ“‚$dirName by executing 'build.bat'..." + Write-Host "⏳ Building '$dirName' by executing 'build.bat'..." Set-Location "$path/attower/src/build/DevBuild/" & ./build.bat build-core-release if ($lastExitCode -ne 0) { throw "Executing 'build.bat' failed with exit code $lastExitCode" } $global:results = "$path\attower\Executables" } elseif (Test-Path "$path/$dirName" -pathType container) { - "⏳ No make rule found, trying subfolder πŸ“‚$($dirName)..." + "⏳ No make rule found, trying subfolder '$($dirName)'..." BuildFolder "$path/$dirName" } else { Write-Warning "Sorry, no make rule applies to: πŸ“‚$dirName" @@ -155,7 +158,7 @@ try { if ($global:results -eq "") { "βœ… Build of πŸ“‚$repoDirName succeeded in $($elapsed)s." } else { - "βœ… Build of πŸ“‚$repoDirName succeeded in $($elapsed)s, results at: πŸ“‚$($global:results)" + "βœ… Build of πŸ“‚$repoDirName succeeded in $($elapsed)s, results in: πŸ“‚$($global:results)" } exit 0 # success } catch {