forked from software-mansion/react-native-reanimated
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RNReanimated.podspec
158 lines (140 loc) · 5.8 KB
/
RNReanimated.podspec
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
reactVersion = '0.0.0'
reactTargetTvOS = false
isUserApp = false
begin
# user app
# /appName/node_modules/react-native-reanimated/RNReanimated.podspec
# /appName/node_modules/react-native/package.json
reactJson = JSON.parse(File.read(File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json")))
reactVersion = reactJson["version"]
reactTargetTvOS = reactJson["name"] == "react-native-tvos"
isUserApp = true
rescue
begin
# monorepo
# /monorepo/packages/appName/node_modules/react-native-reanimated/RNReanimated.podspec
# /monorepo/node_modules/react-native/package.json
reactJson = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "node_modules", "react-native", "package.json")))
reactVersion = reactJson["version"]
reactTargetTvOS = reactJson["name"] == "react-native-tvos"
rescue
begin
# Example app in reanimated repo
# /react-native-reanimated/RNReanimated.podspec
# /react-native-reanimated/{Example,FabricExample,TVOSExample}/node_modules/react-native/package.json
if ENV["ReanimatedTVOSExample"] == "1" then
appName = "TVOSExample"
elsif ENV["RCT_NEW_ARCH_ENABLED"] == "1" then
appName = "FabricExample"
else
appName = "Example"
end
reactJson = JSON.parse(File.read(File.join(__dir__, appName, "node_modules", "react-native", "package.json")))
reactVersion = reactJson["version"]
reactTargetTvOS = ENV["ReanimatedTVOSExample"] == "1"
rescue
# should never happen
reactVersion = '0.68.0'
puts "[RNReanimated] Unable to recognize your `react-native` version! Default `react-native` version: " + reactVersion
end
end
end
if isUserApp
libInstances = %x[find ../../ -name "package.json" | grep "/react-native-reanimated/package.json"]
libInstancesArray = libInstances.split("\n")
if libInstancesArray.length() > 1
parsedLocation = ''
for location in libInstancesArray
location['../../'] = '- '
location['/package.json'] = ''
parsedLocation += location + "\n"
end
raise "[Reanimated] Multiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict between: \n" + parsedLocation
end
end
rnVersion = reactVersion.split('.')[1]
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
folly_prefix = ""
if rnVersion.to_i >= 64
folly_prefix = "RCT-"
end
folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DRNVERSION=' + rnVersion
folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
boost_compiler_flags = '-Wno-documentation'
fabric_flags = ''
if fabric_enabled
fabric_flags = '-DRN_FABRIC_ENABLED -DRCT_NEW_ARCH_ENABLED'
end
Pod::Spec.new do |s|
s.name = "RNReanimated"
s.version = package["version"]
s.summary = package["description"]
s.description = <<-DESC
RNReanimated
DESC
s.homepage = "https://github.com/software-mansion/react-native-reanimated"
s.license = "MIT"
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
s.author = { "author" => "[email protected]" }
s.platforms = { :ios => "9.0", :tvos => "9.0" }
s.source = { :git => "https://github.com/software-mansion/react-native-reanimated.git", :tag => "#{s.version}" }
s.source_files = [
"ios/**/*.{mm,h,m}",
"Common/cpp/**/*.cpp",
"Common/cpp/headers/**/*.h"
]
s.preserve_paths = [
"Common/cpp/hidden_headers/**"
]
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\"",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
}
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"",
"OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags + " " + fabric_flags }
s.requires_arc = true
s.dependency "React-Core"
if fabric_enabled
s.dependency "React-RCTFabric"
s.dependency "React-Codegen"
s.dependency "RCT-Folly"
else
s.dependency "#{folly_prefix}Folly"
end
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core"
s.dependency 'FBLazyVector'
s.dependency 'FBReactNativeSpec'
s.dependency 'React-Core'
s.dependency 'React-CoreModules'
s.dependency 'React-Core/DevSupport'
if !reactTargetTvOS
s.dependency 'React-RCTActionSheet'
end
s.dependency 'React-RCTNetwork'
s.dependency 'React-RCTAnimation'
s.dependency 'React-RCTLinking'
s.dependency 'React-RCTBlob'
s.dependency 'React-RCTSettings'
s.dependency 'React-RCTText'
s.dependency 'React-RCTImage'
s.dependency 'React-Core/RCTWebSocket'
s.dependency 'React-cxxreact'
s.dependency 'React-jsi'
s.dependency 'React-jsiexecutor'
s.dependency 'React-jsinspector'
s.dependency 'Yoga'
s.dependency 'DoubleConversion'
s.dependency 'glog'
if reactVersion.match(/^0.62/)
s.dependency 'ReactCommon/callinvoker'
else
s.dependency 'React-callinvoker'
end
end