Move variable extension for fully linked action to its own function
NFC refactoring to aid link info migration.
@@ -37,27 +37,6 @@ def _build_variable_extensions(
if "ARCHIVE_VARIABLES" in variable_categories:
extensions["obj_list_path"] = intermediate_artifacts.archive_obj_list.path
- if "FULLY_LINK_VARIABLES" in variable_categories:
- extensions["fully_linked_archive_path"] = fully_link_archive.path
- cc_libs = {}
- for cc_lib in objc_provider.flattened_cc_libraries():
- cc_libs[cc_lib.path] = True
- exclusively_objc_libs = []
- for objc_lib in objc_provider.flattened_objc_libraries():
- if objc_lib.path in cc_libs:
- continue
- exclusively_objc_libs.append(objc_lib.path)
-
- import_paths = []
- for import_lib in objc_provider.imported_library.to_list():
- import_paths.append(import_lib.path)
- for static_framework_file in objc_provider.static_framework_file.to_list():
- import_paths.append(static_framework_file.path)
-
- extensions["objc_library_exec_paths"] = exclusively_objc_libs
- extensions["cc_library_exec_paths"] = cc_libs.keys()
- extensions["imported_library_exec_paths"] = import_paths
-
if arc_enabled:
extensions["objc_arc"] = ""
else:
@@ -587,16 +566,36 @@ def _generate_extra_module_map(
grep_includes = _get_grep_includes(common_variables.ctx),
)
+def _build_fully_linked_variable_extensions(fully_link_archive, objc_provider):
+ extensions = {}
+ extensions["fully_linked_archive_path"] = fully_link_archive.path
+ cc_libs = {}
+ for cc_lib in objc_provider.flattened_cc_libraries():
+ cc_libs[cc_lib.path] = True
+ exclusively_objc_libs = []
+ for objc_lib in objc_provider.flattened_objc_libraries():
+ if objc_lib.path in cc_libs:
+ continue
+ exclusively_objc_libs.append(objc_lib.path)
+
+ import_paths = []
+ for import_lib in objc_provider.imported_library.to_list():
+ import_paths.append(import_lib.path)
+ for static_framework_file in objc_provider.static_framework_file.to_list():
+ import_paths.append(static_framework_file.path)
+
+ extensions["objc_library_exec_paths"] = exclusively_objc_libs
+ extensions["cc_library_exec_paths"] = cc_libs.keys()
+ extensions["imported_library_exec_paths"] = import_paths
+
+ return extensions
+
def _register_fully_link_action(common_variables, objc_provider, name):
ctx = common_variables.ctx
feature_configuration = _build_feature_configuration(common_variables, False, False)
output_archive = ctx.actions.declare_file(name + ".a")
- extensions = _build_variable_extensions(
- ctx,
- common_variables.intermediate_artifacts,
- ["FULLY_LINK_VARIABLES"],
- arc_enabled = False,
+ extensions = _build_fully_linked_variable_extensions(
fully_link_archive = output_archive,
objc_provider = objc_provider,
)
