Change BUCK template files (#4624)

Summary:
Slightly changes the format of generated BUCK files for Facebook consumption. Generated targets end up looking like this:
```
cpp_library(
    name = "rocksdb_tools_lib",
    srcs = [
        "tools/db_bench_tool.cc",
        "tools/trace_analyzer_tool.cc",
        "util/testutil.cc",
    ],
    auto_headers = AutoHeaders.RECURSIVE_GLOB,
    arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
    compiler_flags = rocksdb_compiler_flags,
    preprocessor_flags = rocksdb_preprocessor_flags,
    deps = [":rocksdb_lib"],
    external_deps = rocksdb_external_deps,
)
```
Instead of
```
cpp_library(
    name = "rocksdb_tools_lib",
    srcs = [
        "tools/db_bench_tool.cc",
        "tools/trace_analyzer_tool.cc",
        "util/testutil.cc",
    ],
    headers = AutoHeaders.RECURSIVE_GLOB,
    arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
    compiler_flags = rocksdb_compiler_flags,
    preprocessor_flags = rocksdb_preprocessor_flags,
    deps = [":rocksdb_lib"],
    external_deps = rocksdb_external_deps,
)
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4624

Reviewed By: riversand963

Differential Revision: D12906711

Pulled By: philipjameson

fbshipit-source-id: 32ab64a3390cdcf2c4043ff77517ac1ad58a5e2b
main
Philip Jameson 6 years ago committed by Facebook Github Bot
parent 61311157ff
commit 6c6cb465b1
  1. 13
      buckifier/targets_builder.py
  2. 8
      buckifier/targets_cfg.py

@ -31,13 +31,16 @@ class TARGETSBuilder:
self.targets_file.close() self.targets_file.close()
def add_library(self, name, srcs, deps=None, headers=None): def add_library(self, name, srcs, deps=None, headers=None):
headers_attr_prefix = ""
if headers is None: if headers is None:
headers_attr_prefix = "auto_"
headers = "AutoHeaders.RECURSIVE_GLOB" headers = "AutoHeaders.RECURSIVE_GLOB"
self.targets_file.write(targets_cfg.library_template % ( self.targets_file.write(targets_cfg.library_template.format(
name, name=name,
pretty_list(srcs), srcs=pretty_list(srcs),
headers, headers_attr_prefix=headers_attr_prefix,
pretty_list(deps))) headers=headers,
deps=pretty_list(deps)))
self.total_lib = self.total_lib + 1 self.total_lib = self.total_lib + 1
def add_binary(self, name, srcs, deps=None): def add_binary(self, name, srcs, deps=None):

@ -85,13 +85,13 @@ if default_allocator.startswith("jemalloc") and sanitizer == "":
library_template = """ library_template = """
cpp_library( cpp_library(
name = "%s", name = "{name}",
srcs = [%s], srcs = [{srcs}],
headers = %s, {headers_attr_prefix}headers = {headers},
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags, arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
compiler_flags = rocksdb_compiler_flags, compiler_flags = rocksdb_compiler_flags,
preprocessor_flags = rocksdb_preprocessor_flags, preprocessor_flags = rocksdb_preprocessor_flags,
deps = [%s], deps = [{deps}],
external_deps = rocksdb_external_deps, external_deps = rocksdb_external_deps,
) )
""" """

Loading…
Cancel
Save