Skip to content

Commit

Permalink
Merge pull request #1665 from dart-lang/merge-watcher-package
Browse files Browse the repository at this point in the history
Merge `package:watcher`
  • Loading branch information
mosuem authored Dec 17, 2024
2 parents c90e95b + 40494e7 commit 84f7a11
Show file tree
Hide file tree
Showing 50 changed files with 4,241 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/watcher.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:watcher"
about: "Create a bug or file a feature request against package:watcher."
labels: "package:watcher"
---
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,7 @@
'package:unified_analytics':
- changed-files:
- any-glob-to-any-file: 'pkgs/unified_analytics/**'

'package:watcher':
- changed-files:
- any-glob-to-any-file: 'pkgs/watcher/**'
71 changes: 71 additions & 0 deletions .github/workflows/watcher.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: package:watcher

on:
# Run on PRs and pushes to the default branch.
push:
branches: [ main ]
paths:
- '.github/workflows/watcher.yaml'
- 'pkgs/watcher/**'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/watcher.yaml'
- 'pkgs/watcher/**'
schedule:
- cron: "0 0 * * 0"

env:
PUB_ENVIRONMENT: bot.github


defaults:
run:
working-directory: pkgs/watcher/

jobs:
# Check code formatting and static analysis on a single OS (linux)
# against Dart dev.
analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
- name: Analyze code
run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'

# Run tests on a matrix consisting of two dimensions:
# 1. OS: ubuntu-latest, macos-latest, windows-latest
# 2. release channel: dev
test:
needs: analyze
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [3.1, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Run VM tests
run: dart test --platform vm
if: always() && steps.install.outcome == 'success'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ don't naturally belong to other topic monorepos (like
| [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) |
| [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) |
| [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) |
| [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) |

## Publishing automation

Expand Down
4 changes: 4 additions & 0 deletions pkgs/watcher/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Don’t commit the following directories created by pub.
.dart_tool
.packages
pubspec.lock
5 changes: 5 additions & 0 deletions pkgs/watcher/.test_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test_package": {
"platforms": ["vm"]
}
}
130 changes: 130 additions & 0 deletions pkgs/watcher/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
## 1.1.1

- Ensure `PollingFileWatcher.ready` completes for files that do not exist.
- Require Dart SDK `^3.1.0`
- Move to `dart-lang/tools` monorepo.

## 1.1.0

- Require Dart SDK >= 3.0.0
- Remove usage of redundant ConstructableFileSystemEvent classes.

## 1.0.3-dev

- Require Dart SDK >= 2.19

## 1.0.2

- Require Dart SDK >= 2.14
- Ensure `DirectoryWatcher.ready` completes even when errors occur that close the watcher.
- Add markdown badges to the readme.

## 1.0.1

* Drop package:pedantic and use package:lints instead.

## 1.0.0

* Require Dart SDK >= 2.12
* Add the ability to create custom Watcher types for specific file paths.

## 0.9.7+15

* Fix a bug on Mac where modifying a directory with a path exactly matching a
prefix of a modified file would suppress change events for that file.

## 0.9.7+14

* Prepare for breaking change in SDK where modified times for not found files
becomes meaningless instead of null.

## 0.9.7+13

* Catch & forward `FileSystemException` from unexpectedly closed file watchers
on windows; the watcher will also be automatically restarted when this occurs.

## 0.9.7+12

* Catch `FileSystemException` during `existsSync()` on Windows.
* Internal cleanup.

## 0.9.7+11

* Fix an analysis hint.

## 0.9.7+10

* Set max SDK version to `<3.0.0`, and adjust other dependencies.

## 0.9.7+9

* Internal changes only.

## 0.9.7+8

* Fix Dart 2.0 type issues on Mac and Windows.

## 0.9.7+7

* Updates to support Dart 2.0 core library changes (wave 2.2).
See [issue 31847][sdk#31847] for details.

[sdk#31847]: https://github.com/dart-lang/sdk/issues/31847


## 0.9.7+6

* Internal changes only, namely removing dep on scheduled test.

## 0.9.7+5

* Fix an analysis warning.

## 0.9.7+4

* Declare support for `async` 2.0.0.

## 0.9.7+3

* Fix a crashing bug on Linux.

## 0.9.7+2

* Narrow the constraint on `async` to reflect the APIs this package is actually
using.

## 0.9.7+1

* Fix all strong-mode warnings.

## 0.9.7

* Fix a bug in `FileWatcher` where events could be added after watchers were
closed.

## 0.9.6

* Add a `Watcher` interface that encompasses watching both files and
directories.

* Add `FileWatcher` and `PollingFileWatcher` classes for watching changes to
individual files.

* Deprecate `DirectoryWatcher.directory`. Use `DirectoryWatcher.path` instead.

## 0.9.5

* Fix bugs where events could be added after watchers were closed.

## 0.9.4

* Treat add events for known files as modifications instead of discarding them
on Mac OS.

## 0.9.3

* Improved support for Windows via `WindowsDirectoryWatcher`.

* Simplified `PollingDirectoryWatcher`.

* Fixed bugs in `MacOSDirectoryWatcher`
27 changes: 27 additions & 0 deletions pkgs/watcher/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2014, the Dart project authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10 changes: 10 additions & 0 deletions pkgs/watcher/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[![Build Status](https://github.com/dart-lang/tools/actions/workflows/watcher.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/watcher.yaml)
[![pub package](https://img.shields.io/pub/v/watcher.svg)](https://pub.dev/packages/watcher)
[![package publisher](https://img.shields.io/pub/publisher/watcher.svg)](https://pub.dev/packages/watcher/publisher)

A file system watcher.

## What's this?

`package:watcher` monitors changes to contents of directories and sends
notifications when files have been added, removed, or modified.
1 change: 1 addition & 0 deletions pkgs/watcher/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:dart_flutter_team_lints/analysis_options.yaml
Loading

0 comments on commit 84f7a11

Please sign in to comment.