Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PublishBuildArtifactsV1] Delete hardcoded "/E" option not to copy subdirectories #15046

11 changes: 6 additions & 5 deletions Tasks/PublishBuildArtifactsV1/Invoke-Robocopy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ $writer = New-Object System.IO.StreamWriter($stdout, $utf8)
# PowerShell 4, Write-Host and Out-Default do not consider the updated stream writer.

if (!$File) {
$File = "*";
$File = "*";
$CopySubFoldersOption = "/E"
}

# Print the ##command. The /MT parameter is only supported on 2008 R2 and higher.
if ($ParallelCount -gt 1) {
[System.Console]::WriteLine("##[command]robocopy.exe /E /COPY:DA /NP /R:3 /MT:$ParallelCount `"$Source`" `"$Target`" `"$File`"")
[System.Console]::WriteLine("##[command]robocopy.exe $CopySubFoldersOption /COPY:DA /NP /R:3 /MT:$ParallelCount `"$Source`" `"$Target`" `"$File`"")
}
else {
[System.Console]::WriteLine("##[command]robocopy.exe /E /COPY:DA /NP /R:3 `"$Source`" `"$Target`" `"$File`"")
[System.Console]::WriteLine("##[command]robocopy.exe $CopySubFoldersOption /COPY:DA /NP /R:3 `"$Source`" `"$Target`" `"$File`"")
}

# The $OutputEncoding variable instructs PowerShell how to interpret the output
Expand All @@ -74,7 +75,7 @@ $OutputEncoding = [System.Text.Encoding]::Default
#
# Note, the /MT parameter is only supported on 2008 R2 and higher.
if ($ParallelCount -gt 1) {
& robocopy.exe /E /COPY:DA /NP /R:3 /MT:$ParallelCount $Source $Target $File 2>&1 |
& robocopy.exe $CopySubFoldersOption /COPY:DA /NP /R:3 /MT:$ParallelCount $Source $Target $File 2>&1 |
ForEach-Object {
if ($_ -is [System.Management.Automation.ErrorRecord]) {
[System.Console]::WriteLine($_.Exception.Message)
Expand All @@ -85,7 +86,7 @@ if ($ParallelCount -gt 1) {
}
}
else {
& robocopy.exe /E /COPY:DA /NP /R:3 $Source $Target $File 2>&1 |
& robocopy.exe $CopySubFoldersOption /COPY:DA /NP /R:3 $Source $Target $File 2>&1 |
anatolybolshakov marked this conversation as resolved.
Show resolved Hide resolved
ForEach-Object {
if ($_ -is [System.Management.Automation.ErrorRecord]) {
[System.Console]::WriteLine($_.Exception.Message)
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PublishBuildArtifactsV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 186,
"Minor": 192,
"Patch": 0
},
"demands": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PublishBuildArtifactsV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 186,
"Minor": 192,
"Patch": 0
},
"demands": [],
Expand Down