You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Semantics.SourceGenerators had grown a general-purpose code-generation stack that has nothing to do with physical quantities. Roughly half of the project — the C# syntax template object model, the JSON-metadata-driven IIncrementalGenerator base, deterministic output handling, diagnostics plumbing, and the generator test harness — would work unchanged for any metadata-driven generator, but was only usable by this repository.
This epic tracks pulling that infrastructure out into shared packages and migrating Semantics.SourceGenerators onto them.
Status
Every task on the original list is merged. One piece of the goal remains, tracked as #192.
CodeGen/ is shaped for extraction — one-way dependency, nothing physics-specific, public where it needs to be — but it lives here, so a second project cannot use it without depending on ktsu.Semantics. It needs a home first:
(a) A new ktsu-dev/SourceGeneratorToolkit repo — recommended. Keeps the Roslyn dependency and analyzer-packaging rules out of CodeBlocker.
(b) A second package in the CodeBlocker repo — fewer repos, but couples CodeBlocker's release cadence to Roslyn's.
What changed, in short
The template model is a package, and it now emits valid C# for shapes it never handled: types close with } not };, bodies are re-indented to where they are spliced, accessors are data rather than callbacks compared by reference, and operators, generics, enums, interfaces and positional records are expressible at all.
Two generators — not one — had each reimplemented multi-file metadata loading around the base's single-file limit. Both now just declare the files they read.
Three silent failures became diagnostics: a swallowed JsonException on a second metadata file, a missing metadata file that produced no output and no explanation, and parse failures reported under a stray CONV001/SourceGenerator identity.
Generated output is written with LF, matching .gitattributes. The pass that rewrote it to CRLF was working from a premise that stopped being true at the LF migration in Unblock the build (header + LF migration) and fix 66 SonarCloud issues #157; git had been normalising the difference away on every commit since. verify-generated consequently runs on Linux now.
Whether ktsu.CodeBlocker should default to LF rather than Environment.NewLine — deferred from #81.
Definition of done
Semantics.SourceGenerators contains only Models/, Metadata/, and Generators/ with physics-specific emission logic; everything above comes from packages a second project could consume without taking a dependency on this repository.
Summary
Semantics.SourceGeneratorshad grown a general-purpose code-generation stack that has nothing to do with physical quantities. Roughly half of the project — the C# syntax template object model, the JSON-metadata-drivenIIncrementalGeneratorbase, deterministic output handling, diagnostics plumbing, and the generator test harness — would work unchanged for any metadata-driven generator, but was only usable by this repository.This epic tracks pulling that infrastructure out into shared packages and migrating
Semantics.SourceGeneratorsonto them.Status
Every task on the original list is merged. One piece of the goal remains, tracked as #192.
ktsu.CodeBlocker1.3.0Tasks
Layer 1 —
ktsu.CodeBlocker, no Roslyn dependency:TextWriterLayer 2 + cutover, here:
GeneratorBaseand JSON metadata loading, shaped for extraction inCodeGen/Emitsplit into generic C# fragments and Semantics-specific constantsGeneratedSourceretired; the terminator is pinned at constructionktsu.CodeBlocker.TemplatesCodeGen/into a shared toolkit packageWhat #192 still needs
CodeGen/is shaped for extraction — one-way dependency, nothing physics-specific, public where it needs to be — but it lives here, so a second project cannot use it without depending onktsu.Semantics. It needs a home first:ktsu-dev/SourceGeneratorToolkitrepo — recommended. Keeps the Roslyn dependency and analyzer-packaging rules out ofCodeBlocker.CodeBlockerrepo — fewer repos, but couples CodeBlocker's release cadence to Roslyn's.What changed, in short
}not};, bodies are re-indented to where they are spliced, accessors are data rather than callbacks compared by reference, and operators, generics, enums, interfaces and positional records are expressible at all.JsonExceptionon a second metadata file, a missing metadata file that produced no output and no explanation, and parse failures reported under a strayCONV001/SourceGeneratoridentity..gitattributes. The pass that rewrote it to CRLF was working from a premise that stopped being true at the LF migration in Unblock the build (header + LF migration) and fix 66 SonarCloud issues #157; git had been normalising the difference away on every commit since.verify-generatedconsequently runs on Linux now.Follow-ups found along the way
All now tracked:
Semantics.Pathstests fail on Linux;mainred since the matrix added it. Some may be real library bugs, not test assumptions.CustomAfterMicrosoftCommonPropsfixes that.ktsu.CodeBlockershould default to LF rather thanEnvironment.NewLine— deferred from #81.Definition of done
Semantics.SourceGeneratorscontains onlyModels/,Metadata/, andGenerators/with physics-specific emission logic; everything above comes from packages a second project could consume without taking a dependency on this repository.Layer 1 meets this. Layer 2 will once #192 lands.