diff --git a/runtime/TARGETS b/runtime/TARGETS index 7448523f5ff..9f8f1b9783a 100644 --- a/runtime/TARGETS +++ b/runtime/TARGETS @@ -8,8 +8,5 @@ runtime.python_library( deps = [ "//executorch/extension/pybindings:portable_lib", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/runtime/backend/targets.bzl b/runtime/backend/targets.bzl index 1d1f95c6c97..606ae324e37 100644 --- a/runtime/backend/targets.bzl +++ b/runtime/backend/targets.bzl @@ -22,10 +22,7 @@ def define_common_targets(): "interface.h", ], preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/runtime/core:evalue" + aten_suffix, diff --git a/runtime/core/exec_aten/targets.bzl b/runtime/core/exec_aten/targets.bzl index 9114be639c0..df4a87ef033 100644 --- a/runtime/core/exec_aten/targets.bzl +++ b/runtime/core/exec_aten/targets.bzl @@ -15,10 +15,7 @@ def define_common_targets(): name = "lib" + aten_suffix, exported_headers = ["exec_aten.h"], exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = ["//executorch/runtime/core:tensor_shape_dynamism"] + ([] if aten_mode else ["//executorch/runtime/core/portable_type:portable_type"]), exported_external_deps = ["libtorch"] if aten_mode else [], ) diff --git a/runtime/core/exec_aten/testing_util/targets.bzl b/runtime/core/exec_aten/testing_util/targets.bzl index e5ebdc8788a..fa259b41f84 100644 --- a/runtime/core/exec_aten/testing_util/targets.bzl +++ b/runtime/core/exec_aten/testing_util/targets.bzl @@ -16,26 +16,7 @@ def define_common_targets(): "tensor_util.h", "tensor_factory.h", ], - visibility = [ - # Be strict with the visibility so that operator implementations - # under //executorch/kernels/... can't depend on this test-only - # target. It's ok to add any //executorch/*/test/... path to this - # list. - "//executorch/runtime/core/exec_aten/util/test/...", - "//executorch/runtime/core/exec_aten/testing_util/test/...", - "//executorch/runtime/core/portable_type/test/...", - "//executorch/kernels/prim_ops/test/...", - "//executorch/kernels/portable/test/...", - "//executorch/kernels/portable/cpu/util/test/...", - "//executorch/kernels/quantized/test/...", - "//executorch/kernels/optimized/test/...", - "//executorch/kernels/test/...", - "//executorch/kernels/fb/custom_ops/...", - "//executorch/runtime/core/test/...", - "//executorch/test/...", - "//executorch/extension/kernel_util/test/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], compiler_flags = ["-Wno-unneeded-internal-declaration"], exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], exported_deps = [ diff --git a/runtime/core/exec_aten/util/targets.bzl b/runtime/core/exec_aten/util/targets.bzl index 9ec2310250c..ffdfa4f1040 100644 --- a/runtime/core/exec_aten/util/targets.bzl +++ b/runtime/core/exec_aten/util/targets.bzl @@ -23,10 +23,7 @@ def define_common_targets(): exported_headers = [ "scalar_type_util.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_preprocessor_flags = exported_preprocessor_flags_, exported_deps = exported_deps_, exported_external_deps = ["libtorch"] if aten_mode else [], @@ -42,10 +39,7 @@ def define_common_targets(): "//executorch/runtime/core:core", "//executorch/runtime/core/portable_type/c10/c10:c10", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], ) @@ -55,10 +49,7 @@ def define_common_targets(): exported_headers = [ "tensor_util.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], exported_deps = [ ":tensor_dimension_limit", @@ -84,17 +75,11 @@ def define_common_targets(): "//executorch/runtime/core/exec_aten/util:tensor_dimension_limit", ], exported_headers = ["tensor_shape_to_c_string.h"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.cxx_library( name = "tensor_dimension_limit", exported_headers = ["tensor_dimension_limit.h"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/runtime/core/portable_type/c10/c10/targets.bzl b/runtime/core/portable_type/c10/c10/targets.bzl index 6b61f45d7d4..33a558085b7 100644 --- a/runtime/core/portable_type/c10/c10/targets.bzl +++ b/runtime/core/portable_type/c10/c10/targets.bzl @@ -61,11 +61,7 @@ def define_common_targets(): runtime.cxx_library( name = "aten_headers_for_executorch", srcs = [], - visibility = [ - "//executorch/kernels/optimized/...", - "//executorch/kernels/portable/cpu/util/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], # select() on ovr_config//runtime:fbcode does not work # properly in all cases. I have seen # //xplat/executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch @@ -124,10 +120,7 @@ def define_common_targets(): "-DC10_USE_GLOG", "-DC10_USE_MINIMAL_GLOG", ]), - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core/portable_type/c10/torch/headeronly:torch_headeronly", ] + select({ @@ -142,8 +135,5 @@ def define_common_targets(): runtime.cxx_library( name = "c10", exported_deps = [":aten_headers_for_executorch"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/runtime/core/targets.bzl b/runtime/core/targets.bzl index e8240135a69..2c13cdbdae3 100644 --- a/runtime/core/targets.bzl +++ b/runtime/core/targets.bzl @@ -50,10 +50,7 @@ def define_common_targets(): "result.h", "span.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_preprocessor_flags = get_core_flags(), exported_deps = [ "//executorch/runtime/core/portable_type/c10/c10:c10", @@ -82,10 +79,7 @@ def define_common_targets(): ":core", "//executorch/runtime/core/portable_type/c10/c10:c10", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) for aten_mode in get_aten_mode_options(): @@ -96,10 +90,7 @@ def define_common_targets(): "evalue.h", ], srcs = ["evalue.cpp"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ ":core", ":tag", @@ -114,10 +105,7 @@ def define_common_targets(): "event_tracer_hooks.h", "event_tracer_hooks_delegate.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_preprocessor_flags = get_event_tracer_flags() + get_sdk_flags(), exported_deps = [ "//executorch/runtime/platform:platform", @@ -130,10 +118,7 @@ def define_common_targets(): exported_headers = [ "named_data_map.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ ":tensor_layout" + aten_suffix, "//executorch/runtime/core/exec_aten:lib" + aten_suffix, diff --git a/runtime/core/testing_util/targets.bzl b/runtime/core/testing_util/targets.bzl index 40ced267915..dbab5977d67 100644 --- a/runtime/core/testing_util/targets.bzl +++ b/runtime/core/testing_util/targets.bzl @@ -15,10 +15,7 @@ def define_common_targets(): exported_headers = [ "error_matchers.h", ], - visibility = [ - "//executorch/runtime/core/testing_util/test/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_external_deps = [ "gmock", ], diff --git a/runtime/executor/targets.bzl b/runtime/executor/targets.bzl index 103ea299c34..28defd6ab11 100644 --- a/runtime/executor/targets.bzl +++ b/runtime/executor/targets.bzl @@ -37,10 +37,7 @@ def define_common_targets(): exported_deps = [ "//executorch/runtime/core:memory_allocator", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) @@ -55,10 +52,7 @@ def define_common_targets(): exported_headers = [ "pte_data_map.h", ], - visibility = [ - "//executorch/runtime/executor/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/runtime/core:named_data_map" + aten_suffix, @@ -86,10 +80,7 @@ def define_common_targets(): ":program_no_prim_ops" + aten_suffix, "//executorch/kernels/prim_ops:prim_ops_registry" + aten_suffix, ], - visibility = [ - "//executorch/runtime/executor/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.cxx_library( @@ -132,8 +123,5 @@ def define_common_targets(): "//executorch/schema:program", "//executorch/runtime/core/exec_aten/util:tensor_dimension_limit" ], - visibility = [ - "//executorch/runtime/executor/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/runtime/executor/test/targets.bzl b/runtime/executor/test/targets.bzl index 1174b01f42b..0fac69b6a48 100644 --- a/runtime/executor/test/targets.bzl +++ b/runtime/executor/test/targets.bzl @@ -81,11 +81,7 @@ def define_common_targets(is_fbcode = False): exported_headers = [ "managed_memory_manager.h", ], - visibility = [ - "//executorch/runtime/executor/test/...", - "//executorch/test/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], deps = [ "//executorch/runtime/core:memory_allocator", "//executorch/runtime/executor:memory_manager", diff --git a/runtime/kernel/targets.bzl b/runtime/kernel/targets.bzl index 92e30016f42..123dc1ac8da 100644 --- a/runtime/kernel/targets.bzl +++ b/runtime/kernel/targets.bzl @@ -28,10 +28,7 @@ def define_common_targets(): name = "operator_registry_MAX_NUM_KERNELS_TEST_ONLY", srcs = ["operator_registry.cpp"], exported_headers = ["operator_registry.h"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/runtime/core:evalue", @@ -60,10 +57,7 @@ def define_common_targets(): name = "operator_registry" + aten_suffix, srcs = ["operator_registry.cpp"], exported_headers = ["operator_registry.h"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/runtime/core:evalue" + aten_suffix, @@ -76,12 +70,7 @@ def define_common_targets(): exported_headers = [ "kernel_runtime_context.h", ], - visibility = [ - "//executorch/kernels/...", - "//executorch/runtime/executor/...", - "//executorch/runtime/kernel/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/runtime/platform:platform", @@ -98,12 +87,7 @@ def define_common_targets(): exported_headers = [ "kernel_includes.h", ], - visibility = [ - "//executorch/runtime/kernel/...", - "//executorch/kernels/...", - "//executorch/kernels/prim_ops/...", # Prim kernels - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ ":kernel_runtime_context" + aten_suffix, "//executorch/runtime/core/exec_aten:lib" + aten_suffix, diff --git a/runtime/platform/targets.bzl b/runtime/platform/targets.bzl index 457deed531e..65d92b134d6 100644 --- a/runtime/platform/targets.bzl +++ b/runtime/platform/targets.bzl @@ -81,10 +81,7 @@ def define_common_targets(): ":compiler", ":platform_private", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], # WARNING: using a deprecated API to avoid being built into a shared # library. In the case of dynamically loading so library we don't want # it to depend on other so libraries because that way we have to @@ -110,10 +107,7 @@ def define_common_targets(): "ovr_config//os:macos": ["-DET_USE_LIBDL"], }, ), - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) # Common compiler directives such as 'unlikely' or 'deprecated' @@ -122,8 +116,5 @@ def define_common_targets(): exported_headers = [ "compiler.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/shim_et/xplat/executorch/build/runtime_wrapper.bzl b/shim_et/xplat/executorch/build/runtime_wrapper.bzl index 16a204aafc5..f03ddc6c76d 100644 --- a/shim_et/xplat/executorch/build/runtime_wrapper.bzl +++ b/shim_et/xplat/executorch/build/runtime_wrapper.bzl @@ -184,17 +184,7 @@ def _patch_kwargs_common(kwargs): """ env.remove_unsupported_kwargs(kwargs) - # Be careful about dependencies on executorch targets for now, so that we - # don't pick up unexpected clients while things are still in flux. - if not kwargs.pop("_is_external_target", False): - for target in kwargs.get("visibility", []): - if not (target == "PUBLIC" or target.startswith("//executorch") or target.startswith("//pytorch/tokenizers") or target.startswith("@")): - fail("Please manage all external visibility using the " + - "EXECUTORCH_CLIENTS list in " + - "//executorch/build/fb/clients.bzl. " + - "Found external visibility target \"{}\".".format(target)) - else: - kwargs.pop("_is_external_target", None) + kwargs.pop("_is_external_target", False) # Convert `[exported_]external_deps` entries into real deps if necessary. _resolve_external_deps(kwargs)