Skip to content

Commit b59f516

Browse files
committed
feat: support run|build|test--watch source changes during build
1 parent f69cca4 commit b59f516

File tree

7 files changed

+34
-34
lines changed

7 files changed

+34
-34
lines changed

bazel/include/go.MODULE.bazel

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,42 @@ single_version_override(
2525
bazel_dep(name = "aspect_gazelle", version = "0.0.0")
2626
archive_override(
2727
module_name = "aspect_gazelle",
28-
integrity = "sha256-oF39QgqV6y8/ka0+jU652d0bXhmwZ/H3OpKAQLLe4J4=",
29-
strip_prefix = "aspect-gazelle-d4f938fee7fe8fa749cb3c5c56e2eea72d849f4c",
30-
urls = ["https://github.com/aspect-build/aspect-gazelle/archive/d4f938fee7fe8fa749cb3c5c56e2eea72d849f4c.tar.gz"],
28+
integrity = "sha256-OKKap0bvMlNdIXJNTg/F9iw+5emwpdZERPp4fn+Rn1g=",
29+
strip_prefix = "aspect-gazelle-c2ee3832d4255b81c59efcedc14cba94c1d6d520",
30+
urls = ["https://github.com/aspect-build/aspect-gazelle/archive/c2ee3832d4255b81c59efcedc14cba94c1d6d520.tar.gz"],
3131
)
3232

3333
bazel_dep(name = "aspect_gazelle_js", version = "0.0.0")
3434
archive_override(
3535
module_name = "aspect_gazelle_js",
36-
integrity = "sha256-oF39QgqV6y8/ka0+jU652d0bXhmwZ/H3OpKAQLLe4J4=",
37-
strip_prefix = "aspect-gazelle-d4f938fee7fe8fa749cb3c5c56e2eea72d849f4c/language/js",
38-
urls = ["https://github.com/aspect-build/aspect-gazelle/archive/d4f938fee7fe8fa749cb3c5c56e2eea72d849f4c.tar.gz"],
36+
integrity = "sha256-OKKap0bvMlNdIXJNTg/F9iw+5emwpdZERPp4fn+Rn1g=",
37+
strip_prefix = "aspect-gazelle-c2ee3832d4255b81c59efcedc14cba94c1d6d520/language/js",
38+
urls = ["https://github.com/aspect-build/aspect-gazelle/archive/c2ee3832d4255b81c59efcedc14cba94c1d6d520.tar.gz"],
3939
)
4040

4141
bazel_dep(name = "aspect_gazelle_orion", version = "0.0.0")
4242
archive_override(
4343
module_name = "aspect_gazelle_orion",
44-
integrity = "sha256-oF39QgqV6y8/ka0+jU652d0bXhmwZ/H3OpKAQLLe4J4=",
45-
strip_prefix = "aspect-gazelle-d4f938fee7fe8fa749cb3c5c56e2eea72d849f4c/language/orion",
46-
urls = ["https://github.com/aspect-build/aspect-gazelle/archive/d4f938fee7fe8fa749cb3c5c56e2eea72d849f4c.tar.gz"],
44+
integrity = "sha256-OKKap0bvMlNdIXJNTg/F9iw+5emwpdZERPp4fn+Rn1g=",
45+
strip_prefix = "aspect-gazelle-c2ee3832d4255b81c59efcedc14cba94c1d6d520/language/orion",
46+
urls = ["https://github.com/aspect-build/aspect-gazelle/archive/c2ee3832d4255b81c59efcedc14cba94c1d6d520.tar.gz"],
4747
)
4848

4949
bazel_dep(name = "aspect_gazelle_runner", version = "0.0.0")
5050
archive_override(
5151
module_name = "aspect_gazelle_runner",
52-
integrity = "sha256-oF39QgqV6y8/ka0+jU652d0bXhmwZ/H3OpKAQLLe4J4=",
53-
strip_prefix = "aspect-gazelle-d4f938fee7fe8fa749cb3c5c56e2eea72d849f4c/runner",
54-
urls = ["https://github.com/aspect-build/aspect-gazelle/archive/d4f938fee7fe8fa749cb3c5c56e2eea72d849f4c.tar.gz"],
52+
integrity = "sha256-OKKap0bvMlNdIXJNTg/F9iw+5emwpdZERPp4fn+Rn1g=",
53+
strip_prefix = "aspect-gazelle-c2ee3832d4255b81c59efcedc14cba94c1d6d520/runner",
54+
urls = ["https://github.com/aspect-build/aspect-gazelle/archive/c2ee3832d4255b81c59efcedc14cba94c1d6d520.tar.gz"],
5555
)
5656

5757
# Not direclty used but must be declared+overriden until aspect_gazelle_runner points to one published to BCR.
5858
bazel_dep(name = "aspect_gazelle_kotlin", version = "0.0.0")
5959
archive_override(
6060
module_name = "aspect_gazelle_kotlin",
61-
integrity = "sha256-oF39QgqV6y8/ka0+jU652d0bXhmwZ/H3OpKAQLLe4J4=",
62-
strip_prefix = "aspect-gazelle-d4f938fee7fe8fa749cb3c5c56e2eea72d849f4c/language/kotlin",
63-
urls = ["https://github.com/aspect-build/aspect-gazelle/archive/d4f938fee7fe8fa749cb3c5c56e2eea72d849f4c.tar.gz"],
61+
integrity = "sha256-OKKap0bvMlNdIXJNTg/F9iw+5emwpdZERPp4fn+Rn1g=",
62+
strip_prefix = "aspect-gazelle-c2ee3832d4255b81c59efcedc14cba94c1d6d520/language/kotlin",
63+
urls = ["https://github.com/aspect-build/aspect-gazelle/archive/c2ee3832d4255b81c59efcedc14cba94c1d6d520.tar.gz"],
6464
)
6565

6666
# Go modules

cmd/aspect/configure/configure.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ func runConfigureWatch(ctx context.Context, v *runner.GazelleRunner, mode string
294294
return fmt.Errorf("no connection to incremental protocol")
295295
}
296296

297-
for cs, err := range w.Subscribe(ctx, "aspect-configure-watch") {
297+
for cs, err := range w.Subscribe(ctx, watchman.DropState{DropWithinState: "aspect-configure-watch"}) {
298298
if err != nil {
299299
// Break the subscribe iteration if the context is done or if the watcher is closed.
300300
if errors.Is(err, context.Canceled) || errors.Is(err, net.ErrClosed) {

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ go 1.24.9
44

55
require (
66
github.com/alphadose/haxmap v1.4.1
7-
github.com/aspect-build/aspect-gazelle/common v0.0.0-20251124213210-d4f938fee7fe
8-
github.com/aspect-build/aspect-gazelle/language/orion v0.0.0-20251124213210-d4f938fee7fe
9-
github.com/aspect-build/aspect-gazelle/runner v0.0.0-20251124213210-d4f938fee7fe
7+
github.com/aspect-build/aspect-gazelle/common v0.0.0-20251125002441-c2ee3832d425
8+
github.com/aspect-build/aspect-gazelle/language/orion v0.0.0-20251125002441-c2ee3832d425
9+
github.com/aspect-build/aspect-gazelle/runner v0.0.0-20251125002441-c2ee3832d425
1010
github.com/bazelbuild/bazel-gazelle v0.47.0
1111
github.com/bazelbuild/bazelisk v1.27.0 // NOTE: keep vendored code in sync
1212
github.com/bazelbuild/buildtools v0.0.0-20251112105957-8e68360eeafa
@@ -59,8 +59,8 @@ require (
5959
github.com/a8m/envsubst v1.4.3 // indirect
6060
github.com/alecthomas/chroma/v2 v2.20.0 // indirect
6161
github.com/alecthomas/participle/v2 v2.1.4 // indirect
62-
github.com/aspect-build/aspect-gazelle/language/js v0.0.0-20251124213210-d4f938fee7fe // indirect
63-
github.com/aspect-build/aspect-gazelle/language/kotlin v0.0.0-20251124213210-d4f938fee7fe // indirect
62+
github.com/aspect-build/aspect-gazelle/language/js v0.0.0-20251125002441-c2ee3832d425 // indirect
63+
github.com/aspect-build/aspect-gazelle/language/kotlin v0.0.0-20251125002441-c2ee3832d425 // indirect
6464
github.com/atotto/clipboard v0.1.4 // indirect
6565
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
6666
github.com/aymerick/douceur v0.2.0 // indirect

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFI
2727
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
2828
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
2929
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
30-
github.com/aspect-build/aspect-gazelle/common v0.0.0-20251124213210-d4f938fee7fe h1:PcwzZ3D3tnLDzagVf+5TiujWOgBSMHQeFWnF0ddVcC0=
31-
github.com/aspect-build/aspect-gazelle/common v0.0.0-20251124213210-d4f938fee7fe/go.mod h1:cjn7MMGrFYxWLmLGBTni0U3CFmLAT9/JNJ7jb5VsU64=
32-
github.com/aspect-build/aspect-gazelle/language/js v0.0.0-20251124213210-d4f938fee7fe h1:QIF2bKyeh/mcm0P+E684iIKeUM12dWKCooyhG8DW03E=
33-
github.com/aspect-build/aspect-gazelle/language/js v0.0.0-20251124213210-d4f938fee7fe/go.mod h1:HbD/wf7NTJ5abptrTB8ezXr1sChhCxbjuiOmINRqxEw=
34-
github.com/aspect-build/aspect-gazelle/language/kotlin v0.0.0-20251124213210-d4f938fee7fe h1:HbEfJfMi5dfVakkgebrj1ghCjJQ8JVMO5E8/D4nOa3Q=
35-
github.com/aspect-build/aspect-gazelle/language/kotlin v0.0.0-20251124213210-d4f938fee7fe/go.mod h1:CikD3ipH1whpptURl0YWHM3EK7LQDWHP4DZxkzUR2RQ=
36-
github.com/aspect-build/aspect-gazelle/language/orion v0.0.0-20251124213210-d4f938fee7fe h1:SWR5vwHjtnNQkak1xGzUdfHGwEcbhnGnAdz9R/a/X3s=
37-
github.com/aspect-build/aspect-gazelle/language/orion v0.0.0-20251124213210-d4f938fee7fe/go.mod h1:yHaVU1cFJwAXsAb305dPj5+cb10uhWGgM1loj9IdgHE=
38-
github.com/aspect-build/aspect-gazelle/runner v0.0.0-20251124213210-d4f938fee7fe h1:PdGLevyDVltzrwSDy4QVl28iFAMy/CHYpGwVazRvlbU=
39-
github.com/aspect-build/aspect-gazelle/runner v0.0.0-20251124213210-d4f938fee7fe/go.mod h1:FukGILxe2+rWcm+nZLa9kzOPfKsl6571jPB3FviSTgo=
30+
github.com/aspect-build/aspect-gazelle/common v0.0.0-20251125002441-c2ee3832d425 h1:7t007ir9OcGi8bleNshsaz3Prpd1wSZB8quV2LfDvQA=
31+
github.com/aspect-build/aspect-gazelle/common v0.0.0-20251125002441-c2ee3832d425/go.mod h1:cjn7MMGrFYxWLmLGBTni0U3CFmLAT9/JNJ7jb5VsU64=
32+
github.com/aspect-build/aspect-gazelle/language/js v0.0.0-20251125002441-c2ee3832d425 h1:jR9KL/BUV0a1LCVdyRmiYpAAOiY553L71PlfSNYiobU=
33+
github.com/aspect-build/aspect-gazelle/language/js v0.0.0-20251125002441-c2ee3832d425/go.mod h1:HbD/wf7NTJ5abptrTB8ezXr1sChhCxbjuiOmINRqxEw=
34+
github.com/aspect-build/aspect-gazelle/language/kotlin v0.0.0-20251125002441-c2ee3832d425 h1:YT7oziVuDY6Bp4vEEBgWFCfMQIYOTXorQk+DBni2oLM=
35+
github.com/aspect-build/aspect-gazelle/language/kotlin v0.0.0-20251125002441-c2ee3832d425/go.mod h1:CikD3ipH1whpptURl0YWHM3EK7LQDWHP4DZxkzUR2RQ=
36+
github.com/aspect-build/aspect-gazelle/language/orion v0.0.0-20251125002441-c2ee3832d425 h1:AVi4BZ88oYSOiVyApNh/aEECpHn8u0DBl1Xqvw6ywAc=
37+
github.com/aspect-build/aspect-gazelle/language/orion v0.0.0-20251125002441-c2ee3832d425/go.mod h1:yHaVU1cFJwAXsAb305dPj5+cb10uhWGgM1loj9IdgHE=
38+
github.com/aspect-build/aspect-gazelle/runner v0.0.0-20251125002441-c2ee3832d425 h1:4Vc5XZM5nbAPuyKwnoc9k5xJIrUcxau8amk198yaqyE=
39+
github.com/aspect-build/aspect-gazelle/runner v0.0.0-20251125002441-c2ee3832d425/go.mod h1:FukGILxe2+rWcm+nZLa9kzOPfKsl6571jPB3FviSTgo=
4040
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
4141
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
4242
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=

pkg/aspect/build/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (runner *Build) buildWatch(ctx context.Context, bazelCmd []string, streams
153153
fmt.Printf("Initial Build Failed: %v", err)
154154
}
155155

156-
for _, err := range w.Subscribe(ctx, "aspect-build-watch") {
156+
for _, err := range w.Subscribe(ctx, watchman.DeferState{DeferWithinState: "aspect-build-watch"}) {
157157
if err != nil {
158158
// Break the subscribe iteration if the context is done or if the watcher is closed.
159159
if errors.Is(err, context.Canceled) || errors.Is(err, net.ErrClosed) {

pkg/aspect/run/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ func (runner *Run) runWatch(ctx context.Context, bazelCmd []string, bzlCommandSt
400400
}
401401

402402
// Subscribe to further changes
403-
for cs, err := range w.Subscribe(pcctx, "aspect-run-watch") {
403+
for cs, err := range w.Subscribe(pcctx, watcher.DeferState{DeferWithinState: "aspect-run-watch"}) {
404404
if err != nil {
405405
// Break the subscribe iteration if the context is done or if the watcher is closed.
406406
if errors.Is(err, context.Canceled) || errors.Is(err, net.ErrClosed) {

pkg/aspect/test/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (runner *Test) testWatch(ctx context.Context, bazelCmd []string, streams io
145145
fmt.Printf("Initial Build Failed: %v", err)
146146
}
147147

148-
for _, err := range w.Subscribe(ctx, "aspect-test-watch") {
148+
for _, err := range w.Subscribe(ctx, watchman.DeferState{DeferWithinState: "aspect-test-watch"}) {
149149
if err != nil {
150150
// Break the subscribe iteration if the context is done or if the watcher is closed.
151151
if errors.Is(err, context.Canceled) || errors.Is(err, net.ErrClosed) {

0 commit comments

Comments
 (0)