From f5f22a5c764d83e448578ed39f1bc6d480024b9a Mon Sep 17 00:00:00 2001 From: iphydf Date: Tue, 11 Jan 2022 21:28:53 +0000 Subject: [PATCH] chore: Enable layering check in all c-toxcore build files. --- BUILD.bazel | 2 ++ auto_tests/BUILD.bazel | 16 ++++++++++++++++ other/BUILD.bazel | 8 ++++++++ other/fun/BUILD.bazel | 6 ++++++ super_donators/BUILD.bazel | 2 ++ toxcore/BUILD.bazel | 29 ++++++++++++++++++++++++++--- toxencryptsave/BUILD.bazel | 9 ++++++++- 7 files changed, 68 insertions(+), 4 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 5b644fee..0b47b5da 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_cc//cc:defs.bzl", "cc_library") load("//tools/project:build_defs.bzl", "project") +package(features = ["layering_check"]) + project() genrule( diff --git a/auto_tests/BUILD.bazel b/auto_tests/BUILD.bazel index c7a40c8c..0fa6cd9b 100644 --- a/auto_tests/BUILD.bazel +++ b/auto_tests/BUILD.bazel @@ -1,5 +1,7 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") +package(features = ["layering_check"]) + cc_library( name = "check_compat", testonly = True, @@ -36,6 +38,20 @@ flaky_tests = { "//c-toxcore/toxav", "//c-toxcore/toxcore", "//c-toxcore/toxcore:DHT_srcs", + "//c-toxcore/toxcore:Messenger", + "//c-toxcore/toxcore:TCP_connection", + "//c-toxcore/toxcore:ccompat", + "//c-toxcore/toxcore:crypto_core", + "//c-toxcore/toxcore:friend_connection", + "//c-toxcore/toxcore:logger", + "//c-toxcore/toxcore:mono_time", + "//c-toxcore/toxcore:net_crypto", + "//c-toxcore/toxcore:network", + "//c-toxcore/toxcore:onion", + "//c-toxcore/toxcore:onion_announce", + "//c-toxcore/toxcore:onion_client", "//c-toxcore/toxencryptsave", + "@libsodium", + "@libvpx", ], ) for src in glob(["*_test.c"])] diff --git a/other/BUILD.bazel b/other/BUILD.bazel index 63652181..ebfde238 100644 --- a/other/BUILD.bazel +++ b/other/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_cc//cc:defs.bzl", "cc_binary") load("//tools:no_undefined.bzl", "cc_library") +package(features = ["layering_check"]) + cc_library( name = "bootstrap_node_packets", srcs = ["bootstrap_node_packets.c"], @@ -15,5 +17,11 @@ cc_binary( deps = [ "//c-toxcore/testing:misc_tools", "//c-toxcore/toxcore", + "//c-toxcore/toxcore:DHT", + "//c-toxcore/toxcore:TCP_connection", + "//c-toxcore/toxcore:friend_requests", + "//c-toxcore/toxcore:logger", + "//c-toxcore/toxcore:mono_time", + "//c-toxcore/toxcore:network", ], ) diff --git a/other/fun/BUILD.bazel b/other/fun/BUILD.bazel index 7ed252a4..19809393 100644 --- a/other/fun/BUILD.bazel +++ b/other/fun/BUILD.bazel @@ -1,5 +1,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary") +package(features = ["layering_check"]) + #cc_binary( # name = "cracker", # srcs = ["cracker.c"], @@ -16,6 +18,7 @@ cc_binary( srcs = ["cracker_simple.c"], deps = [ "//c-toxcore/testing:misc_tools", + "//c-toxcore/toxcore:ccompat", "@libsodium", ], ) @@ -24,6 +27,7 @@ cc_binary( name = "minimal-save-generator", srcs = ["minimal-save-generator.c"], deps = [ + "//c-toxcore/toxcore:ccompat", "@libsodium", ], ) @@ -34,6 +38,7 @@ cc_binary( copts = ["-w"], deps = [ "//c-toxcore/testing:misc_tools", + "//c-toxcore/toxcore:ccompat", "@libsodium", ], ) @@ -53,5 +58,6 @@ cc_binary( deps = [ "//c-toxcore/testing:misc_tools", "//c-toxcore/toxcore", + "//c-toxcore/toxcore:ccompat", ], ) diff --git a/super_donators/BUILD.bazel b/super_donators/BUILD.bazel index f268d5d5..353e34af 100644 --- a/super_donators/BUILD.bazel +++ b/super_donators/BUILD.bazel @@ -1,5 +1,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary") +package(features = ["layering_check"]) + cc_binary( name = "grencez_tok5", srcs = ["grencez_tok5.c"], diff --git a/toxcore/BUILD.bazel b/toxcore/BUILD.bazel index 862f8eee..e11f91fc 100644 --- a/toxcore/BUILD.bazel +++ b/toxcore/BUILD.bazel @@ -66,6 +66,8 @@ cc_library( srcs = ["logger.c"], hdrs = ["logger.h"], visibility = [ + "//c-toxcore/auto_tests:__pkg__", + "//c-toxcore/other:__pkg__", "//c-toxcore/other/bootstrap_daemon:__pkg__", "//c-toxcore/toxav:__pkg__", ], @@ -84,6 +86,8 @@ cc_library( srcs = ["mono_time.c"], hdrs = ["mono_time.h"], visibility = [ + "//c-toxcore/auto_tests:__pkg__", + "//c-toxcore/other:__pkg__", "//c-toxcore/other/bootstrap_daemon:__pkg__", "//c-toxcore/testing:__pkg__", "//c-toxcore/toxav:__pkg__", @@ -116,6 +120,7 @@ cc_library( "util.h", ], visibility = [ + "//c-toxcore/auto_tests:__pkg__", "//c-toxcore/other:__pkg__", "//c-toxcore/other/bootstrap_daemon:__pkg__", "//c-toxcore/toxav:__pkg__", @@ -190,6 +195,7 @@ cc_library( "ping.h", ], visibility = [ + "//c-toxcore/other:__pkg__", "//c-toxcore/other/bootstrap_daemon:__pkg__", "//c-toxcore/testing:__pkg__", ], @@ -227,6 +233,7 @@ cc_library( ], visibility = [ "//c-toxcore/auto_tests:__pkg__", + "//c-toxcore/other:__pkg__", "//c-toxcore/other/bootstrap_daemon:__pkg__", ], deps = [ @@ -242,6 +249,7 @@ cc_library( name = "onion", srcs = ["onion.c"], hdrs = ["onion.h"], + visibility = ["//c-toxcore/auto_tests:__pkg__"], deps = [ ":DHT", ":crypto_core", @@ -266,7 +274,11 @@ cc_library( "//tools/config:linux": ["-DTCP_SERVER_USE_EPOLL=1"], "//conditions:default": [], }), - visibility = ["//c-toxcore/other/bootstrap_daemon:__pkg__"], + visibility = [ + "//c-toxcore/auto_tests:__pkg__", + "//c-toxcore/other:__pkg__", + "//c-toxcore/other/bootstrap_daemon:__pkg__", + ], deps = [ ":crypto_core", ":list", @@ -291,6 +303,7 @@ cc_library( name = "net_crypto", srcs = ["net_crypto.c"], hdrs = ["net_crypto.h"], + visibility = ["//c-toxcore/auto_tests:__pkg__"], deps = [ ":DHT", ":TCP_connection", @@ -303,7 +316,10 @@ cc_library( name = "onion_announce", srcs = ["onion_announce.c"], hdrs = ["onion_announce.h"], - visibility = ["//c-toxcore/other/bootstrap_daemon:__pkg__"], + visibility = [ + "//c-toxcore/auto_tests:__pkg__", + "//c-toxcore/other/bootstrap_daemon:__pkg__", + ], deps = [ ":DHT", ":mono_time", @@ -316,6 +332,7 @@ cc_library( name = "onion_client", srcs = ["onion_client.c"], hdrs = ["onion_client.h"], + visibility = ["//c-toxcore/auto_tests:__pkg__"], deps = [ ":DHT", ":mono_time", @@ -329,6 +346,7 @@ cc_library( name = "friend_connection", srcs = ["friend_connection.c"], hdrs = ["friend_connection.h"], + visibility = ["//c-toxcore/auto_tests:__pkg__"], deps = [ ":DHT", ":mono_time", @@ -353,7 +371,11 @@ cc_library( name = "friend_requests", srcs = ["friend_requests.c"], hdrs = ["friend_requests.h"], - visibility = ["//c-toxcore/testing:__pkg__"], + visibility = [ + "//c-toxcore/auto_tests:__pkg__", + "//c-toxcore/other:__pkg__", + "//c-toxcore/testing:__pkg__", + ], deps = [ ":friend_connection", ":network", @@ -365,6 +387,7 @@ cc_library( srcs = ["Messenger.c"], hdrs = ["Messenger.h"], visibility = [ + "//c-toxcore/auto_tests:__pkg__", "//c-toxcore/testing:__pkg__", "//c-toxcore/toxav:__pkg__", ], diff --git a/toxencryptsave/BUILD.bazel b/toxencryptsave/BUILD.bazel index 395c4a20..1b083c5f 100644 --- a/toxencryptsave/BUILD.bazel +++ b/toxencryptsave/BUILD.bazel @@ -1,5 +1,7 @@ load("//tools:no_undefined.bzl", "cc_library") +package(features = ["layering_check"]) + filegroup( name = "public_headers", srcs = ["toxencryptsave.h"], @@ -21,6 +23,7 @@ cc_library( ":defines", "//c-toxcore/toxcore:ccompat", "//c-toxcore/toxcore:crypto_core", + "@libsodium", ], ) @@ -31,7 +34,11 @@ cc_library( "*.h", ]), visibility = ["//c-toxcore/other:__pkg__"], - deps = ["//c-toxcore/toxcore:crypto_core"], + deps = [ + "//c-toxcore/toxcore:ccompat", + "//c-toxcore/toxcore:crypto_core", + "@libsodium", + ], ) CIMPLE_SRCS = glob(