Fix TARGETS lint warnings.

Summary:
Fix buckifier script and regenerate TARGETS file with no lint warnings.
Closes https://github.com/facebook/rocksdb/pull/3170

Differential Revision: D6328993

Pulled By: yiwu-arbug

fbshipit-source-id: 17d0e4ed92f676f35fed76659386611cc72b00b2
main
Yi Wu 7 years ago committed by Facebook Github Bot
parent bbcd3b0bd2
commit dd49f89466
  1. 944
      TARGETS
  2. 24
      buckifier/targets_builder.py
  3. 48
      buckifier/targets_cfg.py
  4. 14
      src.mk

File diff suppressed because it is too large Load Diff

@ -3,10 +3,8 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import targets_cfg
import pprint
# TODO(tec): replace this with PrettyPrinter
def pretty_list(lst, indent=6):
def pretty_list(lst, indent=8):
if lst is None or len(lst) == 0:
return ""
@ -14,8 +12,8 @@ def pretty_list(lst, indent=6):
return "\"%s\"" % lst[0]
separator = "\",\n%s\"" % (" " * indent)
res = separator.join(lst)
res = "\n" + (" " * indent) + "\"" + res + "\",\n" + (" " * (indent - 2))
res = separator.join(sorted(lst))
res = "\n" + (" " * indent) + "\"" + res + "\",\n" + (" " * (indent - 4))
return res
@ -27,7 +25,7 @@ class TARGETSBuilder:
self.total_lib = 0
self.total_bin = 0
self.total_test = 0
self.tests_cfg = []
self.tests_cfg = ""
def __del__(self):
self.targets_file.close()
@ -37,8 +35,8 @@ class TARGETSBuilder:
headers = "AutoHeaders.RECURSIVE_GLOB"
self.targets_file.write(targets_cfg.library_template % (
name,
headers,
pretty_list(srcs),
headers,
pretty_list(deps)))
self.total_lib = self.total_lib + 1
@ -53,13 +51,13 @@ class TARGETSBuilder:
exec_mode = "serial"
if is_parallel:
exec_mode = "parallel"
self.tests_cfg.append([test_name, str(src), str(exec_mode)])
self.tests_cfg += targets_cfg.test_cfg_template % (
test_name,
str(src),
str(exec_mode))
self.total_test = self.total_test + 1
def flush_tests(self):
self.targets_file.write(targets_cfg.unittests_template % (
pprint.PrettyPrinter().pformat(self.tests_cfg)
))
self.tests_cfg = []
self.targets_file.write(targets_cfg.unittests_template % self.tests_cfg)
self.tests_cfg = ""

