Fix buck target db_stress_lib in opt mode (#6847)

Summary:
In buck build with opt mode, target should not include rocksdb_test_lib.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6847

Test Plan: Watch for internal cont build.

Reviewed By: ajkr

Differential Revision: D21586803

Pulled By: riversand963

fbshipit-source-id: 76d253c18d16fac6cab86a8c3f6b471ad5b6efb3
main
Yanqin Jin 5 years ago committed by Facebook GitHub Bot
parent 50ba245f6d
commit d790e6004f
  1. 10
      TARGETS
  2. 5
      buckifier/buckify_rocksdb.py
  3. 12
      buckifier/targets_builder.py
  4. 20
      buckifier/targets_cfg.py

@ -109,6 +109,11 @@ ROCKSDB_OS_DEPS += ([(
["third-party//jemalloc:headers"], ["third-party//jemalloc:headers"],
)] if sanitizer == "" else []) )] if sanitizer == "" else [])
ROCKSDB_LIB_DEPS = [
":rocksdb_lib",
":rocksdb_test_lib",
] if not is_opt_mode else [":rocksdb_lib"]
cpp_library( cpp_library(
name = "rocksdb_lib", name = "rocksdb_lib",
srcs = [ srcs = [
@ -437,10 +442,7 @@ cpp_library(
os_deps = ROCKSDB_OS_DEPS, os_deps = ROCKSDB_OS_DEPS,
os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS,
preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS,
deps = [ deps = ROCKSDB_LIB_DEPS,
":rocksdb_lib",
":rocksdb_test_lib",
],
external_deps = ROCKSDB_EXTERNAL_DEPS, external_deps = ROCKSDB_EXTERNAL_DEPS,
) )

@ -168,12 +168,11 @@ def generate_targets(repo_path, deps_map):
["test_util/testutil.cc"], ["test_util/testutil.cc"],
[":rocksdb_lib"]) [":rocksdb_lib"])
# rocksdb_stress_lib # rocksdb_stress_lib
TARGETS.add_library( TARGETS.add_rocksdb_library(
"rocksdb_stress_lib", "rocksdb_stress_lib",
src_mk.get("ANALYZER_LIB_SOURCES", []) src_mk.get("ANALYZER_LIB_SOURCES", [])
+ src_mk.get('STRESS_LIB_SOURCES', []) + src_mk.get('STRESS_LIB_SOURCES', [])
+ ["test_util/testutil.cc"], + ["test_util/testutil.cc"])
[":rocksdb_lib", ":rocksdb_test_lib"])
print("Extra dependencies:\n{0}".format(json.dumps(deps_map))) print("Extra dependencies:\n{0}".format(json.dumps(deps_map)))
# test for every test we found in the Makefile # test for every test we found in the Makefile

@ -50,6 +50,18 @@ class TARGETSBuilder(object):
deps=pretty_list(deps))) deps=pretty_list(deps)))
self.total_lib = self.total_lib + 1 self.total_lib = self.total_lib + 1
def add_rocksdb_library(self, name, srcs, headers=None):
headers_attr_prefix = ""
if headers is None:
headers_attr_prefix = "auto_"
headers = "AutoHeaders.RECURSIVE_GLOB"
self.targets_file.write(targets_cfg.rocksdb_library_template.format(
name=name,
srcs=pretty_list(srcs),
headers_attr_prefix=headers_attr_prefix,
headers=headers))
self.total_lib = self.total_lib + 1
def add_binary(self, name, srcs, deps=None): def add_binary(self, name, srcs, deps=None):
self.targets_file.write(targets_cfg.binary_template % ( self.targets_file.write(targets_cfg.binary_template % (
name, name,

@ -114,6 +114,11 @@ ROCKSDB_OS_DEPS += ([(
"linux", "linux",
["third-party//jemalloc:headers"], ["third-party//jemalloc:headers"],
)] if sanitizer == "" else []) )] if sanitizer == "" else [])
ROCKSDB_LIB_DEPS = [
":rocksdb_lib",
":rocksdb_test_lib",
] if not is_opt_mode else [":rocksdb_lib"]
""" """
@ -132,6 +137,21 @@ cpp_library(
) )
""" """
rocksdb_library_template = """
cpp_library(
name = "{name}",
srcs = [{srcs}],
{headers_attr_prefix}headers = {headers},
arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS,
compiler_flags = ROCKSDB_COMPILER_FLAGS,
os_deps = ROCKSDB_OS_DEPS,
os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS,
preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS,
deps = ROCKSDB_LIB_DEPS,
external_deps = ROCKSDB_EXTERNAL_DEPS,
)
"""
binary_template = """ binary_template = """
cpp_binary( cpp_binary(
name = "%s", name = "%s",

Loading…
Cancel
Save