Ability to supply product flavor for `react-native run-android` command
Summary:This small update to runAndroid.js allows to specify product flavor as optional argument, like that: `react-native run-android --option-flavor=staging` This option is useful when developing complex applications that require some flavor-specific functionality. More information about productFlavors can be found here: http://developer.android.com/intl/ru/tools/building/configuring-gradle.html Closes https://github.com/facebook/react-native/pull/6010 Differential Revision: D3011662 Pulled By: mkonicek fb-gh-sync-id: ce730a17340c1f21b5d75f28a784db4d6fd99725 shipit-source-id: ce730a17340c1f21b5d75f28a784db4d6fd99725
This commit is contained in:
parent
2d27cf0ceb
commit
46422ddd99
|
@ -34,6 +34,10 @@ function _runAndroid(argv, config, resolve, reject) {
|
|||
command: 'root',
|
||||
type: 'string',
|
||||
description: 'Override the root directory for the android build (which contains the android directory)',
|
||||
}, {
|
||||
command: 'flavor',
|
||||
type: 'string',
|
||||
required: false,
|
||||
}], argv);
|
||||
|
||||
args.root = args.root || '';
|
||||
|
@ -70,7 +74,15 @@ function buildAndRun(args, reject) {
|
|||
? 'gradlew.bat'
|
||||
: './gradlew';
|
||||
|
||||
const gradleArgs = ['installDebug'];
|
||||
const gradleArgs = [];
|
||||
if (args['flavor']) {
|
||||
gradleArgs.push('install' +
|
||||
args['flavor'][0].toUpperCase() + args['flavor'].slice(1)
|
||||
);
|
||||
} else {
|
||||
gradleArgs.push('installDebug');
|
||||
}
|
||||
|
||||
if (args['install-debug']) {
|
||||
gradleArgs.push(args['install-debug']);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue