{"id":37225261,"url":"https://github.com/yext/bazel-watcher","last_synced_at":"2026-01-15T01:46:22.172Z","repository":{"id":57579252,"uuid":"177009327","full_name":"yext/bazel-watcher","owner":"yext","description":"Tools for building Bazel targets when source files change.","archived":false,"fork":true,"pushed_at":"2025-03-04T19:29:46.000Z","size":339,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-04T20:30:31.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"bazelbuild/bazel-watcher","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yext.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2019-03-21T19:14:44.000Z","updated_at":"2025-03-04T19:29:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/yext/bazel-watcher","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/yext/bazel-watcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yext%2Fbazel-watcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yext%2Fbazel-watcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yext%2Fbazel-watcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yext%2Fbazel-watcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yext","download_url":"https://codeload.github.com/yext/bazel-watcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yext%2Fbazel-watcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"ssl_error","status_checked_at":"2026-01-15T00:55:20.945Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-15T01:46:21.535Z","updated_at":"2026-01-15T01:46:22.160Z","avatar_url":"https://github.com/yext.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bazel watcher\n\n[![Build status](https://badge.buildkite.com/7694a2e22dcb7ea2e2ec80bb7e8e0380c700079e761394096f.svg?branch=master)](https://buildkite.com/bazel/bazel-watcher-postsubmit)\n\nNote: This is not an official Google product.\n\nA source file watcher for [Bazel](https://Bazel.build) projects\n\nEver wanted to save a file and have your tests automatically run? How about\nrestart your webserver when one of the source files change? Look no further.\n\nInstall `ibazel` using one of the 3 methods [described below](#installation). Then:\n\n```bash\n# ibazel build //path/to/my:target\n```\n\nHack hack hack. Save and your target will be rebuilt.\n\nRight now this repo supports `build`, `test`, and `run`.\n\n## Installation\n\nThere are currently 3 ways to install iBazel\n\n### Mac (Homebrew)\n\nIf you run a mac you can install it from [homebrew](https://brew.sh).\n\n```\n$ brew tap bazelbuild/tap\n$ brew tap-pin bazelbuild/tap\n$ brew install ibazel\n```\n\n### NPM\n\nIf you're a JS developer you can install it as a `devDependency` or by calling `npm install` directly in your project\n\n```\nnpm install @bazel/ibazel\n```\n\n### Compiling yourself\n\nYou can, of course, build iBazel using Bazel.\n\n```\ngit clone git@github.com:bazelbuild/bazel-watcher\ncd bazel-watcher\nbazel build //ibazel\n```\n\nNow copy the generated binary onto your path:\n\n```bash\nexport PATH=$PATH:$PWD/bazel-bin/ibazel/$GOOS_$GOARCH_pure_stripped\n```\n\nwhere `$GOOS` and `$GOARCH` are your host OS (e.g., `darwin` or `linux`) and architecture (e.g., `amd64`).\n\n## Running a target\n\nBy default, a target started with `ibazel run` will be terminated and restarted\nwhenever it's notified of source changes. Alternatively, if the build rule for\nyour target contains `ibazel_notify_changes` in its `tags` attribute, then the\ncommand will stay alive and will receive a notification of the source changes on\nstdin.\n\n## Profiling\n\niBazel has a `--profile_dev` flag which turns on a generated profile output file\nabout the build process and timing. To use it include this flag in the command line. For example,\n\n```\niBazel --profile_dev=profile.json run devserver\n```\n\nThe profile outfile is in concatenated JSON format. Events are outputted one per line.\n\n### Profiler events\n\n| Event | Description | Attributes \u003cfont size=1\u003e(* optional)\u003c/font\u003e |\n| ------------- | ------------- | ------------- |\n| `IBAZEL_START` | Emitted when iBazel is started as part of the first iteration | `type`, `iteration`, `time`, `iBazelVersion`, `bazelVersion`, `maxHeapSize`, `committedHeapSize` |\n| `SOURCE_CHANGE` | A source file change was detected | `type`, `iteration`, `time`, `targets`, `elapsed`, `change` |\n| `GRAPH_CHANGE` | A build file change was detected | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `RELOAD_TRIGGERED` | A livereload was triggered to any listening browsers | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `RUN_START` | A run operation started | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `RUN_FAILED` | A run operation failed | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `RUN_DONE` | A run operation completed successfully | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `BUILD_START` | A build operation started | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `BUILD_FAILED` | A build operation failed | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `BUILD_DONE` | A build operation completed successfully | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `TEST_START` | A test operation started | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `TEST_FAILED` | A test operation failed | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `TEST_DONE` | A test operation completed successfully | `type`, `iteration`, `time`, `targets`, `elapsed`, `changes`* |\n| `REMOTE_EVENT` | A remote event was received from the browser | `type`, `iteration`, `time`, `targets`, `elapsed`, `remoteType`, `remoteTime`, `remoteElapsed`, `remoteData` |\n| `REMOTE_EVENT / PAGE_LOAD` | A remote event emitted by the profiler client-side script on the browser's `load` event. `remoteType` is `PAGE_LOAD`. | `type`, `iteration`, `time`, `targets`, `elapsed`, `remoteType`, `remoteTime`, `remoteElapsed`, `remoteData` |\n\n### Event attributes\n\n| Attribute | Type | Description |\n| ------------- | ------------- | ------------- |\n| `type` | string | Event type. |\n| `iteration` | string | Unique build iteration key. |\n| `time` | integer | Time of event. |\n| `targets` | string[] | List of targets that are being built (Note: this is a complete list and includes targets that were already built prior to an iteration). |\n| `elapsed` | integer | Elapsed time in ms since the start of the iteration. |\n| `change` | string | The file changed on a `SOURCE_CHANGE` or `GRAPH_CHANGE` event. |\n| `changes` | string[] | A cumulative list of files changed during a build iteration. |\n| `iBazelVersion` | string | Version of iBazel that generated this event. |\n| `bazelVersion` | string | Version of bazel in use. |\n| `maxHeapSize` | string | Max heap size as reported by Bazel. |\n| `committedHeapSize` | string | Committed heap size as reported by Bazel. |\n| `remoteType` | string | Sub-type for `REMOTE_EVENT` type. |\n| `remoteTime` | number | Browser time for `REMOTE_EVENT` type. |\n| `remoteElapsed` | number | Elapsed time in browser since `navigationStart` for `REMOTE_EVENT` type. |\n| `remoteData` | string | Data sent from browser for `REMOTE_EVENT` type. This may be in escaped JSON format for some remote events. |\n\n### Example profile output file\n\nYou can find an example profile output JSON file [here](https://github.com/bazelbuild/bazel-watcher/blob/master/example.profile.json). Below is the file in pretty print JSON format:\n\n```\n{  \n   \"type\":\"IBAZEL_START\",\n   \"iteration\":\"4214114686684e0f\",\n   \"time\":1513706108351,\n   \"iBazelVersion\":\"v0.2.0-dirty\",\n   \"bazelVersion\":\"release 0.8.1-homebrew\",\n   \"maxHeapSize\":\"3817MB\",\n   \"committedHeapSize\":\"1372MB\"\n}\n{  \n   \"type\":\"RUN_START\",\n   \"iteration\":\"4214114686684e0f\",\n   \"time\":1513706109329,\n   \"targets\":[\"//src:devserver\"],\n   \"elapsed\":978\n}\n{  \n   \"type\":\"RELOAD_TRIGGERED\",\n   \"iteration\":\"4214114686684e0f\",\n   \"time\":1513706114595,\n   \"targets\":[\"//src:devserver\"],\n   \"elapsed\":6244\n}\n{  \n   \"type\":\"RUN_DONE\",\n   \"iteration\":\"4214114686684e0f\",\n   \"time\":1513706114595,\n   \"targets\":[\"//src:devserver\"],\n   \"elapsed\":6244\n}\n{  \n   \"type\":\"SOURCE_CHANGE\",\n   \"iteration\":\"7e6f8e150e9a8367\",\n   \"time\":1513706129384,\n   \"targets\":[\"//src:devserver\"],\n   \"change\":\"/Users/greg/google/gregmagolan/angular-bazel-example/src/hello-world/hello-world.component.ts\"\n}\n{  \n   \"type\":\"RUN_START\",\n   \"iteration\":\"7e6f8e150e9a8367\",\n   \"time\":1513706129484,\n   \"targets\":[\"//src:devserver\"],\n   \"elapsed\":100,\n   \"changes\":[\"/Users/greg/google/gregmagolan/angular-bazel-example/src/hello-world/hello-world.component.ts\"]\n}\n{  \n   \"type\":\"RELOAD_TRIGGERED\",\n   \"iteration\":\"7e6f8e150e9a8367\",\n   \"time\":1513706133947,\n   \"targets\":[\"//src:devserver\"],\n   \"elapsed\":4563,\n   \"changes\":[\"/Users/greg/google/gregmagolan/angular-bazel-example/src/hello-world/hello-world.component.ts\"]\n}\n{  \n   \"type\":\"RUN_DONE\",\n   \"iteration\":\"7e6f8e150e9a8367\",\n   \"time\":1513706133947,\n   \"targets\":[\"//src:devserver\"],\n   \"elapsed\":4563,\n   \"changes\":[\"/Users/greg/google/gregmagolan/angular-bazel-example/src/hello-world/hello-world.component.ts\"]\n}\n{  \n   \"type\":\"REMOTE_EVENT\",\n   \"iteration\":\"7e6f8e150e9a8367\",\n   \"time\":1513706134297,\n   \"targets\":[\"//src:devserver\"],\n   \"elapsed\":4913,\n   \"remoteType\":\"PAGE_LOAD\",\n   \"remoteTime\":1513706134294,\n   \"remoteElapsed\":346,\n   \"remoteData\":\"{\\\"pageLoadTime\\\":344,\\\"fetchTime\\\":9,\\\"connectTime\\\":0,\\\"requestTime\\\":6,\\\"responseTime\\\":6,\\\"renderTime\\\":325,\\\"navigationStart\\\":1513706133948,\\\"unloadEventStart\\\":1513706133962,\\\"unloadEventEnd\\\":1513706133962,\\\"redirectStart\\\":0,\\\"redirectEnd\\\":0,\\\"fetchStart\\\":1513706133952,\\\"domainLookupStart\\\":1513706133952,\\\"domainLookupEnd\\\":1513706133952,\\\"connectStart\\\":1513706133952,\\\"connectEnd\\\":1513706133952,\\\"secureConnectionStart\\\":0,\\\"requestStart\\\":1513706133955,\\\"responseStart\\\":1513706133955,\\\"responseEnd\\\":1513706133961,\\\"domLoading\\\":1513706133967,\\\"domInteractive\\\":1513706134222,\\\"domContentLoadedEventStart\\\":1513706134222,\\\"domContentLoadedEventEnd\\\":1513706134222,\\\"domComplete\\\":1513706134292,\\\"loadEventStart\\\":1513706134292}\"\n}\n```\n\n## Remote events\n\nRemote events require the client-side profiling script. If you are using the `ts_devserver` bazel rule, this script will automatically be included in the development bundle so you don't have to worry about including it. If you're not using `ts_devserver` for development mode, you can include the following script tag to pull in the client-side profiling script:\n\n```\n\u003cscript src=\"http://localhost:30000/profiler.js\"\u003e\u003c/script\u003e\n```\n\nThe script is served by iBazel on port 30000 by default. If port 30000 is not available, iBazel will attempt to find another available port between 30001 and 30099.\n\nRemote events in the profiler script are sent using the [Beacon API](https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API). This API is available in Chrome 39, Firefox 31, Edge and Opera 26. It is not available in Internet Explorer or Safari. Browser compatability can be checked [here](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon#Browser_compatibility).\n\nIf your browser does not support the Beacon API, you will see the following error in the console when including the profiler script: `iBazel profiler disabled because Beacon API is not available`.\n\n## Custom remote events\n\nWhen the profiler script is loaded, a `window.IBazelProfileEvent(eventType, data)` public API is made available for generating custom remote events. This function sends a custom REMOTE_EVENT to the iBazel profiler log.\n\n| Param | Type | Description |\n| ------------- | ------------- | ------------- |\n| `eventType` | string | The event type that ends up in the 'remoteType' attribute of the REMOTE_EVENT. |\n| `data` | any | Optional data associated with the event. This is converted to a string. If it is an object it will be converted to escaped JSON in the profiler log. |\n\n## Additional notes\n\n### Termination\n\nSIGINT has to be sent twice to kill ibazel: once to kill the subprocess, and\nthe second time for ibazel itself. Also, ibazel will exit on its own when a\nbazel query fails, but it will stay alive when a build, test, or run fails.\nWe use an exit code of 3 for a signal termination, and 4 for a query failure.\nThese codes are not an API and may change at any point.\n\n### What about the `--watchfs` flag?\n\nBazel has a flag called `--watchfs` which, according to the bazel command-line\nhelp does:\n\n\u003e If true, Bazel tries to use the operating system's file watch service for\n\u003e local changes instead of scanning every file for a change\n\nUnfortunately, this option does not rebuild the project on save like the Bazel\nwatcher does, but instead queries the file system for a list of files that have\nbeen invalidated since last build and will require reinspection by the Bazel\nserver.\n\n### Big thanks\n\n * [Google](http://opensource.google.com) for cross-platform build/test CI instances.\n * [Sauce Labs](https://saucelabs.com) for cross-browser testing.\n\nCopyright 2017 The Bazel Authors. All right reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyext%2Fbazel-watcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyext%2Fbazel-watcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyext%2Fbazel-watcher/lists"}