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

Fix licence checker paths in Bazel 7 onwards #39

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

jwnrt
Copy link
Contributor

@jwnrt jwnrt commented Aug 23, 2024

Bazel 7 was unable to find the licence-checker the first time it was used by the rule, but could in subsequent rules. Turns out we were referencing it using .path which is relative to the repository root. This path isn't always available due to weird symlink business that Bazel does.

Instead, this PR changes it to use .short_path which is relative to the runfiles directory that Bazel executes the rule in. This is what the Bazel documentation tells you to use for accessing runfiles: https://bazel.build/rules/lib/builtins/File.html#path

This is also the path under which the file is mapped if it's in the runfiles of a binary.

I've also added a test which makes use of the rule to catch breakages.

I've removed the hack we were using before since it's no longer needed.

Checks that the rule is usable, but doesn't necessary test that it's
checking the correct files.

Signed-off-by: James Wainwright <[email protected]>
@jwnrt jwnrt changed the title Add test module which uses the rule Fix licence checker paths in Bazel 7 onwards Aug 23, 2024
@jwnrt jwnrt requested a review from pamaury August 23, 2024 15:30
@jwnrt jwnrt merged commit c1b420e into lowRISC:master Aug 23, 2024
1 check passed
@jwnrt jwnrt deleted the test-submodule branch August 27, 2024 14:22
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.

1 participant