Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add swift.experimental_rules_swift_package_manager flag #917

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rules/features.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ feature_names = struct(

# When set disable passing the `-import-underlying-module` copt to `swift_library` targets
swift_disable_import_underlying_module = "swift.swift_disable_import_underlying_module",

# Allows consumers to depend on targets from https://github.com/cgrindel/rules_swift_package_manager.
#
# Note: This is a work in progress, and the flag will remain experimental until full support is ready.
experimental_rules_swift_package_manager = "swift.experimental_rules_swift_package_manager",
)
20 changes: 20 additions & 0 deletions rules/framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,27 @@ def _get_virtual_framework_info(ctx, framework_files, compilation_context_fields

# We need to map all the deps here - for both swift headers and others
fw_dep_vfsoverlays = []

# Whether or not to collect SwiftInfo providers from rules_swift_package_manager targets
enable_rules_swift_package_manager = feature_names.experimental_rules_swift_package_manager in ctx.features

for dep in transitive_deps + deps:
if enable_rules_swift_package_manager and SwiftInfo in dep:
if dep.label.workspace_name.startswith("swiftpkg"):
thiagohmcruz marked this conversation as resolved.
Show resolved Hide resolved
for spm_dep in dep[SwiftInfo].transitive_modules.to_list():
if spm_dep.swift:
spm_dep_vfs = make_vfsoverlay(
ctx,
hdrs = [],
module_map = [],
swiftmodules = [spm_dep.swift.swiftmodule, spm_dep.swift.swiftdoc],
private_hdrs = [],
has_swift = True,
merge_vfsoverlays = [],
framework_name = spm_dep.name,
)
fw_dep_vfsoverlays.append(spm_dep_vfs.vfs_info)

# Collect transitive headers. For now, this needs to include all of the
# transitive headers
if CcInfo in dep:
Expand Down
Loading