Version resolution: --pkg-version/--output-dir overrides and dynamic version tokens - #20
Merged
jordancalhoun merged 2 commits intoJul 26, 2026
Conversation
--pkg-version lets the version come from a git tag or CI variable instead
of the committed build-info; it is resolved before ${version} substitution
so it flows into the package name too. --output-dir writes the package to a
chosen directory (created if absent) instead of the project's build/ dir.
Both are threaded through PackageBuildOptions so the GUI can adopt them
without new plumbing. PackageConfiguration.withVersion applies the override
ahead of substitutingVersion; PackageProjectLayout takes an optional
output directory.
Tests: VersionOverrideTests (withVersion isolation; load applies the
override to version and ${version} in name; no override preserves
build-info). verify-loop.sh builds with --pkg-version + --output-dir and
asserts the artifact lands in the target dir with the overridden version
and not in build/.
Support ${TIMESTAMP} (yyyy.MM.dd.HHmm), ${DATE} (yyyy.MM.dd), and
${DATETIME} (yyyy.MM.dd.HHmmss) in the build-info version field, resolved
before ${version} substitution so the stamp flows into the package name.
Mirrors munki-pkg. Static versions are unaffected.
DynamicVersion.resolve takes an injectable clock so tests are deterministic;
resolvingDynamicVersion applies it at load time.
Tests: DynamicVersionTests (each token's format at a fixed date, embedded
token, static passthrough, and resolved version feeding ${version} in name).
verify-loop.sh builds a project versioned ${DATE} and asserts the package
filename matches the dated pattern.
Contributor
📝 WalkthroughWalkthroughChangesVersioned package builds
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLIOptions
participant PackageBuildOptions
participant PackageBuildCoordinator
participant BuildInfoStore
participant PackageProjectLayout
CLIOptions->>PackageBuildOptions: set pkgVersion and outputDir
PackageBuildOptions->>PackageBuildCoordinator: provide versionOverride and outputDirectory
PackageBuildCoordinator->>BuildInfoStore: load with versionOverride
PackageBuildCoordinator->>PackageProjectLayout: initialize with outputDirectory
PackageProjectLayout->>PackageProjectLayout: create intermediate build directories
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This was referenced Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two version-handling features that compose:
--pkg-version/--output-diroverrides — override the build-info version at build time, and write the artifact outside the project'sbuild/directory (leaving the project tree clean).${TIMESTAMP}/${DATE}/${DATETIME}in the build-info version before${version}name substitution, matching munki-pkg (YYYY.MM.DD.HHMM).The two compose cleanly: a
--pkg-versionoverride feeds the same dynamic-resolution → name-substitution pipeline.Tests:
VersionOverrideTests,DynamicVersionTests;verify-loop.shcovers both end to end; full suite green (24 tests).Part of a 9-PR series splitting a batch of features into small, themed, independently reviewable PRs. Each applies cleanly to
mainon its own; the ordering below only minimizes rebases as they land:Happy to squash, split, or reorder any of these to suit your review preferences.
Summary by CodeRabbit
New Features
--pkg-versionto override the package version during builds.--output-dirto choose where built packages are saved, creating missing directories automatically.Documentation
Tests