Skip to content

Commit fa15913

Browse files
committed
iox-#2432: Fix bazel build for --incompatible_disallow_empty_glob
1 parent 7592b2a commit fa15913

File tree

7 files changed

+79
-129
lines changed

7 files changed

+79
-129
lines changed

iceoryx_binding_c/test/BUILD.bazel

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,31 @@
1414
#
1515
# SPDX-License-Identifier: Apache-2.0
1616

17-
load("@rules_cc//cc:defs.bzl", "cc_test")
17+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
18+
19+
cc_library(
20+
name = "test",
21+
testonly = True,
22+
hdrs = ["test.hpp"],
23+
includes = ["."],
24+
deps = ["@googletest//:gtest"],
25+
)
26+
27+
cc_library(
28+
name = "mocks",
29+
testonly = True,
30+
hdrs = ["mocks/wait_set_mock.hpp"],
31+
includes = ["mocks"],
32+
deps = [
33+
"//iceoryx_binding_c",
34+
"//iceoryx_posh",
35+
],
36+
)
1837

1938
cc_test(
2039
name = "binding_c_moduletests",
21-
srcs = glob([
22-
"moduletests/*.cpp",
23-
"moduletests/*.hpp",
24-
"mocks/*.hpp",
25-
"*.hpp",
26-
]),
27-
includes = [
28-
".",
29-
"mocks",
30-
"moduletests",
31-
],
40+
srcs = glob(["moduletests/*"]),
41+
includes = ["moduletests"],
3242
linkopts = select({
3343
"//iceoryx_platform:linux": ["-ldl"],
3444
"//iceoryx_platform:mac": ["-ldl"],
@@ -38,8 +48,9 @@ cc_test(
3848
"//conditions:default": ["-ldl"],
3949
}),
4050
tags = ["exclusive"],
41-
visibility = ["//visibility:private"],
4251
deps = [
52+
":mocks",
53+
":test",
4354
"//iceoryx_binding_c",
4455
"//iceoryx_hoofs:iceoryx_hoofs_testing",
4556
"//iceoryx_posh",
@@ -50,17 +61,7 @@ cc_test(
5061

5162
cc_test(
5263
name = "binding_c_integrationtests",
53-
srcs = glob([
54-
"integrationtests/*.cpp",
55-
"integrationtests/*.hpp",
56-
"mocks/*.hpp",
57-
"*.hpp",
58-
]),
59-
includes = [
60-
".",
61-
"integrationtests",
62-
"mocks",
63-
],
64+
srcs = ["integrationtests/main_test_binding_c_integration.cpp"],
6465
linkopts = select({
6566
"//iceoryx_platform:linux": ["-ldl"],
6667
"//iceoryx_platform:mac": ["-ldl"],
@@ -70,8 +71,8 @@ cc_test(
7071
"//conditions:default": ["-ldl"],
7172
}),
7273
tags = ["exclusive"],
73-
visibility = ["//visibility:private"],
7474
deps = [
75+
":test",
7576
"//iceoryx_binding_c",
7677
"//iceoryx_hoofs:iceoryx_hoofs_testing",
7778
"//iceoryx_posh",

iceoryx_hoofs/BUILD.bazel

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,14 @@ configure_file(
3131

3232
cc_library(
3333
name = "iceoryx_hoofs",
34-
srcs = glob([
35-
"cli/source/*.cpp",
36-
"concurrent/buffer/source/*.cpp",
37-
"concurrent/sync/source/*.cpp",
38-
"design/source/*.cpp",
39-
"filesystem/source/*.cpp",
40-
"memory/source/*.cpp",
41-
"posix/auth/source/*.cpp",
42-
"posix/design/source/*.cpp",
43-
"posix/filesystem/source/*.cpp",
44-
"posix/ipc/source/*.cpp",
45-
"posix/sync/source/*.cpp",
46-
"posix/time/source/*.cpp",
47-
"posix/utility/source/*.cpp",
48-
"posix/vocabulary/source/*.cpp",
49-
"primitives/source/*.cpp",
50-
"reporting/source/*.cpp",
51-
"time/source/*.cpp",
52-
"utility/source/*.cpp",
53-
"vocabulary/source/**/*.cpp",
54-
]),
55-
hdrs = glob(["buffer/**"]) + glob(["cli/**"]) + glob(["concurrent/**"]) + glob(["container/**"]) + glob(["design/**"]) + glob(["filesystem/**"]) + glob(["functional/**"]) + glob(["legacy/**"]) + glob(["memory/**"]) + glob(["posix/**"]) + glob(["primitives/**"]) + glob(["reporting/**"]) + glob(["time/**"]) + glob(["utility/**"]) + glob(["vocabulary/**"]) + [
56-
":iceoryx_hoofs_deployment_hpp",
57-
],
34+
srcs = glob(
35+
[
36+
"**/*.cpp",
37+
"**/*.inl",
38+
],
39+
exclude = ["testing/**/*"],
40+
),
41+
hdrs = glob(["**/*.hpp"]) + [":iceoryx_hoofs_deployment_hpp"],
5842
includes = [
5943
"buffer/include/",
6044
"cli/include/",

iceoryx_hoofs/test/BUILD.bazel

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
#
1515
# SPDX-License-Identifier: Apache-2.0
1616

17-
load("@rules_cc//cc:defs.bzl", "cc_test")
17+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
18+
19+
cc_library(
20+
name = "test",
21+
testonly = True,
22+
hdrs = ["test.hpp"],
23+
includes = ["."],
24+
deps = ["@googletest//:gtest"],
25+
)
1826

1927
cc_test(
2028
name = "hoofs_moduletests",
21-
srcs = glob([
22-
"moduletests/*.cpp",
23-
"moduletests/*.hpp",
24-
"*.hpp",
25-
]),
26-
includes = [
27-
".",
28-
"moduletests",
29-
],
29+
srcs = glob(["moduletests/**/*"]),
3030
linkopts = select({
3131
"//iceoryx_platform:linux": ["-ldl"],
3232
"//iceoryx_platform:mac": [],
@@ -39,21 +39,15 @@ cc_test(
3939
"exclusive",
4040
"requires-fakeroot",
4141
],
42-
visibility = ["//visibility:private"],
43-
deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"],
42+
deps = [
43+
":test",
44+
"//iceoryx_hoofs:iceoryx_hoofs_testing",
45+
],
4446
)
4547

4648
cc_test(
4749
name = "hoofs_integrationtests",
48-
srcs = glob([
49-
"integrationtests/*.cpp",
50-
"integrationtests/*.hpp",
51-
"*.hpp",
52-
]),
53-
includes = [
54-
".",
55-
"integrationtests",
56-
],
50+
srcs = ["integrationtests/main_test_hoofs_integration.cpp"],
5751
linkopts = select({
5852
"//iceoryx_platform:linux": ["-ldl"],
5953
"//iceoryx_platform:mac": [],
@@ -63,6 +57,8 @@ cc_test(
6357
"//conditions:default": ["-ldl"],
6458
}),
6559
tags = ["exclusive"],
66-
visibility = ["//visibility:private"],
67-
deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"],
60+
deps = [
61+
":test",
62+
"//iceoryx_hoofs:iceoryx_hoofs_testing",
63+
],
6864
)

iceoryx_hoofs/test/stresstests/BUILD.bazel

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,12 @@ cc_test(
4040
"//conditions:default": ["-ldl"],
4141
}),
4242
tags = ["exclusive"],
43-
visibility = ["//visibility:private"],
4443
deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"],
4544
)
4645

4746
cc_test(
4847
name = "hoofs_stresstests",
49-
srcs = glob([
50-
"*.cpp",
51-
"*.hpp",
52-
]),
53-
includes = [
54-
".",
55-
"stresstests",
56-
],
48+
srcs = glob(["*.cpp"]),
5749
linkopts = select({
5850
"//iceoryx_platform:linux": ["-ldl"],
5951
"//iceoryx_platform:mac": [],
@@ -63,6 +55,5 @@ cc_test(
6355
"//conditions:default": ["-ldl"],
6456
}),
6557
tags = ["exclusive"],
66-
visibility = ["//visibility:private"],
6758
deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"],
6859
)

iceoryx_platform/test/BUILD.bazel

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@
1414
#
1515
# SPDX-License-Identifier: Apache-2.0
1616

17-
load("@rules_cc//cc:defs.bzl", "cc_test")
17+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
18+
19+
cc_library(
20+
name = "test",
21+
testonly = True,
22+
hdrs = ["test.hpp"],
23+
includes = ["."],
24+
deps = ["@googletest//:gtest"],
25+
)
1826

1927
cc_test(
2028
name = "platform_moduletests",
21-
srcs = glob([
22-
"moduletests/*.cpp",
23-
"moduletests/*.hpp",
24-
"*.hpp",
25-
]),
26-
data = glob(["input/**"]),
27-
includes = [
28-
".",
29-
"moduletests",
30-
],
29+
srcs = glob(["moduletests/*.cpp"]),
3130
linkopts = select({
3231
"//iceoryx_platform:linux": ["-ldl"],
3332
"//iceoryx_platform:mac": [],
@@ -37,37 +36,25 @@ cc_test(
3736
"//conditions:default": ["-ldl"],
3837
}),
3938
tags = ["exclusive"],
40-
visibility = ["//visibility:private"],
4139
deps = [
40+
":test",
4241
"//iceoryx_platform",
43-
"@googletest//:gtest",
4442
],
4543
)
4644

4745
cc_test(
4846
name = "platform_integrationtests",
49-
srcs = glob([
50-
"integrationtests/*.cpp",
51-
"integrationtests/*.hpp",
52-
"*.hpp",
53-
]),
54-
data = glob(["input/**"]),
55-
includes = [
56-
".",
57-
"integrationtests",
58-
],
47+
srcs = ["integrationtests/main_test_platform_integration.cpp"],
5948
linkopts = select({
6049
"//iceoryx_platform:linux": ["-ldl"],
61-
"//iceoryx_platform:mac": [],
6250
"//iceoryx_platform:qnx": [],
6351
"//iceoryx_platform:unix": [],
6452
"//iceoryx_platform:win": [],
6553
"//conditions:default": ["-ldl"],
6654
}),
6755
tags = ["exclusive"],
68-
visibility = ["//visibility:private"],
6956
deps = [
57+
":test",
7058
"//iceoryx_platform",
71-
"@googletest//:gtest",
7259
],
7360
)

iceoryx_posh/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ cc_library(
117117
name = "iceoryx_posh",
118118
srcs = glob(
119119
[
120-
"source/log/**",
121120
"source/capro/**",
122-
"source/error_handling/**",
123121
"source/mepoo/**",
124122
"source/popo/**",
125123
"source/version/**",

iceoryx_posh/test/BUILD.bazel

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@
1414
#
1515
# SPDX-License-Identifier: Apache-2.0
1616

17-
load("@rules_cc//cc:defs.bzl", "cc_test")
17+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
18+
19+
cc_library(
20+
name = "test",
21+
testonly = True,
22+
hdrs = ["test.hpp"],
23+
includes = ["."],
24+
deps = ["@googletest//:gtest"],
25+
)
1826

1927
cc_test(
2028
name = "posh_moduletests",
@@ -25,13 +33,6 @@ cc_test(
2533
"stubs/*.hpp",
2634
"*.hpp",
2735
]),
28-
data = glob(["input/**"]),
29-
includes = [
30-
".",
31-
"mocks",
32-
"moduletests",
33-
"stubs",
34-
],
3536
linkopts = select({
3637
"//iceoryx_platform:linux": ["-ldl"],
3738
"//iceoryx_platform:mac": [],
@@ -41,8 +42,8 @@ cc_test(
4142
"//conditions:default": ["-ldl"],
4243
}),
4344
tags = ["exclusive"],
44-
visibility = ["//visibility:private"],
4545
deps = [
46+
":test",
4647
"//iceoryx_hoofs:iceoryx_hoofs_testing",
4748
"//iceoryx_posh",
4849
"//iceoryx_posh:iceoryx_posh_config",
@@ -55,15 +56,7 @@ cc_test(
5556
cc_test(
5657
name = "posh_integrationtests",
5758
timeout = "long",
58-
srcs = glob([
59-
"integrationtests/*.cpp",
60-
"integrationtests/*.hpp",
61-
"*.hpp",
62-
]),
63-
includes = [
64-
".",
65-
"integrationtests",
66-
],
59+
srcs = glob(["integrationtests/*"]),
6760
linkopts = select({
6861
"//iceoryx_platform:linux": ["-ldl"],
6962
"//iceoryx_platform:mac": [],
@@ -73,8 +66,8 @@ cc_test(
7366
"//conditions:default": ["-ldl"],
7467
}),
7568
tags = ["exclusive"],
76-
visibility = ["//visibility:private"],
7769
deps = [
70+
":test",
7871
"//iceoryx_hoofs:iceoryx_hoofs_testing",
7972
"//iceoryx_posh",
8073
"//iceoryx_posh:iceoryx_posh_gateway",

0 commit comments

Comments
 (0)