|
@@ -11,7 +11,7 @@ Options:
|
|
|
|
|
|
Function Request-File {
|
|
|
While ($Input.MoveNext()) {
|
|
|
- $VAR = @{
|
|
|
+ New-Variable -Name VAR -Option Constant -Value @{
|
|
|
Uri = $Input.Current
|
|
|
OutFile = (Split-Path -Path $Input.Current -Leaf).Split('?')[0]
|
|
|
}
|
|
@@ -35,6 +35,19 @@ Function Install-Program {
|
|
|
}
|
|
|
|
|
|
Function Build-Project {
|
|
|
+ New-Variable -Name VAR -Option Constant -Value @{
|
|
|
+ Src = 'lazpaint'
|
|
|
+ Use = 'use'
|
|
|
+ Pkg = 'use\components.txt'
|
|
|
+ }
|
|
|
+ If (! (Test-Path -Path $Var.Src)) {
|
|
|
+ 'Source do not find!' | Out-Host
|
|
|
+ Exit 1
|
|
|
+ }
|
|
|
+ If (Test-Path -Path '.gitmodules') {
|
|
|
+ & git submodule update --init --recursive --force --remote | Out-Host
|
|
|
+ ".... [[$($LastExitCode)]] git submodule update" | Out-Host
|
|
|
+ }
|
|
|
@(
|
|
|
@{
|
|
|
Cmd = 'lazbuild'
|
|
@@ -47,24 +60,17 @@ Function Build-Project {
|
|
|
$Env:PATH+=";$($_.Path)"
|
|
|
(Get-Command $_.Cmd).Source | Out-Host
|
|
|
}
|
|
|
- If (Test-Path -Path '.gitmodules') {
|
|
|
- & git submodule update --init --recursive --force --remote | Out-Host
|
|
|
- ".... [[$($LastExitCode)]] git submodule update" | Out-Host
|
|
|
- }
|
|
|
- $Env:Src = 'lazpaint'
|
|
|
- $Env:Use = 'use'
|
|
|
- $Env:Pkg = 'use\components.txt'
|
|
|
- If (Test-Path -Path $Env:Use) {
|
|
|
- If (Test-Path -Path $Env:Pkg) {
|
|
|
- Get-Content -Path $Env:Pkg |
|
|
|
+ If (Test-Path -Path $VAR.Use) {
|
|
|
+ If (Test-Path -Path $VAR.Pkg) {
|
|
|
+ Get-Content -Path $VAR.Pkg |
|
|
|
Where-Object {
|
|
|
- ! (Test-Path -Path "$($Env:Use)\$($_)") &&
|
|
|
+ ! (Test-Path -Path "$($VAR.Use)\$($_)") &&
|
|
|
! (& lazbuild --verbose-pkgsearch $_ ) &&
|
|
|
! (& lazbuild --add-package $_)
|
|
|
} | ForEach-Object {
|
|
|
Return @{
|
|
|
Uri = "https://packages.lazarus-ide.org/$($_).zip"
|
|
|
- Path = "$($Env:Use)\$($_)"
|
|
|
+ Path = "$($VAR.Use)\$($_)"
|
|
|
OutFile = (New-TemporaryFile).FullName
|
|
|
}
|
|
|
} | ForEach-Object -Parallel {
|
|
@@ -74,31 +80,32 @@ Function Build-Project {
|
|
|
Return ".... download $($_.Uri)"
|
|
|
} | Out-Host
|
|
|
}
|
|
|
- (Get-ChildItem -Filter '*.lpk' -Recurse -File –Path $Env:Use).FullName |
|
|
|
+ (Get-ChildItem -Filter '*.lpk' -Recurse -File –Path $VAR.Use).FullName |
|
|
|
ForEach-Object {
|
|
|
& lazbuild --add-package-link $_ | Out-Null
|
|
|
Return ".... [$($LastExitCode)] add package link $($_)"
|
|
|
} | Out-Host
|
|
|
}
|
|
|
- If (Test-Path -Path $Env:Src) {
|
|
|
- Exit (
|
|
|
- (Get-ChildItem -Filter '*.lpi' -Recurse -File –Path $Env:Src).FullName |
|
|
|
- Sort-Object |
|
|
|
- ForEach-Object {
|
|
|
- $error = 0
|
|
|
- $Output = (& lazbuild --build-all --recursive --no-write-project --build-mode='release' $_)
|
|
|
- $Result = @(".... [$($LastExitCode)] build project $($_)")
|
|
|
- If ($LastExitCode -eq 0) {
|
|
|
+ Exit (
|
|
|
+ (Get-ChildItem -Filter '*.lpi' -Recurse -File –Path $Var.Src).FullName |
|
|
|
+ Sort-Object |
|
|
|
+ ForEach-Object {
|
|
|
+ $Output = (& lazbuild --build-all --recursive --no-write-project --build-mode='release' $_)
|
|
|
+ $Result = @(".... [$($LastExitCode)] build project $($_)")
|
|
|
+ $exitCode = Switch ($LastExitCode) {
|
|
|
+ 0 {
|
|
|
$Result += $Output | Select-String -Pattern 'Linking'
|
|
|
- } Else {
|
|
|
- $error = 1
|
|
|
+ 0
|
|
|
+ }
|
|
|
+ Default {
|
|
|
$Result += $Output | Select-String -Pattern 'Error:', 'Fatal:'
|
|
|
+ 1
|
|
|
}
|
|
|
- $Result | Out-Host
|
|
|
- Return $error
|
|
|
- } | Measure-Object -Sum
|
|
|
- ).Sum
|
|
|
- }
|
|
|
+ }
|
|
|
+ $Result | Out-Host
|
|
|
+ Return $exitCode
|
|
|
+ } | Measure-Object -Sum
|
|
|
+ ).Sum
|
|
|
}
|
|
|
|
|
|
Function Switch-Action {
|
|
@@ -120,4 +127,4 @@ Function Switch-Action {
|
|
|
}
|
|
|
|
|
|
##############################################################################################################
|
|
|
-Switch-Action @args | Out-Null
|
|
|
+Switch-Action @args
|