Permalink
Browse files

Allow applicationId to be specified on build

Summary:
Added the ability to define a specific applicationId (in case it's different to the package name)

<details>
  Thanks for submitting a PR! Please read these instructions carefully:

  - [x] Explain the **motivation** for making this change.
  - [ ] Provide a **test plan** demonstrating that the code is solid.
  - [x] Match the **code formatting** of the rest of the codebase.
  - [x] Target the `master` branch, NOT a "stable" branch.

  Please read the [Contribution Guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md) to learn more about contributing to React Native.
</details>

We have a specific requirement that our package name differs from the applicationId but not in a way that allows us to add it as a suffix to our package name. I wanted to add the option to specify a specific applicationId.

`react-native run-android --appId <Specific Application Id>`
Closes #14524

Differential Revision: D5910259

Pulled By: shergin

fbshipit-source-id: 768fbc910f6b520dd18936f6bceeee136fca7025
  • Loading branch information...
shockdesign authored and facebook-github-bot committed Sep 26, 2017
1 parent c70ac24 commit 979629504b6449454576e9325811e6f467da4dc5
Showing with 15 additions and 1 deletion.
  1. +15 −1 local-cli/runAndroid/runAndroid.js
@@ -88,6 +88,16 @@ function tryRunAdbReverse(packagerPort, device) {
}
}
function getPackageNameWithSuffix(appId, appIdSuffix, packageName) {
if (appId) {
return appId;
} else if (appIdSuffix) {
return packageName + '.' + appIdSuffix;
}
return packageName;
}
// Builds the app and runs it on a connected emulator / device.
function buildAndRun(args) {
process.chdir(path.join(args.root, 'android'));
@@ -100,7 +110,7 @@ function buildAndRun(args) {
'utf8'
).match(/package="(.+?)"/)[1];
const packageNameWithSuffix = args.appIdSuffix ? packageName + '.' + args.appIdSuffix : packageName;
const packageNameWithSuffix = getPackageNameWithSuffix(args.appId, args.appIdSuffix, packageName);
const adbPath = getAdbPath();
if (args.deviceId) {
@@ -302,6 +312,10 @@ module.exports = {
command: '--appFolder [string]',
description: 'Specify a different application folder name for the android source.',
default: 'app',
}, {
command: '--appId [string]',
description: 'Specify an applicationId to launch after build.',
default: '',
}, {
command: '--appIdSuffix [string]',
description: 'Specify an applicationIdSuffix to launch after build.',

0 comments on commit 9796295

Please sign in to comment.