Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
Remove usage of deprecated ObjCProvider attributes (#75)
Browse files Browse the repository at this point in the history
These APIs were deprecated a while ago, but Bazel 4.0.0 has removed them completely. The information in `ObjCProvider` has been migrated to `CcCompilationContext`: bazelbuild/bazel#10674

I've replaced the usages of the deprecated APIs with the equivalents from `CcCompilationContext` and can confirm that it now works with Bazel 4.0.0.
  • Loading branch information
indragiek authored Sep 8, 2021
1 parent 5c58425 commit 24477ba
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions aspects.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,9 @@ def _objc_compiler_info(ctx, target, srcs, feature_configuration, cc_toolchain):
),
)

defines = ["-D\"{}\"".format(val) for val in target.objc.define.to_list()]
includes = ["-I{}".format(val) for val in target.objc.include.to_list()]
system_includes = ["-isystem {}".format(val) for val in target.objc.include_system.to_list()]
iquotes = ["-iquote {}".format(val) for val in target.objc.iquote.to_list()]
frameworks = (["-F {}/..".format(val) for val in target.objc.static_framework_paths.to_list()] +
["-F {}/..".format(val) for val in target.objc.dynamic_framework_paths.to_list()] +
["-F {}/..".format(val) for val in target.objc.framework_search_path_only.to_list()])
["-F {}/..".format(val) for val in target[CcInfo].compilation_context.framework_includes.to_list()])

xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]

Expand All @@ -239,10 +235,7 @@ def _objc_compiler_info(ctx, target, srcs, feature_configuration, cc_toolchain):
["-F {}/Developer/Library/Frameworks".format(platform_root)] +
# FIXME this needs to be done per-file to be fully correct
["-fobjc-arc"] +
defines +
includes +
iquotes +
system_includes +
get_compile_flags(target) +
frameworks +
(ctx.rule.attr.copts if "copts" in dir(ctx.rule.attr) else []))

Expand Down Expand Up @@ -386,5 +379,5 @@ _compilation_database = rule(
def compilation_database(**kwargs):
_compilation_database(
filename = kwargs.pop("filename", "compile_commands.json"),
**kwargs,
**kwargs
)

0 comments on commit 24477ba

Please sign in to comment.