aspect-build / aspect-cli

correct, fast, usable: choose three
https://aspect.build/cli
Apache License 2.0
84 stars 19 forks source link

[FR]: automatically configure BUILD files when needed #684

Open alexeagle opened 4 months ago

alexeagle commented 4 months ago

What is the current behavior?

Currently users get an error from Bazel or their application when BUILD files are out-of-date. For example, adding a new source file to a package that doesn't use glob means that source file won't be included in actions that invoke a build step. They have to interpret this error to mean "BUILD files are outdated" and then run aspect configure manually to fix them.

Describe the feature

https://pkg.go.dev/github.com/bazelbuild/bazel-gazelle/cmd/autogazelle is one attempt at this, it's highly experimental and I don't know of success stories.

Some ideas:

  1. At Google, an editor plugin detects code changes that should run gazelle (actually the google3 equivalents "glaze", "taze", etc).
  2. watch the filesystem, similar to what we need for #63 so we know that a source file is created or other changes that make BUILD files "dirty" and run configure. But this implies that the CLI starts a daemon process is always running. Note that bb-clientd is already a similar shape.
  3. watch for build errors that suggest that configure needs to be re-run. Then retry the same bazel command again, so the user only notices a slower build but doesn't need to manually configure