@dolami-inc/react-native-expo-unity 0.1.2 → 0.1.3
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/ios/ExpoUnity.podspec +9 -5
- package/package.json +1 -1
package/ios/ExpoUnity.podspec
CHANGED
|
@@ -3,9 +3,11 @@ require 'json'
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
4
|
|
|
5
5
|
# Resolve the Unity build artifacts directory.
|
|
6
|
-
#
|
|
6
|
+
# Pod::Config.instance.project_root points to the ios/ folder (where the Podfile lives),
|
|
7
|
+
# so we go one level up (..) to reach the React Native project root, then into unity/builds/ios/.
|
|
7
8
|
# Override with EXPO_UNITY_PATH environment variable.
|
|
8
|
-
|
|
9
|
+
rn_project_root = File.expand_path('..', Pod::Config.instance.project_root.to_s)
|
|
10
|
+
unity_ios_dir = ENV['EXPO_UNITY_PATH'] || File.join(rn_project_root, 'unity', 'builds', 'ios')
|
|
9
11
|
|
|
10
12
|
Pod::Spec.new do |s|
|
|
11
13
|
s.name = 'ExpoUnity'
|
|
@@ -24,18 +26,20 @@ Pod::Spec.new do |s|
|
|
|
24
26
|
s.source_files = '**/*.{h,m,mm,swift}'
|
|
25
27
|
s.exclude_files = 'UnityFramework.framework/**/*'
|
|
26
28
|
|
|
27
|
-
# Copy Unity build artifacts
|
|
29
|
+
# Copy all Unity build artifacts into the pod at install time
|
|
28
30
|
s.prepare_command = <<-CMD
|
|
29
31
|
if [ -d "#{unity_ios_dir}" ]; then
|
|
30
|
-
cp -
|
|
32
|
+
cp -Rn "#{unity_ios_dir}/." . 2>/dev/null || true
|
|
31
33
|
fi
|
|
32
34
|
CMD
|
|
33
35
|
|
|
34
|
-
# Link UnityFramework if present
|
|
35
36
|
if File.exist?(File.join(unity_ios_dir, 'UnityFramework.framework'))
|
|
36
37
|
s.vendored_frameworks = 'UnityFramework.framework'
|
|
37
38
|
end
|
|
38
39
|
|
|
40
|
+
a_files = Dir.glob(File.join(unity_ios_dir, '*.a')).map { |f| File.basename(f) }
|
|
41
|
+
s.vendored_libraries = a_files unless a_files.empty?
|
|
42
|
+
|
|
39
43
|
s.pod_target_xcconfig = {
|
|
40
44
|
'HEADER_SEARCH_PATHS' => [
|
|
41
45
|
'"${PODS_TARGET_SRCROOT}/UnityFramework.framework/Headers"',
|