Skip to content

Commit dae6bbe

Browse files
dsarlisIDX GitHub Automation
andauthored
chore: Update visibility of dfn_* libraries (#804)
This PR updates the visibility of `dfn_*` libraries to only the packages that really need them. `dfn_*` libraries in `rust_canisters` are considered the "internal" Rust CDK which is long deprecated. We eventually plan to remove it but we cannot yet as different parts of the code still depend on them. The first step is to disallow usage of these libraries outside of their current users to prevent them from spreading out even more. The restrictions are as strict as they can reasonably be without having to list a gazillion of packages (e.g. `//rs/nns` is whitelisted for all its packages as the majority needs them anyway). --------- Co-authored-by: IDX GitHub Automation <infra+github-automation@dfinity.org>
1 parent a0c43a1 commit dae6bbe

File tree

7 files changed

+71
-7
lines changed

7 files changed

+71
-7
lines changed

rs/rust_canisters/dfn_candid/BUILD.bazel

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@ load("@rules_rust//rust:defs.bzl", "rust_library")
22
load("//bazel:canisters.bzl", "rust_canister")
33
load("//bazel:defs.bzl", "rust_ic_test")
44

5-
package(default_visibility = ["//visibility:public"])
5+
package(default_visibility = [
6+
# Keep sorted.
7+
"//rs/nervous_system/clients:__pkg__",
8+
"//rs/nervous_system/common:__subpackages__",
9+
"//rs/nervous_system/runtime:__pkg__",
10+
"//rs/nns:__subpackages__",
11+
"//rs/registry/canister:__pkg__",
12+
"//rs/rosetta-api:__pkg__",
13+
"//rs/rosetta-api/icp_ledger:__subpackages__",
14+
"//rs/rust_canisters:__subpackages__",
15+
"//rs/scenario_tests:__pkg__",
16+
"//rs/sns:__subpackages__",
17+
"//rs/tests:__subpackages__",
18+
])
619

720
DEPENDENCIES = [
821
# Keep sorted.

rs/rust_canisters/dfn_core/BUILD.bazel

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,22 @@ load("@rules_rust//rust:defs.bzl", "rust_doc_test", "rust_library", "rust_test")
22
load("//bazel:canisters.bzl", "rust_canister")
33
load("//bazel:defs.bzl", "rust_ic_test")
44

5-
package(default_visibility = ["//visibility:public"])
5+
package(default_visibility = [
6+
# Keep sorted.
7+
"//publish/canisters:__pkg__",
8+
"//rs/nervous_system/clients:__pkg__",
9+
"//rs/nervous_system/common:__subpackages__",
10+
"//rs/nervous_system/root:__pkg__",
11+
"//rs/nervous_system/runtime:__pkg__",
12+
"//rs/nns:__subpackages__",
13+
"//rs/registry/canister:__pkg__",
14+
"//rs/rosetta-api/icp_ledger:__subpackages__",
15+
"//rs/rosetta-api/icrc1/benchmark/generator:__pkg__",
16+
"//rs/rosetta-api/icrc1/benchmark/worker:__pkg__",
17+
"//rs/rust_canisters:__subpackages__",
18+
"//rs/sns:__subpackages__",
19+
"//rs/tests/test_canisters/message:__pkg__",
20+
])
621

722
DEPENDENCIES = [
823
# Keep sorted.

rs/rust_canisters/dfn_http/BUILD.bazel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_doc_test", "rust_library")
22

3-
package(default_visibility = ["//visibility:public"])
3+
package(default_visibility = [
4+
# Keep sorted.
5+
"//rs/nns/test_utils:__pkg__",
6+
"//rs/rust_canisters:__subpackages__",
7+
])
48

59
DEPENDENCIES = [
610
# Keep sorted.

rs/rust_canisters/dfn_http_metrics/BUILD.bazel

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
load("@rules_rust//rust:defs.bzl", "rust_library")
22

3-
package(default_visibility = ["//visibility:public"])
3+
package(default_visibility = [
4+
# Keep sorted.
5+
"//rs/nns:__subpackages__",
6+
"//rs/registry/canister:__pkg__",
7+
"//rs/rosetta-api/icp_ledger:__subpackages__",
8+
"//rs/rosetta-api/icrc1:__pkg__",
9+
"//rs/rosetta-api/icrc1/benchmark/generator:__pkg__",
10+
"//rs/rosetta-api/icrc1/benchmark/worker:__pkg__",
11+
"//rs/rosetta-api/icrc1/ledger:__pkg__",
12+
"//rs/rust_canisters:__subpackages__",
13+
])
414

515
DEPENDENCIES = [
616
# Keep sorted.

rs/rust_canisters/dfn_json/BUILD.bazel

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
load("@rules_rust//rust:defs.bzl", "rust_library")
22

3-
package(default_visibility = ["//visibility:public"])
3+
package(default_visibility = [
4+
# Keep sorted.
5+
"//rs/nns/integration_tests:__pkg__",
6+
"//rs/nns/test_utils:__pkg__",
7+
"//rs/rust_canisters:__subpackages__",
8+
"//rs/scenario_tests:__pkg__",
9+
"//rs/tests:__subpackages__",
10+
])
411

512
rust_library(
613
name = "dfn_json",

rs/rust_canisters/dfn_macro/BUILD.bazel

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
load("@rules_rust//cargo:defs.bzl", "cargo_build_script")
22
load("@rules_rust//rust:defs.bzl", "rust_doc_test", "rust_proc_macro")
33

4-
package(default_visibility = ["//visibility:public"])
4+
package(default_visibility = [
5+
# Keep sorted.
6+
"//rs/nns/handlers/root:__subpackages__",
7+
"//rs/rosetta-api:__pkg__",
8+
"//rs/rust_canisters:__subpackages__",
9+
])
510

611
rust_proc_macro(
712
name = "dfn_macro",

rs/rust_canisters/dfn_protobuf/BUILD.bazel

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
load("@rules_rust//rust:defs.bzl", "rust_library")
22

3-
package(default_visibility = ["//visibility:public"])
3+
package(default_visibility = [
4+
# Keep sorted.
5+
"//rs/nervous_system/common:__pkg__",
6+
"//rs/nns:__subpackages__",
7+
"//rs/rosetta-api:__pkg__",
8+
"//rs/rosetta-api/icp_ledger:__subpackages__",
9+
"//rs/rosetta-api/ledger_canister_blocks_synchronizer:__pkg__",
10+
"//rs/rust_canisters:__subpackages__",
11+
"//rs/sns/test_utils:__pkg__",
12+
"//rs/tests:__subpackages__",
13+
])
414

515
rust_library(
616
name = "dfn_protobuf",

0 commit comments

Comments
 (0)