-
Notifications
You must be signed in to change notification settings - Fork 35
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
Public access to all targets declared in packages #932
Comments
I don't feel strongly about the visibility of the generated targets. @brentleyjones Do you have any thoughts? |
The visibility is to enforce the same restriction that SPM has: you depend on the products of Swift packages, nothing else. So, in an SPM world, I don't believe you are able to do what you are trying to do, can you? If I'm wrong there, then yes, let's open them up. Or, if you can give a concrete example of how the current way fails, maybe there is a different solution than opening up the visibility. |
If this is just because you need a product that is a subset of another product, you could patch the package to add that product in. But I have a feeling that's not the root issue here. |
Agree. This is actually a bazel-only feature. I can give some of my context of the usecase:
For extra context, this PR is based on the same usecase: need to disable library evolution in order to create the prebuilt frameworks |
@acecilia described the problem very well. In short, a framework can contain only one module (aka SPM target), a product can depend on multiple targets. With only access to the product, I can't create all the necessary artifacts to distribute internally prebuilt binaries.
This technically may work (manually creating products for all the targets), but it does not solve the problems with complex dependency trees that @acecilia mentioned (they need to be maintained). |
Could you provide an example repro for what you are trying to do. It would help me fully wrap my head around this. In the end we might allow changing the visibility, but I want to make sure there isn't another option first. |
I agree with @brentleyjones. If we proceed with adjusting the visibility, I would like to add it as an option set in |
@brentleyjones spm-to-xcframework, let me know if that helps. |
That does help. I need to think on this more. |
I think we can do this with a flag, preferably set per-package, with a disclaimer that the format of the labels can change between @sewerynplazuk could you take on the work to implement this PR? |
@brentleyjones Great, that should work for us. I'll prepare the change. |
Attempt to solve #932. Following the example given in the linked issue, with the new flag `publicly_expose_all_targets `, it is possible to granularly expose the build files of individual packages, as an example: ``` swift_deps.configure_package( name = "swift-nio-transport-services", publicly_expose_all_targets = True, ) swift_deps.configure_package( name = "swift-protobuf", publicly_expose_all_targets = True, ) use_repo( swift_deps, "swift_deps_info", "swift_package", "swiftpkg_swift_nio_transport_services", "swiftpkg_swift_protobuf", ) ```
In the latest release - 0.28.0 - the underlying targets declared by the packages were hidden. As I understand the change was introduced in #883. I generally agree with the view that you need to rely on the library products rather than the underlying targets but not in all cases.
I use these rules to generate BUILD files for SPM packages, so I can wrap them in XCFrameworks and use them for internal distribution. To do this, access to the underlying targets is crucial. Thus my question, can we restore public access to these targets, perhaps under a feature toggle?
The text was updated successfully, but these errors were encountered: