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:
Gabriel20xx committed 2026-10-27 14:20:32 +00:00
1 parent b776bacd70
commit e8cb7c6c68
1 file changed
+33 -2
+33 -2
View File
@@ -1,6 +1,8 @@
[CmdletBinding()] [CmdletBinding()]
param( param(
[string]$SourceRepository, [string]$SourceRepository,
[string[]]$Consumers,
[string]$ConsumersFile,
[switch]$Force, [switch]$Force,
[switch]$Commit, [switch]$Commit,
[switch]$Push [switch]$Push
@@ -45,7 +47,6 @@ $consumerProjects = @(
New-ConsumerProject 'Original/InfiniteVideo' New-ConsumerProject 'Original/InfiniteVideo'
New-ConsumerProject 'Fork/MegaBasterd' New-ConsumerProject 'Fork/MegaBasterd'
New-ConsumerProject 'Fork/HordeWorker' New-ConsumerProject 'Fork/HordeWorker'
New-ConsumerProject 'Original/OutdoorGames'
New-ConsumerProject 'Original/KioskDisplay' New-ConsumerProject 'Original/KioskDisplay'
New-ConsumerProject 'Original/CraftStudio' New-ConsumerProject 'Original/CraftStudio'
New-ConsumerProject 'Original/MediaViewer' New-ConsumerProject 'Original/MediaViewer'
@@ -57,6 +58,36 @@ $consumerProjects = @(
New-ConsumerProject 'Core/OmniLogger' 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 { function Invoke-GitText {
param( param(
[Parameter(Mandatory = $true)] [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]' $failures = New-Object 'System.Collections.Generic.List[string]'
foreach ($consumerProject in $consumerProjects) { foreach ($consumerProject in $selectedConsumers) {
$relativeProject = $consumerProject.Path $relativeProject = $consumerProject.Path
$destination = $consumerProject.Destination $destination = $consumerProject.Destination
$projectRoot = Join-Path $workspaceRoot ($relativeProject -replace '/', '\') $projectRoot = Join-Path $workspaceRoot ($relativeProject -replace '/', '\')