Follow-up to #47 / PR that ships the Nuke.Common MVP shim.
Current state
src/Shims/Nuke.Common/ ships a hand-written shim covering the entry-point surface: NukeBuild, INukeBuild, [Parameter], [Secret], [Solution], [GitRepository]. That's enough for a class Build : NukeBuild { ... } declaration to compile against the shim.
Gap
Hand-written shims don't scale. Fallout.Common alone has 158 public types. Add Fallout.Build, Fallout.Components, Fallout.Tooling, ProjectModel, SolutionModel, Utilities (and sub-packages) — easily 500+ public types across all shim packages. Each needs:
| C# construct |
Shim mechanism |
| Class |
Public subclass with constructors mirrored |
| Sealed class |
Wrapper with member-by-member delegation |
| Interface |
Sub-interface |
| Abstract class |
Public subclass (stays abstract) |
| Enum |
Cannot be subclassed — needs a using = alias documentation, or skip |
| Delegate |
Cannot be implicitly converted across types — skip |
| Static helper class |
Static wrapper with method-by-method delegation |
| Attribute |
Subclass with constructor pass-through |
| Generic class/method |
Pass through type parameters / constraints |
Design
A Roslyn source generator referenced from each shim project. The generator:
- Reads
[assembly: ShimAllPublicTypesFrom("Fallout.Common")] marker (or similar).
- Finds the canonical referenced assembly in the compilation's references.
- Walks every public type via
INamespaceSymbol/INamedTypeSymbol.
- For each, emits source for the appropriate shim mechanism above into a generated
.cs file in the shim project.
- Skips types it can't bridge (enums, delegates) — logs them and emits build warnings so we know what consumers are still locked out of.
Out of scope (deliberately)
- Bridging delegates —
fallout-migrate handles that
- Bridging enums —
fallout-migrate handles that
Why hand-written shipped first
- Source generator is non-trivial (~500 LOC of generator code + tests)
- A hand-written MVP gave Chris's other Fallout-consuming project something to test today
- Architecture (subclass-based) is the same in both — only the generation method differs
Done when
Follow-up to #47 / PR that ships the Nuke.Common MVP shim.
Current state
src/Shims/Nuke.Common/ships a hand-written shim covering the entry-point surface:NukeBuild,INukeBuild,[Parameter],[Secret],[Solution],[GitRepository]. That's enough for aclass Build : NukeBuild { ... }declaration to compile against the shim.Gap
Hand-written shims don't scale. Fallout.Common alone has 158 public types. Add Fallout.Build, Fallout.Components, Fallout.Tooling, ProjectModel, SolutionModel, Utilities (and sub-packages) — easily 500+ public types across all shim packages. Each needs:
using =alias documentation, or skipDesign
A Roslyn source generator referenced from each shim project. The generator:
[assembly: ShimAllPublicTypesFrom("Fallout.Common")]marker (or similar).INamespaceSymbol/INamedTypeSymbol..csfile in the shim project.Out of scope (deliberately)
fallout-migratehandles thatfallout-migratehandles thatWhy hand-written shipped first
Done when
Nuke.Common,Nuke.Build,Nuke.Components, etc.)tests/Nuke.Common.Shim.Tests/SampleConsumerBuild.csexpanded to exercise the full surface a typical consumer touches and still compiles