Skip to content

Commit fed6576

Browse files
committed
Fix parsing options in composer.json
1 parent 4040878 commit fed6576

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

extension/BuildPhpExtension/private/Get-ExtensionConfig.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@ Function Get-ExtensionConfig {
6161
if ($ref -match 'refs/pull/(\d+)/merge') {
6262
$ref = $Matches[1]
6363
}
64+
$packageName = $Extension
65+
if($Extension.Contains("oci8")) {
66+
$packageName = "oci8"
67+
}
6468
$config = [PSCustomObject]@{
6569
name = $Extension
66-
package_name = $Extension
70+
package_name = $packageName
6771
ref = $ref
6872
php_version = $PhpVersion
6973
arch = $Arch
@@ -78,18 +82,14 @@ Function Get-ExtensionConfig {
7882
docs = @()
7983
build_directory = ""
8084
}
81-
if($Extension.Contains("oci8")) {
82-
$config.package_name = "oci8"
83-
}
8485
$composerJson = $null
86+
if((-not(Test-Path composer.json)) -and (Test-Path $PSScriptRoot\..\config\stubs\$packageName.composer.json)) {
87+
Copy-Item $PSScriptRoot\..\config\stubs\$packageName.composer.json composer.json
88+
}
8589
if(Test-Path composer.json) {
8690
$composerJson = Get-Content composer.json -Raw | ConvertFrom-Json
8791
}
88-
if($null -eq $composerJson -or $null -eq $composerJson."php-ext") {
89-
if (Test-Path $PSScriptRoot\..\config\stubs\${config.package_name}.composer.json) {
90-
Copy-Item $PSScriptRoot\..\config\stubs\${config.package_name}.composer.json composer.json
91-
}
92-
} else {
92+
if($null -ne $composerJson -and $null -ne $composerJson."php-ext") {
9393
$composerJson."php-ext"."configure-options" | ForEach-Object {
9494
$config.options += "--$( $_.name )"
9595
}

0 commit comments

Comments
 (0)