-
-
Notifications
You must be signed in to change notification settings - Fork 156
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: #1370 - restrict bazel projects to pattern BUILD{,.bazel}
#1373
Conversation
4258360
to
f0e139e
Compare
…el}` Signed-off-by: Florian Heubeck <[email protected]>
f0e139e
to
e5982ea
Compare
@@ -1898,7 +1898,7 @@ export async function createJavaBom(path, options) { | |||
// NOTE: This can match BUILD files used by perl, so could lead to errors in some projects | |||
const bazelFiles = getAllFiles( | |||
path, | |||
`${options.multiProject ? "**/" : ""}BUILD*`, | |||
`${options.multiProject ? "**/" : ""}BUILD{,.bazel}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of looking for BUILD
and BUILD.bazel
files, it should instead:
WORKSPACE
- since that defines a Bazel project (and alsoWORKSPACE.bazel
), and only at the root directory of the projectMODULE.bazel
- as an alternative toWORKSPACE
in newer versions of Bazel
As the error suggests we can only run Bazel build commands from "below a directory having a WORKSPACE file" so even just looking for BUILD
and BUILD.bazel
will still result in failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so
`(WORKSPACE{,.bazel}|${options.multiProject ? "**/" : ""}BUILD{,.bazel})`
would be the pattern?
or can't it be covered with the pattern at all as it's a conditional thing, depending on a WORKSPACE file to be present or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some bazel projects without any workspace files. Not sure since when workspace was introduced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to find a WORKSPACE
or a MODULE.bazel
file at the root of the project, so something like
(WORKSPACE{,.bazel}|MODULE.bazel)
Alternatively you can run bazel info
and look for the message
ERROR: The 'info' command is only supported from within a workspace (below a directory having a WORKSPACE file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me try this in a new PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. This will fix the immediate problem of incorrectly triggering bazel for gradle projects
No description provided.