From 4c3f34282618d2de2cd343018a2cb7ee66392ac8 Mon Sep 17 00:00:00 2001 From: Vakhid Betrakhmadov Date: Fri, 18 Oct 2024 18:57:54 +0100 Subject: [PATCH] Make AppleDebugInfo and AppleSymbolsFileInfo available from outside of rules_apple (#2558) (#9) --- apple/internal/partials/BUILD | 1 + .../internal/partials/apple_symbols_file.bzl | 15 +++++-------- apple/internal/providers/BUILD | 10 +++++++++ apple/internal/providers/apple_debug_info.bzl | 2 -- .../providers/apple_symbols_file_info.bzl | 22 +++++++++++++++++++ 5 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 apple/internal/providers/apple_symbols_file_info.bzl diff --git a/apple/internal/partials/BUILD b/apple/internal/partials/BUILD index 52a3b65664..51a89c6e16 100644 --- a/apple/internal/partials/BUILD +++ b/apple/internal/partials/BUILD @@ -60,6 +60,7 @@ bzl_library( "@bazel_skylib//lib:partial", "@bazel_skylib//lib:shell", "@build_bazel_apple_support//lib:apple_support", + "//apple/internal/providers:apple_symbols_file_info", ], ) diff --git a/apple/internal/partials/apple_symbols_file.bzl b/apple/internal/partials/apple_symbols_file.bzl index 59b71ab1d2..3538d3926a 100644 --- a/apple/internal/partials/apple_symbols_file.bzl +++ b/apple/internal/partials/apple_symbols_file.bzl @@ -35,12 +35,9 @@ load( "@build_bazel_rules_apple//apple/internal:processor.bzl", "processor", ) - -_AppleSymbolsFileInfo = provider( - doc = "Private provider to propagate the transitive .symbols `File`s.", - fields = { - "symbols_output_dirs": "Depset of `File`s containing directories of $UUID.symbols files for transitive dependencies.", - }, +load( + "@build_bazel_rules_apple//apple/internal/providers:apple_symbols_file_info.bzl", + "AppleSymbolsFileInfo", ) def _apple_symbols_file_partial_impl( @@ -89,9 +86,9 @@ def _apple_symbols_file_partial_impl( transitive_output_files = depset( direct = outputs, transitive = [ - x[_AppleSymbolsFileInfo].symbols_output_dirs + x[AppleSymbolsFileInfo].symbols_output_dirs for x in dependency_targets - if _AppleSymbolsFileInfo in x + if AppleSymbolsFileInfo in x ], ) @@ -102,7 +99,7 @@ def _apple_symbols_file_partial_impl( return struct( bundle_files = bundle_files, - providers = [_AppleSymbolsFileInfo(symbols_output_dirs = transitive_output_files)], + providers = [AppleSymbolsFileInfo(symbols_output_dirs = transitive_output_files)], ) def apple_symbols_file_partial( diff --git a/apple/internal/providers/BUILD b/apple/internal/providers/BUILD index 04fcab9de9..d9217f2dff 100644 --- a/apple/internal/providers/BUILD +++ b/apple/internal/providers/BUILD @@ -11,6 +11,16 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") licenses(["notice"]) +bzl_library( + name = "apple_symbols_file_info", + srcs = ["apple_symbols_file_info.bzl"], + visibility = [ + # Visibility set to pkg since this provider is used only + # by the `apple_symbols_file` partial. + "//apple/internal/partials:__pkg__", + ], +) + bzl_library( name = "app_intents_info", srcs = ["app_intents_info.bzl"], diff --git a/apple/internal/providers/apple_debug_info.bzl b/apple/internal/providers/apple_debug_info.bzl index d5c0f9df8e..0a2761c693 100644 --- a/apple/internal/providers/apple_debug_info.bzl +++ b/apple/internal/providers/apple_debug_info.bzl @@ -14,8 +14,6 @@ """AppleDebugInfo provider implementation for resource aspect and debug symbols partial support.""" -visibility("//apple/internal/...") - AppleDebugInfo = provider( doc = """ Private provider to propagate transitive dSYM and link maps information used by the debug symbols diff --git a/apple/internal/providers/apple_symbols_file_info.bzl b/apple/internal/providers/apple_symbols_file_info.bzl new file mode 100644 index 0000000000..a9def50f73 --- /dev/null +++ b/apple/internal/providers/apple_symbols_file_info.bzl @@ -0,0 +1,22 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""AppleSymbolsFileInfo provider implementation for transitive .symbols `File`s propagation.""" + +AppleSymbolsFileInfo = provider( + doc = "Private provider to propagate the transitive .symbols `File`s.", + fields = { + "symbols_output_dirs": "Depset of `File`s containing directories of $UUID.symbols files for transitive dependencies.", + }, +)