Skip to content

Commit 84f7a11

Browse files
authored
Merge pull request #1665 from dart-lang/merge-watcher-package
Merge `package:watcher`
2 parents c90e95b + 40494e7 commit 84f7a11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4241
-0
lines changed

.github/ISSUE_TEMPLATE/watcher.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
name: "package:watcher"
3+
about: "Create a bug or file a feature request against package:watcher."
4+
labels: "package:watcher"
5+
---

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,7 @@
123123
'package:unified_analytics':
124124
- changed-files:
125125
- any-glob-to-any-file: 'pkgs/unified_analytics/**'
126+
127+
'package:watcher':
128+
- changed-files:
129+
- any-glob-to-any-file: 'pkgs/watcher/**'

.github/workflows/watcher.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: package:watcher
2+
3+
on:
4+
# Run on PRs and pushes to the default branch.
5+
push:
6+
branches: [ main ]
7+
paths:
8+
- '.github/workflows/watcher.yaml'
9+
- 'pkgs/watcher/**'
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- '.github/workflows/watcher.yaml'
14+
- 'pkgs/watcher/**'
15+
schedule:
16+
- cron: "0 0 * * 0"
17+
18+
env:
19+
PUB_ENVIRONMENT: bot.github
20+
21+
22+
defaults:
23+
run:
24+
working-directory: pkgs/watcher/
25+
26+
jobs:
27+
# Check code formatting and static analysis on a single OS (linux)
28+
# against Dart dev.
29+
analyze:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
sdk: [dev]
35+
steps:
36+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
37+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
38+
with:
39+
sdk: ${{ matrix.sdk }}
40+
- id: install
41+
name: Install dependencies
42+
run: dart pub get
43+
- name: Check formatting
44+
run: dart format --output=none --set-exit-if-changed .
45+
if: always() && steps.install.outcome == 'success'
46+
- name: Analyze code
47+
run: dart analyze --fatal-infos
48+
if: always() && steps.install.outcome == 'success'
49+
50+
# Run tests on a matrix consisting of two dimensions:
51+
# 1. OS: ubuntu-latest, macos-latest, windows-latest
52+
# 2. release channel: dev
53+
test:
54+
needs: analyze
55+
runs-on: ${{ matrix.os }}
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
os: [ubuntu-latest, macos-latest, windows-latest]
60+
sdk: [3.1, dev]
61+
steps:
62+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
63+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
64+
with:
65+
sdk: ${{ matrix.sdk }}
66+
- id: install
67+
name: Install dependencies
68+
run: dart pub get
69+
- name: Run VM tests
70+
run: dart test --platform vm
71+
if: always() && steps.install.outcome == 'success'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ don't naturally belong to other topic monorepos (like
4444
| [test_reflective_loader](pkgs/test_reflective_loader/) | Support for discovering tests and test suites using reflection. | [![package issues](https://img.shields.io/badge/package:test_reflective_loader-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Atest_reflective_loader) | [![pub package](https://img.shields.io/pub/v/test_reflective_loader.svg)](https://pub.dev/packages/test_reflective_loader) |
4545
| [timing](pkgs/timing/) | A simple package for tracking the performance of synchronous and asynchronous actions. | [![package issues](https://img.shields.io/badge/package:timing-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Atiming) | [![pub package](https://img.shields.io/pub/v/timing.svg)](https://pub.dev/packages/timing) |
4646
| [unified_analytics](pkgs/unified_analytics/) | A package for logging analytics for all Dart and Flutter related tooling to Google Analytics. | [![package issues](https://img.shields.io/badge/package:unified_analytics-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aunified_analytics) | [![pub package](https://img.shields.io/pub/v/unified_analytics.svg)](https://pub.dev/packages/unified_analytics) |
47+
| [watcher](pkgs/watcher/) | Monitor directories and send notifications when the contents change. | [![package issues](https://img.shields.io/badge/package:watcher-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Awatcher) | [![pub package](https://img.shields.io/pub/v/watcher.svg)](https://pub.dev/packages/watcher) |
4748

4849
## Publishing automation
4950

pkgs/watcher/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Don’t commit the following directories created by pub.
2+
.dart_tool
3+
.packages
4+
pubspec.lock

pkgs/watcher/.test_config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"test_package": {
3+
"platforms": ["vm"]
4+
}
5+
}

pkgs/watcher/CHANGELOG.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
## 1.1.1
2+
3+
- Ensure `PollingFileWatcher.ready` completes for files that do not exist.
4+
- Require Dart SDK `^3.1.0`
5+
- Move to `dart-lang/tools` monorepo.
6+
7+
## 1.1.0
8+
9+
- Require Dart SDK >= 3.0.0
10+
- Remove usage of redundant ConstructableFileSystemEvent classes.
11+
12+
## 1.0.3-dev
13+
14+
- Require Dart SDK >= 2.19
15+
16+
## 1.0.2
17+
18+
- Require Dart SDK >= 2.14
19+
- Ensure `DirectoryWatcher.ready` completes even when errors occur that close the watcher.
20+
- Add markdown badges to the readme.
21+
22+
## 1.0.1
23+
24+
* Drop package:pedantic and use package:lints instead.
25+
26+
## 1.0.0
27+
28+
* Require Dart SDK >= 2.12
29+
* Add the ability to create custom Watcher types for specific file paths.
30+
31+
## 0.9.7+15
32+
33+
* Fix a bug on Mac where modifying a directory with a path exactly matching a
34+
prefix of a modified file would suppress change events for that file.
35+
36+
## 0.9.7+14
37+
38+
* Prepare for breaking change in SDK where modified times for not found files
39+
becomes meaningless instead of null.
40+
41+
## 0.9.7+13
42+
43+
* Catch & forward `FileSystemException` from unexpectedly closed file watchers
44+
on windows; the watcher will also be automatically restarted when this occurs.
45+
46+
## 0.9.7+12
47+
48+
* Catch `FileSystemException` during `existsSync()` on Windows.
49+
* Internal cleanup.
50+
51+
## 0.9.7+11
52+
53+
* Fix an analysis hint.
54+
55+
## 0.9.7+10
56+
57+
* Set max SDK version to `<3.0.0`, and adjust other dependencies.
58+
59+
## 0.9.7+9
60+
61+
* Internal changes only.
62+
63+
## 0.9.7+8
64+
65+
* Fix Dart 2.0 type issues on Mac and Windows.
66+
67+
## 0.9.7+7
68+
69+
* Updates to support Dart 2.0 core library changes (wave 2.2).
70+
See [issue 31847][sdk#31847] for details.
71+
72+
[sdk#31847]: https://github.com/dart-lang/sdk/issues/31847
73+
74+
75+
## 0.9.7+6
76+
77+
* Internal changes only, namely removing dep on scheduled test.
78+
79+
## 0.9.7+5
80+
81+
* Fix an analysis warning.
82+
83+
## 0.9.7+4
84+
85+
* Declare support for `async` 2.0.0.
86+
87+
## 0.9.7+3
88+
89+
* Fix a crashing bug on Linux.
90+
91+
## 0.9.7+2
92+
93+
* Narrow the constraint on `async` to reflect the APIs this package is actually
94+
using.
95+
96+
## 0.9.7+1
97+
98+
* Fix all strong-mode warnings.
99+
100+
## 0.9.7
101+
102+
* Fix a bug in `FileWatcher` where events could be added after watchers were
103+
closed.
104+
105+
## 0.9.6
106+
107+
* Add a `Watcher` interface that encompasses watching both files and
108+
directories.
109+
110+
* Add `FileWatcher` and `PollingFileWatcher` classes for watching changes to
111+
individual files.
112+
113+
* Deprecate `DirectoryWatcher.directory`. Use `DirectoryWatcher.path` instead.
114+
115+
## 0.9.5
116+
117+
* Fix bugs where events could be added after watchers were closed.
118+
119+
## 0.9.4
120+
121+
* Treat add events for known files as modifications instead of discarding them
122+
on Mac OS.
123+
124+
## 0.9.3
125+
126+
* Improved support for Windows via `WindowsDirectoryWatcher`.
127+
128+
* Simplified `PollingDirectoryWatcher`.
129+
130+
* Fixed bugs in `MacOSDirectoryWatcher`

pkgs/watcher/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2014, the Dart project authors.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following
11+
disclaimer in the documentation and/or other materials provided
12+
with the distribution.
13+
* Neither the name of Google LLC nor the names of its
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pkgs/watcher/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[![Build Status](https://github.com/dart-lang/tools/actions/workflows/watcher.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/watcher.yaml)
2+
[![pub package](https://img.shields.io/pub/v/watcher.svg)](https://pub.dev/packages/watcher)
3+
[![package publisher](https://img.shields.io/pub/publisher/watcher.svg)](https://pub.dev/packages/watcher/publisher)
4+
5+
A file system watcher.
6+
7+
## What's this?
8+
9+
`package:watcher` monitors changes to contents of directories and sends
10+
notifications when files have been added, removed, or modified.

pkgs/watcher/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: package:dart_flutter_team_lints/analysis_options.yaml

0 commit comments

Comments
 (0)