@@ -13,83 +13,92 @@ function Add-Package {
1313 begin {
1414 }
1515 process {
16- $currentDirectory = (Get-Location ).Path
17- New-Item - Path $currentDirectory \artifacts - ItemType Directory - Force | Out-Null
18- $docsFiles = @ (" LICENSE" , " COPYRIGHT" , " COPYING" )
19- $docsFiles | ForEach-Object {
20- if (Test-Path - Path $_ ) {
21- Copy-Item - Path $_ - Destination artifacts - Force
22- }
23- }
24- if (Test-Path ..\deps) {
25- Get-ChildItem - Path ..\deps - Recurse - Filter " LICENSE*" | ForEach-Object {
26- if (Test-Path - Path $_ - PathType Leaf) {
27- Copy-Item - Path $_.FullName - Destination artifacts - Force
16+ Add-StepLog " Packaging $ ( $Config.name ) extension"
17+ try {
18+ Set-GAGroup start
19+ $currentDirectory = (Get-Location ).Path
20+ New-Item - Path $currentDirectory \artifacts - ItemType Directory - Force | Out-Null
21+ $docsFiles = @ (" LICENSE" , " COPYRIGHT" , " COPYING" )
22+ $docsFiles | ForEach-Object {
23+ if (Test-Path - Path $_ ) {
24+ Copy-Item - Path $_ - Destination artifacts - Force
2825 }
2926 }
30- }
31- $Config.docs | ForEach-Object {
32- if ($null -ne $_ ) {
33- $directoryPath = [System.IO.Path ]::GetDirectoryName($_ )
34- $targetDir = Join-Path - Path artifacts - ChildPath $directoryPath
35- New-Item - ItemType Directory - Path $targetDir - Force | Out-Null
36- Copy-Item - Path $_ - Destination $targetDir - Force
27+ if (Test-Path ..\deps) {
28+ Get-ChildItem - Path ..\deps - Recurse - Filter " LICENSE*" | ForEach-Object {
29+ if (Test-Path - Path $_ - PathType Leaf) {
30+ Copy-Item - Path $_.FullName - Destination artifacts - Force
31+ }
32+ }
3733 }
38- }
39- Get-ChildItem - Path $Config.build_directory - Recurse - Filter " *.dll" | ForEach-Object {
40- Copy-Item - Path $_.FullName - Destination artifacts - Force
41- }
42- Get-ChildItem - Path " artifacts\*.dll" | ForEach-Object {
43- $pdbFilePath = Join-Path - Path $Config.build_directory - ChildPath ($_.BaseName + " .pdb" )
44- if (Test-Path - Path $pdbFilePath ) {
45- Copy-Item - Path $pdbFilePath - Destination artifacts - Force
34+ $Config.docs | ForEach-Object {
35+ if ($null -ne $_ ) {
36+ $directoryPath = [System.IO.Path ]::GetDirectoryName($_ )
37+ $targetDir = Join-Path - Path artifacts - ChildPath $directoryPath
38+ New-Item - ItemType Directory - Path $targetDir - Force | Out-Null
39+ Copy-Item - Path $_ - Destination $targetDir - Force
40+ }
4641 }
47- }
48- # TODO: Filter these using deplister
49- if (Test-Path ..\deps\bin) {
50- Get-ChildItem - Path ..\deps\bin - Recurse - Include " *.dll" , " *.pdb" | ForEach-Object {
42+ Get-ChildItem - Path $Config.build_directory - Recurse - Filter " *.dll" | ForEach-Object {
5143 Copy-Item - Path $_.FullName - Destination artifacts - Force
5244 }
53- if (Test-Path (Join-Path - Path ..\deps\bin - ChildPath " *.xml" )) {
54- New-Item - ItemType Directory - Path artifacts\config - Force | Out-Null
55- Get-ChildItem - Path ..\deps\bin - Recurse - Filter " *.xml" | ForEach-Object {
56- Copy-Item - Path $_.FullName - Destination artifacts\config - Force
45+ Get-ChildItem - Path " artifacts\*.dll" | ForEach-Object {
46+ $pdbFilePath = Join-Path - Path $Config.build_directory - ChildPath ($_.BaseName + " .pdb" )
47+ if (Test-Path - Path $pdbFilePath ) {
48+ Copy-Item - Path $pdbFilePath - Destination artifacts - Force
49+ }
50+ }
51+ # TODO: Filter these using deplister
52+ if (Test-Path ..\deps\bin) {
53+ Get-ChildItem - Path ..\deps\bin - Recurse - Include " *.dll" , " *.pdb" | ForEach-Object {
54+ Copy-Item - Path $_.FullName - Destination artifacts - Force
55+ }
56+ if (Test-Path (Join-Path - Path ..\deps\bin - ChildPath " *.xml" )) {
57+ New-Item - ItemType Directory - Path artifacts\config - Force | Out-Null
58+ Get-ChildItem - Path ..\deps\bin - Recurse - Filter " *.xml" | ForEach-Object {
59+ Copy-Item - Path $_.FullName - Destination artifacts\config - Force
60+ }
5761 }
5862 }
59- }
6063
61- Set-Location $currentDirectory \artifacts
62- if (Test-Path - Path " vc140.pdb" ) {
63- Remove-Item - Path " vc140.pdb" - Force
64- }
64+ Set-Location $currentDirectory \artifacts
65+ if (Test-Path - Path " vc140.pdb" ) {
66+ Remove-Item - Path " vc140.pdb" - Force
67+ }
6568
66- # As per https://github.com/ThePHPF/pie-design#windows-binaries
67- $arch = $Config.arch
68- if (-not (Test-Path - Path " php_$ ( $Config.name ) .dll" )) {
69- throw " Failed to build extension"
70- }
71- if ($env: ARTIFACT_NAMING_SCHEME -eq ' pie' ) {
72- if ($arch -eq ' x64' ) {
73- $arch = ' x86_64'
69+ # As per https://github.com/ThePHPF/pie-design#windows-binaries
70+ $arch = $Config.arch
71+ if (-not (Test-Path - Path " php_$ ( $Config.name ) .dll" )) {
72+ throw " Failed to build extension"
7473 }
75- $artifact = " php_$ ( $Config.package_name ) -$ ( $Config.ref ) -$ ( $Config.php_version ) -$ ( $Config.ts ) -$ ( $Config.vs_version ) -$arch "
76- @ (" php_$ ( $Config.name ) .dll" , " php_$ ( $Config.name ) .pdb" ) | ForEach-Object {
77- $extension = $_.Split (' .' )[1 ]
78- if (Test-Path - Path $_ ) {
79- Move-Item - Path $_ - Destination " $artifact .$extension " - Force
74+ if ($env: ARTIFACT_NAMING_SCHEME -eq ' pie' ) {
75+ if ($arch -eq ' x64' ) {
76+ $arch = ' x86_64'
77+ }
78+ $artifact = " php_$ ( $Config.package_name ) -$ ( $Config.ref ) -$ ( $Config.php_version ) -$ ( $Config.ts ) -$ ( $Config.vs_version ) -$arch "
79+ @ (" php_$ ( $Config.name ) .dll" , " php_$ ( $Config.name ) .pdb" ) | ForEach-Object {
80+ $extension = $_.Split (' .' )[1 ]
81+ if (Test-Path - Path $_ ) {
82+ Move-Item - Path $_ - Destination " $artifact .$extension " - Force
83+ }
8084 }
85+ } else {
86+ $artifact = " php_$ ( $Config.package_name ) -$ ( $Config.ref ) -$ ( $Config.php_version ) -$ ( $Config.ts ) -$ ( $Config.vs_version ) -$arch "
8187 }
82- } else {
83- $artifact = " php_$ ( $Config.package_name ) -$ ( $Config.ref ) -$ ( $Config.php_version ) -$ ( $Config.ts ) -$ ( $Config.vs_version ) -$arch "
84- }
8588
86- 7z a - sdel " $artifact .zip" *
89+ 7z a - sdel " $artifact .zip" *
8790
88- Set-Location $currentDirectory
89- New-Item - Path $currentDirectory \artifacts\logs - ItemType Directory - Force | Out-Null
90- Copy-Item - Path build-*. txt - Destination artifacts\logs\ - Force
91- Set-Location $currentDirectory \artifacts\logs
92- 7z a - sdel " $artifact .zip" *
91+ Set-Location $currentDirectory
92+ New-Item - Path $currentDirectory \artifacts\logs - ItemType Directory - Force | Out-Null
93+ Copy-Item - Path build-*. txt - Destination artifacts\logs\ - Force
94+ Set-Location $currentDirectory \artifacts\logs
95+ 7z a - sdel " $artifact .zip" *
96+ Set-GAGroup end
97+ Add-BuildLog tick " Packaging" " Extension $ ( $Config.name ) packaged successfully"
98+ } catch {
99+ Add-BuildLog cross " Packaging" " Failed to package $ ( $Config.name ) extension"
100+ throw
101+ }
93102 }
94103 end {
95104 }
0 commit comments