diff options
author | 2016-03-29 11:35:29 -0700 | |
---|---|---|
committer | 2016-03-29 13:02:25 -0700 | |
commit | b7b8d05f25974c1cf14718d23ca67192f63d41c0 (patch) | |
tree | 4dddfdb9730dd7007bd668f382a3c7833dc6b89d /templates | |
parent | 6e6230a6e4715be6b8ff0ab489e35a4e640bb50b (diff) |
Fix the Bazel build re/nanopb
This change modifies the BUILD rule dependencies used for nanopb,
switching them from third_party to //external -- the former uses
submodules, which don't work well with Bazel (since Bazel removes
submodules from repositories as it fetches them, preferring instead to
unify submodule versions across the workspace via the top-level
WORKSPACE configuration).
Diffstat (limited to 'templates')
-rw-r--r-- | templates/BUILD.template | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/templates/BUILD.template b/templates/BUILD.template index 54dc697125..ebf7ffbf9a 100644 --- a/templates/BUILD.template +++ b/templates/BUILD.template @@ -60,7 +60,7 @@ deps.append(':%s' % (d)) return deps %> - + % for lib in libs: % if lib.build in ("all", "protoc"): ${cc_library(lib)} @@ -80,13 +80,19 @@ % endfor <%def name="cc_library(lib)"> + <% + lib_hdrs = lib.get("headers", []) + hdrs = [h for h in lib_hdrs if not h.startswith('third_party/nanopb')] + srcs = [s for s in lib.src if not s.startswith('third_party/nanopb')] + uses_nanopb = len(lib_hdrs) != len(hdrs) or len(srcs) != len(lib.src) + %> cc_library( name = "${lib.name}", srcs = [ - % for hdr in lib.get("headers", []): + % for hdr in hdrs: "${hdr}", % endfor - % for src in lib.src: + % for src in srcs: "${src}", % endfor ], @@ -103,6 +109,9 @@ % for dep in get_deps(lib): "${dep}", % endfor + % if uses_nanopb: + "//external:nanopb", + % endif ], % if lib.name in ("grpc", "grpc_unsecure"): copts = [ @@ -113,10 +122,16 @@ </%def> <%def name="objc_library(lib)"> + <% + lib_hdrs = lib.get("headers", []) + hdrs = [h for h in lib_hdrs if not h.startswith('third_party/nanopb')] + srcs = [s for s in lib.src if not s.startswith('third_party/nanopb')] + uses_nanopb = len(lib_hdrs) != len(hdrs) or len(srcs) != len(lib.src) + %> objc_library( name = "${lib.name}_objc", srcs = [ - % for src in lib.src: + % for src in srcs: "${src}", % endfor ], @@ -124,7 +139,7 @@ % for hdr in lib.get("public_headers", []): "${hdr}", % endfor - % for hdr in lib.get("headers", []): + % for hdr in hdrs: "${hdr}", % endfor ], @@ -139,6 +154,9 @@ % if lib.get('secure', False): "//external:libssl_objc", % endif + % if uses_nanopb: + "//external:nanopb", + % endif ], % if lib.get("baselib", false): sdk_dylibs = ["libz"], |