Make the TARGETS file Starlark compliant (#7743)

Summary:
Buck TARGETS files are sometimes parsed with Python, and sometimes with Starlark - this TARGETS file was not Starlark compliant. In Starlark you can't have a top-level if in a TARGETS file, but you can have a ternary `a if b else c`. Therefore I converted TARGETS, and updated the generator for it.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7743

Reviewed By: pdillinger

Differential Revision: D25342587

Pulled By: ndmitchell

fbshipit-source-id: 88cbe8632071a45a3ea8675812967614c62c78d1
main
Neil Mitchell 4 years ago committed by Facebook GitHub Bot
parent 1df8584896
commit b77569f18b
  1. 10
      TARGETS
  2. 10
      buckifier/targets_builder.py

@ -775,8 +775,7 @@ cpp_library(
external_deps = ROCKSDB_EXTERNAL_DEPS,
)
if not is_opt_mode:
cpp_binary(
cpp_binary(
name = "c_test_bin",
srcs = ["db/c_test.c"],
arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS,
@ -784,17 +783,16 @@ if not is_opt_mode:
compiler_flags = ROCKSDB_COMPILER_FLAGS,
preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS,
deps = [":rocksdb_test_lib"],
)
) if not is_opt_mode else None
if not is_opt_mode:
custom_unittest(
custom_unittest(
"c_test",
command = [
native.package_name() + "/buckifier/rocks_test_runner.sh",
"$(location :{})".format("c_test_bin"),
],
type = "simple",
)
) if not is_opt_mode else None
cpp_library(
name = "env_basic_test_lib",

@ -79,8 +79,7 @@ class TARGETSBuilder(object):
def add_c_test(self):
self.targets_file.write(b"""
if not is_opt_mode:
cpp_binary(
cpp_binary(
name = "c_test_bin",
srcs = ["db/c_test.c"],
arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS,
@ -88,17 +87,16 @@ if not is_opt_mode:
compiler_flags = ROCKSDB_COMPILER_FLAGS,
preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS,
deps = [":rocksdb_test_lib"],
)
) if not is_opt_mode else None
if not is_opt_mode:
custom_unittest(
custom_unittest(
"c_test",
command = [
native.package_name() + "/buckifier/rocks_test_runner.sh",
"$(location :{})".format("c_test_bin"),
],
type = "simple",
)
) if not is_opt_mode else None
""")
def register_test(self,

Loading…
Cancel
Save