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:
parent
adee21951b
commit
5652b6e57f
@ -3,19 +3,17 @@ 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 ""
|
||||||
|
|
||||||
if len(lst) == 1:
|
if len(lst) == 1:
|
||||||
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 = []
|
|
||||||
|
@ -2,56 +2,59 @@ 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",
|
||||||
"-DROCKSDB_LIB_IO_POSIX",
|
"-DROCKSDB_LIB_IO_POSIX",
|
||||||
"-DROCKSDB_FALLOCATE_PRESENT",
|
"-DROCKSDB_FALLOCATE_PRESENT",
|
||||||
"-DROCKSDB_MALLOC_USABLE_SIZE",
|
"-DROCKSDB_MALLOC_USABLE_SIZE",
|
||||||
"-DROCKSDB_RANGESYNC_PRESENT",
|
"-DROCKSDB_RANGESYNC_PRESENT",
|
||||||
"-DROCKSDB_SCHED_GETCPU_PRESENT",
|
"-DROCKSDB_SCHED_GETCPU_PRESENT",
|
||||||
"-DROCKSDB_SUPPORT_THREAD_LOCAL",
|
"-DROCKSDB_SUPPORT_THREAD_LOCAL",
|
||||||
"-DOS_LINUX",
|
"-DOS_LINUX",
|
||||||
# Flags to enable libs we include
|
# Flags to enable libs we include
|
||||||
"-DSNAPPY",
|
"-DSNAPPY",
|
||||||
"-DZLIB",
|
"-DZLIB",
|
||||||
"-DBZIP2",
|
"-DBZIP2",
|
||||||
"-DLZ4",
|
"-DLZ4",
|
||||||
"-DZSTD",
|
"-DZSTD",
|
||||||
"-DGFLAGS=gflags",
|
"-DGFLAGS=gflags",
|
||||||
"-DNUMA",
|
"-DNUMA",
|
||||||
"-DTBB",
|
"-DTBB",
|
||||||
# Needed to compile in fbcode
|
# Needed to compile in fbcode
|
||||||
"-Wno-expansion-to-defined",
|
"-Wno-expansion-to-defined",
|
||||||
]
|
]
|
||||||
|
|
||||||
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"),
|
||||||
]
|
]
|
||||||
|
|
||||||
rocksdb_preprocessor_flags = [
|
rocksdb_preprocessor_flags = [
|
||||||
# Directories with files for #include
|
# Directories with files for #include
|
||||||
"-I" + REPO_PATH + "include/",
|
"-I" + REPO_PATH + "include/",
|
||||||
"-I" + REPO_PATH,
|
"-I" + REPO_PATH,
|
||||||
]
|
]
|
||||||
|
|
||||||
rocksdb_arch_preprocessor_flags = {
|
rocksdb_arch_preprocessor_flags = {
|
||||||
"x86_64": ["-DHAVE_SSE42"],
|
"x86_64": ["-DHAVE_SSE42"],
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -59,32 +62,39 @@ 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,
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
binary_template = """
|
binary_template = """
|
||||||
cpp_binary(
|
cpp_binary(
|
||||||
name = "%s",
|
name = "%s",
|
||||||
srcs = [%s],
|
srcs = [%s],
|
||||||
deps = [%s],
|
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
|
||||||
preprocessor_flags = rocksdb_preprocessor_flags,
|
compiler_flags = rocksdb_compiler_flags,
|
||||||
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
|
preprocessor_flags = rocksdb_preprocessor_flags,
|
||||||
compiler_flags = rocksdb_compiler_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",
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
38
src.mk
38
src.mk
@ -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 \
|
||||||
@ -218,10 +218,10 @@ LIB_SOURCES_C =
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
TOOL_LIB_SOURCES = \
|
TOOL_LIB_SOURCES = \
|
||||||
tools/ldb_cmd.cc \
|
tools/ldb_cmd.cc \
|
||||||
tools/ldb_tool.cc \
|
tools/ldb_tool.cc \
|
||||||
tools/sst_dump_tool.cc \
|
tools/sst_dump_tool.cc \
|
||||||
utilities/blob_db/blob_dump_tool.cc \
|
utilities/blob_db/blob_dump_tool.cc \
|
||||||
|
|
||||||
MOCK_LIB_SOURCES = \
|
MOCK_LIB_SOURCES = \
|
||||||
table/mock_table.cc \
|
table/mock_table.cc \
|
||||||
@ -231,19 +231,19 @@ 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 = \
|
||||||
util/testharness.cc \
|
db/db_test_util.cc \
|
||||||
util/testutil.cc \
|
util/testharness.cc \
|
||||||
db/db_test_util.cc \
|
util/testutil.cc \
|
||||||
utilities/cassandra/test_utils.cc \
|
utilities/cassandra/test_utils.cc \
|
||||||
|
|
||||||
MAIN_SOURCES = \
|
MAIN_SOURCES = \
|
||||||
cache/cache_bench.cc \
|
cache/cache_bench.cc \
|
||||||
cache/cache_test.cc \
|
cache/cache_test.cc \
|
||||||
db/column_family_test.cc \
|
db/column_family_test.cc \
|
||||||
db/compaction_job_stats_test.cc \
|
db/compaction_job_stats_test.cc \
|
||||||
db/compaction_job_test.cc \
|
db/compaction_job_test.cc \
|
||||||
@ -258,7 +258,7 @@ MAIN_SOURCES = \
|
|||||||
db/db_compaction_test.cc \
|
db/db_compaction_test.cc \
|
||||||
db/db_dynamic_level_test.cc \
|
db/db_dynamic_level_test.cc \
|
||||||
db/db_encryption_test.cc \
|
db/db_encryption_test.cc \
|
||||||
db/db_flush_test.cc \
|
db/db_flush_test.cc \
|
||||||
db/db_inplace_update_test.cc \
|
db/db_inplace_update_test.cc \
|
||||||
db/db_io_failure_test.cc \
|
db/db_io_failure_test.cc \
|
||||||
db/db_iter_test.cc \
|
db/db_iter_test.cc \
|
||||||
|
Loading…
Reference in New Issue
Block a user