diff options
author | Neil Mitchell <ndmitchell@fb.com> | 2020-12-07 10:26:20 -0800 |
---|---|---|
committer | Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> | 2020-12-07 10:28:26 -0800 |
commit | b77569f18bfc77fb1d8a0b3218f6ecf571bc4988 (patch) | |
tree | 4ca4e63e8303694075dfdcdafa1ea6eb6a7c68f3 /buckifier | |
parent | 1df85848968f8822fa3df411dfbcc818f020fe38 (diff) |
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
Diffstat (limited to 'buckifier')
-rw-r--r-- | buckifier/targets_builder.py | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/buckifier/targets_builder.py b/buckifier/targets_builder.py index e9f6f5be4..78f6c18ec 100644 --- a/buckifier/targets_builder.py +++ b/buckifier/targets_builder.py @@ -79,26 +79,24 @@ class TARGETSBuilder(object): def add_c_test(self): self.targets_file.write(b""" -if not is_opt_mode: - cpp_binary( - name = "c_test_bin", - srcs = ["db/c_test.c"], - arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, - os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, - compiler_flags = ROCKSDB_COMPILER_FLAGS, - preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, - deps = [":rocksdb_test_lib"], - ) +cpp_binary( + name = "c_test_bin", + srcs = ["db/c_test.c"], + arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, + os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, + 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( - "c_test", - command = [ - native.package_name() + "/buckifier/rocks_test_runner.sh", - "$(location :{})".format("c_test_bin"), - ], - type = "simple", - ) +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, |