@ -2,13 +2,16 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
rocksdb_target_header = """
import os
rocksdb_target_header = """import os
TARGETS_PATH = os.path.dirname(__file__)
REPO_PATH = "rocksdb/src/"
REPO_PATH = TARGETS_PATH[(TARGETS_PATH.find('fbcode/') + len('fbcode/')):] + "/"
BUCK_BINS = "buck-out/gen/" + REPO_PATH
TEST_RUNNER = REPO_PATH + "buckifier/rocks_test_runner.sh"
rocksdb_compiler_flags = [
"-fno-builtin-memcmp",
"-DROCKSDB_PLATFORM_POSIX",
@ -33,13 +36,13 @@ rocksdb_compiler_flags = [
]
rocksdb_external_deps = [
('bzip2', None, 'bz2'),
('snappy', None, "snappy"),
('zlib', None, 'z'),
('gflags', None, 'gflags'),
('lz4', None, 'lz4'),
('zstd', None),
('tbb', None),
("bzip2", None, "bz2"),
("snappy", None, "snappy"),
("zlib", None, "z"),
("gflags", None, "gflags"),
("lz4", None, "lz4"),
("zstd", None),
("tbb", None),
("numa", None, "numa"),
("googletest", None, "gtest"),
]
@ -59,12 +62,12 @@ rocksdb_arch_preprocessor_flags = {
library_template = """
cpp_library(
name = "%s",
headers = %s,
srcs = [%s],
deps = [%s],
preprocessor_flags = rocksdb_preprocessor_flags,
headers = %s,
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
compiler_flags = rocksdb_compiler_flags,
preprocessor_flags = rocksdb_preprocessor_flags,
deps = [%s],
external_deps = rocksdb_external_deps,
)
"""
@ -73,18 +76,25 @@ binary_template = """
cpp_binary(
name = "%s",
srcs = [%s],
deps = [%s],
preprocessor_flags = rocksdb_preprocessor_flags,
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
compiler_flags = rocksdb_compiler_flags,
preprocessor_flags = rocksdb_preprocessor_flags,
deps = [%s],
external_deps = rocksdb_external_deps,
)
"""
test_cfg_template = """ [
"%s",
"%s",
"%s",
],
"""
unittests_template = """
# [test_name, test_src, test_type]
ROCKS_TESTS = %s
ROCKS_TESTS = [
%s]
# Generate a test rule for each entry in ROCKS_TESTS
for test_cfg in ROCKS_TESTS:
@ -112,13 +122,13 @@ for test_cfg in ROCKS_TESTS:
custom_unittest(
name = "make_rocksdbjavastatic",
type = "simple",
command = ["internal_repo_rocksdb/make_rocksdbjavastatic.sh"],
type = "simple",
)
custom_unittest(
name = "make_rocksdb_lite_release",
type = "simple",
command = ["internal_repo_rocksdb/make_rocksdb_lite_release.sh"],
type = "simple",
)
"""

@ -15,13 +15,13 @@ LIB_SOURCES = \
db/convenience.cc \
db/db_filesnapshot.cc \
db/db_impl.cc \
db/db_impl_write.cc \
db/db_impl_compaction_flush.cc \
db/db_impl_files.cc \
db/db_impl_open.cc \
db/db_impl_debug.cc \
db/db_impl_experimental.cc \
db/db_impl_files.cc \
db/db_impl_open.cc \
db/db_impl_readonly.cc \
db/db_impl_write.cc \
db/db_info_dumper.cc \
db/db_iter.cc \
db/dbformat.cc \
@ -155,9 +155,9 @@ LIB_SOURCES = \
utilities/blob_db/blob_db.cc \
utilities/blob_db/blob_db_impl.cc \
utilities/blob_db/blob_file.cc \
utilities/blob_db/blob_log_format.cc \
utilities/blob_db/blob_log_reader.cc \
utilities/blob_db/blob_log_writer.cc \
utilities/blob_db/blob_log_format.cc \
utilities/blob_db/ttl_extractor.cc \
utilities/cassandra/cassandra_compaction_filter.cc \
utilities/cassandra/format.cc \
@ -192,8 +192,8 @@ LIB_SOURCES = \
utilities/simulator_cache/sim_cache.cc \
utilities/spatialdb/spatial_db.cc \
utilities/table_properties_collectors/compact_on_deletion_collector.cc \
utilities/transactions/optimistic_transaction_db_impl.cc \
utilities/transactions/optimistic_transaction.cc \
utilities/transactions/optimistic_transaction_db_impl.cc \
utilities/transactions/pessimistic_transaction.cc \
utilities/transactions/pessimistic_transaction_db.cc \
utilities/transactions/snapshot_checker.cc \
@ -231,14 +231,14 @@ BENCH_LIB_SOURCES = \
tools/db_bench_tool.cc \
EXP_LIB_SOURCES = \
utilities/col_buf_encoder.cc \
utilities/col_buf_decoder.cc \
utilities/col_buf_encoder.cc \
utilities/column_aware_encoding_util.cc
TEST_LIB_SOURCES = \
db/db_test_util.cc \
util/testharness.cc \
util/testutil.cc \
db/db_test_util.cc \
utilities/cassandra/test_utils.cc \
MAIN_SOURCES = \

Loading…
Cancel
Save