Consume the extracted source-generator toolkit from its package - #207
Conversation
…kage [minor] CodeGen/ and the test harness moved to ktsu-dev/SourceGeneratorToolkit and ship as ktsu.SourceGeneratorToolkit and ktsu.SourceGeneratorToolkit.Testing. This is the repoint: the four CodeGen/ files and Semantics.Test/Quantities/ GeneratorHarness.cs are deleted, the package references added, and the usings pointed at the new namespaces. Semantics.SourceGenerators is now Models/, Metadata/, Generators/ and the Semantics-specific bindings — SemanticsGenerator, SemanticsDiagnostics and the half of Emit that is about physics rather than C#. That was #181's definition of done. The seam is unchanged and deliberate. SemanticsGenerator<T> and SemanticsMultiFileGenerator still bind this repository's diagnostic catalogue and file header onto the package's GeneratorBase in one place, which is what keeps the package free of anything specific to this repository. Generated output under Semantics.Quantities/Generated/ is byte-identical, so verify-generated stays green and the alias props need no regeneration. Closes #192. Closes #181. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RJU8zt8qf83C9mznh5ZhRd
CI is red on the expected blocker, not on this changeTwo checks failed on Nothing compiled, so neither check reached the code this PR changes. Why it isn't this PR's to fix. The packages don't exist on nuget.org yet. The pipeline that publishes them is still running on The change itself is validated. Built and tested locally against the packed Not re-running yet. A re-run now would fail identically. I'm holding it until the package publishes, then re-running and correcting the pinned version here if the release pipeline computes something other than One thing I can't do myself: if I'm watching this PR and will drive it to green once the package is up. Generated by Claude Code |
|
Green — the blocker above is resolvedBoth packages published at 1.0.0 (
Ready to merge. Merging closes #192 and #181, which completes the epic. Generated by Claude Code |



Closes #192. Closes #181.
What this does
CodeGen/and the test harness moved to ktsu-dev/SourceGeneratorToolkit and ship as two packages, both published at 1.0.0:ktsu.SourceGeneratorToolkitktsu.SourceGeneratorToolkit.TestingThis is the repoint:
Semantics.SourceGenerators/CodeGen/(GeneratorBase.cs,MetadataFile.cs,DiagnosticCatalog.cs,CSharpKeywords.cs) andSemantics.Test/Quantities/GeneratorHarness.cs.ktsu.SourceGeneratorToolkittoSemantics.SourceGenerators(PrivateAssets="all" GeneratePathProperty="true", so it bundles alongside the generator the wayktsu.CodeBlockerdoes), and both packages toSemantics.Test.Semantics.SourceGenerators.CodeGen→ktsu.SourceGeneratorToolkit, harness →ktsu.SourceGeneratorToolkit.Testing.Emit.csnow referencesCSharpKeywordsfrom the package rather than through the old nested namespace.CLAUDE.mdto describe where the base classes come from now.Semantics.SourceGeneratorsis nowModels/,Metadata/,Generators/and the Semantics-specific bindings —SemanticsGenerator,SemanticsDiagnostics, and the half ofEmitthat is about physics rather than C#. That was #181's definition of done.One deviation from the plan recorded on #192
The issue said
GeneratorHarnessships in the package. It ships, but as a second package,ktsu.SourceGeneratorToolkit.Testing, rather than inside the analyzer one.The harness reads metadata off disk, which RS1035 bans for code that runs in an analyzer host. Putting it in the main package would have meant suppressing RS1035 project-wide there, and losing that guard for
GeneratorBaseandMetadataFile— which genuinely do run inside the compiler. Splitting keepsEnforceExtendedAnalyzerRuleson where it matters, and a consumer testing their own generator still gets the harness, which was the point of shipping it at all.The dependency split is as #192 specified: Roslyn and
System.Collections.ImmutablearePrivateAssets="all";ktsu.CodeBlockerandSystem.Text.Jsonflow to consumers. Verified against the built.nuspec.The seam is unchanged
SemanticsGenerator<T>andSemanticsMultiFileGeneratorstill bind this repository's diagnostic catalogue and file header onto the package'sGeneratorBasein one place. That is what keeps the package free of anything specific to this repository, and it should stay.Validation
Verified against the live nuget.org feed, with the locally-packed copy purged from the NuGet cache first so nothing could resolve from it:
Semantics.Quantities/Generated/is byte-identical — confirmed green byVerify Generated Filesin CI, and the alias props need no regeneration..sonarlint/sonar-local.props) report 5 findings, all pre-existing in files this change does not touch (TextValidationAttributesTests.cs,Paths/DirectoryNameTests.cs).Earlier CI failures on this head (resolved)
The first runs failed with
NU1101on both toolkit packages — they had not published yet, so nothing compiled. That is fixed; the re-runs restore from nuget.org normally. No code on this branch changed between those failures and the re-runs.🤖 Generated with Claude Code
https://claude.ai/code/session_01RJU8zt8qf83C9mznh5ZhRd
Generated by Claude Code