expo-modules-autolinking 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/scripts/ios/autolinking_manager.rb +2 -0
- package/scripts/ios/cocoapods/pod_target.rb +50 -0
- package/scripts/ios/cocoapods/sandbox.rb +0 -19
- package/scripts/ios/cocoapods/umbrella_header_generator.rb +22 -0
- package/scripts/ios/React-Core.modulemap +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.5.5 — 2022-01-05
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Fix `umbrella directory '../../Public/React-Core/React' not found` build error when in `use_frameworks!` mode. ([#15773](https://github.com/expo/expo/pull/15773) by [@kudo](https://github.com/kudo))
|
|
18
|
+
|
|
13
19
|
## 0.5.4 — 2021-12-29
|
|
14
20
|
|
|
15
21
|
### 🐛 Bug fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-autolinking",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Scripts that autolink Expo modules.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"find-up": "^5.0.0",
|
|
48
48
|
"fs-extra": "^9.1.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "81d318c3ac2db24ba192d2b3fc5a2dd1bbd8bd4d"
|
|
51
51
|
}
|
|
@@ -2,8 +2,10 @@ require_relative 'constants'
|
|
|
2
2
|
require_relative 'package'
|
|
3
3
|
|
|
4
4
|
# Require extensions to CocoaPods' classes
|
|
5
|
+
require_relative 'cocoapods/pod_target'
|
|
5
6
|
require_relative 'cocoapods/sandbox'
|
|
6
7
|
require_relative 'cocoapods/target_definition'
|
|
8
|
+
require_relative 'cocoapods/umbrella_header_generator'
|
|
7
9
|
require_relative 'cocoapods/user_project_integrator'
|
|
8
10
|
|
|
9
11
|
module Expo
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class PodTarget
|
|
3
|
+
private
|
|
4
|
+
|
|
5
|
+
_original_module_map_path = instance_method(:module_map_path)
|
|
6
|
+
|
|
7
|
+
public
|
|
8
|
+
|
|
9
|
+
# CocoaPods's default modulemap did not generate submodules correctly
|
|
10
|
+
# `ios/Pods/Headers/Public/React/React-Core.modulemap`
|
|
11
|
+
# ```
|
|
12
|
+
# module React {
|
|
13
|
+
# umbrella header "React-Core-umbrella.h"
|
|
14
|
+
#
|
|
15
|
+
# export *
|
|
16
|
+
# module * { export * }
|
|
17
|
+
# }
|
|
18
|
+
# ```
|
|
19
|
+
# clang will generate submodules for headers relative to the umbrella header directory.
|
|
20
|
+
# https://github.com/llvm/llvm-project/blob/2782cb8da0b3c180fa7c8627cb255a026f3d25a2/clang/lib/Lex/ModuleMap.cpp#L1133
|
|
21
|
+
# In this case, it is `ios/Pods/Headers/Public/React`.
|
|
22
|
+
# But the React public headers are placed in `ios/Pods/Headers/Public/React-Core/React`, so clang cannot find the headers and generate submodules.
|
|
23
|
+
#
|
|
24
|
+
# This case happens when a pod's name different to its module name, e.g. the pod name is `React-Core` but the module name is `React` since it defines header_dir as `React`.
|
|
25
|
+
# To fix the issue, we rewrite the `module_map_path` and `umbrella_header_path` to be with the public headers,
|
|
26
|
+
# i.e. `ios/Pods/Headers/Public/React-Core/React/React-Core.modulemap` and `ios/Pods/Headers/Public/React-Core/React/React-Core-umbrella.h`
|
|
27
|
+
#
|
|
28
|
+
def rewrite_module_dir
|
|
29
|
+
if ['React-Core'].include?(name) && product_module_name != name
|
|
30
|
+
return sandbox.public_headers.root + name + product_module_name
|
|
31
|
+
end
|
|
32
|
+
return nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def umbrella_header_path
|
|
36
|
+
if dir = self.rewrite_module_dir
|
|
37
|
+
return dir + "#{label}-umbrella.h"
|
|
38
|
+
end
|
|
39
|
+
super
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
define_method(:module_map_path) do
|
|
43
|
+
if dir = self.rewrite_module_dir
|
|
44
|
+
return dir + "#{label}.modulemap"
|
|
45
|
+
end
|
|
46
|
+
_original_module_map_path.bind(self).()
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end # class PodTarget
|
|
50
|
+
end # module Pod
|
|
@@ -19,25 +19,6 @@ module Pod
|
|
|
19
19
|
if name == 'React-Core'
|
|
20
20
|
spec_json = JSON.parse(spec.to_pretty_json)
|
|
21
21
|
|
|
22
|
-
# CocoaPods's default modulemap did not generate submodules correctly
|
|
23
|
-
# `ios/Pods/Headers/Public/React/React-Core.modulemap`
|
|
24
|
-
# ```
|
|
25
|
-
# module React {
|
|
26
|
-
# umbrella header "React-Core-umbrella.h"
|
|
27
|
-
#
|
|
28
|
-
# export *
|
|
29
|
-
# module * { export * }
|
|
30
|
-
# }
|
|
31
|
-
# ```
|
|
32
|
-
# clang will generate submodules for headers relative to the umbrella header directory.
|
|
33
|
-
# https://github.com/llvm/llvm-project/blob/2782cb8da0b3c180fa7c8627cb255a026f3d25a2/clang/lib/Lex/ModuleMap.cpp#L1133
|
|
34
|
-
# In this case, it is `ios/Pods/Headers/Public/React`.
|
|
35
|
-
# But React headers are placed in `ios/Pods/Headers/Public/React-Core/React`, so clang cannot find the headers and generate submodules.
|
|
36
|
-
# We patch `React-Core.podspec` to use custom modulemap and use `umbrella "../../Public/React-Core/React"` for clang to generate submodules correctly.
|
|
37
|
-
# Since CocoaPods generates the umbrella headers based on public headers,
|
|
38
|
-
# it is pretty safe to replace the umbrella header with the `umbrella` directory search inside the public headers directory.
|
|
39
|
-
spec_json['module_map'] ||= File.join(__dir__, '..', 'React-Core.modulemap')
|
|
40
|
-
|
|
41
22
|
# clang module does not support objc++.
|
|
42
23
|
# We should put Hermes headers inside private headers directory.
|
|
43
24
|
# Otherwise, clang will throw errors in building module.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
module Generator
|
|
3
|
+
class UmbrellaHeader
|
|
4
|
+
private
|
|
5
|
+
|
|
6
|
+
_original_generate = instance_method(:generate)
|
|
7
|
+
|
|
8
|
+
public
|
|
9
|
+
|
|
10
|
+
define_method (:generate) do
|
|
11
|
+
if self.target.is_a?(Pod::PodTarget) && self.target.rewrite_module_dir
|
|
12
|
+
# If we write the `umbrella_header_path`, the import headers are in the same directory,
|
|
13
|
+
# e.g. `#import "React/RCTBridge.h"` -> `#import "RCTBridge.h"`
|
|
14
|
+
self.imports = self.imports.map { |import| import.basename }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
_original_generate.bind(self).()
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end # class UmbrellaHeader
|
|
21
|
+
end # module Generator
|
|
22
|
+
end # module Pod
|