mirror of https://github.com/facebook/rocksdb.git
Fix skylark incompatible build files in rocksdb
Reviewed By: ttsugriy Differential Revision: D13583867 fbshipit-source-id: 8f218a9ffd9807d386ba0adc966af2a9a48ac64c
This commit is contained in:
parent
cf852fdf55
commit
a3ab59d030
90
TARGETS
90
TARGETS
|
@ -1,12 +1,9 @@
|
||||||
load("@fbcode_macros//build_defs:auto_headers.bzl", "AutoHeaders")
|
load("@fbcode_macros//build_defs:auto_headers.bzl", "AutoHeaders")
|
||||||
|
load(":defs.bzl", "test_binary")
|
||||||
|
|
||||||
REPO_PATH = package_name() + "/"
|
REPO_PATH = package_name() + "/"
|
||||||
|
|
||||||
BUCK_BINS = "buck-out/gen/" + REPO_PATH
|
ROCKSDB_COMPILER_FLAGS = [
|
||||||
|
|
||||||
TEST_RUNNER = REPO_PATH + "buckifier/rocks_test_runner.sh"
|
|
||||||
|
|
||||||
rocksdb_compiler_flags = [
|
|
||||||
"-fno-builtin-memcmp",
|
"-fno-builtin-memcmp",
|
||||||
"-DROCKSDB_PLATFORM_POSIX",
|
"-DROCKSDB_PLATFORM_POSIX",
|
||||||
"-DROCKSDB_LIB_IO_POSIX",
|
"-DROCKSDB_LIB_IO_POSIX",
|
||||||
|
@ -33,7 +30,7 @@ rocksdb_compiler_flags = [
|
||||||
"-Wnarrowing",
|
"-Wnarrowing",
|
||||||
]
|
]
|
||||||
|
|
||||||
rocksdb_external_deps = [
|
ROCKSDB_EXTERNAL_DEPS = [
|
||||||
("bzip2", None, "bz2"),
|
("bzip2", None, "bz2"),
|
||||||
("snappy", None, "snappy"),
|
("snappy", None, "snappy"),
|
||||||
("zlib", None, "z"),
|
("zlib", None, "z"),
|
||||||
|
@ -45,13 +42,13 @@ rocksdb_external_deps = [
|
||||||
("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": [
|
"x86_64": [
|
||||||
"-DHAVE_SSE42",
|
"-DHAVE_SSE42",
|
||||||
"-DHAVE_PCLMUL",
|
"-DHAVE_PCLMUL",
|
||||||
|
@ -64,16 +61,15 @@ is_opt_mode = build_mode.startswith("opt")
|
||||||
|
|
||||||
# -DNDEBUG is added by default in opt mode in fbcode. But adding it twice
|
# -DNDEBUG is added by default in opt mode in fbcode. But adding it twice
|
||||||
# doesn't harm and avoid forgetting to add it.
|
# doesn't harm and avoid forgetting to add it.
|
||||||
if is_opt_mode:
|
ROCKSDB_COMPILER_FLAGS += (["-DNDEBUG"] if is_opt_mode else [])
|
||||||
rocksdb_compiler_flags.append("-DNDEBUG")
|
|
||||||
|
|
||||||
sanitizer = read_config("fbcode", "sanitizer")
|
sanitizer = read_config("fbcode", "sanitizer")
|
||||||
|
|
||||||
# Do not enable jemalloc if sanitizer presents. RocksDB will further detect
|
# Do not enable jemalloc if sanitizer presents. RocksDB will further detect
|
||||||
# whether the binary is linked with jemalloc at runtime.
|
# whether the binary is linked with jemalloc at runtime.
|
||||||
if sanitizer == "":
|
ROCKSDB_COMPILER_FLAGS += (["-DROCKSDB_JEMALLOC"] if sanitizer == "" else [])
|
||||||
rocksdb_compiler_flags.append("-DROCKSDB_JEMALLOC")
|
|
||||||
rocksdb_external_deps.append(("jemalloc", None, "headers"))
|
ROCKSDB_EXTERNAL_DEPS += ([("jemalloc", None, "headers")] if sanitizer == "" else [])
|
||||||
|
|
||||||
cpp_library(
|
cpp_library(
|
||||||
name = "rocksdb_lib",
|
name = "rocksdb_lib",
|
||||||
|
@ -306,11 +302,11 @@ cpp_library(
|
||||||
"utilities/write_batch_with_index/write_batch_with_index_internal.cc",
|
"utilities/write_batch_with_index/write_batch_with_index_internal.cc",
|
||||||
],
|
],
|
||||||
auto_headers = AutoHeaders.RECURSIVE_GLOB,
|
auto_headers = AutoHeaders.RECURSIVE_GLOB,
|
||||||
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 = [],
|
deps = [],
|
||||||
external_deps = rocksdb_external_deps,
|
external_deps = ROCKSDB_EXTERNAL_DEPS,
|
||||||
)
|
)
|
||||||
|
|
||||||
cpp_library(
|
cpp_library(
|
||||||
|
@ -328,11 +324,11 @@ cpp_library(
|
||||||
"utilities/column_aware_encoding_util.cc",
|
"utilities/column_aware_encoding_util.cc",
|
||||||
],
|
],
|
||||||
auto_headers = AutoHeaders.RECURSIVE_GLOB,
|
auto_headers = AutoHeaders.RECURSIVE_GLOB,
|
||||||
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 = [":rocksdb_lib"],
|
deps = [":rocksdb_lib"],
|
||||||
external_deps = rocksdb_external_deps,
|
external_deps = ROCKSDB_EXTERNAL_DEPS,
|
||||||
)
|
)
|
||||||
|
|
||||||
cpp_library(
|
cpp_library(
|
||||||
|
@ -343,22 +339,22 @@ cpp_library(
|
||||||
"util/testutil.cc",
|
"util/testutil.cc",
|
||||||
],
|
],
|
||||||
auto_headers = AutoHeaders.RECURSIVE_GLOB,
|
auto_headers = AutoHeaders.RECURSIVE_GLOB,
|
||||||
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 = [":rocksdb_lib"],
|
deps = [":rocksdb_lib"],
|
||||||
external_deps = rocksdb_external_deps,
|
external_deps = ROCKSDB_EXTERNAL_DEPS,
|
||||||
)
|
)
|
||||||
|
|
||||||
cpp_library(
|
cpp_library(
|
||||||
name = "env_basic_test_lib",
|
name = "env_basic_test_lib",
|
||||||
srcs = ["env/env_basic_test.cc"],
|
srcs = ["env/env_basic_test.cc"],
|
||||||
auto_headers = AutoHeaders.RECURSIVE_GLOB,
|
auto_headers = AutoHeaders.RECURSIVE_GLOB,
|
||||||
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 = [":rocksdb_test_lib"],
|
deps = [":rocksdb_test_lib"],
|
||||||
external_deps = rocksdb_external_deps,
|
external_deps = ROCKSDB_EXTERNAL_DEPS,
|
||||||
)
|
)
|
||||||
|
|
||||||
# [test_name, test_src, test_type]
|
# [test_name, test_src, test_type]
|
||||||
|
@ -1103,26 +1099,16 @@ ROCKS_TESTS = [
|
||||||
# Generate a test rule for each entry in ROCKS_TESTS
|
# Generate a test rule for each entry in ROCKS_TESTS
|
||||||
# Do not build the tests in opt mode, since SyncPoint and other test code
|
# Do not build the tests in opt mode, since SyncPoint and other test code
|
||||||
# will not be included.
|
# will not be included.
|
||||||
if not is_opt_mode:
|
[
|
||||||
for test_cfg in ROCKS_TESTS:
|
test_binary(
|
||||||
test_name = test_cfg[0]
|
parallelism = parallelism,
|
||||||
test_cc = test_cfg[1]
|
rocksdb_arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS,
|
||||||
ttype = "gtest" if test_cfg[2] == "parallel" else "simple"
|
rocksdb_compiler_flags = ROCKSDB_COMPILER_FLAGS,
|
||||||
test_bin = test_name + "_bin"
|
rocksdb_external_deps = ROCKSDB_EXTERNAL_DEPS,
|
||||||
|
rocksdb_preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS,
|
||||||
cpp_binary(
|
test_cc = test_cc,
|
||||||
name = test_bin,
|
test_name = test_name,
|
||||||
srcs = [test_cc],
|
)
|
||||||
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
|
for test_name, test_cc, parallelism in ROCKS_TESTS
|
||||||
compiler_flags = rocksdb_compiler_flags,
|
if not is_opt_mode
|
||||||
preprocessor_flags = rocksdb_preprocessor_flags,
|
]
|
||||||
deps = [":rocksdb_test_lib"],
|
|
||||||
external_deps = rocksdb_external_deps,
|
|
||||||
)
|
|
||||||
|
|
||||||
custom_unittest(
|
|
||||||
name = test_name,
|
|
||||||
command = [TEST_RUNNER, BUCK_BINS + test_bin],
|
|
||||||
type = ttype,
|
|
||||||
deps = [":" + test_bin],
|
|
||||||
)
|
|
||||||
|
|
|
@ -3,14 +3,11 @@ 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 = """load("@fbcode_macros//build_defs:auto_headers.bzl", "AutoHeaders")
|
rocksdb_target_header = """load("@fbcode_macros//build_defs:auto_headers.bzl", "AutoHeaders")
|
||||||
|
load(":defs.bzl", "test_binary")
|
||||||
|
|
||||||
REPO_PATH = package_name() + "/"
|
REPO_PATH = package_name() + "/"
|
||||||
|
|
||||||
BUCK_BINS = "buck-out/gen/" + REPO_PATH
|
ROCKSDB_COMPILER_FLAGS = [
|
||||||
|
|
||||||
TEST_RUNNER = REPO_PATH + "buckifier/rocks_test_runner.sh"
|
|
||||||
|
|
||||||
rocksdb_compiler_flags = [
|
|
||||||
"-fno-builtin-memcmp",
|
"-fno-builtin-memcmp",
|
||||||
"-DROCKSDB_PLATFORM_POSIX",
|
"-DROCKSDB_PLATFORM_POSIX",
|
||||||
"-DROCKSDB_LIB_IO_POSIX",
|
"-DROCKSDB_LIB_IO_POSIX",
|
||||||
|
@ -37,7 +34,7 @@ rocksdb_compiler_flags = [
|
||||||
"-Wnarrowing",
|
"-Wnarrowing",
|
||||||
]
|
]
|
||||||
|
|
||||||
rocksdb_external_deps = [
|
ROCKSDB_EXTERNAL_DEPS = [
|
||||||
("bzip2", None, "bz2"),
|
("bzip2", None, "bz2"),
|
||||||
("snappy", None, "snappy"),
|
("snappy", None, "snappy"),
|
||||||
("zlib", None, "z"),
|
("zlib", None, "z"),
|
||||||
|
@ -49,13 +46,13 @@ rocksdb_external_deps = [
|
||||||
("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": [
|
"x86_64": [
|
||||||
"-DHAVE_SSE42",
|
"-DHAVE_SSE42",
|
||||||
"-DHAVE_PCLMUL",
|
"-DHAVE_PCLMUL",
|
||||||
|
@ -68,16 +65,15 @@ is_opt_mode = build_mode.startswith("opt")
|
||||||
|
|
||||||
# -DNDEBUG is added by default in opt mode in fbcode. But adding it twice
|
# -DNDEBUG is added by default in opt mode in fbcode. But adding it twice
|
||||||
# doesn't harm and avoid forgetting to add it.
|
# doesn't harm and avoid forgetting to add it.
|
||||||
if is_opt_mode:
|
ROCKSDB_COMPILER_FLAGS += (["-DNDEBUG"] if is_opt_mode else [])
|
||||||
rocksdb_compiler_flags.append("-DNDEBUG")
|
|
||||||
|
|
||||||
sanitizer = read_config("fbcode", "sanitizer")
|
sanitizer = read_config("fbcode", "sanitizer")
|
||||||
|
|
||||||
# Do not enable jemalloc if sanitizer presents. RocksDB will further detect
|
# Do not enable jemalloc if sanitizer presents. RocksDB will further detect
|
||||||
# whether the binary is linked with jemalloc at runtime.
|
# whether the binary is linked with jemalloc at runtime.
|
||||||
if sanitizer == "":
|
ROCKSDB_COMPILER_FLAGS += (["-DROCKSDB_JEMALLOC"] if sanitizer == "" else [])
|
||||||
rocksdb_compiler_flags.append("-DROCKSDB_JEMALLOC")
|
|
||||||
rocksdb_external_deps.append(("jemalloc", None, "headers"))
|
ROCKSDB_EXTERNAL_DEPS += ([("jemalloc", None, "headers")] if sanitizer == "" else [])
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,11 +82,11 @@ cpp_library(
|
||||||
name = "{name}",
|
name = "{name}",
|
||||||
srcs = [{srcs}],
|
srcs = [{srcs}],
|
||||||
{headers_attr_prefix}headers = {headers},
|
{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 = [{deps}],
|
deps = [{deps}],
|
||||||
external_deps = rocksdb_external_deps,
|
external_deps = ROCKSDB_EXTERNAL_DEPS,
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -98,11 +94,11 @@ binary_template = """
|
||||||
cpp_binary(
|
cpp_binary(
|
||||||
name = "%s",
|
name = "%s",
|
||||||
srcs = [%s],
|
srcs = [%s],
|
||||||
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 = [%s],
|
||||||
external_deps = rocksdb_external_deps,
|
external_deps = ROCKSDB_EXTERNAL_DEPS,
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -121,27 +117,17 @@ ROCKS_TESTS = [
|
||||||
# Generate a test rule for each entry in ROCKS_TESTS
|
# Generate a test rule for each entry in ROCKS_TESTS
|
||||||
# Do not build the tests in opt mode, since SyncPoint and other test code
|
# Do not build the tests in opt mode, since SyncPoint and other test code
|
||||||
# will not be included.
|
# will not be included.
|
||||||
if not is_opt_mode:
|
[
|
||||||
for test_cfg in ROCKS_TESTS:
|
test_binary(
|
||||||
test_name = test_cfg[0]
|
parallelism = parallelism,
|
||||||
test_cc = test_cfg[1]
|
rocksdb_arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS,
|
||||||
ttype = "gtest" if test_cfg[2] == "parallel" else "simple"
|
rocksdb_compiler_flags = ROCKSDB_COMPILER_FLAGS,
|
||||||
test_bin = test_name + "_bin"
|
rocksdb_external_deps = ROCKSDB_EXTERNAL_DEPS,
|
||||||
|
rocksdb_preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS,
|
||||||
cpp_binary(
|
test_cc = test_cc,
|
||||||
name = test_bin,
|
test_name = test_name,
|
||||||
srcs = [test_cc],
|
)
|
||||||
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
|
for test_name, test_cc, parallelism in ROCKS_TESTS
|
||||||
compiler_flags = rocksdb_compiler_flags,
|
if not is_opt_mode
|
||||||
preprocessor_flags = rocksdb_preprocessor_flags,
|
]
|
||||||
deps = [":rocksdb_test_lib"],
|
|
||||||
external_deps = rocksdb_external_deps,
|
|
||||||
)
|
|
||||||
|
|
||||||
custom_unittest(
|
|
||||||
name = test_name,
|
|
||||||
command = [TEST_RUNNER, BUCK_BINS + test_bin],
|
|
||||||
type = ttype,
|
|
||||||
deps = [":" + test_bin],
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue