diff options
author | Wyatt Hepler <hepler@google.com> | 2021-04-15 08:20:05 -0700 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2021-04-15 16:36:10 +0000 |
commit | 9e08015900d5138f45fd095e4028255abac2841f (patch) | |
tree | 9473d469388526e36550b8db9e4a565294083800 | |
parent | ea500563dcfb8e106edb9197b34b5446b8d14ca2 (diff) | |
download | pigweed-9e08015900d5138f45fd095e4028255abac2841f.tar.gz |
pw_watch: Automatically restart builds by default
Change-Id: I8ac1c4c7a29cb39a52f7ad599e17b8adaa639949
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/41161
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Keir Mierle <keir@google.com>
-rw-r--r-- | pw_watch/docs.rst | 4 | ||||
-rwxr-xr-x | pw_watch/py/pw_watch/watch.py | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/pw_watch/docs.rst b/pw_watch/docs.rst index 6e0824a8f..ad4def6bb 100644 --- a/pw_watch/docs.rst +++ b/pw_watch/docs.rst @@ -50,7 +50,9 @@ patterns. These patterns do not override Git's ignoring logic. The ``--exclude_list`` argument can be used to exclude directories from being watched. This decreases the number of files monitored with inotify in Linux. -While running ``pw watch``, press enter to immediately trigger a rebuild. +By default, ``pw watch`` automatically restarts an ongoing build when files +change. This can be disabled with the ``--no-restart`` option. While running +``pw watch``, you may also press enter to immediately restart a build. Unit Test Integration ===================== diff --git a/pw_watch/py/pw_watch/watch.py b/pw_watch/py/pw_watch/watch.py index 30d221ff3..c7269e7f9 100755 --- a/pw_watch/py/pw_watch/watch.py +++ b/pw_watch/py/pw_watch/watch.py @@ -141,7 +141,7 @@ class PigweedBuildWatcher(FileSystemEventHandler, DebouncedFunction): ignore_patterns: Sequence[str] = (), build_commands: Sequence[BuildCommand] = (), charset: WatchCharset = _ASCII_CHARSET, - restart: bool = False, + restart: bool = True, ): super().__init__() @@ -350,9 +350,10 @@ def add_parser_arguments(parser: argparse.ArgumentParser) -> None: type=Path, help='directories to ignore during pw watch', default=[]) - parser.add_argument('--restart', - action='store_true', - help='restart an ongoing build if files change') + parser.add_argument('--no-restart', + dest='restart', + action='store_false', + help='do not restart ongoing builds if files change') parser.add_argument( 'default_build_targets', nargs='*', |