This is an archive of the discontinued LLVM Phabricator instance.

[Bazel] Use dynamic workspace root determination
ClosedPublic

Authored by aaronmondal on Oct 28 2022, 10:41 PM.

Details

Summary

The clang:ast and clang:builtin_headers_gen targets currently use hardcoded external/llvm-project
paths to access generated headers.

With bzlmod this path becomes dependent on the module name, module version and module extension,
so we need a more dynamic approach.

Does not affect the WORKSPACE build.

Diff Detail

Event Timeline

aaronmondal created this revision.Oct 28 2022, 10:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2022, 10:41 PM
aaronmondal requested review of this revision.Oct 28 2022, 10:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2022, 10:41 PM
GMNGeoffrey added inline comments.Nov 3 2022, 4:29 PM
utils/bazel/llvm-project-overlay/clang/BUILD.bazel
731

Oh this is way better. These have always felt like a hack relying on a Bazel implementation detail.

It seems like you're synced to a bad commit that's broken for other reasons. Could you rebase and try the pre-merge checks again?

It seems like you're synced to a bad commit that's broken for other reasons. Could you rebase and try the pre-merge checks again?

Re-ran builds. Seems to work now 😊

Rebase. Let's rerun tests once more to make sure this is fine.

Hahaha reminder to self: I need to of course change the last line in the commit message to "Does not affect the WORKSPACE build" 😂😂

aaronmondal added a reviewer: Restricted Project.Apr 1 2023, 7:22 AM
aaronmondal edited the summary of this revision. (Show Details)Apr 1 2023, 8:29 AM
mravishankar resigned from this revision.Apr 17 2023, 12:55 PM
GMNGeoffrey accepted this revision.Apr 17 2023, 1:27 PM

Much nicer, thank you. I thought I'd stamped out all the places where this was hardcoded

This revision is now accepted and ready to land.Apr 17 2023, 1:27 PM
This revision was automatically updated to reflect the committed changes.
MaskRay added inline comments.
utils/bazel/llvm-project-overlay/clang/BUILD.bazel
1545

c5f6a287499a816cba5585708999e2c8b134290f fixed an issue due to antique bash on macOS here :)