Skip to content

Versioning Phase 6 — restore the dormant ThisAssemblyClass SDK module and source generator #295

@rdeago

Description

@rdeago

Sub-issue of #267. Independent of Phases 4 (#293) and 5 (#294); prerequisite for Phase 7 (the NBGV swap), which turns this on and feeds it the version values. Lands dormant (off by default) so it carries no behavior risk and does not collide with NBGV's own ThisAssembly.

Scope

  • Restore the ThisAssemblyClass SDK module (removed in PR Replace code generation tasks with source generators #158, last present at v1.0.0-alpha.20) as src/Buildvana.Sdk/Modules/ThisAssemblyClass/Module.targets, recovered from the pre-removal state and registered in the SDK's module imports. Off by default: GenerateThisAssemblyClass defaults false; the EnableDefaultThisAssemblyConstants knob is preserved.
  • Restore + refactor the ThisAssembly class source generator into Buildvana.Sdk.SourceGenerators, modernized to the current incremental-generator style and reusing the constant-value parsing already shared with AdditionalAssemblyInfoGenerator / AdditionalAssemblyInfoValues (the type:value syntax in docs/ConstantsSyntax.md) — no parallel parser. Preserve CompilerGenerated + ExcludeFromCodeCoverage on the generated class. C# only: VB support is not restored; BVW1900 is emitted on any non-C# language.
  • No version coupling yet: the generator emits only user-declared ThisAssemblyConstants (plus existing defaults); wiring version values in is Phase 7. The AdditionalAssemblyInfo module (literal assembly attributes) is untouched — only the ThisAssembly class feature returns.
  • Dormant / no conflict: with GenerateThisAssemblyClass off by default, no project — including this repo, still built by the NBGV-based published SDK — generates a Buildvana ThisAssembly, so there is no collision with NBGV's.
  • Docs: docs/ConstantsSyntax.md already documents the feature; refresh to reflect C#-only support (and any restored-surface differences).

Acceptance criteria

  • A C# project opting in with GenerateThisAssemblyClass=true and ThisAssemblyConstant items gets a correct generated ThisAssembly class, with the documented value-parsing and the CompilerGenerated/ExcludeFromCodeCoverage attributes; default-off projects generate nothing.
  • BVW1900 is emitted for non-C# languages (including VB); default constants honor EnableDefaultThisAssemblyConstants.
  • NBGV remains in use and unaffected; dotnet bv build self-hosts with the generator off.
  • Generator unit tests pass in CI.
  • CHANGELOG: Unreleased "Added" entry — the ThisAssemblyClass module / GenerateThisAssemblyClass is reintroduced (default off, C# only); additive, not breaking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement[issue/PR] requests / implements new or improved functionality.refactor[issue/PR] requests / implements a refactor of existing code without affecting functionality.
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions