feat: support selective shared consumer sync
- Accept consumer paths or an AutoCode JSON selection file - Remove OutdoorGames from the sync catalogue
This commit is contained in:
1 parent
b776bacd70
commit
e8cb7c6c68
1 file changed
+33
-2
@@ -1,6 +1,8 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$SourceRepository,
|
||||
[string[]]$Consumers,
|
||||
[string]$ConsumersFile,
|
||||
[switch]$Force,
|
||||
[switch]$Commit,
|
||||
[switch]$Push
|
||||
@@ -45,7 +47,6 @@ $consumerProjects = @(
|
||||
New-ConsumerProject 'Original/InfiniteVideo'
|
||||
New-ConsumerProject 'Fork/MegaBasterd'
|
||||
New-ConsumerProject 'Fork/HordeWorker'
|
||||
New-ConsumerProject 'Original/OutdoorGames'
|
||||
New-ConsumerProject 'Original/KioskDisplay'
|
||||
New-ConsumerProject 'Original/CraftStudio'
|
||||
New-ConsumerProject 'Original/MediaViewer'
|
||||
@@ -57,6 +58,36 @@ $consumerProjects = @(
|
||||
New-ConsumerProject 'Core/OmniLogger'
|
||||
)
|
||||
|
||||
# Targets are chosen per run. Without -Consumers or -ConsumersFile every
|
||||
# catalogue entry is synchronized. The file is the one AutoCode exports from its
|
||||
# Shared sync panel: {"consumers": ["Original/MediaDesktop", ...]}. OutdoorGames
|
||||
# is not in the catalogue because it runs without the shared packages.
|
||||
if ($Consumers -and $ConsumersFile) {
|
||||
throw 'Pass either -Consumers or -ConsumersFile, not both.'
|
||||
}
|
||||
|
||||
$requestedConsumers = $Consumers
|
||||
if ($ConsumersFile) {
|
||||
$targetFile = Get-Content -LiteralPath $ConsumersFile -Raw | ConvertFrom-Json
|
||||
if ($null -eq $targetFile.consumers) {
|
||||
throw "'$ConsumersFile' has no 'consumers' array."
|
||||
}
|
||||
$requestedConsumers = @($targetFile.consumers)
|
||||
}
|
||||
|
||||
$selectedConsumers = $consumerProjects
|
||||
if ($null -ne $requestedConsumers) {
|
||||
$catalogPaths = @($consumerProjects | ForEach-Object { $_.Path })
|
||||
$unknownConsumers = @($requestedConsumers | Where-Object { $catalogPaths -notcontains $_ })
|
||||
if ($unknownConsumers.Count -gt 0) {
|
||||
throw "Unknown consumer(s): $($unknownConsumers -join ', '). Choose from: $($catalogPaths -join ', ')."
|
||||
}
|
||||
$selectedConsumers = @($consumerProjects | Where-Object { $requestedConsumers -contains $_.Path })
|
||||
if ($selectedConsumers.Count -eq 0) {
|
||||
throw 'No consumers selected; nothing to synchronize.'
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-GitText {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
@@ -247,7 +278,7 @@ Write-Host "Synchronizing $($sourceFiles.Count) tracked shared files from $sourc
|
||||
|
||||
$failures = New-Object 'System.Collections.Generic.List[string]'
|
||||
|
||||
foreach ($consumerProject in $consumerProjects) {
|
||||
foreach ($consumerProject in $selectedConsumers) {
|
||||
$relativeProject = $consumerProject.Path
|
||||
$destination = $consumerProject.Destination
|
||||
$projectRoot = Join-Path $workspaceRoot ($relativeProject -replace '/', '\')
|
||||
|
||||
Reference in new issue
Block a user