Skip to content

Shall script project.pbxproj contains an error #865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
KonstantinZhukovskij opened this issue Dec 27, 2022 · 3 comments
Closed

Shall script project.pbxproj contains an error #865

KonstantinZhukovskij opened this issue Dec 27, 2022 · 3 comments

Comments

@KonstantinZhukovskij
Copy link

KonstantinZhukovskij commented Dec 27, 2022

Issue

The shall script in the project.pbxproj contains an error. I found out about this after the react-native-version library started throwing an error. [RNV] SyntaxError: Expected "\"", "\\'", "\\\"", "\\n", or [^\\"] but "\\" found.
If the script is removed, then everything works correctly. I think that there are errors associated with the path or \ /

Shall script after installing the library

#!/bin/sh\ncd ${PROJECT_DIR}\ncd ..\nif [ -s \"$HOME/.nvm/nvm.sh\" ]; then\n. \"$HOME/.nvm/nvm.sh\"\nelif [ -x \"$(command -v brew)\" ] && [ -s \"$(brew --prefix nvm)/nvm.sh\" ]; then\n. \"$(brew --prefix nvm)/nvm.sh\"\nfi\nexport NODE_BINARY=node\n\nINSTABUG_SOURCEMAPS_UPLOAD_DISABLE=$(echo $INSTABUG_SOURCEMAPS_UPLOAD_DISABLE | tr 'A-Z' 'a-z')\nif [ \"${INSTABUG_SOURCEMAPS_UPLOAD_DISABLE}\" = \"true\" ]; then\n echo \"Instabug: Environment variable INSTABUG_SOURCEMAPS_UPLOAD_DISABLE was set to true, skipping sourcemap upload\"\n exit 0\nfi\n\nif [ ! \"$INFOPLIST_FILE\" ] || [ -z \"$INFOPLIST_FILE\" ]; then\n echo \"Instabug: INFOPLIST_FILE not found in Xcode build settings, skipping sourcemap upload\"\n exit 0\nfi\n\nif [ ! \"${PROJECT_DIR}\" ] || [ -z \"${PROJECT_DIR}\" ]; then\n echo \"Instabug: PROJECT_DIR not found in Xcode build settings, skipping sourcemap upload\"\n exit 0\nfi\n\nPLIST_ABS_PATH=\"$PROJECT_DIR/$INFOPLIST_FILE\"\necho \"Instabug: PLIST_ABS_PATH: $PLIST_ABS_PATH\"\n\nif [ ! \"${INSTABUG_APP_TOKEN}\" ] || [ -z \"${INSTABUG_APP_TOKEN}\" ]; then\n echo \"Instabug: Looking for Token...\"\n INSTABUG_APP_TOKEN=$(grep -r --exclude-dir={node_modules,ios,android} \"Instabug.start[WithToken]*([\\\"\\'][0-9a-zA-Z]*[\\\"\\']\" ./ -m 1 | grep -o \"[\\\"\\'][0-9a-zA-Z]*[\\\"\\']\" | cut -d \"\\\"\" -f 2 | cut -d \"'\" -f 2)\nfi\n\nif [ ! \"${INSTABUG_APP_TOKEN}\" ] || [ -z \"${INSTABUG_APP_TOKEN}\" ]; then\n echo \"Instabug: INSTABUG_APP_TOKEN not found. Make sure you've added the SDK initialization line Instabug.start Or added the environment variable INSTABUG_APP_TOKEN\"\n exit 0\nelse\n if [ ! \"${INSTABUG_APP_VERSION_CODE}\" ] || [ -z \"${INSTABUG_APP_VERSION_CODE}\" ]; then\n INSTABUG_APP_VERSION_CODE=$(/usr/libexec/PlistBuddy -c 'print CFBundleVersion' ${PLIST_ABS_PATH} )\n if [ ! \"${INSTABUG_APP_VERSION_CODE}\" ] || [ -z \"${INSTABUG_APP_VERSION_CODE}\" ]; then\n echo \"CFBundleVersion could not be found, please upload the sourcemap files manually\"\n exit 0\n fi\n INSTABUG_APP_VERSION_CODE_ENV=$(grep -o '$(.*)' <<< $INSTABUG_APP_VERSION_CODE | cut -d \"(\" -f2 | cut -d \")\" -f1)\n if !([ ! \"${INSTABUG_APP_VERSION_CODE_ENV}\" ] || [ -z \"${INSTABUG_APP_VERSION_CODE_ENV}\" ]); then\n INSTABUG_APP_VERSION_CODE=${!INSTABUG_APP_VERSION_CODE_ENV}\n if [ ! \"${INSTABUG_APP_VERSION_CODE}\" ] || [ -z \"${INSTABUG_APP_VERSION_CODE}\" ]; then\n echo \"Environment variable $INSTABUG_APP_VERSION_CODE_ENV was specified inside Info.plist but was not found, please upload the sourcemap files manually\" \n exit 0\n fi\n fi\n fi\n if [ ! \"${INSTABUG_APP_VERSION_NAME}\" ] || [ -z \"${INSTABUG_APP_VERSION_NAME}\" ]; then\n INSTABUG_APP_VERSION_NAME=$(/usr/libexec/PlistBuddy -c 'print CFBundleShortVersionString' ${PLIST_ABS_PATH} )\n if [ ! \"${INSTABUG_APP_VERSION_NAME}\" ] || [ -z \"${INSTABUG_APP_VERSION_NAME}\" ]; then\n echo \"CFBundleShortVersionString could not be found, please upload the sourcemap files manually\"\n exit 0\n fi\n INSTABUG_APP_VERSION_NAME_ENV=$(grep -o '$(.*)' <<< $INSTABUG_APP_VERSION_NAME | cut -d \"(\" -f2 | cut -d \")\" -f1)\n if !([ ! \"${INSTABUG_APP_VERSION_NAME_ENV}\" ] || [ -z \"${INSTABUG_APP_VERSION_NAME_ENV}\" ]); then\n INSTABUG_APP_VERSION_NAME=${!INSTABUG_APP_VERSION_NAME_ENV}\n if [ ! \"${INSTABUG_APP_VERSION_NAME}\" ] || [ -z \"${INSTABUG_APP_VERSION_NAME}\" ]; then\n echo \"Environment variable $INSTABUG_APP_VERSION_NAME_ENV was specified inside Info.plist but was not found, please upload the sourcemap files manually\" \n exit 0\n fi\n fi\n fi\n if [ -z \"${INSTABUG_ENTRY_FILE}\" ]; then \n ENTRY_FILE='index.js'\n else \n ENTRY_FILE=${INSTABUG_ENTRY_FILE}\n fi\n if [ ! -f $ENTRY_FILE ]; then\n echo \"Instabug: err: entry file not found. Make sure\" \"\\\"${ENTRY_FILE}\\\"\" \"exists in your projects root directory. Or add the environment variable INSTABUG_ENTRY_FILE with the name of your entry file\"\n exit 0\n fi\n VERSION='{\"code\":\"'\"$INSTABUG_APP_VERSION_CODE\"'\",\"name\":\"'\"$INSTABUG_APP_VERSION_NAME\"'\"}'\n echo \"Instabug: Token:\" \"\\\"\"${INSTABUG_APP_TOKEN}\"\\\"\"\n echo \"Instabug: VERSION: $VERSION\"\n echo \"Instabug: Entry file found\" \"\\\"\"${ENTRY_FILE}\"\\\"\"\n echo \"Instabug: Generating sourcemap files...\"\n HERMES_ENABLED=$(grep hermes-engine ./ios/Podfile.lock -m 1)\n INSTALLED_RN_VERSION_MAJOR=$(node -p \"require('./node_modules/react-native/package.json').version\" | cut -d \".\" -f2)\n if [[ ! -z \"$HERMES_ENABLED\" && \"$INSTALLED_RN_VERSION_MAJOR\" -ge 65 && \"$INSTALLED_RN_VERSION_MAJOR\" -lt 70 ]]; then\n EXTRA_ARGS=\"--minify false\"\n fi\n #Generate ios sourcemap\n npx react-native bundle --platform ios \\\n --reset-cache \\\n --entry-file $ENTRY_FILE \\\n --dev false \\\n --bundle-output ./ios/main.jsbundle \\\n --sourcemap-output ./ios-sourcemap.json \\\n $EXTRA_ARGS\n \n echo \"Instabug: Uploading files...\"\n #Upload ios sourcemap\n curl -X POST 'https://api.instabug.com/api/sdk/v3/symbols_files' -F \"app_version=${VERSION}\" -F \"symbols_file=@./ios-sourcemap.json\" -F \"application_token=${INSTABUG_APP_TOKEN}\" -F \"platform=react_native\" -F \"os=ios\" \n rm -rf ios-sourcemap.json\n echo \nfi\n";

React Native, iOS and Android Versions

"instabug-reactnative": "11.5.1",
"react": "17.0.2",
"react-native": "0.67.4",

@TheBuggedYRN
Copy link
Contributor

Thanks @KonstantinZhukovskij for reporting this!

This issue is a duplicated of #771, you can use the legacy mode from react-native-version as follows:

npx react-native-version --target android,ios --generate-build -L

@KonstantinZhukovskij
Copy link
Author

It's still a mistake, after all. Yes there is a workaround, but the error is actual

@TheBuggedYRN
Copy link
Contributor

@KonstantinZhukovskij I understand how frustrating it might be,
but it's a well-known issue with react-native-version.

From our side, we have a change planned in the future to deprecate these shell scripts in favour of a NodeJS-based script. This might help solving the issue, but it will be a few months until this change lands in.

Don't hesitate to reach out if you still need further help with this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants