'Bazel: submodule in project does not use bazel , pushing to git doesnt include locally added BUILD file in submodule, how do i build?
I am just starting to learn how to use bazel following this tutorial
One thing I am unsure how to do is how to use a submodule, from my own repo for example. where I do not use bazel. The repo just has some c/h files that I need to pull in. To make things work locally I added a BUILD file in folder pulled in from submodules. However after I commit and push my changes the BUILD file is obviously not there. How do I add the c/h files from the submodule folder to my build. Bazel seems to be looking for a BUILD folder in that directory and there will be none, if for example someone else clones this repo.
currently my "main" Directory has this build file:
cc_library(
name = "uCShell-main",
srcs = ["main.c"],
deps = ["//uCShell:uCShell-lib" ],
)
cc_binary(
name = "uCShell-bin",
deps = [":uCShell-main" , "//uCShell:uCShell-lib" ]
)
and the folder with the pulled in submodule has this locally added BUILD file:
cc_library(
name = "uCShell-lib",
srcs = glob(["*.c"]),
hdrs = glob(["*.h"]),
visibility = ["//visibility:public"],
)
This works and compiles just fine. However do correct any issues or misuse of Bazel you see here, I'd like to learn. Ultimately to reiterate the issue, when I push this project the locally added BUILD file will not be in the project because it is not in the original submodule. So how can I inlcude the c/h files in that submodule in order to build my main. And I would like to leave it as a submodule. Ultimately I can just add a BUILD file for the submodule's repo, but would like to find a better way, for example what if this was not my repo where I can just add a BUILD file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
