Add Buildvana.Core.Versioning shared library (Versioning Phase 4)#292
Add Buildvana.Core.Versioning shared library (Versioning Phase 4)#292rdeago wants to merge 1 commit into
Conversation
Move VersionSpec and VersionSpecChange from Buildvana.Tool into a new host-agnostic Buildvana.Core.Versioning library (depending only on NuGet.Versioning and CommunityToolkit.Diagnostics). The Tool now references the library; no behavior change. Add VersionFileData, an immutable model of current-version.json with a strict parser, and VersionCalculator, which computes the semantic version from version-file data, git height, branch name, public-release branch patterns, and a prerelease tag. CalculatedVersion carries the result. The library is unit-tested but not yet wired into the live tool path: bv still computes versions via nbgv until Phase 5. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@claude please review this PR. |
|
Claude finished @rdeago's task in 3m 12s —— View job PR Review
|

Closes #271. Part of #267.
Summary
Stands up a new host-agnostic
Buildvana.Core.Versioninglibrary holding the pure version logic that native versioning (Phases 5–6) will build on. The library is added and unit-tested but not yet wired into the live version-computation path —bvstill computes versions vianbgv, so there is no behavior change in this phase.Changes
src/Buildvana.Core.Versioning/($(StandardTfm); depends only onNuGet.Versioning+CommunityToolkit.Diagnostics):VersionSpecandVersionSpecChangemoved verbatim fromBuildvana.Tool(recorded as renames; namespace →Buildvana.Core.Versioning, madepublic).VersionFileData— immutable model ofcurrent-version.json({ major, minor, prerelease }) with a strictParse(string)rejecting malformed input (FormatException). Parse-only; "fail loudly if the file is absent" is documented as a caller contract.VersionCalculator.Compute(...)— buildsM.m.{height}[-tag]from version-file data + git height + branch;IsPublicRelease= branch matches any public-release pattern.CalculatedVersion— result record (SemanticVersion,CurrentStr,IsPublicRelease,IsPrerelease).Buildvana.Toolreferences the new library;usings updated where the two types moved. No logic change.tests/Buildvana.Core.Versioning.Tests/(TUnit, 24 tests): version-string construction, regex matching (empty list, detached HEAD),current-version.jsonparsing (valid/malformed), plusVersionSpec(previously untested).Notes / decisions
Buildvana.Core.Versioning(Core-tier convention) rather than the issue'sBuildvana.Versioning.VersionSpecChangemoved alongsideVersionSpec(ApplyChangedepends on it).Computetakes pre-compiledIReadOnlyList<Regex>; callers own compilation/timeout/error-translation (mirrorsReleaseSettings).VersionFileDatawith an emptyprereleaseTagthrows, so a prerelease can't silently degrade to a stable version.Acceptance criteria
VersionSpecno longer exists underBuildvana.Tool.VersionCalculatorandVersionFileDatapass.bvbehavior unchanged (NBGV still in use).Verification
dotnet bv pack→ success (Release artifacts produced).dotnet build -c Release→ 0 warnings / 0 errors.inspectcode --severity=WARNING→ 0 results.🤖 Generated with Claude Code