-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Default excludes #49454
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
base: main
Are you sure you want to change the base?
Default excludes #49454
Conversation
Thanks for your PR, @@tmat. |
Implement watching project, props and targets files.
@DustinCampbell ptal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the FileWatcher in dotnet-watch to support per-file watching and SDK DefaultItemExcludes
globs, while continuing to ignore bin
/obj
by default. It also adds re-evaluation support for project file changes and refactors watcher APIs to use a new DirectoryWatcher
base class.
- Introduce
FilePathExclusions
and wire upDefaultItemExcludes
globs inHotReloadDotNetWatcher
. - Refactor file-watching APIs: remove
IDirectoryWatcher
/FileWatcherFactory
, addDirectoryWatcher
withWatchFiles
/WatchContainingDirectories
. - Update tests and project evaluation to cover individual-file watch and project file changes.
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/.../FilePathExclusions.cs | Implement exclusion logic for DefaultItemExcludes globs and output dirs |
src/.../FileWatcher/DirectoryWatcher.cs | New base watcher, handles per-file and directory-tree watching |
src/.../HotReloadDotNetWatcher.cs | Integrate exclusions and project-file change re-evaluation |
src/.../MsBuildFileSetFactory.cs | Propagate CancellationToken when loading the project graph |
src/.../ProjectGraphNodeExtensions.cs | Expose EnableDefaultItems and DefaultItemExcludes |
test/.../FileWatcherTests.cs | Update tests to validate per-file watch logic |
test/.../ApplyDeltaTests.cs | Add tests for project file change scenarios |
test/.../HotReload/CompilationHandlerTests.cs | Pass CancellationToken when loading project graph |
test/.../HotReload/RuntimeProcessLauncherTests.cs | Rename test semaphore to ignoringChangeInExcludedFile |
test/TestAssets/TestProjects/.../*.csproj and props files | Add or update DefineConstants and project properties for tests |
Comments suppressed due to low confidence (2)
test/dotnet-watch.Tests/FileWatcherTests.cs:25
- The fallback
[]
array literal does not match the expectedImmutableHashSet<string>
parameter. ReplacewatchedFileNames ?? []
withwatchedFileNames ?? ImmutableHashSet<string>.Empty
.
using var watcher = DirectoryWatcher.Create(dir, watchedFileNames ?? [], usePolling, includeSubdirectories: watchSubdirectories);
Adds capability to watch individual files to FileWatcher.
If enabled, uses the SDK's
DefaultItemExcludes
globs to exclude files from being watched.Otherwise, excludes
out
andbin
directories as previously implemented.Implement support for project file changes (proj, props, targets).