Skip to content

Commit

Permalink
Get Objc compile info from CcCompilationContext
Browse files Browse the repository at this point in the history
Note strict includes still come from ObjcProvider.

Step 2 of 3-step plan:
1. Migrate the definitions.
2. Migrate the uses.
3. Delete old ObjcProvider definitions.

See bazelbuild/bazel#10674.

RELNOTES: None
PiperOrigin-RevId: 296338258
  • Loading branch information
googlewalt authored and swiple-rules-gardener committed Apr 22, 2020
1 parent 2ebfc40 commit c444628
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 3 additions & 6 deletions swift/internal/compiling.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,6 @@ def _dependencies_clang_defines_configurator(prerequisites, args):
"""Adds C/C++ dependencies' preprocessor defines to the command line."""
all_clang_defines = depset(transitive = [
prerequisites.cc_info.compilation_context.defines,
prerequisites.objc_info.define,
])
args.add_all(all_clang_defines, before_each = "-Xcc", format_each = "-D%s")

Expand Down Expand Up @@ -600,7 +599,6 @@ def _dependencies_clang_modules_configurator(prerequisites, args):
# should not include its headers in the inputs.
header_depsets = [
prerequisites.cc_info.compilation_context.headers,
prerequisites.objc_info.header,
prerequisites.objc_info.umbrella_header,
]

Expand All @@ -614,9 +612,8 @@ def _dependencies_clang_modules_configurator(prerequisites, args):
def _framework_search_paths_configurator(prerequisites, args):
"""Add search paths for prebuilt frameworks to the command line."""
args.add_all(
prerequisites.objc_info.framework_search_path_only,
prerequisites.cc_info.compilation_context.framework_includes,
format_each = "-F%s",
map_each = paths.dirname,
)

def _static_frameworks_disable_autolink_configurator(prerequisites, args):
Expand Down Expand Up @@ -722,7 +719,7 @@ def _conditional_compilation_flag_configurator(prerequisites, args):
prerequisites.transitive_defines,
# Take any Swift-compatible defines from Objective-C dependencies
# and define them for Swift.
prerequisites.objc_info.define,
prerequisites.cc_info.compilation_context.defines,
],
)
args.add_all(
Expand Down Expand Up @@ -1326,7 +1323,7 @@ def _merge_targets_providers(supports_objc_interop, targets):
if apple_common.Objc in target and supports_objc_interop:
objc_infos.append(target[apple_common.Objc])
objc_include_paths_workaround_depsets.append(
target[apple_common.Objc].include,
target[apple_common.Objc].strict_include,
)

return struct(
Expand Down
5 changes: 4 additions & 1 deletion swift/internal/swift_protoc_gen_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,15 @@ def _swift_protoc_gen_aspect_impl(target, aspect_ctx):
if linker_inputs:
objc_info_args["link_inputs"] = depset(linker_inputs)

includes = [aspect_ctx.bin_dir.path]
objc_info = apple_common.new_objc_provider(
include = depset([aspect_ctx.bin_dir.path]),
include = depset(includes),
providers = objc_infos,
uses_swift = True,
**objc_info_args
)
else:
includes = None
objc_info = None

providers = [
Expand All @@ -458,6 +460,7 @@ def _swift_protoc_gen_aspect_impl(target, aspect_ctx):
cc_info = create_cc_info(
cc_infos = cc_infos,
compilation_outputs = compilation_outputs,
includes = includes,
libraries_to_link = [library_to_link],
),
objc_info = objc_info,
Expand Down

0 comments on commit c444628

Please sign in to comment.