-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
63 lines (51 loc) · 1.64 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
[CmdletBinding()]
param (
[Parameter(Mandatory=$False)]
[string]
$Filter,
[Parameter(Mandatory=$true)]
[string]
$BuildPath
)
$InformationPreference= 'Continue'
$ErrorActionPreference = 'Stop'
push-Location $PSScriptRoot
$importSpecs = Get-Content -Raw -Path "import.json" | ConvertFrom-Json
$keys = $importSpecs | ForEach-Object { $_ | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name }
$resolvedBuildPath = Resolve-Path $BuildPath
$GenepoolPath = .\.\Resolve-GenepoolPath.ps1
Write-Host "Genepool path: $GenepoolPath"
if((Test-Path $resolvedBuildPath -PathType Container) -eq $false)
{
Write-Information "Could not find build path $BuildPath" -ForegroundColor
return
}
Write-Host "Resolved build path: $resolvedBuildPath"
$BuildScript = Join-Path $resolvedBuildPath -ChildPath "..\build.ps1" -Resolve
Get-ChildItem -Path $resolvedBuildPath -Directory | ForEach-Object {
Write-Warning "Removing $_"
$fullName = $_.FullName
Remove-Item $fullName -Recurse -ErrorAction Continue
}
Write-Host "Build script path: $BuildScript"
try{
$keys | ForEach-Object {
$importSpec = $importSpecs.$_
$TemplateName = $_
if($Filter -and $TemplateName -notlike $Filter){
return
}
$osType = $importSpec.osType
try{
& $BuildScript -Filter $TemplateName
Set-Location $PSScriptRoot
$packed = .\.\pack_build.ps1 $TemplateName -BuildPath $resolvedBuildPath -RemoveBuild
Set-Location $PSScriptRoot
.\.\test_packed.ps1 -Geneset $packed -GenepoolPath $GenepoolPath -OsType $osType
}catch{
Write-Error $_
}
}
}finally{
pop-Location
}