Preserve target order in generated project (#1619)
* Implement targetOrdering option
* Preserve target order
* Fix json parsing
* Update CHANGELOG.md
* Read file once
* Update SpecFile.swift
* Extract multiplatform target name helper
* Simplify target sort with tuple comparison
* Carry target declaration order through spec resolution
The declaration order was computed from raw spec keys before
resolveProject, so it missed platform/name values inherited from
target templates, and keys containing ${VARIABLES} never matched
the expanded target dictionary — both cases silently fell back to
alphabetical order.
Instead of pre-computing final names, stamp each raw target with a
__declarationIndex before resolution. The index rides through the
variable, template, rename and multiplatform transformations along
with the rest of the target dictionary, and is read back off the
resolved targets (keyed by resolved name) to sort them. Declaration
keys are expanded with the same variables as the dictionary keys so
${VAR} target names stay in the order map.
Order extraction no longer throws: a spec whose contents can't be
re-parsed for ordering just falls back to alphabetical instead of
failing generation.
Adds regression tests for a template-supplied platform array, a
template-supplied name, and an environment-expanded target key. M
mirkokg committed
42f9f76516e66bf0674cec7279c0c5fa6618c02b
Parent: 20bd16d
Committed by GitHub <noreply@github.com>
on 7/16/2026, 5:42:42 AM