From e5fefdc64a119a67bb6999da3aaa7640d95d85fa Mon Sep 17 00:00:00 2001 From: Marcel Hlopko Date: Tue, 8 Mar 2022 22:12:34 +0100 Subject: [PATCH] Cut loading time deps of the import macro (#1177) Co-authored-by: UebelAndre --- util/import/BUILD.bazel | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/util/import/BUILD.bazel b/util/import/BUILD.bazel index 54a060bac1..7cb0395cde 100644 --- a/util/import/BUILD.bazel +++ b/util/import/BUILD.bazel @@ -47,11 +47,19 @@ alias( name = "import", actual = select({ ":use_fake_import_macro": ":fake_import_macro_impl", - "//conditions:default": ":import_macro", + "//conditions:default": ":import_macro_label", }), visibility = ["//visibility:public"], ) +# This is there to cut the loading-time dependency on the import macro dependencies +# (so users who don't use the macro don't need to add those deps to their WORKSPACE +# file). Bazel in the loading phase doesn't "see" through `label_flag`. +label_flag( + name = "import_macro_label", + build_setting_default = "import_macro", +) + config_setting( name = "use_fake_import_macro", flag_values = {