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
This commit is contained in:
Yi Wu 2017-11-15 14:13:39 -08:00
parent adee21951b
commit 5652b6e57f
4 changed files with 1055 additions and 535 deletions

944
TARGETS

File diff suppressed because it is too large Load Diff

View File

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

View File

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

14
src.mk
View File

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