Skip to content

Commit 6eee1c8

Browse files
committed
Pack-Crates.ps1 artifact output
1 parent c15eaf2 commit 6eee1c8

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

eng/scripts/Pack-Crates.ps1

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ Packing crates with
2222
RUSTFLAGS: '${env:RUSTFLAGS}'
2323
"@
2424

25-
if ($OutputPath) {
26-
$OutputPath = New-Item -ItemType Directory -Path $OutputPath -Force | Select-Object -ExpandProperty FullName
27-
}
28-
2925
function Get-OutputPackageNames($workspacePackages) {
3026
$packablePackages = $workspacePackages | Where-Object -Property publish -NE -Value @()
3127
$packablePackageNames = $packablePackages.name
@@ -139,25 +135,32 @@ try {
139135
exit $LASTEXITCODE
140136
}
141137

142-
if ($OutputPath -and $package.OutputPackage) {
143-
$sourcePath = [System.IO.Path]::Combine($RepoRoot, "target", "package", "$packageName-$packageVersion")
144-
$targetPath = [System.IO.Path]::Combine($OutputPath, $packageName)
145-
$targetContentsPath = [System.IO.Path]::Combine($targetPath, "contents")
146-
$targetApiReviewFile = [System.IO.Path]::Combine($targetPath, "$packageName.rust.json")
138+
if ($OutputPath) {
139+
$OutputPath = New-Item -ItemType Directory -Path $OutputPath -Force | Select-Object -ExpandProperty FullName
147140

148-
if (Test-Path -Path $targetContentsPath) {
149-
Remove-Item -Path $targetContentsPath -Recurse -Force
150-
}
141+
foreach ($package in $packages) {
142+
$sourcePath = [System.IO.Path]::Combine($RepoRoot, "target", "package", "$($package.name)-$($package.version)")
143+
$targetPath = [System.IO.Path]::Combine($OutputPath, $package.name)
144+
$targetContentsPath = [System.IO.Path]::Combine($targetPath, "contents")
145+
$targetApiReviewFile = [System.IO.Path]::Combine($targetPath, "$($package.name).rust.json")
151146

152-
Write-Host "Copying package '$packageName' to '$targetContentsPath'"
153-
New-Item -ItemType Directory -Path $targetContentsPath -Force | Out-Null
154-
Copy-Item -Path $sourcePath/* -Destination $targetContentsPath -Recurse -Exclude "Cargo.toml.orig"
147+
if (Test-Path -Path $targetContentsPath) {
148+
Remove-Item -Path $targetContentsPath -Recurse -Force
149+
}
155150

156-
Write-Host "Creating API review file"
157-
$apiReviewFile = Create-ApiViewFile $package
158-
159-
Write-Host "Copying API review file to '$targetApiReviewFile'"
160-
Copy-Item -Path $apiReviewFile -Destination $targetApiReviewFile -Force
151+
Write-Host "Copying package contents '$($package.name)' to '$targetContentsPath'"
152+
New-Item -ItemType Directory -Path $targetContentsPath -Force | Out-Null
153+
Copy-Item -Path $sourcePath/* -Destination $targetContentsPath -Recurse
154+
155+
Write-Host "Copying .crate file for '$($package.name)' to '$targetPath'"
156+
Copy-Item -Path "$sourcePath.crate" -Destination $targetPath -Force
157+
158+
Write-Host "Creating API review file"
159+
$apiReviewFile = Create-ApiViewFile $package
160+
161+
Write-Host "Copying API review file to '$targetApiReviewFile'"
162+
Copy-Item -Path $apiReviewFile -Destination $targetApiReviewFile -Force
163+
}
161164
}
162165

163166
if ($OutBuildOrderFile) {

0 commit comments

Comments
 (0)