What is the best way to build and publish internal...
# compose-ios
j
What is the best way to build and publish internal iOS app binaries in CMP? Can you use Gradle and firebase app distribution or testflight? Or how do you do this and how to integrate this in Gradle build task? Can be debug app to begin with, but learn release app with push notifications will be important as well.
a
Prepare for pain is all the advice I can give ๐Ÿ™ˆ
j
Haha, any knowledge of pain can provide? ๐Ÿ˜€ I think Fastlane should work. I am just horrible at find info how. I expect like a simple Gradle task doing everything for me like in Android.
a
My colleague put the iOS side of this together through blood sweat and tears. We use Github actions. Iโ€™ve redacted our app name. Iโ€™m dumping the full script for context. We do have a few custom Gradle tasks that you can ignore. Itโ€™s the
deploy_pre_release_ios
job
๐Ÿ˜ฎ 1
Iโ€™m sure thereโ€™s better ways of deploying iOS apps, but this works for us and got no time to improve it just now ๐Ÿ˜…
j
Omg that looks insane ๐Ÿคฃ Doesnt Fastlane or firebase app distribution works for this crap?
a
It might yea, we thought about it initially, but were used to gradle play publisher for Android. I'm not sure firebase app distribution for iOS can publish to TestFlight though ๐Ÿ˜…
It's an absolute headache, I think CHATGPT helped write it, as you can probably tell ๐Ÿ˜‚
j
Yeah same triplet play plugin in Android used. For Appstore publish not sure if possible. In my case want only internal distribution. If using Firebase app distribution not need TestFlight, same thing almost. Chatgpt sucks, sorry ๐Ÿ˜
a
helped me a lot with iOS crap, would have been in trouble without it ๐Ÿ˜…
my colleague looked into Firebase app distro for iOS, itโ€™s a huge pain in the ass apparently
@Shahzar Ahmed can elaborate on the issues with Firebase app distribution
j
It looks easy in Googles docs for Fastlane but maybe complex in CMP/KMP Gradle setup, not sure. I waited as long as possible fix it ๐Ÿ˜
a
yea that looks really good actually
j
But yeah having zero knowledge about TestFlight and iOS certs for release build to be publish in iOS store .
Hoped FastLane and Firebase spared me this pain or some Amper Gradle plugin ๐Ÿ˜
Isnt there any library KMP doing this, like Moko or such? Havent find anything like triplet play but cross platform. Also need same for macOS store and publish to web server once enable desktop and web in my CMP project ๐Ÿ˜
a
it really doesnโ€™t help not having iOS experience, it really screwed us for a while ๐Ÿ™ˆ
I couldnโ€™t find one on moko, only use that for resources so far
j
I mean ofc can do manually setup but will break each Gradle release. Hence nice having a library solve that with more in depth knowledge about iOS and Gradle.
I think Jetbrains working on these things but not sure.
a
apparently for Firebase app distro, you need to put some device ID from the devices you want to install it on in the provisioning profile for the app, then make a release with that, or something along those lines
๐Ÿ˜ 1
j
Google play services and app distribution seems painful. I think even code Fastlane is painful ๐Ÿ˜
I expect one line config json and point to maybe a api key and one Gradle task done ๐Ÿ˜
a
can only hope that will happen one day ๐Ÿ˜…
j
Yeah heard that, but I think those device ids only required if need push notifications.
Also I think in firebase app distro app can add these keys yourself on invite but not sure.
a
Ah okay. We use firebase analytics, crashlytics and remote config, so might also be required for that, not sure
j
Yeah I usually avoid Firebase but need it now.
Using Firebase cloud messaging is easier for iOS and Android cross platform imo instead of only use it for Android and expect actual impl KMP in iOS. I rather take hit launch Google play services in iOS ,๐Ÿ˜
a
Yea that's what I was thinking, ironic that firebase on Android is more limiting market wise than iOS. Google's tactic is to sell useful solutions to Android developers so that devices without Google Play services are outta luck ๐Ÿ˜…
j
Yeah and then if need Huawei store not allow Google play services its funny even more ๐Ÿ˜
Can use Huawei frameworks but not recommended ๐Ÿ˜
a
Huawei is a disaster. Google don't have a store in the UAE so I'm outta luck with getting a pixel here. My wife has a Google-less Huawei and honestly... It's such a disaster. Need to run apps in weird containers like gbox to fake Google Play services
Great hardware, crap software ๐Ÿ˜…
Surely some way to side load it with jailbreaking or something, which is probably worth losing the warranty
j
We at least have nice emulator in Android ๐Ÿ™‚
d
Don't be afraid to use Fastlane, it's (personal opinion) much neater than doing it in Gradle. The device ID adding you're talking about has always been a thing on iOS if you want to distribute apps ad-hoc (non-TestFlight/AppStore), it's not a Firebase specific thing. Perhaps read up a bit on iOS Distribution Profiles first. I don't think there's anything Compose specific here either, the process would be the same without it.
You could look into a mobile-first CI/CD platform like Bitrise.io (I think they had a free tier if not there are others) which will give a friendlier interface for some of the things you have to set up.
j
Hehe sorry I hate Bitrise, I dont ever want to see it again, nightmare UX ๐Ÿ˜ I want to have ideally one setup or one framework both distribute iOS and Android in same, like Fastlane. Dont want pain using multiple ones. I want cross platform setup, ideally Gradle as thats what KMP using. Always looked past through iOS CI pipelines knowing how painful it is to distribute iOS apps compared to other. In Android is very basic single command and no setup with Gradle plugin.
d
Yeah Fastlane is basically your wrapper/entry point around Gradle and xcodebuild respectively then and a lot of the setup can be done there. You iOS and Android "lanes" would be very similar to each other so it turns out pretty neat
๐ŸŽ‰ 1
Basically Fastlane will do โ€ข Call into either gradle (to build a signed aab/apk) or xcodebuild (to "archive" a signed ipa) โ€ข Take these 2 and pass them over to Firebase App Distribution
j
So what, Fastlane is wrapped around Gradle, thought reverse. Gradle plugin wrapping Fastlane or some simple GitHub Action Fastlane plugin. So need both CI calling Gradle and Fastlane ๐Ÿ˜ Ah well at least work both for Android and iOS. Is there any nice documentation doing this the most clean way? Without a gazillion config files.
d
For signing the iOS app you have 2 options realistically - sign it for ad-hoc distribution or for AppStore (TestFlight included) distribution. If you don't want to use TestFlight and want to use Firebase App Distribution you need ad-hoc (or enterprise but let's not go there). Ad-hoc signed apps can only be installed on devices that have been "whitelisted" beforehand by adding their UDID to your Device List/Provisioning Profile
No, no double wrapping needed. Your script can directly invoke Fastlane which will then simply call gradle to run your assemble task and get the produced binary from it. Similarly on iOS just it's not gradle in that case that Fastlane would be calling into
๐ŸŽ‰ 1
j
Hopefully Gradle Amper and Jetbrains fixing this mess soon. Like compose multiplatform distribution tools for desktop, web, iOS and Android. Also same for library SDKs publish. This is redicilous how hard should be publish stuff imo ๐Ÿ˜ Yeah Fastlane itself fine, but its like additional framework on top of also firebase app distribution, Gradle, Xcode etc. Would expect ONE entry point and plugins for all of this.
d
Well, the distribution "rules" if we call them for iOS are set by Apple, so Jetbrains can't do much about it (I mean the signing part and all that)
https://docs.fastlane.tools/actions/build_android_app/ Is a good starting point if you've not used Fastlane before, this will feel familiar and you can see there that it's invoking gradle
j
Yeah ofc, just mean odd no one created plugins to decouple Apples madness. Dont want to know how hard distribute Swift SDK Library ๐Ÿ˜ I tested Fastlane way back but dodged as Android had better tools. But going back test again. Thanks for letting me know Fastlane works on both platforms and for CMP case.
d
Distribution of Swift libraries is slightly different and there could be some new tools to help with that but when it comes to actual iOS apps, Apple keeps a tight leash..at the end of the day they control the whole ecosystem including all devices where you'd want to run your app, so they can just force us to do it their way (at least for now)