Skip to content

Commit c1b32bd

Browse files
committed
chore: Enable compiler layering check.
This ensures that we're explicit about what we depend on and avoids transitive dependencies.
1 parent eebc516 commit c1b32bd

File tree

4 files changed

+135
-12
lines changed

4 files changed

+135
-12
lines changed

other/bootstrap_daemon/BUILD.bazel

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
load("@rules_cc//cc:defs.bzl", "cc_binary")
22

3+
package(features = ["layering_check"])
4+
35
cc_binary(
46
name = "bootstrap_daemon",
57
srcs = glob([
@@ -9,6 +11,13 @@ cc_binary(
911
deps = [
1012
"//c-toxcore/other:bootstrap_node_packets",
1113
"//c-toxcore/toxcore",
14+
"//c-toxcore/toxcore:DHT",
15+
"//c-toxcore/toxcore:TCP_connection",
16+
"//c-toxcore/toxcore:ccompat",
17+
"//c-toxcore/toxcore:logger",
18+
"//c-toxcore/toxcore:mono_time",
19+
"//c-toxcore/toxcore:network",
20+
"//c-toxcore/toxcore:onion_announce",
1221
"@libconfig",
1322
],
1423
)

testing/BUILD.bazel

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
22

3+
package(features = ["layering_check"])
4+
35
CIMPLE_FILES = [
46
"//c-toxcore/toxav:cimple_files",
57
"//c-toxcore/toxcore:cimple_files",
@@ -20,7 +22,11 @@ cc_library(
2022
srcs = ["misc_tools.c"],
2123
hdrs = ["misc_tools.h"],
2224
visibility = ["//c-toxcore:__subpackages__"],
23-
deps = ["//c-toxcore/toxcore"],
25+
deps = [
26+
"//c-toxcore/toxcore",
27+
"//c-toxcore/toxcore:ccompat",
28+
"@libsodium",
29+
],
2430
)
2531

2632
cc_library(
@@ -35,7 +41,10 @@ cc_binary(
3541
srcs = ["DHT_test.c"],
3642
deps = [
3743
":misc_tools",
38-
"//c-toxcore/toxcore",
44+
"//c-toxcore/toxcore:DHT",
45+
"//c-toxcore/toxcore:Messenger",
46+
"//c-toxcore/toxcore:friend_requests",
47+
"//c-toxcore/toxcore:mono_time",
3948
],
4049
)
4150

@@ -44,7 +53,8 @@ cc_binary(
4453
srcs = ["Messenger_test.c"],
4554
deps = [
4655
":misc_tools",
47-
"//c-toxcore/toxcore",
56+
"//c-toxcore/toxcore:Messenger",
57+
"//c-toxcore/toxcore:mono_time",
4858
],
4959
)
5060

toxav/BUILD.bazel

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
load("@rules_cc//cc:defs.bzl", "cc_test")
22
load("//tools:no_undefined.bzl", "cc_library")
33

4+
package(features = ["layering_check"])
5+
46
filegroup(
57
name = "public_headers",
68
srcs = ["toxav.h"],
@@ -25,6 +27,7 @@ cc_test(
2527
srcs = ["ring_buffer_test.cc"],
2628
deps = [
2729
":ring_buffer",
30+
"@com_google_googletest//:gtest",
2831
"@com_google_googletest//:gtest_main",
2932
],
3033
)
@@ -47,14 +50,23 @@ cc_library(
4750
":ring_buffer",
4851
"//c-toxcore/toxcore",
4952
"//c-toxcore/toxcore:Messenger",
53+
"//c-toxcore/toxcore:logger",
54+
"//c-toxcore/toxcore:mono_time",
55+
"//c-toxcore/toxcore:network",
5056
],
5157
)
5258

5359
cc_library(
5460
name = "rtp",
5561
srcs = ["rtp.c"],
5662
hdrs = ["rtp.h"],
57-
deps = [":bwcontroller"],
63+
deps = [
64+
":bwcontroller",
65+
"//c-toxcore/toxcore:Messenger",
66+
"//c-toxcore/toxcore:logger",
67+
"//c-toxcore/toxcore:mono_time",
68+
"//c-toxcore/toxcore:network",
69+
],
5870
)
5971

6072
cc_test(
@@ -64,6 +76,7 @@ cc_test(
6476
deps = [
6577
":rtp",
6678
"//c-toxcore/toxcore:crypto_core",
79+
"@com_google_googletest//:gtest",
6780
"@com_google_googletest//:gtest_main",
6881
],
6982
)
@@ -75,6 +88,8 @@ cc_library(
7588
deps = [
7689
":public",
7790
":rtp",
91+
"//c-toxcore/toxcore:logger",
92+
"//c-toxcore/toxcore:mono_time",
7893
"//c-toxcore/toxcore:network",
7994
"@opus",
8095
],
@@ -93,6 +108,10 @@ cc_library(
93108
deps = [
94109
":audio",
95110
":public",
111+
":ring_buffer",
112+
":rtp",
113+
"//c-toxcore/toxcore:logger",
114+
"//c-toxcore/toxcore:mono_time",
96115
"//c-toxcore/toxcore:network",
97116
"@libvpx",
98117
],
@@ -104,6 +123,9 @@ cc_library(
104123
hdrs = ["groupav.h"],
105124
deps = [
106125
"//c-toxcore/toxcore",
126+
"//c-toxcore/toxcore:logger",
127+
"//c-toxcore/toxcore:mono_time",
128+
"//c-toxcore/toxcore:network",
107129
"@opus",
108130
],
109131
)
@@ -120,7 +142,12 @@ cc_library(
120142
visibility = ["//c-toxcore:__subpackages__"],
121143
deps = [
122144
":groupav",
145+
":rtp",
123146
":video",
147+
"//c-toxcore/toxcore:Messenger",
148+
"//c-toxcore/toxcore:logger",
149+
"//c-toxcore/toxcore:mono_time",
150+
"//c-toxcore/toxcore:network",
124151
],
125152
)
126153

0 commit comments

Comments
 (0)