1# Copyright (c) Meta Platforms, Inc. and affiliates.
2#
3# This source code is licensed under the MIT license found in the
4# LICENSE file in the root directory of this source tree.
5
6require_relative './utils.rb'
7
8# It sets up the JavaScriptCore and JSI pods.
9#
10# @parameter react_native_path: relative path to react-native
11# @parameter fabric_enabled: whether Fabirc is enabled
12def setup_jsc_ABI49_0_0!(react_native_path: "../node_modules/react-native", fabric_enabled: false)
13    pod 'ABI49_0_0React-jsi', :path => "#{react_native_path}/ReactCommon/jsi", :project_name => 'ABI49_0_0'
14    pod 'ABI49_0_0React-jsc', :path => "#{react_native_path}/ReactCommon/jsc", :project_name => 'ABI49_0_0'
15    if fabric_enabled
16        pod 'ABI49_0_0React-jsc/Fabric', :path => "#{react_native_path}/ReactCommon/jsc", :project_name => 'ABI49_0_0'
17    end
18end
19
20# It sets up the Hermes and JSI pods.
21#
22# @parameter react_native_path: relative path to react-native
23# @parameter fabric_enabled: whether Fabirc is enabled
24def setup_hermes_ABI49_0_0!(react_native_path: "../node_modules/react-native", fabric_enabled: false)
25    # The following captures the output of prepare_hermes for use in tests
26
27    pod 'ABI49_0_0React-jsi', :path => "#{react_native_path}/ReactCommon/jsi", :project_name => 'ABI49_0_0'
28    # This `:tag => hermestag` below is only to tell CocoaPods to update hermes-engine when React Native version changes.
29    # We have custom logic to compute the source for hermes-engine. See sdks/hermes-engine/*
30    hermestag_file = File.join(react_native_path, "sdks", ".hermesversion")
31    hermestag = File.exist?(hermestag_file) ? File.read(hermestag_file).strip : ''
32
33    if File.exist?("#{react_native_path}/sdks/hermes-engine/destroot")
34      pod 'ABI49_0_0hermes-engine', :path => "#{react_native_path}/sdks/hermes-engine", :project_name => 'ABI49_0_0', :tag => 'hermes-2023-08-07-RNv0.72.4-813b2def12bc9df02654b3e3653ae4a68d0572e0'
35    else
36      pod 'ABI49_0_0hermes-engine', :podspec => "#{react_native_path}/sdks/hermes-engine/ABI49_0_0hermes-engine.podspec", :project_name => 'ABI49_0_0', :tag => 'hermes-2023-08-07-RNv0.72.4-813b2def12bc9df02654b3e3653ae4a68d0572e0'
37    end
38    pod 'ABI49_0_0React-hermes', :path => "#{react_native_path}/ReactCommon/hermes", :project_name => 'ABI49_0_0'
39    pod 'libevent', '~> 2.1.12'
40end
41