dotnet / dotnet/msbuild

IMSBuildGlob should have a method that expands globs

Open
#1,908 0 comments 0 reactions 0 assignees View on GitHub
Feature - Globbing help wanted triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

[IMSBuildGlob](https://github.com/Microsoft/msbuild/blob/master/src/Build/Globbing/IMSBuildGlob.cs) currently knows how to match strings against itself.
It would be nice if it also had an `ExpandToFiles` method which hit the disk and expanded the glob into matching files, with the same behaviour that the engine is internally using. We didn't expose this functionality because there's no outside asks for it yet.

Implementation details:
- Since expansion is slow, the results should be cached, and maybe the method should also have an async counterpart
- A very easy implementation is to just call `EngineFileUtilities.GetFileList`. However, that method needlessly parses the glob again. A better implementation is to rework the internal static methods to also accept an already parsed glob. This poses some complications due to the different validation checks done by `EngineFileUtilities.GetFileList` and `FileMatcher.GetFiles`
- Behaviour on illegal filespecs (as per the engine today):
- `EngineFileUtilities.GetFileList` returns back the original illegal filespec
- `FileMatcher.GetFiles` return back the original illegal filespec if it's not excluded, otherwise returns empty

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.