From e8cb7c6c684578141980b6d61242a7bd69a88297 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 27 Oct 2026 14:20:32 +0000 Subject: [PATCH] feat: support selective shared consumer sync - Accept consumer paths or an AutoCode JSON selection file - Remove OutdoorGames from the sync catalogue --- scripts/sync-consumers.ps1 | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/scripts/sync-consumers.ps1 b/scripts/sync-consumers.ps1 index ea33efc..f2a6b9a 100644 --- a/scripts/sync-consumers.ps1 +++ b/scripts/sync-consumers.ps1 @@ -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 '/', '\')