-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Please let me exclude some directories when running bazel test //...
#2460
Comments
Hi @math4tots , can you try |
@meteorcloudy ah thanks, that seems to work I don't want to push too hard on something where we don't immediately need it... But this is going to be a bit annoying going forward having to specify this for every new directory that might have this issue right? Is there a way to ignore all subdirectories of a given directory? |
Yeah, I agree. We should support not only a package, but also all packages under a certain directory. |
(see also #1083) This would also be useful to us on RobotLocomotion/drake. Our legacy CMake build checks out externals as git submodules. The submodules are underneath the WORKSPACE directory, so if they contain BUILD files, |
We should definitely do something along. |
hi, i randomly came across this FR just now. we actually already have the meat of this functionality implemented (the original commit was 7ef96d7), it's currently unused in bazel. it's used internally at google to blacklist certain directories we don't want to index. BlacklistedPackagePrefixesValue [1] contains a set of directories which and whose subdirectories BlacklistedPackagePrefixesValue is produced from the contents of a file in the workspace whose path is hardcoded into bazel. you can see in [2] that it's hardcoded to be nothing, but you could imagine changing since into a constant agreed-upon path in the workspace (perhaps under 'tools/'?) or into a value set by a user flag. let me know if you have any questions. bazel/src/main/java/com/google/devtools/build/lib/skyframe/SequencedSkyframeExecutor.java Line 172 in 65a15ed
|
I have trouble specifically with nested For example, if I have a top-level Seems like any folder with a |
nested WORKSPACE should be ignored if they are included in the parent workpsace by way of local_repository. /cc @katre |
@pcj To re-iterate what @dmg just said, there are two pieces to the logic at play with WORKSPACE files in your project:
There is a bug (#2841) currently where a local_directory without a WORKSPACE is considered valid. I'm in the process of submitting https://bazel-review.googlesource.com/c/10271/ to make this an error. |
I have a similar issue to @david-german-tri. Our project has some sub-directories that use cmake to pull external projects (one of which is grpc). When doing "bazel test //...", it tries to build the files in that sub-directory. I would really like a way to ignore a whole directory, and all of its sub-directories. We also have a sub-directory at the top of the repo called "experimental", where developers are allowed to submit whatever they want (working or not). This whole directory should be ignored when running "bazel test //...", and I'm not sure how to achieve that currently |
Happy birthday issue #2460! I also ran into this issue with golang's It would be great to be able to ignore a folder AND all its subfolders, because maintaining a list of ignored folders is a bit much... That being said |
As
local_repository(
name = "ignore_thing",
path = "./thing",
) Then, commands on |
The I do want to access/build files in there if they are necessary, but sometimes they have dependencies in files I don't care about (e.g. I use only a small part of library A, but if I were using its XML parsing capabilities too, it would also depend on library B for that). Normally this is not an issue if I explicitly build/test targets directly, but if I use I want to run Maybe in the future |
+1 for this, I have a problem where our CI system pushes branches called BUILD whenever a successful build completes. You can probably guess how that interferes with |
Example:
|
Neither of the workarounds mentioned by @jwnimmer-tri or @phedoreanu seem to help in my repo - bazel still scans and scans |
We created a read-only FUSE mount of symlinks with all the undesired directory and files excluded to make it possible to use Given the VFS implementation in bazel, adding a filter should not be that hard. However, I don't think bazel team will implement that anytime soon, as they have much bigger fishes to fry all the time. |
I wonder if the recent work on #4888 is good enough to close this issue? |
I tested 0.17.1rc1 which adds support for |
@aehlig Confirmed; |
Great, so I think we can finally consider this feature request closed. |
Is that explained in the docs somewhere? I have to resort to random DuckDuckGo searches, because the docs are just not usable for even basic use-cases like having nested workspaces. :( |
@Profpatsch: I'm not even sure where this comment should live, but you are correct that it's not well documented. Please feel free to file additional issues as feature requests to add more documentation. |
Description of the problem / feature request / question:
I need a command that will let me exclude certain directories when running
bazel test //...
.I'm working on a project that involves a ton of Go code that won't play nice with bazel and needs glide. The non-Go code in Scala uses bazel. Now our Go code depends on https://github.com/coreos/docs/tree/master/golang and it causes a
BUILD
file to get created under thevendor
directory, that has nothing to do with bazel.This messes up
bazel test //...
, and I can't use it anymore to test everything.bazel test //... --deleted_packages=vendor
doesn't work either, since bazel tries to parse all the BUILD files first, even the ones I'm trying to include.The error message I get:
If possible, provide a minimal example to reproduce the problem:
Start with a working bazel workspace.
Create a directory named
vendor/foo
. Create a file namedvendor/foo/BUILD
, and add rubbish inside it.Now try running
bazel test //...
.Environment info
Operating System:
OS X
Bazel version (output of
bazel info release
):release 0.3.2-homebrew
Have you found anything relevant by searching the web? (e.g. GitHub issues, email threads in the bazel-discuss@googlegroups.com archive)
Someone asked something very similar before: #829
But the solution proposed there (
deleted_packages
) doesn't work, as demonstrated above.The text was updated successfully, but these errors were encountered: