bazelbuild / bazelbuild/bazel

stable name for execution root convenience symlink

Open
#20,799 3 comments 1 reaction 0 assignees View on GitHub
team-Core type: feature request untriaged
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

By default, bazel will put a symlink `bazel-$(basename $(dirname WORKSPACE))` in the workspace root pointing to `$(bazel info execution_root)`. It's possible to modify the prefix (`bazel-`) on that with [`--symlink_prefix`](https://bazel.build/reference/command-line-reference#flag--symlink_prefix), but it's not possible to change the suffix.

A few ways to implement this, any of which would meet our use cases:
1. set the full name of the convenience symlink e.g. in `.bazelrc`
2. override the automatically-detected workspace basename used along with the prefix, again in `.bazelrc`
3. Use the workspace name as [declared](https://bazel.build/rules/lib/globals/workspace#workspace) in the `WORKSPACE` file, rather than the name of the directory that the code was checked out into.

### Which category does this issue belong to?

_No response_

### What underlying problem are you trying to solve with this feature?

The current scheme poses difficulties in places where we'd like to integrate bazel with other tools. For example, one of our use cases is we'd like to be able use a `.vscode/c_cpp_properties.json` file into the repository to tell the editor about various include paths from downloaded remote repos, e.g. `bazel-src/external/libtiff/libtiff`, and we'd like to be able to check that file in to make onboarding more pleasant, as well as to make life more pleasant for people who might have multiple worktrees checked out in different locations. The problem is that `bazel-src` there only works if you've checked the repository out in a directory named `src`.

### Which operating system are you running Bazel on?

Linux

### What is the output of `bazel info release`?

release 6.3.2

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing Bazel's --symlink_prefix handling and the generation of the execution-root convenience symlink, then review how .bazelrc and the WORKSPACE workspace name could provide a stable suffix or full name. Done means a supported configuration produces a predictable symlink independent of the checkout directory, with coverage for the selected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.