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

Bazel: Fix relative go to definition in external repositories #103

Conversation

cameron-martin
Copy link
Contributor

@cameron-martin cameron-martin commented Jan 1, 2024

The resolve root was calculated incorrectly for relative load statements in external repositories. Instead of removing the file's path relative to the external repository, it only kept this part. For example if the current file is $(bazel info output_base)/external/foo/bar/BUILD, it would compute the resolve root as bar/BUILD, whereas it needs to be $(bazel info output_base)/external/foo.

For relative loads from external repositories, the resolve root was calcualated incorrectly. Instead of _removing_ the path of the file within the external repository, it only kept this part. For example if the current file was `$(bazel info output_base)/external/foo/bar/BUILD`, it would compute the resolve root as `bar/BUILD`, whereas it needs to be `$(bazel info output_base)/external/foo`.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 1, 2024
@facebook-github-bot
Copy link
Contributor

@ndmitchell has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@ndmitchell merged this pull request in c696737.

facebook-github-bot pushed a commit to facebook/buck2 that referenced this pull request Jan 19, 2024
Summary:
The resolve root was calculated incorrectly for relative load statements in external repositories. Instead of removing the file's path relative to the external repository, it only kept this part. For example if the current file is `$(bazel info output_base)/external/foo/bar/BUILD`, it would compute the resolve root as `bar/BUILD`, whereas it needs to be `$(bazel info output_base)/external/foo`.

X-link: facebook/starlark-rust#103

Reviewed By: stepancheg

Differential Revision: D52887182

Pulled By: ndmitchell

fbshipit-source-id: 3025ae7be81a85976f2e250c104de7163db6a6a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants