-
Notifications
You must be signed in to change notification settings - Fork 349
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
[Frameworks] Allow to customize the module name #205
Comments
@mrackwitz if we do this, then we'll have to handle the potential for duplicated module names in |
I wonder if we really need to extend the DSL for this or if allowing it to be implicitly customisable via |
or, we just recommend that people name their pods in a C99-compatible manner. |
I think the example that spawned this issue is a good case for adding the DSL, "LibName.swift" -> |
@segiddins: There are already a lot of podspecs out, which have incompatible names. While I can understand the point of duplicate names, I don't think that's necessarily a problem we have to solve. This can already occur now. @neonichu: The implicit customization would suffice probably from a technical point of view regarding the integration / build outputs. But I would prefer to deliver our users a clean way, even when we spawn by this more potential combinations, which need more effort to cover by tests. To have a distinct property |
@mrackwitz it can't happen now, because you |
@segiddins not if one uses |
The example that @orta mentions is a good one and so I think an attribute for it is warranted, but I think it should definitely default to
@mrackwitz I don’t think we should add warnings for things that we can have sensible defaults for, but what you can do is show the inflected module name so that the author can at least see it and think about it. E.g. a ‘note’ in the linter. Warnings tend to leave people with an annoyance if they in fact know what they’re doing, so it should be limited to things that really do need a warning. |
I see the issue more in application code, an implicitly derived module name will be an unexpected breaking change for all current users once we eventually opt everyone into frameworks. If |
@neonichu I guess I’m missing a few pieces of the puzzle here as to why/how those breakages can occur. Can you elaborate? |
@alloy Just in terms of header paths. Example: pod name or |
@neonichu Gotcha. I don’t see how implicitly derived differs in that aspect, though? |
@alloy nope, in fact using explicit names brings an additional can of worms for those Pods whose name is already a valid module name. |
Correct me if I’m wrong, but can’t we have
Yeah that would open up the possibility for even more complex scenarios. Hrmm. |
Good points! 👍 |
@alloy the import path and module name cannot differ as the former is derived from the name of the framework when using the I think the complexity of |
@neonichu Gotcha, thanks for the info 👍 |
I found that the name of the built framework is changed to `youtube_ios_player_helper` when framework (clang module) is enabled because of the clang module specification: CocoaPods/Core#205 To make things worse this only happens when clang module is enabled, so make thing so much completecated. I can't keep using the name `youtube-ios-player-helper` anymore because of this, so I'm going to rename the entire module name to simple `YTPlayerView` in next commit.
CocoaPods/Core#205 Just learned from Facebook-iOS-SDK. Now cocoapods also supports module_name as well, so I added it too.
@orta , can you please give an example of using module_name with a Swift project's pod spec? |
Regarding Framework / Swift Support by CocoaPods/CocoaPods#2835:
By supporting Frameworks and Swift, we have also support Clang modules. Module names are C99-extended identifiers, which means
[a-Z_][a-Z0-9_]*
. Some podspecs use names beginning with a number or containing-
or.
. These characters are not possible in the module name and would be replaced by_
. (That's the same what happens by e.g.${PRODUCT_NAME:c99ext_identifier}
.)@orta proposed, we could solve that by allowing to define an alternative module name by the Podspec DSL. At the moment you can give your library another name for imports by specifying the
header_dir
in the podspec. E.g. it is solved in that way for Facebook-iOS-SDK. This option is currently not considered for frameworks on CocoaPods/CocoaPods#2835, so you would need to@import Facebook_iOS_SDK
. We can derive it in the following way to keep maximum compatibility with user projects:Where the attribute
module_name
is new to the Podsepc DSL and has to be introduced. It should be validated to allow only C99-extended identifiers.The text was updated successfully, but these errors were encountered: