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

Append the workspace name to the runfiles directory name #856

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

EdSchouten
Copy link
Contributor

@EdSchouten EdSchouten commented Apr 17, 2024

The runfiles directory is broken down by workspace name. This means that files belonging to the main workspace are placed at "${name}.runfiles/${ctx.workspace_name}/${short_path}". Files belonging to externals have a short_path starting with "../${external_name}".

Because we currently don't append ctx.workspace_name to the computed runfiles path, files belonging to the main workspace are placed at the top level of the runfiles directory, which is incorrect. Even worse is that files belonging to external repositories end up alongside the runfiles directory, instead of being contained within.

This makes the runfiles directory layout consistent with how Bazel creates it locally:

$ find bazel-bin/tests/an_executable.runfiles \! -type d 
bazel-bin/tests/an_executable.runfiles/MANIFEST
bazel-bin/tests/an_executable.runfiles/_repo_mapping
bazel-bin/tests/an_executable.runfiles/_main/tests/testdata/hello.txt
bazel-bin/tests/an_executable.runfiles/_main/tests/foo.cc
bazel-bin/tests/an_executable.runfiles/_main/tests/an_executable

The runfiles directory is broken down by workspace name. This means that
files belonging to the main workspace are placed at
"${name}.runfiles/${ctx.workspace_name}/${short_path}". Files belonging
to externals have a short_path starting with "../${external_name}".

Because we currently don't append ctx.workspace_name to the computed
runfiles path, files belonging to the main workspace are placed at the
top level of the runfiles directory, which is incorrect. Even worse is
that files belonging to external repositories end up alongside the
runfiles directory, instead of being contained within.
@cgrindel
Copy link
Collaborator

I will wait to merge until @aiuto has had a chance to look at this.

@aiuto
Copy link
Collaborator

aiuto commented Apr 24, 2024

This is probably going to break people, but it is the right thing to do. We're going to have to bump the major version # on the next release.

@aiuto aiuto merged commit a811e7f into bazelbuild:main Apr 24, 2024
2 checks passed
@EdSchouten EdSchouten deleted the eschouten/20240417-workspace-name branch April 24, 2024 04:27
@korjek
Copy link

korjek commented May 16, 2024

is this supposed to be released soon?

@aiuto
Copy link
Collaborator

aiuto commented May 17, 2024

I can do a release by end of month.

@korjek
Copy link

korjek commented Jun 3, 2024

@aiuto sorry for bothering you.
Are there any updates on release that contains this change?

@aiuto
Copy link
Collaborator

aiuto commented Jun 3, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants