[bv] Forward command-line arguments verbatim to dotnet#266
Conversation
Replaces the abandoned structured-MSBuild-bag / `/`-prefix design with a simpler forwarding model: `restore`/`build`/`test`/`pack` are marked `[ConsumeAllArguments]` and forward any extra arguments verbatim, in encounter order, to their underlying `dotnet` invocation(s), between bv's leading group (`-nologo`, `-v <verbosity>`, `--no-restore`/`--no-build`, overridable `Configuration` default) and trailing group (authoritative `ContinuousIntegrationBuild`). `-maxcpucount:1` is no longer forced. - Pre-parser splits globals (now incl. position-flexible `--main-branch`) from the subcommand and its forwarded args; `ForwardedArguments` stashes them for the command body. - `Configuration` moves from the deleted `BuildSettings` to `ReleaseSettings`; pipeline commands no longer parse `-c` (forwarded, bv emits `Release` as an overridable default). `release` keeps `-c`. - `GitService` reads `MainBranch` from the `GlobalOptions` singleton; `BuildSettingsHolder` is removed. `SelfReferenceUpdater` and the NuGet push step take the artifacts path computed by the release flow. - Help: `BvHelpProvider` drops the MSBuild-kinds machinery; root help marks forwarding commands and per-command help gains a FORWARDED ARGUMENTS section. - Removes `MSBuildProperties`, `MSBuildOptionKinds`, `AcceptsMSBuildOptionsAttribute`, `BuildSettings`, `BuildSettingsHolder`. Phase 3 of Tenacom#257 (Tenacom#260). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@claude please review this PR. |
|
Claude finished @rdeago's task in 3m 44s —— View job PR Review: Forward command-line arguments verbatim to dotnet
Overall this is a well-structured PR. The design is sound and the implementation is clean. I found one correctness concern, one brittleness, and a few minor observations. 1.
|
Replaces two disconnected, implicit assumptions about commands — the hardcoded name<->class list in Program.cs and the "RestoreCommand implements 'restore'" suffix-stripping in ConsumeAllArgumentsCommands — with a single declarative source of truth. - ImplementsCommandAttribute(string name, bool consumesAllArguments = false) on each command class declares its CLI name and forwarding behavior. - CommandRegistry discovers decorated classes by reflection and is the sole authority for registering them with Spectre (RegisterAll, via the generic IConfigurator.AddCommand) and answering ConsumesAllArguments for the pre-parser and BvHelpProvider. - Display/registration order comes from one readable array, PipelineCommandNames; non-pipeline commands (release) sort after, by name. Discovery fails fast if a listed pipeline command has no implementing class. - Removes ConsumeAllArgumentsAttribute and ConsumeAllArgumentsCommands. No behavior change: command order, forwarding, and help output are identical. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The pre-parser strips --main-branch before Spectre binds it, so settings.MainBranch is always null in command handlers; the effective value lives in GlobalOptions.MainBranch (read by GitService). Add a remark pointing readers there so nobody reads the settings property and wonders why it's null. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The nonGlobal.Contains("--help")/"-h" check relies on TryNormalizeHelp
having already canonicalized case-variants to lowercase upstream; add a
one-line comment so the assumption isn't silent.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The post-changelog build/test/pack block called DotNetService directly with an explicit empty forwarded-args array, while the pre-pipeline block went through BuildSteps. The direct calls are exactly the BuildSteps helpers, so route them through BuildSteps too: both blocks now read identically and forwarded args resolve to [] from the DI holder (release forwards nothing). Drops the now-unused solution local and its using. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Hey @claude 😜
Fixed.
Fixed by refactoring the association between command names and implementing classes using an
This will be fixed when we introduce a settings file, as
Good catch, worth a one-line comment before
Fair point. Fixed by using BuildSteps calls in both blocks. |
|
Claude finished @rdeago's task in 1m 43s —— View job Follow-up review
All five fixes are in and look correct. Summary: Issue 1 ( Issue 2 ( Issue 3 ( Issue 4 ( Issue 5 ( No further issues. The PR looks good to merge from my end. |
Closes #260 (Phase 3 of #257). With this merged, all three phases are complete.
Summary
bv restore,bv build,bv test, andbv packare now marked[ConsumeAllArguments]and forward any extra arguments verbatim, in encounter order, to their underlyingdotnetinvocation(s).bvno longer parses or validates them — malformed/unknown args now produce adotnet(or, fortest, a Microsoft.Testing.Platform) error instead of abvone. Previously only-p://p:properties were forwarded.dotnetinvocation is composed as: leading group (-nologo,-v <verbosity>,--no-restore/--no-buildwhere applicable, overridableConfigurationdefault) → user args → trailing group (authoritative-p:ContinuousIntegrationBuild=…).-maxcpucount:1is no longer forced; MSBuild uses its default parallelism unless the user forwards their own-m.--main-branchis promoted to a position-flexible global option (shown inGLOBAL OPTIONS, honored by the Git-touching commands).Configuration(-c/--configuration) moves from the deletedBuildSettingstoReleaseSettings. Pipeline commands no longer parse it (forwarded;bvemitsReleaseas an overridable default).releasekeeps it, since it needs the value to locate artifacts.[MSBuild: …]indicators are gone; root help marks the forwarding commands and per-command help gains aFORWARDED ARGUMENTSsection.MSBuildProperties,MSBuildOptionKinds,AcceptsMSBuildOptionsAttribute,BuildSettings,BuildSettingsHolder; addsConsumeAllArgumentsAttribute,ConsumeAllArgumentsCommands(a reflection map shared byProgram.MainandBvHelpProvider), and aForwardedArgumentsDI holder.Notable design decisions
Flagged here so reviewers don't have to dig (a few diverge from #260's written proposal):
dotnetinvocation #260's stated acceptance criteria).bvemits the default in the leading group as an MSBuild property (-p:Configuration=Release,--property:Configuration=Releasefortestsincedotnet testrejects-p:), so a forwarded-c Debug/-p:Configuration=Debugwins under MSBuild's last-wins. This relies ondotnetpreserving arg order to MSBuild — the same observed-not-documented last-wins reliance Overhaul thebvCLI command and option surface #257 already accepts.restoreemits noConfiguration, matching today's behavior (dotnet restorehas no-c).ContinuousIntegrationBuildis still emitted (trailing) for all four.dotnet testMTP probe stays minimal (dotnet msbuild <proj> -nologo -getProperty:IsTestingPlatformApplication) — it deliberately does not receive the forwarded args, which may be test-app flagsdotnet msbuildwould reject.--verbosityis always forwarded, sodotnet's build output now followsbv's verbosity (defaultnormal) instead ofdotnet's own default (minimal).GlobalOptionsis nowpublic(wasinternal) — the publicGitService/DotNetServicetake it as a constructor parameter (same reason the removedMSBuildPropertieswas public).Test plan
dotnet bv pack— 0 errors, 0 warnings; bothBuildvana.Sdkandbvpackages produced.dotnet dnx JetBrains.ReSharper.GlobalTools inspectcode --swea --severity=WARNING … Buildvana.slnx— 0 results.bv): root help (--main-branchin globals, forward annotations),bv build --help(FORWARDED ARGUMENTS section),bv release --help(keeps-c, no forwarding section),--version,--nologo --version, no-args help, unknown-command error, missing--v-value error.bv testforwarding path (--nologo/-v/--property:→dotnet test→ MTP). The repo has no test projects, so this path is implemented to spec but only compile-checked.