forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
directly call community-cli-plugin in react-native-xcode.sh (facebook…
…#44721) Summary: Pull Request resolved: facebook#44721 For iOS builds of `react-native`, the [react-native-xcode.sh](https://www.internalfb.com/code/fbsource/[7ad79aae3e8bf565d53f087ac7f7b7622b19acec]/xplat/js/react-native-github/packages/react-native/scripts/react-native-xcode.sh) script is executed as one of the build phases. This phase bundles the JS application (dev or production). I've updated this to use the new `bundle.js` script instead of calling the `react-native/cli.js`. This is identical except with how the config is captured: {F1669960016} This is similar to our approach with the Gradle plugin, giving Framework authors more control. **Other:** formatting changes for the Privacy Manifest that Xcode keeps updating. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D57915368 fbshipit-source-id: f52ea4b3cb94212ac97a3d7edeb68747418fe0a9
- Loading branch information
Showing
8 changed files
with
151 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"platforms": { | ||
"ios": {}, | ||
"android": {} | ||
}, | ||
"project": { | ||
"ios": { | ||
"sourceDir": "HELLOWORLD_PATH/ios", | ||
"xcodeProject": { | ||
"name": "HelloWorld.xcworkspace", | ||
"isWorkspace": true | ||
} | ||
}, | ||
"android": { | ||
"sourceDir": "HELLOWORLD_PATH/android", | ||
"appName": "app", | ||
"packageName": "com.helloworld", | ||
"applicationId": "com.helloworld", | ||
"mainActivity": ".MainActivity" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const {bundleCommand: bc} = require('@react-native/community-cli-plugin'); | ||
const {execSync} = require('child_process'); | ||
const program = require('commander'); | ||
const {existsSync, readFileSync} = require('fs'); | ||
const path = require('path'); | ||
|
||
program.version( | ||
JSON.parse( | ||
readFileSync(path.resolve(__dirname, '..', 'package.json'), 'utf8'), | ||
).version, | ||
); | ||
|
||
program | ||
.name(bc.name) | ||
.description(bc.description ?? '') | ||
.option( | ||
'--config-cmd <string>', | ||
'Command to generate a JSON project config', | ||
'npx react-native config', | ||
) | ||
.option('--load-config <string>', 'JSON project config') | ||
.action(async function handleAction(options, ...args) { | ||
let config = null; | ||
|
||
if (options.loadConfig != null) { | ||
const rawText = existsSync(options.loadConfig) | ||
? readFileSync(options.loadConfig, 'utf8') | ||
: options.loadConfig; | ||
config = JSON.parse(rawText); | ||
} else if (options.configCmd != null) { | ||
config = JSON.parse( | ||
execSync(options.configCmd.trim(), {encoding: 'utf8'}), | ||
); | ||
} | ||
|
||
if (config == null) { | ||
throw new Error('No config provided'); | ||
} | ||
|
||
await bc.func(args, config, options); | ||
}); | ||
|
||
if (bc.options != null) { | ||
for (const o of bc.options) { | ||
program.option( | ||
o.name, | ||
o.description ?? '', | ||
o.parse ?? (value => value), | ||
o.default, | ||
); | ||
} | ||
} | ||
|
||
if (require.main === module) { | ||
program.parse(process.argv); | ||
} | ||
|
||
module.exports = program; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters