chen3feng / blade-build

Blade is a powerful build system from Tencent, supports many mainstream programming languages, such as C/C++, java, scala, python, protobuf...
Other
2.05k stars 500 forks source link

can't declare a dependency to a lib in the root directory #965

Closed ericuni closed 2 years ago

ericuni commented 2 years ago

Describe the bug

.
├── again
│   ├── BUILD
│   └── hello_test.cc
├── BLADE_ROOT
├── BUILD
├── hello.cpp
├── hello.h
└── hello_test.cc

BUILD in the root directory defines a simple library

cc_library(
  name = 'hello',
  hdrs = 'hello.h',
  srcs = 'hello.cpp',
)

And hello_test in again directory wants to use the hello lib, but I couldn't find a way to declare the dependency in BUILD.

cc_test(
  name = 'hello_test',
  srcs = 'hello_test.cc',
  deps = '//:hello',
)

I have tried the deps with //:hello, '//./:hello', //hello', but all would fail.

To Reproduce Use a lib within the root directory.

Expected behavior Those libs defined in the root directory could be used in other directories.

Error message

again(master ✗) bb
Blade: Entering directory `/root/git/blade_example'
Blade(info): Loading config file "/root/opt/blade-build/blade.conf"
Blade(info): Loading config file "/root/git/blade_example/BLADE_ROOT"
Blade(info): Loading BUILD files...
again/BUILD:4: error: hello_test: Target "//:hello" does not exist
Blade(info): Loading done.
Blade(error): There are 1 errors in the load stage
Blade(info): Cost time 0.0305s
Blade(error): Failure

System (please complete the following information):

Additional context None

chen3feng commented 2 years ago

confirmed, thanks.