From 289e7fe323e352434337334103ad110e7ed57f21 Mon Sep 17 00:00:00 2001 From: Craig Martin Date: Thu, 11 Mar 2021 22:46:05 -0500 Subject: [PATCH 1/2] fix: codegen - project paths with spaces - Fixed iOS codegen script incorrectly splitting root project paths that contain spaces --- scripts/react_native_pods.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index 2a2b04e2b350fa..c1b337f29b40ae 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -159,12 +159,12 @@ def use_react_native_codegen!(spec, options={}) codegen_modules_output_dir = options[:codegen_modules_output_dir] ||= File.join(prefix, "React/#{codegen_modules_library_name}/#{codegen_modules_library_name}") # Run the codegen as part of the Xcode build pipeline. - env_vars = "SRCS_DIR=#{srcs_dir}" - env_vars += " CODEGEN_MODULES_OUTPUT_DIR=#{codegen_modules_output_dir}" + env_vars = "SRCS_DIR='#{srcs_dir}'" + env_vars += " CODEGEN_MODULES_OUTPUT_DIR='#{codegen_modules_output_dir}'" # Since the generated files are not guaranteed to exist when CocoaPods is run, we need to create # empty files to ensure the references are included in the resulting Pods Xcode project. - mkdir_command = "mkdir -p #{codegen_modules_output_dir}" + mkdir_command = "mkdir -p '#{codegen_modules_output_dir}'" generated_filenames = [ "#{codegen_modules_library_name}.h", "#{codegen_modules_library_name}-generated.mm" ] generated_files = generated_filenames.map { |filename| File.join(codegen_modules_output_dir, filename) } @@ -173,8 +173,8 @@ def use_react_native_codegen!(spec, options={}) # Eventually, we want these to be part of the same library as #{codegen_modules_library_name} above. codegen_components_library_name = "rncore" codegen_components_output_dir = File.join(prefix, "ReactCommon/react/renderer/components/#{codegen_components_library_name}") - env_vars += " CODEGEN_COMPONENTS_OUTPUT_DIR=#{codegen_components_output_dir}" - mkdir_command += " #{codegen_components_output_dir}" + env_vars += " CODEGEN_COMPONENTS_OUTPUT_DIR='#{codegen_components_output_dir}'" + mkdir_command += " '#{codegen_components_output_dir}'" components_generated_filenames = [ "ComponentDescriptors.h", "EventEmitters.cpp", @@ -192,10 +192,10 @@ def use_react_native_codegen!(spec, options={}) :name => 'Generate Specs', :input_files => [srcs_dir], :output_files => ["$(DERIVED_FILE_DIR)/codegen-#{codegen_modules_library_name}.log"].concat(generated_files), - :script => "set -o pipefail\n\nbash -l -c '#{env_vars} CODEGEN_MODULES_LIBRARY_NAME=#{codegen_modules_library_name} #{File.join(__dir__, "generate-specs.sh")}' 2>&1 | tee \"${SCRIPT_OUTPUT_FILE_0}\"", + :script => "set -o pipefail\n\nbash -l -c \"#{env_vars} CODEGEN_MODULES_LIBRARY_NAME='#{codegen_modules_library_name}' '#{File.join(__dir__, "generate-specs.sh")}'\" 2>&1 | tee \"${SCRIPT_OUTPUT_FILE_0}\"", :execution_position => :before_compile, :show_env_vars_in_log => true } - spec.prepare_command = "#{mkdir_command} && touch #{generated_files.reduce() { |str, file| str + " " + file }}" + spec.prepare_command = "#{mkdir_command} && touch #{generated_files.reduce() { |str, file| 'str' + " " + 'file' }}" end From f9c743258bd934b63f6dc161a9f7c590a08c64a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= <165856+hramos@users.noreply.github.com> Date: Thu, 6 May 2021 07:11:34 -0700 Subject: [PATCH 2/2] Update scripts/react_native_pods.rb Co-authored-by: rrrasti <48554232+rrrasti@users.noreply.github.com> --- scripts/react_native_pods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index c1b337f29b40ae..01fd51e0e91612 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -197,5 +197,5 @@ def use_react_native_codegen!(spec, options={}) :show_env_vars_in_log => true } - spec.prepare_command = "#{mkdir_command} && touch #{generated_files.reduce() { |str, file| 'str' + " " + 'file' }}" + spec.prepare_command = "#{mkdir_command} && touch #{generated_files.map {|file| "'#{file}'"}.join(" ")}" end