-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Copy task SourceFolders #8843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy task SourceFolders #8843
Conversation
|
Can the build be re-run? Or is it necessary to push a new commit? Update: Pushed a new commit to address a TODO. The question remains. When the PR build fails for causes in the build infrastructure and not the repo, is there a way to re-run the build or request that the build be re-run? In the backing Azure Pipelines, I can only view. In the GitHub desktop client, there is a "Re-run Checks" button. Clicking the button for the dotnet/msbuild repo does nothing. |
This reverts commit c8db782.
You can write "/azp run" in the comment to the PR to re-run checks. |
|
Commenter does not have sufficient privileges for PR 8843 in repo dotnet/msbuild |
|
Yeah, only committers have permission for |
|
Is the new capability documented anywhere? I’d like to see a couple of examples. |
|
Feature is fully described in the issue with feature request: |
|
does the description in the issue match the actual implementation? I’m afraid documenting a feature in an issue is insufficient. Ideally if there’s existing documentation for the Copy task, we should augment that. |
|
Yes, I agree, documenting in an issue is insufficient, we should add this to https://learn.microsoft.com/en-us/visualstudio/msbuild/copy-task. |
Fixes #5881
Context
Implementation of proposed
ITaskItem[] SourceFoldersparameter.Changes Made
Within Copy.cs:
ITaskItem[] SourceFoldersparameterValidateInputs()to support the new parameterInitializeDestinationFiles()SourceFilesto createDestinationFilesitems given theDestinationFolder.Copytask actually only operates onSourceFilesandDestinationFiles.FileMatcher::GetFiles()for each directory inSourceFoldersSourceFilesandDestinationFilesfor each file foundAdded additional unit tests in Copy_Tests.cs.
Added new error MSB3894
Copy.IncompatibleParametersfor the case whereSourceFoldersandDestinationFilesare both present. This is very close to the existing MSB3022Copy.ExactlyOneTypeOfDestinationbut it seemed prudent not to re-use MSB3022.Testing
Tested on Windows 11 and macOS 12
Ran full suite of unit tests from the command line
Ran some sample project files
Notes
This implementation conforms to the proposed design with the exception that it does not copy empty directories.
This implementation leverages the existing
FileMatcher::GetFiles()which recurses the directory tree using multiple threads.GetFiles()returns a list of files. Empty directories are not identified.The use of
FileMatchercould be replaced. TheCopytask could implement its own support for recursing a directory tree. The wildcard matching logic inFileMatcheris not relevant for theCopytask.