简体   繁体   中英

bazel targets that are lazily built

I'm using " bazel-deps -like" solution to keep my maven third party jars. in a pair of maven_jar repository rule and java_import rule. As part of a big organisation I sync all of our managed dependencies to the workspace. That makes me having a lot more dependency targets that I actually use.

The problem is when running bazel build //... - it refers to all java_import (or scala_import ) and downloads all jars (even those I don't need).

How can I tell bazel to build those third party targets only if referred in the other targets.

One very ugly solution I can think of is to move all internal targets to one main folder:

+ third_party
  | - com
  | - org
+ internal
  | - module-a
  | - module-b

and then I can build only my internal targets by running bazel run //internal/... But it's far from being elegant.

I'd be happy to have some kind of flag on targets that I don't want to be built unless directly or transitively required by targets that do not have this flag.

Targets with tags=["manual"] will not be included in wildcard target patterns (..., :*, :all, etc). You should specify such test targets with explicit target patterns on the command line if you want Bazel to build/test them.

https://docs.bazel.build/versions/master/user-manual.html#target-patterns

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM