Skip to content

Commit

Permalink
Fix Xcode Archive task failing if project path contains whitespace
Browse files Browse the repository at this point in the history
Summary:
Currently, Xcodebuild Archive task "Bundle React Native code and images" step fails if the project path contains whitespace characters. This is due to `react-native-xcode.sh` not escaping the local CLI path.

Ideally, of course, folks would use sane directory names, but this affects people in the community. I have seen this at a beginner hackathon, as well as Stack Overflow, e.g. https://stackoverflow.com/questions/48209829/cannot-create-offline-bundle-for-react-native-ios

```
mkdir Bad\ Name
cd Bad\ Name
react-native init TestProject
cd TestProject
open ios/TestProject.xcodeproj
```
* Run `Build > Archive`
* `cli.js bundle` command fails with "Cannot find module '.../Bad'"

* Patch `/node_modules/react-native/scripts/react-native-xcode.sh` with changed file
* Run `Build > Archive`
* Build succeeds

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scrip] - Added thing to script that nobody will see
-->

 [IOS] [MINOR] [scripts/react-native-xcode.sh] - Escape directory paths with spaces
Closes #17628

Differential Revision: D6806418

Pulled By: hramos

fbshipit-source-id: 7ef3943d91807d0086f0717e436e1988f9faf03d
  • Loading branch information
jevakallio authored and facebook-github-bot committed Jan 26, 2018
1 parent be56a3e commit 8aa568e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/react-native-xcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fi

BUNDLE_FILE="$DEST/main.jsbundle"

$NODE_BINARY $CLI_PATH $BUNDLE_COMMAND \
$NODE_BINARY "$CLI_PATH" $BUNDLE_COMMAND \
$CONFIG_ARG \
--entry-file "$ENTRY_FILE" \
--platform ios \
Expand Down

0 comments on commit 8aa568e

Please sign in to comment.