File tree Expand file tree Collapse file tree 6 files changed +69
-1
lines changed Expand file tree Collapse file tree 6 files changed +69
-1
lines changed Original file line number Diff line number Diff line change 82
82
build-directory : C:\build
83
83
env :
84
84
artifact-naming-scheme : pecl
85
+ auto-detect-args : true
85
86
86
87
artifacts :
87
88
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 76
76
' Add-Path' ,
77
77
' Add-PhpDependencies' ,
78
78
' Add-StepLog' ,
79
+ ' Get-ArgumentFromConfig' ,
79
80
' Get-BuildDirectory' ,
80
81
' Get-Extension' ,
81
82
' Get-ExtensionConfig' ,
Original file line number Diff line number Diff line change @@ -35,10 +35,12 @@ Function Add-Extension {
35
35
}
36
36
}
37
37
}
38
+ $configW32Content = [string ](Get-Content - Path " config.w32" )
39
+ $argument = Get-ArgumentFromConfig $Extension $configW32Content
38
40
$bat_content = @ ()
39
41
$bat_content += " "
40
42
$bat_content += " call phpize 2>&1"
41
- $bat_content += " call configure --with-php-build=`" ..\deps`" $ ( $Config .options ) --with-mp=`" disable`" --with-prefix=$Prefix 2>&1"
43
+ $bat_content += " call configure --with-php-build=`" ..\deps`" $argument --with-mp=`" disable`" --with-prefix=$Prefix 2>&1"
42
44
$bat_content += " nmake /nologo 2>&1"
43
45
$bat_content += " exit %errorlevel%"
44
46
Set-Content - Encoding " ASCII" - Path $Extension -task.bat - Value $bat_content
Original file line number Diff line number Diff line change
1
+ Function Get-ArgumentFromConfig {
2
+ <#
3
+ . SYNOPSIS
4
+ Get the Libraries from the config.w32 file
5
+ . PARAMETER Extension
6
+ Extension Name
7
+ . PARAMETER ConfigW32Content
8
+ config.w32 content
9
+ #>
10
+ [OutputType ()]
11
+ param (
12
+ [Parameter (Mandatory = $true , Position = 0 , HelpMessage = ' Extension Name' )]
13
+ [string ] $Extension ,
14
+ [Parameter (Mandatory = $true , Position = 1 , HelpMessage = ' config.w32 content' )]
15
+ [string ] $ConfigW32Content
16
+ )
17
+ begin {
18
+ }
19
+ process {
20
+ $buildArgPrefix = $null ;
21
+ $dashedExtension = $Extension -replace " _" , " -"
22
+ if ($configW32Content.contains (" ARG_ENABLE(`" $dashedExtension `" " ) -or $configW32Content.contains (" ARG_ENABLE('$dashedExtension '" )) {
23
+ $buildArgPrefix = " enable"
24
+ } elseif ($configW32Content.contains (" ARG_WITH(`" $dashedExtension `" " ) -or $configW32Content.contains (" ARG_WITH('$dashedExtension '" )) {
25
+ $buildArgPrefix = " with"
26
+ } elseif ($configW32Content.contains (" ARG_ENABLE(`" $extension `" " ) -or $configW32Content.contains (" ARG_ENABLE('$extension '" )) {
27
+ $buildArgPrefix = " enable"
28
+ $dashedExtension = $Extension
29
+ } elseif ($configW32Content.contains (" ARG_WITH(`" $extension `" " ) -or $configW32Content.contains (" ARG_WITH('$extension '" )) {
30
+ $buildArgPrefix = " with"
31
+ $dashedExtension = $Extension
32
+ }
33
+
34
+ $argValue = ' ' ;
35
+ if ($ConfigW32Content.Contains (" PHP_$ ( $Extension.ToUpper ()) _SHARED" )) {
36
+ $argValue = " shared"
37
+ }
38
+
39
+ $arg = ' '
40
+ if ($null -ne $buildArgPrefix ) {
41
+ $arg = " --$buildArgPrefix -$dashedExtension "
42
+ }
43
+ if ($argValue -ne ' ' ) {
44
+ $arg = " $arg =$argValue "
45
+ }
46
+ return $arg
47
+ }
48
+ end {
49
+ }
50
+ }
Original file line number Diff line number Diff line change @@ -182,6 +182,19 @@ Function Get-ExtensionConfig {
182
182
$config.build_tools += " python"
183
183
}
184
184
185
+ if ($env: AUTO_DETECT_ARGS -eq ' true' ) {
186
+ $buildArgPrefix = $null ;
187
+ $dashedExtension = $Extension -replace " _" , " -"
188
+ if ($configW32Content.contains (" ARG_ENABLE(`" $dashedExtension `" " )) {
189
+ $buildArgPrefix = " enable"
190
+ } elseif ($configW32Content.contains (" ARG_WITH(`" $dashedExtension `" " )) {
191
+ $buildArgPrefix = " with"
192
+ }
193
+ if (-not ($config.options.contains (" --$buildArgPrefix -$dashedExtension " ))) {
194
+ $config.options += " --$buildArgPrefix -$dashedExtension "
195
+ }
196
+ }
197
+
185
198
$config.build_directory = if ($Arch -eq " x64" ) { " x64\" } else { " " }
186
199
$config.build_directory += " Release"
187
200
if ($Ts -eq " ts" ) { $config.build_directory += " _TS" }
Original file line number Diff line number Diff line change 66
66
TEST_OPCACHE_MODE : ${{inputs.test-opcache-mode}}
67
67
BUILD_DIRECTORY : ${{inputs.build-directory}}
68
68
AUTH_TOKEN : ${{inputs.auth-token}}
69
+ AUTO_DETECT_ARGS : ${{env.auto-detect-args}}
69
70
run : |
70
71
Import-Module ${{ github.action_path }}\BuildPhpExtension -Force
71
72
Invoke-PhpBuildExtension -ExtensionUrl "${{inputs.extension-url}}" `
You can’t perform that action at this time.
0 commit comments