Skip to content

Commit dd76040

Browse files
author
Pavel Purma
committed
Print out the folders structure
1 parent c83628f commit dd76040

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

eng/Stage-EngCommon.ps1

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,38 @@ param(
66
Set-StrictMode -Version Latest
77
$ErrorActionPreference = 'Stop'
88

9+
function Write-FolderStructure {
10+
param(
11+
[Parameter(Mandatory)]
12+
[string]$Path,
13+
14+
[ValidateRange(0, 10)]
15+
[int]$Depth = 2
16+
)
17+
18+
$resolvedPath = (Resolve-Path -LiteralPath $Path).Path
19+
Write-Host "Folder structure for: $resolvedPath"
20+
21+
Get-ChildItem -LiteralPath $resolvedPath -Recurse -Depth $Depth |
22+
ForEach-Object {
23+
$relativePath = [System.IO.Path]::GetRelativePath($resolvedPath, $_.FullName)
24+
$suffix = if ($_.PSIsContainer) { [System.IO.Path]::DirectorySeparatorChar } else { '' }
25+
Write-Host " $relativePath$suffix"
26+
}
27+
}
28+
929
$repoRoot = Split-Path $PSScriptRoot -Parent
1030
$source = Join-Path $PSScriptRoot 'common'
1131
$dockerfiles = Get-ChildItem (Join-Path $repoRoot 'src') -Filter Dockerfile -File -Recurse |
1232
Where-Object {
1333
Select-String -LiteralPath $_.FullName -Pattern '^\s*COPY\s+eng/common/' -Quiet
1434
}
1535

36+
Write-Host "RepoRoot: $repoRoot"
37+
Write-FolderStructure -Path $repoRoot
38+
1639
foreach ($dockerfile in $dockerfiles) {
40+
Write-Host "Processing Dockerfile: $($dockerfile.FullName)"
1741
$engDirectory = Join-Path $dockerfile.Directory.FullName 'eng'
1842
$destination = Join-Path $engDirectory 'common'
1943

@@ -22,8 +46,11 @@ foreach ($dockerfile in $dockerfiles) {
2246
}
2347

2448
if (-not $Clean) {
49+
Write-Host " - Destination for eng/common: $destination"
2550
New-Item -Path $engDirectory -ItemType Directory -Force | Out-Null
2651
Copy-Item -LiteralPath $source -Destination $engDirectory -Recurse -Force
27-
Write-Host "Staged eng/common next to $($dockerfile.FullName)"
52+
Write-Host " - Destination folder structure:"
53+
Write-FolderStructure -Path $destination
54+
Write-Host ""
2855
}
2956
}

0 commit comments

Comments
 (0)