1
0
mirror of https://github.com/fleschutz/PowerShell.git synced 2025-03-25 21:46:43 +01:00

Improve both scripts

This commit is contained in:
Markus Fleschutz 2021-04-14 20:02:04 +02:00
parent 6e5d0d05cb
commit a829a7c92d
2 changed files with 27 additions and 5 deletions

View File

@ -9,9 +9,10 @@
param($RepoDir = "$PWD")
try {
$StartTime = get-date
if (test-path "$RepoDir/CMakeLists.txt") {
"Building $RepoDir using CMakeLists.txt..."
if (-not(test-path "$RepoDir/CMakeBuild") {
if (-not(test-path "$RepoDir/CMakeBuild")) {
& mkdir "$RepoDir/CMakeBuild/"
}
set-location "$RepoDir/CMakeBuild/"
@ -21,24 +22,47 @@ try {
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (test-path "$RepoDir/configure") {
"Building $RepoDir using 'configure'..."
set-location "$RepoDir/"
& ./configure
if ($lastExitCode -ne "0") { throw "Executing 'configure' has failed" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (test-path "$RepoDir/autogen.sh") {
"Building $RepoDir using 'autogen.sh'..."
set-location "$RepoDir/"
& ./autogen.sh
if ($lastExitCode -ne "0") { throw "Script 'autogen.sh' has failed" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (test-path "$RepoDir/Makefile") {
"Building $RepoDir using Makefile..."
set-location "$RepoDir/"
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (test-path "$RepoDir/attower/src/build/DevBuild/build-all-release.bat") {
"Building $RepoDir using build-all-release.bat..."
set-location "$RepoDir/attower/src/build/DevBuild/"
& build-all-release.bat
& ./build-all-release.bat
if ($lastExitCode -ne "0") { throw "Script 'build-all-release.bat' returned error(s)" }
} else {
write-warning "Sorry, no clue how to build $RepoDir"
exit 0
}
write-host -foregroundColor green "OK - built Git repository $RepoDir"
$Elapsed = new-timeSpan -start $StartTime -end (get-date)
write-host -foregroundColor green "OK - built Git repository $RepoDir in $($Elapsed.seconds) second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -18,8 +18,6 @@ try {
[int]$Count = 0
get-childItem $ParentDir -attributes Directory | foreach-object {
& "$PSScriptRoot/build-repo.ps1" "$($_.FullName)"
if ($lastExitCode -ne "0") { throw "Script 'build-repo.ps1' failed" }
$Count++
}