Improved build-repo.ps1

This commit is contained in:
Markus Fleschutz 2024-05-02 13:09:54 +02:00
parent 6cfc31ffd4
commit 57b87c4b48

View File

@ -29,22 +29,36 @@ function BuildInDir([string]$path) {
"⏳ (2/4) Executing 'cmake' to generate the Makefile..." "⏳ (2/4) Executing 'cmake' to generate the Makefile..."
& cmake .. & cmake ..
if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' exited with error code $lastExitCode" }
"⏳ (3/4) Executing 'make -j4' to compile and link..." "⏳ (3/4) Executing 'make -j4' to compile and link..."
& make -j4 & make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make -j4' exited with error code $lastExitCode" }
"⏳ (4/4) Executing 'ctest -V' to perform tests (optional)..." "⏳ (4/4) Executing 'ctest -V' to perform tests (optional)..."
& ctest -V & ctest -V
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'ctest -V' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
"⏳ Building 📂$dirName by using 'autogen.sh'..."
Set-Location "$path/"
& ./autogen.sh --force
if ($lastExitCode -ne "0") { throw "Executing './autogen.sh --force' exited with error code $lastExitCode" }
& ./configure
if ($lastExitCode -ne "0") { throw "Executing './configure' exited with error code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/configure" -pathType leaf) { } elseif (Test-Path "$path/configure" -pathType leaf) {
"⏳ Building 📂$dirName by using 'configure'..." "⏳ Building 📂$dirName by using 'configure'..."
Set-Location "$path/" Set-Location "$path/"
& ./configure & ./configure
#if ($lastExitCode -ne "0") { throw "Script 'configure' exited with error code $lastExitCode" } #if ($lastExitCode -ne "0") { throw "Executing './configure' exited with error code $lastExitCode" }
& make -j4 & make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
@ -52,31 +66,21 @@ function BuildInDir([string]$path) {
& make test & make test
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
"⏳ Building 📂$dirName by using 'autogen.sh'..."
Set-Location "$path/"
& ./autogen.sh
if ($lastExitCode -ne "0") { throw "Script 'autogen.sh' exited with error code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/build.gradle" -pathType leaf) { } elseif (Test-Path "$path/build.gradle" -pathType leaf) {
"⏳ Building 📂$dirName by using Gradle..." "⏳ Building 📂$dirName by using Gradle..."
Set-Location "$path" Set-Location "$path"
& gradle build & gradle build
if ($lastExitCode -ne "0") { throw "'gradle build' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'gradle build' exited with error code $lastExitCode" }
& gradle test & gradle test
if ($lastExitCode -ne "0") { throw "'gradle test' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'gradle test' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/meson.build" -pathType leaf) { } elseif (Test-Path "$path/meson.build" -pathType leaf) {
"⏳ Building 📂$dirName by using Meson..." "⏳ Building 📂$dirName by using Meson..."
Set-Location "$path" Set-Location "$path"
& meson . build --prefix=/usr/local & meson . build --prefix=/usr/local
if ($lastExitCode -ne "0") { throw "'meson . build' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'meson . build' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/Imakefile" -pathType leaf) { } elseif (Test-Path "$path/Imakefile" -pathType leaf) {
"⏳ Building 📂$dirName by using Imakefile..." "⏳ Building 📂$dirName by using Imakefile..."
@ -107,7 +111,7 @@ function BuildInDir([string]$path) {
Set-Location "$path/" Set-Location "$path/"
& ./compile.sh & ./compile.sh
if ($lastExitCode -ne "0") { throw "Script 'compile.sh' exited with error code $lastExitCode" } if ($lastExitCode -ne "0") { throw "Executing './compile.sh' exited with error code $lastExitCode" }
& make -j4 & make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
@ -117,7 +121,7 @@ function BuildInDir([string]$path) {
Set-Location "$path/attower/src/build/DevBuild/" Set-Location "$path/attower/src/build/DevBuild/"
& ./build.bat build-all-release & ./build.bat build-all-release
if ($lastExitCode -ne "0") { throw "Script 'build.bat' exited with error code $lastExitCode" } if ($lastExitCode -ne "0") { throw "Executing 'build.bat build-all-release' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/$dirName" -pathType container) { } elseif (Test-Path "$path/$dirName" -pathType container) {
"⏳ No make rule found, trying subfolder 📂$($dirName)..." "⏳ No make rule found, trying subfolder 📂$($dirName)..."