ERROR:target 'all' not declared in package

1,668 views
Skip to first unread message

Yogur

unread,
Jul 27, 2015, 5:17:26 AM7/27/15
to bazel-discuss

I can bazel build //v/test:all  or  bazel build //v/test:*   to compile  all the targets in the v/test/BUILD as the http://bazel.io/ writes,
however,I got the error as follows:

ERROR: no such target '//v/test:all': target 'all' not declared in package 'v/test' defined by v/test/BUILD and referenced by '//:lpp'.
ERROR: Loading failed; build aborted.


genrule(
    name = "lpp",
    outs = ["######"],
    srcs=["//v/test:all"],
    cmd = "######",
)


any reply would be appreciated~~~

Damien Martin-guillerez

unread,
Jul 27, 2015, 5:22:44 AM7/27/15
to Yogur, bazel-discuss
Hello,

all is a wildcard and you cannot use it except in the command line. In the genrule you have to explictely list all the dependency your rules depends on.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/934e7e91-a723-426e-9c2c-e323b19eda9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yogur

unread,
Jul 27, 2015, 5:41:49 AM7/27/15
to bazel-discuss, dmar...@google.com
alright...
I use a loop to compile many .c files to simplify the code...
now I have to explictely list all the dependency...
:(
thx for your reply

Damien Martin-guillerez

unread,
Jul 27, 2015, 5:54:32 AM7/27/15
to Yogur, bazel-discuss
You could use list comprehension like:
genrule(
   name = "lpp-"
   ...
   srcs = ["//v/test:input-rule-" + file.replace(".", "_") for file in glob(["**/*.c"])]
)
(untested example)

That would avoid you from writing a lot of boilerplate.
Reply all
Reply to author
Forward
0 new messages