better bazel error message for empty glob

379 views
Skip to first unread message

thibaul...@device-insight.com

unread,
Nov 27, 2015, 3:04:27 AM11/27/15
to bazel-dev
Hi,

just a suggestion to improve error output. In my case:

java_test(
    name = "example-tests",
    srcs = glob(["src/test/java/**/*Test.java"],
    deps = [
        ':example',
        '@junit//jar',
        '@hamcrest-all//jar',
    ],
)

cause error:
ERROR: /home/kruset/work/java/build-bench/build/bazel/BUILD:27:12: in deps attribute of java_test rule //:example-tests: deps not allowed without srcs; move to runtime_deps?.

The cause was that srcs globbing did not hit any files. It might be more useful if the rule gave at least a warning if the globbing did not produce files.

Damien Martin-guillerez

unread,
Nov 27, 2015, 3:24:52 AM11/27/15
to thibaul...@device-insight.com, bazel-dev
Hi,

The problem is that in some situation glob returning an empty list is actually wanted as a regular case so it doesn't really make sense to give a warning there.

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.
To post to this group, send email to baze...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-dev/405e209c-416e-41e7-b784-a8c2dad544f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages