Skip to content

Refactor Update Dependencies project to facilitate adding additional commands - #6378

Merged
lbussell merged 7 commits into
dotnet:nightlyfrom
lbussell:update-deps-refactor
Apr 17, 2025
Merged

lbussell merged 7 commits into
dotnet:nightlyfrom
lbussell:update-deps-refactor

Conversation

@lbussell

@lbussell lbussell commented Apr 16, 2025 •

Copy link
Copy Markdown
Member

Motivation

  • Update-dependencies tool relies too heavily on Set-DotNetVersions.ps1 and Get-DropVersions.ps1 to construct the correct set of arguments for update operations. It is desirable to use .NET for this instead.
  • As part of Consume .NET 10 builds from VMR instead of dotnet/sdk #6363, we need to write/rewrite new logic to enable consuming builds from the VMR. The options were to write more PowerShell scripts or to refactor parts of this tool to enable consuming those VMR builds. Re-factoring this tool means we can easily use pre-existing .NET libraries written by the product construction team, so this is the preferred approach.
  • So ultimately, update-dependencies needs to provide a way to define additional entrypoints (new subcommand(s)) that can call into the existing update-dependencies logic.

Details

  • The old root command (update-dependencies) is now a sub-command called "specific"
    • Intended usage:
      • update-dependencies specific 10.0 --product-version foo=bar ...
    • Potential future usage:
      • update-dependencies from-channel 4567 https://github.com/dotnet/dotnet
      • update-dependencies from-builds 123456
      • update-dependencies from-builds 123456 133337 ...
      • ...We can just infer product versions and Dockerfile versions from the BAR builds
  • New sub-commands can instantiate SpecificCommand and call it using arguments, or use any of the other existing classes to facilitate updating versions, e.g. DockerfileShaUpdater.CreateUpdaters(...) ...

Other changes

  • System.CommandLine 2.0.0 Beta 5
    • No, this is not out yet, but presumably it will be soon. Once I learned there was a version 5, I didn't want to write new code in an older version. This project now references the dotnet-libraries nuget feed in order to get it.
    • Standard dependency injection setup which will allow services to be injected into individual command classes
    • Some boilerplate to handle command setup and registration
    • Use System.CommandLine.NamingConventionBinder to bind options to properties

Fixes #3899... sorta.

@lbussell
lbussell requested a review from a team as a code owner April 16, 2025 22:16
Comment thread eng/update-dependencies/BaseCommand.cs Resolved
Comment thread eng/update-dependencies/NuGet.config Resolved
lbussell and others added 2 commits April 17, 2025 07:44
Co-authored-by: Matt Thalman <mthalman@microsoft.com>
@lbussell
lbussell enabled auto-merge (squash) April 17, 2025 15:10
@lbussell
lbussell disabled auto-merge April 17, 2025 19:51
@lbussell
lbussell merged commit f8c90fd into dotnet:nightly Apr 17, 2025
lbussell added a commit to lbussell/dotnet-docker that referenced this pull request May 9, 2025
…commands (dotnet#6378)

Co-authored-by: Matt Thalman <mthalman@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants