Skip to content

Commit b2e2f43

Browse files
mysport12facebook-github-bot
authored andcommitted
fix: codegen - project paths with spaces (#31141)
Summary: - Fixed iOS codegen script incorrectly splitting root project paths that contain spaces react-native-community/releases#214 (comment) iOS builds were failing on 0.64.0-rc.4 for projects that contained spaces in the root directory path. The error logs pointed to the codegen script not being able to find a directory. The path was being split at a space in one of the folder names. This PR modifies the codegen script to include the spaces and use the entire project root path. ## Changelog [Internal] fix: codegen script failing for iOS builds on projects with spaces in root directory path Pull Request resolved: #31141 Test Plan: Failing Test: Upgrade or init a new project and make sure that the project root directory contains a space (ex: /Users/test/cool projects/app/). With a clean install of node_modules and pods, attempt to build the project with Xcode. The build fails with an error running the script in FBReactNativeSpec (no such file or directory). Passing Test: Include the changes presented in this PR and rerun the failing test (clean node_modules + PR patch/clean pods). The app should build. Reviewed By: mdvacca Differential Revision: D28255539 Pulled By: hramos fbshipit-source-id: d44011985750639bd2fabfd40ed645d4eb661bd7
1 parent 438a4cf commit b2e2f43

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scripts/react_native_pods.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ def use_react_native_codegen!(spec, options={})
159159
modules_output_dir = "React/#{modules_library_name}/#{modules_library_name}"
160160

161161
# Run the codegen as part of the Xcode build pipeline.
162-
env_vars = "SRCS_DIR=#{js_srcs}"
163-
env_vars += " MODULES_OUTPUT_DIR=#{prefix}/#{modules_output_dir}"
164-
env_vars += " MODULES_LIBRARY_NAME=#{modules_library_name}"
162+
env_vars = "SRCS_DIR='#{js_srcs}'"
163+
env_vars += " MODULES_OUTPUT_DIR='#{prefix}/#{modules_output_dir}'"
164+
env_vars += " MODULES_LIBRARY_NAME='#{modules_library_name}'"
165165

166166
generated_dirs = [ modules_output_dir ]
167167
generated_filenames = [ "#{modules_library_name}.h", "#{modules_library_name}-generated.mm" ]
@@ -172,7 +172,7 @@ def use_react_native_codegen!(spec, options={})
172172
# Eventually, we want these to be part of the same library as #{modules_library_name} above.
173173
components_output_dir = "ReactCommon/react/renderer/components/rncore/"
174174
generated_dirs.push components_output_dir
175-
env_vars += " COMPONENTS_OUTPUT_DIR=#{prefix}/#{components_output_dir}"
175+
env_vars += " COMPONENTS_OUTPUT_DIR='#{prefix}/#{components_output_dir}'"
176176
components_generated_filenames = [
177177
"ComponentDescriptors.h",
178178
"EventEmitters.cpp",
@@ -194,5 +194,5 @@ def use_react_native_codegen!(spec, options={})
194194
:execution_position => :before_compile,
195195
:show_env_vars_in_log => true
196196
}
197-
spec.prepare_command = "mkdir -p #{generated_dirs.reduce("") { |str, dir| "#{str} ../../#{dir}" }} && touch #{generated_files.reduce("") { |str, filename| "#{str} ../../#{filename}" }}"
197+
spec.prepare_command = "mkdir -p #{generated_dirs.map {|dir| "'../../#{dir}'"}.join(" ")} && touch #{generated_files.map {|file| "'../../#{file}'"}.join(" ")}"
198198
end

0 commit comments

Comments
 (0)