Add bazel init
to setup new workspaces
#15604
Labels
P3
We're not considering working on this, but happy to review a PR. (No assignee)
stale
Issues or PRs that are stale (no activity for 30 days)
team-OSS
Issues for the Bazel OSS team: installation, release processBazel packaging, website
type: feature request
Description of the feature request:
Add a
bazel init
command that sets up a skeleton Bazel workspace for new projects. It could createWORKSPACE
,BUILD.bazel
,.bazelrc
and maybe others, using a template that applies modern best practices.The
init
command is popular in other tools. E.g.,git init
- create a new git reponpm init
- create a new npm packagepoetry init
- create a new Poetry (python) packagecargo init
- create a new Cargo (rust) packageWhat underlying problem are you trying to solve with this feature?
New users often get tripped up by environment variables leaking into their builds and invalidating caches. The
--incompatible_strict_action_env
flag has existed for years and often solves the problem, but it is disabled by default due (I think) to not being compatible with many existing workspaces.Arguably
--incompatible_strict_action_env
should be enabled by default, as well as a variety of other flags for correctness, performance, and dev experience detailed in this post.bazel init
would offer a place to put these more recent, incompatible flags for use in new repos, and also provide a skeleton to help new users get started.The text was updated successfully, but these errors were encountered: