Cli: Better building for release story for iOS and Android

Created on 19 Feb 2019  路  5Comments  路  Source: react-native-community/cli

In the docs for running on device, it recommends running the following command on iOS:
https://facebook.github.io/react-native/docs/next/signed-apk-android#testing-the-release-build-of-your-app

react-native run-ios --configuration Release

and the following command for Android:
https://facebook.github.io/react-native/docs/next/signed-apk-android#testing-the-release-build-of-your-app

react-native run-android --variant=release

Is there a reason that these are different, one being configuration and one being variant? Should they both be the same?

run-ios discussion feature request

Most helpful comment

That's a good question to ask! "Variant", "Configuration" (and "Scheme") are platform specific and make sense for native developers. I usually use Fastlane to deal with all that and the options passed to specific actions/lanes are also platform-specific.

I think it would be great to unify the interfaces, but it requires someone with extensive iOS and Android building knowledge to come up with simple but permissive API (and see if it makes sense at all).

cc @ferrannp @Krizzu @michalchudziak @dratwas

All 5 comments

That's a good question to ask! "Variant", "Configuration" (and "Scheme") are platform specific and make sense for native developers. I usually use Fastlane to deal with all that and the options passed to specific actions/lanes are also platform-specific.

I think it would be great to unify the interfaces, but it requires someone with extensive iOS and Android building knowledge to come up with simple but permissive API (and see if it makes sense at all).

cc @ferrannp @Krizzu @michalchudziak @dratwas

If the command was run (rather than run-ios and run-android), I think unifying the names would make more sense. Still, I feel it is a very ambitious task with potentially high risk of limiting the API for future extension (what about features that are iOS specific?)

We could optimise for this particular use-case by aliasing both --variant and --Configuration with something else, e.g. --mode=Release|Debug

We could optimise for this particular use-case by aliasing both --variant and --Configuration with something else, e.g. --mode=Release|Debug

Or a general API: --mode=release|debug that is _overridable_ (not just aliased) per-platform with --android-variant and --xcode-configuration

@radex, sounds like a plan. Would you be up to sending a quick PR? 鉂わ笍

Adding to the OP, the fact that we have run-* commands, that additionally spawn Metro server and boot up simulators, is not something a user wants when building their up, e.g. on a CI.

I believe we should introduce build-android and build-ios that share their backend withrun-* commands, but without starting Metro instance and booting up a simulator. In addition to --mode flag mentioned here, I think that would provide a proper DX.

Was this page helpful?
0 / 5 - 0 ratings