Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bazel init to setup new workspaces #15604

Closed
jvolkman opened this issue Jun 1, 2022 · 5 comments
Closed

Add bazel init to setup new workspaces #15604

jvolkman opened this issue Jun 1, 2022 · 5 comments
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

Comments

@jvolkman
Copy link
Contributor

jvolkman commented Jun 1, 2022

Description of the feature request:

Add a bazel init command that sets up a skeleton Bazel workspace for new projects. It could create WORKSPACE, 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 repo
  • npm init - create a new npm package
  • poetry init - create a new Poetry (python) package
  • cargo init - create a new Cargo (rust) package

What 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.

@ckolli5 ckolli5 added type: feature request team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website labels Jun 2, 2022
@jin
Copy link
Member

jin commented Jun 2, 2022

I have a similar project here, without adding a new bazel command: https://github.com/jin/create-bazel-workspace

@aaronmondal
Copy link

+1 for default --incompatible_strict_action_env. This can cause evil confusing behaviour with path overrides.

But do we really need a command for bazel workspace initialization? Anything more than

touch WORKSPACE.bazel MODULE.bazel .bazelrc

would mean opinionating defaults.

I think language-specific setups should be handled by their respective rule repos. Otherwise bazel will depend on external rulesets.

@meteorcloudy meteorcloudy added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Nov 18, 2022
@Greenere
Copy link

Greenere commented Feb 24, 2023

The ChatGPT thinks that the command "bazel init" exists:

image

Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Apr 30, 2024
Copy link

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post @bazelbuild/triage in a comment here and we'll take a look. Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

7 participants
@jvolkman @jin @meteorcloudy @aaronmondal @Greenere @ckolli5 and others