Skip to content

Commit

Permalink
getattr for dynamic framework provider too
Browse files Browse the repository at this point in the history
since we use bazel's internal linking function on 7.x, it looks for this
old provider, so we can't use the new one until we drop that.
  • Loading branch information
keith committed Dec 6, 2024
1 parent 7ed23bb commit fe396d6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions apple/internal/apple_framework_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ load(
)
load(
"//apple/internal/providers:apple_dynamic_framework_info.bzl",
"AppleDynamicFrameworkInfo",
"new_appledynamicframeworkinfo",
)
load(
"//apple/internal/providers:framework_import_bundle_info.bzl",
Expand Down Expand Up @@ -285,7 +285,7 @@ def _apple_dynamic_framework_import_impl(ctx):
# Create AppleDynamicFramework provider.
framework_groups = _grouped_framework_files(framework_imports)
framework_dirs_set = depset(framework_groups.keys())
providers.append(AppleDynamicFrameworkInfo(
providers.append(new_appledynamicframeworkinfo(
cc_info = cc_info,
framework_dirs = framework_dirs_set,
framework_files = depset(framework_imports),
Expand Down
3 changes: 2 additions & 1 deletion apple/internal/apple_xcframework_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ load(
load(
"//apple/internal/providers:apple_dynamic_framework_info.bzl",
"AppleDynamicFrameworkInfo",
"new_appledynamicframeworkinfo",
)
load(
"//apple/internal/providers:framework_import_bundle_info.bzl",
Expand Down Expand Up @@ -517,7 +518,7 @@ def _apple_dynamic_xcframework_import_impl(ctx):
providers.append(cc_info)

# Create AppleDynamicFrameworkInfo provider
apple_dynamic_framework_info = AppleDynamicFrameworkInfo(
apple_dynamic_framework_info = new_appledynamicframeworkinfo(
cc_info = cc_info,
)
providers.append(apple_dynamic_framework_info)
Expand Down
4 changes: 2 additions & 2 deletions apple/internal/partials/framework_provider.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ load(
)
load(
"//apple/internal/providers:apple_dynamic_framework_info.bzl",
"AppleDynamicFrameworkInfo",
"new_appledynamicframeworkinfo",
)

def _framework_provider_partial_impl(
Expand Down Expand Up @@ -80,7 +80,7 @@ def _framework_provider_partial_impl(
],
)

framework_provider = AppleDynamicFrameworkInfo(
framework_provider = new_appledynamicframeworkinfo(
binary = binary_artifact,
cc_info = wrapper_cc_info,
framework_dirs = depset([absolute_framework_dir]),
Expand Down
13 changes: 12 additions & 1 deletion apple/internal/providers/apple_dynamic_framework_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ visibility([
"//apple/internal/...",
])

AppleDynamicFrameworkInfo = provider(
_AppleDynamicFrameworkInfo = provider(
doc = "Contains information about an Apple dynamic framework.",
fields = {
"framework_dirs": """\
Expand All @@ -36,3 +36,14 @@ into the binary.
""",
},
)

# TODO: Remove when we drop 7.x
AppleDynamicFrameworkInfo = getattr(apple_common, "AppleDynamicFramework", _AppleDynamicFrameworkInfo)

# TODO: Remove when we drop 7.x
def new_appledynamicframeworkinfo(**kwargs):
legacy_initializer = getattr(apple_common, "new_dynamic_framework_provider", None)
if legacy_initializer:
return legacy_initializer(**kwargs)

return AppleDynamicFrameworkInfo(**kwargs)

0 comments on commit fe396d6

Please sign in to comment.