Skip to content
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

fix: codegen - project paths with spaces #31141

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand All @@ -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",
Expand All @@ -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' }}"
hramos marked this conversation as resolved.
Show resolved Hide resolved
end