Skip to content

Add net10 Solution.g codegen console + toggle (Lever 1, dogfooded)#15

Closed
ChrisonSimtian wants to merge 9 commits into
mainfrom
build/free-sourcegenerators-cone
Closed

Add net10 Solution.g codegen console + toggle (Lever 1, dogfooded)#15
ChrisonSimtian wants to merge 9 commits into
mainfrom
build/free-sourcegenerators-cone

Conversation

@ChrisonSimtian

@ChrisonSimtian ChrisonSimtian commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Lever 1 of the framework-modernization work (Fallout-build#441): a net10 pre-build codegen path for the strongly-typed [Solution] accessor, so the in-compiler Roslyn generator can eventually shed its Solution/Persistence/Utilities/Globbing cone (which forces those to netstandard2.0).

Standalone, non-breaking, independent of the de-static stack (#9#14). Intended for upstream once the remaining packaging lands; on the fork while in progress.

What's here (built, dogfooded, verified)

  • src/shared/SolutionEmitter.cs — Scriban emit logic extracted into one shared source file, linked into both the generator and the console → byte-identical output, no parity drift.
  • StronglyTypedSolutionGenerator — refactored onto the shared emitter; self-suppresses when FalloutSolutionCodegenMode == Build (read via CompilerVisibleProperty). Otherwise unchanged → stays the live in-IDE fallback.
  • src/Fallout.Solution.Codegen (net10 console) — discovers [Solution(GenerateProjects=true)] by syntactic parse (no pre-build compilation), reads the solution with the real Fallout.Persistence.Solution parser, emits via the shared emitter.
  • Fallout.Solution.Codegen.targets — reusable pre-build target (FalloutSolutionCodegenProject for in-repo, or a published FalloutSolutionCodegenAssembly for packaged consumers) + the toggle plumbing.
  • build/_build.csproj — dogfoods the console path (Mode=Build). Verified: target runs the console → Solution.g.cs from fallout.slnx → generator suppresses → _build compiles (0 errors). Full fallout.slnx build green.

Non-breaking

The default is unchanged for everyone else — the generator runs unless a project explicitly opts into Build. Only the dogfood build is switched. Consumers are untouched.

Remaining follow-ups (out of scope here)

🤖 Generated with Claude Code

ChrisonSimtian and others added 6 commits June 29, 2026 13:47
Host.Default scans every public subclass of Host and asserted each defines a
static IsRunning{Name} property. The Nuke.* transition shim emits
Nuke.Common.Host (a public subclass with no IsRunningHost), so detection threw
inside FalloutBuild's static constructor — aborting *any* build that merely
referenced the shim, before a single target ran.

Treat a subclass that doesn't follow the convention as not-running instead of
throwing. Adds a runtime regression test in Nuke.Common.Shim.Tests (the existing
shim tests are compile-only, which is why this slipped through).

Surfaced by the new fallout.canary acceptance suite (Fallout-build/Fallout.Canary#3).
Convert the new HostDetectionTests to the repo's FluentAssertions convention
(per review nitpick) and add a note to docs/dependencies.md explaining why we
pin FluentAssertions 8.x: it's covered by the free Xceed Community License as
an OSS, test-only dependency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Create PRs as draft by default (issue-and-pr-style.md)
- Test naming follows AV1600 behavior-focused style (conventions.md)
- Test files/classes use Specs suffix (conventions.md)
- Revert AGENTS.md to remove overly broad rules; keep canonical brief

Closes Fallout-build#438
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ld#387)

GitHubActionsJob.Write emitted runs-on: {Image.GetValue()} unconditionally,
so a workflow could only target the fixed GitHubActionsImage enum. Self-hosted
runner pools are selected by a label array (runs-on: [self-hosted, linux, x64])
which was impossible to produce.

Add an additive string[] RunsOnLabels to GitHubActionsAttribute, plumb it
through GetJobs onto GitHubActionsJob, and branch in Write: non-empty emits the
array form via JoinCommaSpace(), otherwise the existing scalar path is unchanged.
RunsOnLabels defaults empty, so existing usages generate byte-for-byte identical
YAML. Validated at configuration-generation time: it requires exactly one image
(a multi-image matrix is ambiguous) and rejects null/empty/whitespace entries
that would emit malformed YAML.

Covered by a runs-on-labels Verify snapshot and GitHubActionsRunsOnLabelsValidationTest.
@ChrisonSimtian ChrisonSimtian added the target/2026 Releases on the 2026 calendar line label Jun 29, 2026
@ChrisonSimtian ChrisonSimtian marked this pull request as ready for review June 29, 2026 11:07
@ChrisonSimtian ChrisonSimtian changed the title Free the SourceGenerators cone: net10 Solution.g codegen + shared emitter (Lever 1) Add net10 Solution.g codegen console + toggle (Lever 1, dogfooded) Jun 29, 2026
ChrisonSimtian and others added 3 commits June 29, 2026 23:12
First half of freeing the Fallout.SourceGenerators dependency cone (issue
Fallout-build#441, Lever 1): introduce a net10 pre-build codegen path for the
strongly-typed [Solution] accessor as the future default, with the in-compiler
generator retained as the toggle fallback.

- src/shared/SolutionEmitter.cs: the Scriban emit logic extracted out of
  StronglyTypedSolutionGenerator into a single shared source file, linked into
  BOTH the generator and the new console so they emit byte-identical Solution.g.cs.
- StronglyTypedSolutionGenerator: refactored to call SolutionEmitter (behaviour
  unchanged — still the in-IDE/live fallback).
- src/Fallout.Solution.Codegen: net10 console that discovers
  [Solution(GenerateProjects = true)] members by parsing the build project's .cs
  syntactically (no compilation available pre-build), reads the solution with the
  real Fallout.Persistence.Solution parser (no parsing-parity risk), and emits via
  the shared emitter. Verified end-to-end against this repo's own build/Build.cs +
  fallout.slnx — output matches the generator.
- AssemblyInfo: IVT for the console (it uses Build.Shared's internal Constants).

Remaining (next commits on this branch): the packaged pre-build MSBuild target +
FalloutSolutionCodegenMode toggle (default = console; suppress the generator in
console mode), dogfood-build wiring, and — as the deliberate follow-up — dropping
the now-removable cone refs from Fallout.SourceGenerators once the fallback is
retired/cone-freed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…1, steps 1-2)

- StronglyTypedSolutionGenerator self-suppresses when FalloutSolutionCodegenMode == Build
  (reads it via CompilerVisibleProperty), so exactly one path emits.
- src/Fallout.Solution.Codegen/build/Fallout.Solution.Codegen.targets: reusable pre-build
  target that runs the console (via FalloutSolutionCodegenProject or a published
  FalloutSolutionCodegenAssembly), writes <Member>.g.cs into obj/, and includes it. Exposes
  the toggle to the fallback generator.
- build/_build.csproj: dogfoods the console path (FalloutSolutionCodegenMode=Build). Verified:
  the target runs the console, emits Solution.g.cs from fallout.slnx, the generator suppresses,
  and _build compiles (0 errors). Full fallout.slnx build green.

Default is unchanged for everyone else (generator runs unless a project opts into Build), so
this is non-breaking. Remaining follow-ups: ship the console + targets in the consumer package
and flip the default to Build, then drop the now-removable cone refs from Fallout.SourceGenerators.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…allout.Solution.Codegen project

The generator's output for fallout.slnx now includes the new Fallout.Solution.Codegen
project; the only snapshot change is that one accessor line (confirming the shared-emitter
refactor preserved output). BOM stripped to match the repo's no-BOM verified convention.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisonSimtian ChrisonSimtian force-pushed the build/free-sourcegenerators-cone branch from b35a7fd to 9567f9a Compare June 29, 2026 11:17
@ChrisonSimtian

Copy link
Copy Markdown
Owner Author

Superseded by the upstream PR Fallout-build#442 — same branch (build/free-sourcegenerators-cone), rebased onto current upstream main (incl. the .Specs rename) and raised straight against upstream to land it sooner. Closing this fork-targeted one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target/2026 Releases on the 2026 calendar line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants