Commit 71c6bfb
- Keep the quotes on header search paths (#57981)
Summary:
a regression from a8156ac and breaks react-native nightly build at expo: https://github.com/expo/expo/actions/runs/31990917142/job/95274214849
the `shellsplit` will stripe quotes and break paths with spaces like `Swift Compatibility Header`. this pr tries to re-quote.
here's small demo script
```ruby
require 'shellwords'
# What main does today: shellsplit the existing value, append, write it back.
def main_behaviour(existing, add)
paths = existing || []
paths = Shellwords.shellsplit(paths) if paths.is_a?(String)
(paths + add).uniq
end
# What this PR does: quote only the paths we add, never touch what is there.
def this_pr(existing, add)
quoted = add.map { |path| "\"#{path}\"" }
case existing
when nil
quoted
when Array
existing + quoted.reject { |path| existing.include?(path) }
else
([existing] + quoted.reject { |path| existing.include?(path) }).join(" ")
end
end
# Xcode joins an Array setting with spaces, then splits it on whitespace while
# honouring quotes. This is what the compiler ends up with.
def as_xcode_reads_it(value)
Shellwords.shellsplit(value.is_a?(Array) ? value.join(" ") : value)
end
ADD = ['$(PODS_ROOT)/ReactNativeDependencies/Headers']
# A pod that exports a Swift compatibility header. The directory name has
# spaces, so the podspec quotes it. Podspecs write this as a String or as an
# Array, and both forms reach add_rn_third_party_dependencies.
SWIFT_HEADER = '${PODS_CONFIGURATION_BUILD_DIR}/MyPod/Swift Compatibility Header'
CASES = {
'String' => "\"$(PODS_ROOT)/DoubleConversion\" \"#{SWIFT_HEADER}\"",
'Array' => ['"$(PODS_ROOT)/DoubleConversion"', "\"#{SWIFT_HEADER}\""],
}
CASES.each do |label, existing|
puts "#{label} HEADER_SEARCH_PATHS"
{ 'main' => method(:main_behaviour), 'this PR' => method(:this_pr) }.each do |name, fn|
paths = as_xcode_reads_it(fn.call(existing, ADD))
verdict = paths.include?(SWIFT_HEADER) ? 'ok' : 'BROKEN'
puts " #{name.ljust(7)} -> #{paths.size} paths, #{verdict}: #{paths.inspect}"
end
puts
end
```
output
```
String HEADER_SEARCH_PATHS
main -> 5 paths, BROKEN: ["$(PODS_ROOT)/DoubleConversion", "${PODS_CONFIGURATION_BUILD_DIR}/MyPod/Swift", "Compatibility", "Header", "$(PODS_ROOT)/ReactNativeDependencies/Headers"]
this PR -> 3 paths, ok: ["$(PODS_ROOT)/DoubleConversion", "${PODS_CONFIGURATION_BUILD_DIR}/MyPod/Swift Compatibility Header", "$(PODS_ROOT)/ReactNativeDependencies/Headers"]
Array HEADER_SEARCH_PATHS
main -> 3 paths, ok: ["$(PODS_ROOT)/DoubleConversion", "${PODS_CONFIGURATION_BUILD_DIR}/MyPod/Swift Compatibility Header", "$(PODS_ROOT)/ReactNativeDependencies/Headers"]
this PR -> 3 paths, ok: ["$(PODS_ROOT)/DoubleConversion", "${PODS_CONFIGURATION_BUILD_DIR}/MyPod/Swift Compatibility Header", "$(PODS_ROOT)/ReactNativeDependencies/Headers"]
```
## Changelog:
[IOS][FIXED] - Keep the quotes on header search paths containing spaces in `add_rn_third_party_dependencies`
Pull Request resolved: #57981
Test Plan: apply the patch on create-expo-nightly and the ios build should pass expo/expo#49023
Reviewed By: javache
Differential Revision: D116600347
Pulled By: cipolleschi
fbshipit-source-id: 73c3c7560e5c4970b678298c05743d1e2404cc9b1 parent b03652a commit 71c6bfb
2 files changed
Lines changed: 120 additions & 25 deletions
Lines changed: 89 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
Lines changed: 31 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
53 | 45 | | |
54 | 46 | | |
55 | 47 | | |
56 | 48 | | |
57 | 49 | | |
58 | 50 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | 51 | | |
64 | 52 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
69 | 56 | | |
70 | 57 | | |
71 | 58 | | |
| |||
148 | 135 | | |
149 | 136 | | |
150 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
151 | 157 | | |
152 | 158 | | |
153 | 159 | | |
| |||
0 commit comments