feat(SourceGenerator): Scaffold + [<ArguGenerate>] marker attribute#318
Conversation
There was a problem hiding this comment.
Pull request overview
This PR scaffolds a new companion package (Argu.SourceGenerator) that introduces an [<ArguGenerate>] marker attribute to create an opt-in seam for a future compile-time schema generator, and adds a sample that demonstrates the intended usage pattern.
Changes:
- Adds new
src/Argu.SourceGeneratorproject (netstandard2.0) publishing the[<ArguGenerate>]marker attribute plus package README. - Adds new
samples/Argu.Samples.SourceGeneratedsample showing annotation and current reflection-based parsing flow. - Registers both projects in
Argu.sln.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Argu.SourceGenerator/README.md | Documents motivation, status, and roadmap for the planned generator. |
| src/Argu.SourceGenerator/AttributeMarkers.fs | Introduces the [<ArguGenerate>] marker attribute type. |
| src/Argu.SourceGenerator/Argu.SourceGenerator.fsproj | Adds the new packable library project and packaging configuration. |
| samples/Argu.Samples.SourceGenerated/Program.fs | Adds a sample CLI template annotated with [<ArguGenerate>]. |
| samples/Argu.Samples.SourceGenerated/Argu.Samples.SourceGenerated.fsproj | Adds the new sample project referencing Argu + the marker package. |
| Argu.sln | Includes the new library and sample in the solution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
69f7875 to
93f0a26
Compare
There was a problem hiding this comment.
Approved in principle - ideally any forward looking statements like 'planned' get trimmed (see copilot comments) and we merge this just before the impl arrives.
(Main concern being not to merge something that nobody on the planet will end up using if anything changes)
|
@bartelink @nojaf — packaging hygiene cleanup pushed (ad7c6fc) to address Copilot's review:
Pack succeeds with no warnings. CI green. Ready for review whenever convenient — this PR is just the marker scaffold; the generator itself is deliberately out of scope and there's no behaviour change to the core library. |
|
@bartelink — doc comment reworked per your note (cc8b9b5):
I've kept this PR marker-only as before. On your "do the generator in one shot" offer — happy to, once you accept the marker first and bring the generator as its own PR so the scaffold isn't held up behind a much larger change. If you'd prefer them together, say so and I'll fold it in. Otherwise this is ready for merge whenever you're happy. |
* New project src/Argu.SourceGenerator (netstandard2.0): publishes the [<ArguGenerate>] marker attribute. Today the marker is inert; a follow-up release will ship the actual generator that consumes it to emit a compile-time-built schema (bypassing Argu's reflection path). README.md documents the planned design and roadmap. * New sample samples/Argu.Samples.SourceGenerated: shows the opt-in shape. The sample currently runs through Argu's standard reflection path; once the generator lands, the same SampleArgs annotated with [<ArguGenerate>] will use the generated factory automatically. * Argu.sln: register both new projects. The sample is nested under the existing 'samples' folder; the SourceGenerator library is a sibling of Argu. Strictly additive. No change to the core Argu package's public surface, behaviour, or dependency graph. # Conflicts: # Argu.slnx
- AttributeMarkers.fs: drop "(shipped separately)" wording, which was inconsistent with the <remarks> noting the generator is intentionally out of scope for this release. - Argu.SourceGenerator.fsproj: - Set <PackageReadmeFile>README.md</PackageReadmeFile> so NuGet clients render the README as the package readme. - Add <PackageReference Include="DotNet.ReproducibleBuilds" PrivateAssets="All" /> to match the core Argu package and produce reproducible nupkg metadata. - Change PackagePath="\" to "" for the README pack item to match the existing pattern in src/Argu/Argu.fsproj.
Addresses review feedback on the AttributeMarkers.fs doc comment: - <summary> now states the attribute's purpose in final form (no "planned" / "future" wording), terse, and calls out the key consideration a user must account for: the union and its Argu attributes must be statically resolvable, since the generator reads the type at compile time. - <remarks> carries the caveat that the generator does not exist yet and that the marker can be applied now for a no-source-change benefit later. - README intro reworded into plainer English describing what the package does now versus later.
cc8b9b5 to
a6194f4
Compare
|
(merging shortly) |
c614188 to
30c1e6b
Compare
|
Thanks for the cleanups & follow-up! |
feat(SourceGenerator): Scaffold + [] marker attribute
[] marker attribute. Today the marker is inert; a
follow-up release will ship the actual generator that consumes it to
emit a compile-time-built schema (bypassing Argu's reflection path).
README.md documents the planned design and roadmap.
shape. The sample currently runs through Argu's standard reflection
path; once the generator lands, the same SampleArgs annotated with
[] will use the generated factory automatically.
existing 'samples' folder; the SourceGenerator library is a sibling
of Argu.
Strictly additive. No change to the core Argu package's public surface,
behaviour, or dependency graph.