Allow darc update-dependencies to update specific VMR folders with target-directory#5340
Conversation
darc update-dependencies to update specific VMR folders with target-directory
There was a problem hiding this comment.
Pull Request Overview
This PR introduces enhancements to dependency update functionality, adding support for targeting specific directories (including simple globbing) and excluding assets per directory, along with related refactoring to modularize update logic and extend asset matching.
- Added per-directory dependency update workflow with optional glob expansion and root/path handling.
- Introduced asset exclusion with relative path-aware matching and refactored update logic into smaller helper methods.
- Extended APIs (IAssetMatcher, Local.UpdateDependenciesAsync) and added new command-line options (target-directory, excluded-assets).
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| AssetMatcher.cs | Added path-aware exclusion overload to matcher interface and implementation. |
| Local.cs | Extended UpdateDependenciesAsync to support relative base paths and adjusted eng/common file path rewriting. |
| UpdateDependenciesCommandLineOptions.cs | Added target-directory and excluded-assets options with help text. |
| UpdateDependenciesOperation.cs | Major refactor: directory-scoped update flow, asset exclusion integration, task reuse, and decomposition into helper methods. |
| string pathToReplaceWith; | ||
| if (relativeDependencyBasePath == UnixPath.Empty) | ||
| { | ||
| pathToReplaceWith = null; | ||
| } | ||
| else | ||
| { | ||
| pathToReplaceWith = relativeDependencyBasePath.ToString(); | ||
| } | ||
|
|
||
| engCommonFiles = engCommonFiles | ||
| .Select(f => new GitFile( | ||
| f.FilePath.Replace("src/arcade/", null), | ||
| f.FilePath.Replace(VmrInfo.ArcadeRepoDir, pathToReplaceWith, StringComparison.InvariantCultureIgnoreCase).TrimStart('/'), |
There was a problem hiding this comment.
pathToReplaceWith can be null, which will cause string.Replace to throw an ArgumentNullException. Use string.Empty instead of null when you intend to remove the prefix.
| if (nonCoherencyResult != Constants.SuccessCode) | ||
| { | ||
| _logger.LogError(" Failed to update non-coherent parent tied dependencies."); | ||
| return; |
There was a problem hiding this comment.
On failure this method logs and returns without propagating an error, allowing the caller to continue and potentially perform coherency updates on stale data. Consider throwing or returning a status so the caller can abort the directory update.
Co-authored-by: Copilot <[email protected]>
…eration.cs Co-authored-by: Copilot <[email protected]>
…ndLineOptions.cs Co-authored-by: Přemek Vysoký <[email protected]>
|
@dkurepa I'm seeing some issues with darc that look related to the changes in this PR: |
|
Thanks for catching this @ellahathaway. I made a regression in one of the commits and didn't test that code path with no excluded assets. Opened a PR to fix it #5347 |
#5221