1 | require "json"
|
2 | require_relative './scripts/reanimated_utils'
|
3 |
|
4 | reanimated_package_json = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
5 | $config = find_config()
|
6 | assert_latest_react_native_with_new_architecture($config, reanimated_package_json)
|
7 | assert_minimal_react_native_version($config)
|
8 |
|
9 | $new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
10 | is_release = ENV['PRODUCTION'] == '1'
|
11 |
|
12 | folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DREACT_NATIVE_MINOR_VERSION=' + $config[:react_native_minor_version].to_s
|
13 | folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
|
14 | boost_compiler_flags = '-Wno-documentation'
|
15 | fabric_flags = $new_arch_enabled ? '-DRCT_NEW_ARCH_ENABLED' : ''
|
16 | example_flag = $config[:is_reanimated_example_app] ? '-DIS_REANIMATED_EXAMPLE_APP' : ''
|
17 | version_flag = '-DREANIMATED_VERSION=' + reanimated_package_json["version"]
|
18 | debug_flag = is_release ? '-DNDEBUG' : ''
|
19 | ios_min_version = $config[:react_native_minor_version] >= 73 ? '13.4' : '9.0'
|
20 |
|
21 | def self.install_modules_dependencies_legacy(s)
|
22 | using_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1'
|
23 | s.dependency "React-Core"
|
24 | if $new_arch_enabled
|
25 | s.dependency "React-RCTFabric"
|
26 | s.dependency "React-Codegen"
|
27 | end
|
28 | s.dependency "RCT-Folly"
|
29 | s.dependency "RCTRequired"
|
30 | s.dependency "RCTTypeSafety"
|
31 | s.dependency 'FBLazyVector'
|
32 | if $config[:react_native_minor_version] <= 71
|
33 | s.dependency 'FBReactNativeSpec'
|
34 | end
|
35 | s.dependency 'React-Core'
|
36 | s.dependency 'React-CoreModules'
|
37 | s.dependency 'React-Core/DevSupport'
|
38 | if !$config[:is_tvos_target]
|
39 | s.dependency 'React-RCTActionSheet'
|
40 | end
|
41 | s.dependency 'React-RCTNetwork'
|
42 | s.dependency 'React-RCTAnimation'
|
43 | s.dependency 'React-RCTLinking'
|
44 | s.dependency 'React-RCTBlob'
|
45 | s.dependency 'React-RCTSettings'
|
46 | s.dependency 'React-RCTText'
|
47 | s.dependency 'React-RCTImage'
|
48 | s.dependency 'React-Core/RCTWebSocket'
|
49 | s.dependency 'React-cxxreact'
|
50 | s.dependency 'React-jsi'
|
51 | s.dependency 'React-jsiexecutor'
|
52 | s.dependency 'React-jsinspector'
|
53 | s.dependency 'Yoga'
|
54 | s.dependency 'DoubleConversion'
|
55 | s.dependency 'glog'
|
56 | if using_hermes && !$config[:is_tvos_target] && $config[:react_native_minor_version] >= 70
|
57 | s.dependency 'React-hermes'
|
58 | s.dependency 'hermes-engine'
|
59 | end
|
60 | s.dependency 'React-callinvoker'
|
61 | if $config[:react_native_minor_version] >= 72 && !$new_arch_enabled
|
62 | s.dependency 'React-RCTAppDelegate'
|
63 | end
|
64 | end
|
65 |
|
66 | Pod::Spec.new do |s|
|
67 |
|
68 | s.name = "RNReanimated"
|
69 | s.version = reanimated_package_json["version"]
|
70 | s.summary = reanimated_package_json["description"]
|
71 | s.description = <<-DESC
|
72 | RNReanimated
|
73 | DESC
|
74 | s.homepage = "https://github.com/software-mansion/react-native-reanimated"
|
75 | s.license = "MIT"
|
76 | s.author = { "author" => "author@domain.cn" }
|
77 | s.platforms = { :ios => ios_min_version, :tvos => "9.0", :osx => "10.14", :visionos => "1.0" }
|
78 | s.source = { :git => "https://github.com/software-mansion/react-native-reanimated.git", :tag => "#{s.version}" }
|
79 |
|
80 | s.source_files = [
|
81 | "apple/**/*.{mm,h,m}",
|
82 | "Common/cpp/**/*.{cpp,h}"
|
83 | ]
|
84 |
|
85 | s.preserve_paths = [
|
86 | "Common/cpp/hidden_headers/**"
|
87 | ]
|
88 |
|
89 | gcc_debug_definitions = "$(inherited)"
|
90 | if $config[:react_native_minor_version] >= 73 || !is_release
|
91 | gcc_debug_definitions << " HERMES_ENABLE_DEBUGGER=1"
|
92 | end
|
93 |
|
94 | s.pod_target_xcconfig = {
|
95 | "USE_HEADERMAP" => "YES",
|
96 | "DEFINES_MODULE" => "YES",
|
97 | "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Private/Yoga\"",
|
98 | "FRAMEWORK_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes\"",
|
99 | "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
100 | "GCC_PREPROCESSOR_DEFINITIONS[config=Debug]" => gcc_debug_definitions,
|
101 | "GCC_PREPROCESSOR_DEFINITIONS[config=Release]" => "$(inherited) NDEBUG=1",
|
102 | }
|
103 | s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
|
104 | s.xcconfig = {
|
105 | "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Public/React-hermes\" \"$(PODS_ROOT)/Headers/Public/hermes-engine\" \"$(PODS_ROOT)/#{$config[:react_native_common_dir]}\"",
|
106 | "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags + " " + fabric_flags + " " + example_flag + " " + version_flag + " " + debug_flag
|
107 | }
|
108 | s.requires_arc = true
|
109 | s.dependency "ReactCommon/turbomodule/core"
|
110 | if defined?(install_modules_dependencies()) != nil
|
111 | install_modules_dependencies(s)
|
112 | else
|
113 | install_modules_dependencies_legacy(s)
|
114 | end
|
115 | end
|