forked from php/php-windows-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInvoke-Build.ps1
51 lines (50 loc) · 1.71 KB
/
Invoke-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
Function Invoke-Build {
<#
.SYNOPSIS
Build the extension
.PARAMETER Config
Extension Configuration
#>
[OutputType()]
param(
[Parameter(Mandatory = $true, Position=0, HelpMessage='Extension Configuration')]
[PSCustomObject] $Config
)
begin {
}
process {
Add-StepLog "Building $($Config.name) extension"
try {
Set-GAGroup start
$bat_content = @()
$bat_content += ""
$bat_content += "call phpize 2>&1"
$bat_content += "call configure --with-php-build=`"..\deps`" $($Config.options) --with-mp=`"disable`" --enable-debug-pack 2>&1"
$bat_content += "nmake /nologo 2>&1"
$bat_content += "exit %errorlevel%"
Set-Content -Encoding "ASCII" -Path task.bat -Value $bat_content
$builder = "php-sdk\phpsdk-starter.bat"
$task = (Get-Item -Path "." -Verbose).FullName + '\task.bat'
$ref = $Config.ref
if($env:ARTIFACT_NAMING_SCHEME -eq 'pecl') {
$ref = $Config.ref.ToLower()
}
$suffix = "php_" + (@(
$Config.name,
$ref,
$Config.php_version,
$Config.ts,
$Config.vs_version,
$Config.arch
) -join "-")
& $builder -c $Config.vs_version -a $Config.Arch -s $Config.vs_toolset -t $task | Tee-Object -FilePath "build-$suffix.txt"
Set-GAGroup end
Add-BuildLog tick $Config.name "Extension $($Config.name) built successfully"
} catch {
Add-BuildLog cross $Config.name "Failed to build"
throw
}
}
end {
}
}