Quick Help: Migrate iOS project dependencies to Bazel.
Before you read: Invitation to Network Spy
Wait. Thank you for stopping by. This is a special invitation. You can jump to read the article if you want. 🙌
With Network Spy, you can monitor, inspect, and modify your network traffic during development. Perfect for debugging and more analysis. 🙌 Join the Waitlist Today! https://mozzlog.com/projects/network-spy
First, if you still use XcodeProj, try to migrate using XcodeGen first. This isn’t necessary. But it will help you understand the project.
Second, If you use CocoaPods, you can use PodsToBUILD. But there’s an issue where you have limited time with huge dependencies to be migrated. So, build with CocoaPods-Rome. Then you integrate with bazel apple rules
apple_dynamic_framework.There will be an issue during iTunes verification, though. It may be incomplete bitcode. You may need to disable Bitcode.
Also, there will be some dependencies that will have an incorrect layout according to Apple Bundle rules. This happens to me when integrating MidtransSDK. So I move this to PodsToBUILD. But there will be an issue later. I’ll cover it below.
Third, maybe some dependencies can’t be built with CocoaPods-Rome. You can try to build it with Carthage. This is the last resort for a dynamic framework.
Integrating with PodsToBUILD is the recommended way, as this will build a static library. But my experience with MidtransSDK yields errors when running on the device.
This is because MidtransSDK will reference its Nib from the main bundle, which should refer to its framework bundle rather than Application Bundle. The resources will be available in different bundle by PodToBUILD generated configuration. So you will find a crash.
You can work around this. But again, you have limited time and resources to do so, so I suggest this precedence:
Migrating to a different build system is both difficult and easy at the same time. You should try it yourself. There will be pros and cons to your use case. The learning curve is worth the new knowledge.
Bazel itself is an extensible build system, and we have Tulsi to incorporate it into Xcode. The best part, we can mix Swift, Objective-C, Kotlin, Rust, C, C++, and other languages of your choice into your iOS app with a single build system. As bazel says, fast and correct, choose two.
Uh Snap! Error Happen!
Well, this article is not perfect. Do you find mistakes? Does it crash?
Perhaps this article is also obsolete. Please comment below if so. Let me update it as soon as possible. Thank you very much!
If you want to read another article that talks about mobile, web, and backend, you can go here: https://www.mozzlog.com/blog