forked from microsoft/PowerToys
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate-repository.ps1
More file actions
56 lines (48 loc) · 1.64 KB
/
Copy pathvalidate-repository.ps1
File metadata and controls
56 lines (48 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
[CmdletBinding()]
param()
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$requiredPaths = @(
'App\MouseWithoutBorders.csproj',
'MouseWithoutBorders.UnitTests\MouseWithoutBorders.UnitTests.csproj',
'docs\DEVELOPMENT.md',
'docs\UPSTREAM_SYNC.md',
'LICENSE'
)
$forbiddenPaths = @(
'src',
'deps',
'doc',
'installer',
'tools',
'.pipelines',
'PowerToys.slnx',
'Directory.Build.targets',
'App\Service',
'App\MouseWithoutBorders.Standalone.csproj',
'App\Helper\MouseWithoutBordersHelper.csproj',
'App\Helper\MouseWithoutBordersHelper.Standalone.csproj'
)
foreach ($requiredPath in $requiredPaths) {
if (-not (Test-Path -LiteralPath (Join-Path $PSScriptRoot $requiredPath))) {
throw "Required portable-project path is missing: $requiredPath"
}
}
foreach ($forbiddenPath in $forbiddenPaths) {
if (Test-Path -LiteralPath (Join-Path $PSScriptRoot $forbiddenPath)) {
throw "PowerToys-only or retired comparison path returned: $forbiddenPath"
}
}
$projectFiles = @(
Get-ChildItem -LiteralPath $PSScriptRoot -Filter '*.csproj' -File -Recurse |
ForEach-Object { [IO.Path]::GetRelativePath($PSScriptRoot, $_.FullName) } |
Sort-Object
)
$expectedProjects = @(
'App\MouseWithoutBorders.csproj',
'MouseWithoutBorders.UnitTests\MouseWithoutBorders.UnitTests.csproj'
)
if (Compare-Object -ReferenceObject $expectedProjects -DifferenceObject $projectFiles) {
throw "Expected only the portable app and unit-test projects. Found: $($projectFiles -join ', ')"
}
Write-Host "Clean portable repository layout verified ($($projectFiles.Count) projects)."