Skip to content

Commit ed6f851

Browse files
committed
style: bazel: put functions and lists in separate files.
This will allow us to auto-generate the lists (e.g. with cmake) at a later date if needed to support cmake or the like.
1 parent 0243b97 commit ed6f851

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
load(":bigtable_emulator_common.bzl", "bigtable_emulator_common_hdrs", "bigtable_emulator_common_srcs")
1616
load(":bigtable_emulator_programs.bzl", "bigtable_emulator_programs")
1717
load(":bigtable_emulator_test_common.bzl", "bigtable_emulator_test_common_hdrs", "bigtable_emulator_test_common_srcs")
18-
load(":bigtable_emulator_unit_tests.bzl", "bigtable_emulator_unit_tests", "gen_cc_tests")
18+
load(":bigtable_emulator_unit_tests.bzl", "bigtable_emulator_unit_tests")
19+
load(":funcs.bzl", "gen_cc_tests")
1920

2021
cc_library(
2122
name = "bigtable_emulator_common",

bigtable_emulator_unit_tests.bzl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,3 @@ bigtable_emulator_unit_tests = [
2323
"server_test.cc",
2424
"table_test.cc",
2525
]
26-
27-
def gen_cc_tests(srcs, deps = [], copts = []):
28-
for src in srcs:
29-
test_name = src.replace("/", "_").replace(".cc", "")
30-
native.cc_test(
31-
name = test_name,
32-
srcs = [src],
33-
deps = deps,
34-
copts = copts,
35-
)

funcs.bzl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
def gen_cc_tests(srcs, deps = [], copts = []):
16+
for src in srcs:
17+
test_name = src.replace("/", "_").replace(".cc", "")
18+
native.cc_test(
19+
name = test_name,
20+
srcs = [src],
21+
deps = deps,
22+
copts = copts,
23+
)

0 commit comments

Comments
 (0)