mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-23 14:18:38 +01:00
Improve build-repo.ps1
This commit is contained in:
parent
96596a7581
commit
23c2be2dd4
@ -7,19 +7,15 @@
|
||||
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
|
||||
if (test-path "$RepoDir/CMakeLists.txt") {
|
||||
"⏳ Building 📂$RepoDirName using CMakeLists.txt ..."
|
||||
if (-not(test-path "$RepoDir/BuildFiles/" -pathType container)) {
|
||||
& mkdir "$RepoDir/BuildFiles/"
|
||||
function MakeDir { param($Path)
|
||||
$DirName = (get-item "$Path").Name
|
||||
if (test-path "$Path/CMakeLists.txt") {
|
||||
"⏳ Building 📂$DirName using CMakeLists.txt ..."
|
||||
if (-not(test-path "$Path/BuildFiles/" -pathType container)) {
|
||||
& mkdir "$Path/BuildFiles/"
|
||||
}
|
||||
|
||||
set-location "$RepoDir/BuildFiles/"
|
||||
set-location "$Path/BuildFiles/"
|
||||
& cmake ..
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' has failed" }
|
||||
|
||||
@ -28,9 +24,9 @@ try {
|
||||
|
||||
set-location ..
|
||||
|
||||
} elseif (test-path "$RepoDirName/configure") {
|
||||
"⏳ Building 📂$RepoDirName using 'configure' ..."
|
||||
set-location "$RepoDir/"
|
||||
} elseif (test-path "$Path/configure") {
|
||||
"⏳ Building 📂$DirName using 'configure' ..."
|
||||
set-location "$Path/"
|
||||
|
||||
& ./configure
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'configure' has failed" }
|
||||
@ -38,9 +34,9 @@ try {
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$RepoDir/autogen.sh") {
|
||||
"⏳ Building 📂$RepoDirName using 'autogen.sh' ..."
|
||||
set-location "$RepoDir/"
|
||||
} elseif (test-path "$Path/autogen.sh") {
|
||||
"⏳ Building 📂$DirName using 'autogen.sh' ..."
|
||||
set-location "$Path/"
|
||||
|
||||
& ./autogen.sh
|
||||
if ($lastExitCode -ne "0") { throw "Script 'autogen.sh' has failed" }
|
||||
@ -48,8 +44,8 @@ try {
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$RepoDir/Imakefile") {
|
||||
"⏳ Building 📂$RepoDirName using Imakefile ..."
|
||||
} elseif (test-path "$Path/Imakefile") {
|
||||
"⏳ Building 📂$DirName using Imakefile ..."
|
||||
set-location "$RepoDir/"
|
||||
|
||||
& xmkmf
|
||||
@ -58,24 +54,36 @@ try {
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$RepoDir/Makefile") {
|
||||
"⏳ Building 📂$RepoDirName using Makefile..."
|
||||
set-location "$RepoDir/"
|
||||
} elseif (test-path "$Path/Makefile") {
|
||||
"⏳ Building 📂$DirName using Makefile..."
|
||||
set-location "$Path"
|
||||
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$RepoDir/attower/src/build/DevBuild/build.bat") {
|
||||
"⏳ Building 📂$RepoDirName using build.bat ..."
|
||||
set-location "$RepoDir/attower/src/build/DevBuild/"
|
||||
} elseif (test-path "$Path/attower/src/build/DevBuild/build.bat") {
|
||||
"⏳ Building 📂$DirName using build.bat ..."
|
||||
set-location "$Path/attower/src/build/DevBuild/"
|
||||
|
||||
& ./build.bat build-all-release
|
||||
if ($lastExitCode -ne "0") { throw "Script 'build.bat' returned error(s)" }
|
||||
|
||||
} elseif (test-path "$Path/$DirName" -pathType container) {
|
||||
"⏳ No make rule found, but trying the subdirectory 📂$DirName ..."
|
||||
MakeDir "$Path/$DirName"
|
||||
} else {
|
||||
write-warning "Sorry, no rule found to build 📂$RepoDirName"
|
||||
write-warning "Sorry, no make rule found in 📂$DirName"
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
|
||||
MakeDir "$RepoDir"
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ built Git repository 📂$RepoDirName in $Elapsed sec."
|
||||
|
Loading…
Reference in New Issue
Block a user