Skip to content

Commit db05ae8

Browse files
authored
refactor: add logging of watchman events (#268)
Can be enabled via [logging setup](https://github.com/aspect-build/aspect-gazelle/blob/e67fd7a1f12173dc0a58682a162bfebac77bf9d0/common/logger/logger.go#L56-L69) ### Changes are visible to end-users: no ### Test plan - Covered by existing test cases
1 parent 3df2de6 commit db05ae8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/aspect/run/run.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ func (runner *Run) runWatch(ctx context.Context, bazelCmd []string, bzlCommandSt
418418
return fmt.Errorf("failed to enter build state: %w", err)
419419
}
420420

421+
logger.Debugf("watchman detected changes: %v", cs.Paths)
422+
421423
// The command to detect changes in the run target.
422424
detectCmd, err := createBazelScriptCmd(false, true)
423425
if err != nil {
@@ -445,6 +447,8 @@ func (runner *Run) runWatch(ctx context.Context, bazelCmd []string, bzlCommandSt
445447
// Output a basic warning and resume waiting for changes.
446448
fmt.Printf("%s incremental bazel build command failed: %v\n", color.YellowString("WARNING:"), incBuildErr)
447449
} else if changes := changedetect.cycleChanges(); len(changes) > 0 {
450+
logger.Infof("Cycle changes: %v", changes)
451+
448452
// For now just rerun the target, beware that RunCommand does not yield until
449453
// the subprocess exists.
450454
fmt.Printf("%s Found %d changes, rebuilding the target.\n", color.GreenString("INFO:"), len(changes))

0 commit comments

Comments
 (0)