Modernize to net8.0/net10.0 and ship as a native-AOT tool - #13
Merged
Merged
Conversation
…kaging CommandLineParser's reflection-based parsing is trimmed away under NativeAOT, so a published AOT build of the old CLI silently failed to recognize its own arguments. Porting to Nullean.Argh (source-generated, no reflection at parse time) unblocks AOT packaging the same way curb, assembly-differ, and nupkg-validator already ship it: one native-AOT package per RID plus a framework-dependent 'any' fallback, selected transparently by the root package's DotnetToolSettings.xml. Also bumps the pinned nupkg-validator and assembly-differ build tools to versions that can actually validate/diff net8.0+ output (the old pins predate those TFMs and either fail to load the assembly or mis-resolve its framework folder), and modernizes the CI workflow with an AOT pack matrix job. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
assembly-rewritertargetsnet8.0/net10.0, ships as a self-contained native-AOT executable on five platforms, and parses its CLI withNullean.Arghinstead ofCommandLineParser.Prompt summary: Modernize this repo's build tooling the way
curb,assembly-differ, andnupkg-validatoralready do — bump the stale target frameworks, move CLI parsing onto a source-generated parser, and package the tool as native-AOT dotnet tools per-RID with a framework-dependent fallback.Why
The project still targeted
netcoreapp3.0,netcoreapp3.1,net5.0, andnet6.0— all out of support.CommandLineParserparses arguments through reflection, which native AOT trims away, blocking the AOT packaging this PR adds. The pinned build tools,nupkg-validator0.5.0andassembly-differ0.14.0, predatenet8.0+output: the oldnupkg-validatorthrows loading this project's assembly for validation, and the oldassembly-differmis-resolves the dottednet8.0framework folder when diffing.What
CLI parsing
AssemblyRewriterCommand.csreplaces theCommandLineParserwiring inProgram.cswithNullean.Argh, registered viaMapAndRootAlias<AssemblyRewriterCommands>()with[DefaultCommand]so the original bare invocation (no subcommand) still works.Options.csdrops itsCommandLineParserattributes and becomes a plain data holder. Doc-comment-driven flag names and short aliases (-i/--in,-o/--out,-r/--resolvedir,-k/--keyfile,-m/--merge,-v/--verbose) only get picked up this way — a bare method-groupMap/MapRootdelegate silently ignores them, filed as nullean/argh#74.Target frameworks
assembly-rewriter.csprojmoves fromnetcoreapp3.0;netcoreapp3.1;net5.0;net6.0tonet8.0;net10.0.global.jsonandbuild/scripts/scripts.fsprojfollow suit, and<Nullable>enable</Nullable>is on for new code with aNoWarnlist covering the legacy code that predates nullable annotations.Native-AOT packaging
The project gains
linux-x64,linux-arm64,win-x64,win-arm64, andosx-arm64asRuntimeIdentifiers, plus a framework-dependentanyfallback, withPublishAot,PublishSelfContained, andStripSymbolsscoped to builds targeting a specific RID.Package staging, signing, and CI
generatePackagesstages a fulldotnet packand keeps only the root andanypackages, replacing the unsignedobj/copy of this project's own assembly thatdotnet packputs inside theanypackage with the correctly signedbin/one..github/workflows/ci.ymladds anaot-packmatrix job building each RID on a matching runner, ahead of abuildjob that downloads and merges the artifacts before packages get published.Build tool pins
dotnet-tools.jsonbumpsnupkg-validatorfrom0.5.0to0.10.1andassembly-differfrom0.14.0to0.16.0.Verify
./build.sh build generatepackages validatepackages generateapichanges -s true dotnet tool install --add-source build/output assembly-rewriter assembly-rewriter --in path/to/Some.dll --out path/to/Some.Rewritten.dll