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

feat(iOS): Include native-bridge.js as a resource in both Cocoapods and direct build #4505

Merged
merged 6 commits into from
Apr 29, 2021

Conversation

ikeith
Copy link
Contributor

@ikeith ikeith commented Apr 27, 2021

This branch updates the podspec and direct build process of the Capacitor.framework to ensure that they build functionally identical frameworks. Specifically, the native-bridge.js file is added as a resource for the framework in both scenarios. It also adds a test case to verify that the injection method can locate the javascript file as expected.

@jcesarmobile
Copy link
Member

If we are going to have the bundle file, then we should use it instead of having two (this one and the generated by CocoaPods)
Can be done with the resource option
https://guides.cocoapods.org/syntax/podspec.html#resources

@ikeith
Copy link
Contributor Author

ikeith commented Apr 28, 2021

I'm not sure I understand. This change has Xcode generate a .bundle file as a build artifact and include it in the framework. So there isn't a file that can be referenced from the podspec (although the final products match). Are you suggesting that we create the bundle as a static resource and check into git?

@ikeith
Copy link
Contributor Author

ikeith commented Apr 28, 2021

The other option is that we just use the Cocoapods resource option for the native-bridge.js file. A resource bundle is only needed to avoid conflicts if the binary will be a static library, but a framework is our default configuration for capacitor apps.

I don't have a strong opinion either way, I just want to ensure that the final product is the same structure regardless of how it gets built (from the capacitor .xcworkspace or via Cocoapods)

@jcesarmobile
Copy link
Member

I tried that and wasn’t able to read the file, but if you can make it work I’m ok with it

@ikeith ikeith changed the title feat(iOS): Adding CapBridge.bundle to match Cocoapods feat(iOS): Include native-bridge.js as a resource in both Cocoapods and direct build Apr 28, 2021
@ikeith
Copy link
Contributor Author

ikeith commented Apr 28, 2021

Updated. This uses the podspec resources key to package the native bridge file and updates the direct build process to match. The direct build version is verified through the new unit test and the pod version passes integration testing via the test app.

Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

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

works fine and reduces the code, nice!

@ikeith ikeith merged commit c16ccc0 into main Apr 29, 2021
@ikeith ikeith deleted the bridge-bundle branch April 29, 2021 14:42
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.

2 participants