Skip to content

Conversation

@congt
Copy link
Contributor

@congt congt commented Jul 29, 2021

Downstream targets can directly read them. A use case is to repackage a static framework into a dynamic framework.

Downstream targets can directly read them. A use case is to repackage a static framework into a dynamic framework.
@congt congt force-pushed the cshi/framework-info branch from e202b19 to 4e0deb5 Compare July 29, 2021 16:52
framework_info = dep[FrameworkInfo]
fw_dep_vfsoverlays.extend(framework_info.vfsoverlay_infos)
propagated_interface_headers.append(framework_info.framework_headers)
framework_headers = depset(framework_info.headers + framework_info.modulemap + framework_info.private_headers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify why framework_info.framework_headers is not being appended anymore here? Is the new set already covering the same files?

Copy link
Contributor Author

@congt congt Jul 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, framework_headers originally included headers, modulemap, private_headers.

FrameworkInfo = provider(
fields = {
"vfsoverlay_infos": "Merged VFS overlay infos, present when virtual frameworks enabled",
"framework_headers": "Headers part of the framework's public interface",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is a breaking API change right? Just checking to ensure this is intentional

Copy link
Contributor Author

@congt congt Jul 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, FrameworkInfo was just introduced to support vfs framework by @jerrymarino. I believe it's only used internally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"private_headers": "Private headers of the framework",
"modulemap": "The module map of the framework",
"swiftmodule": "The swiftmodule",
"swiftdoc": " The Swift doc",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what;s the relationship between swiftmoduel and swiftdoc? right now based on what i have seen it feels like swiftdoc is a child of swiftmodule... along with swiftinterface

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's just how they're packaged in a framework.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're all binary formats, you can read more about swift modules here: https://github.com/apple/swift/blob/main/docs/Serialization.md

(TL;DR functionally they're like headers that expose public APIs)

Also IIRC .swiftdoc files hold documentation related things like when you use "///" to document a public class and want its description to show up in the UI for who is consuming it (it could be holding more info than that but AFAIK this format is not documented)

Copy link
Contributor

@jerrymarino jerrymarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestions on duping over material into this provider we propagate in other providers. ESP on binary and swift, ideally we avoid having the entirety of these providers and behavior implemented and handled 2x

fields = {
"vfsoverlay_infos": "Merged VFS overlay infos, present when virtual frameworks enabled",
"framework_headers": "Headers part of the framework's public interface",
"binary": "The binary of the framework",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is returned inside of the apple binary already - any reason to replicate here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to reuse FrameworkInfo to package a dynamic framework. By adding binary and swiftmodule here, I won't need to pass around AppleBundleInfo or swiftinfo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm saying is that today, upstream dependees of this rule are required to retrieve the swiftmodule, and binaries.
https://github.com/bazel-ios/rules_ios/blob/master/rules/framework.bzl#L497 - so it's already passed around. To access the attributes, just use framework[SwiftInfo].swiftmodule or the other existing ones

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally understood. I want to make FrameworkInfo self-contain from the API's perspective. Then downstream targets can only return FrameworkInfo without returning SwiftInfo or AppleBundleInfo.

"headers": "Headers of the framework's public interface",
"private_headers": "Private headers of the framework",
"modulemap": "The module map of the framework",
"swiftmodule": "The swiftmodule",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These ones are in swiftinfo - any reason to put here too?

Copy link
Contributor

@jerrymarino jerrymarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine, I think it makes sense

@congt congt merged commit e2e5709 into master Jul 30, 2021
@congt congt deleted the cshi/framework-info branch July 30, 2021 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants