1require 'json'
2
3package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
5fabric_compiler_flags = '-DRN_FABRIC_ENABLED'
6folly_version = '2021.07.22.00'
7folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
8
9Pod::Spec.new do |s|
10  s.name           = 'ExpoModulesCore'
11  s.version        = package['version']
12  s.summary        = package['description']
13  s.description    = package['description']
14  s.license        = package['license']
15  s.author         = package['author']
16  s.homepage       = package['homepage']
17  s.platform       = :ios, '13.0'
18  s.swift_version  = '5.4'
19  s.source         = { git: 'https://github.com/expo/expo.git' }
20  s.static_framework = true
21  s.header_dir     = 'ExpoModulesCore'
22
23  # Swift/Objective-C compatibility
24  s.pod_target_xcconfig = {
25    'USE_HEADERMAP' => 'YES',
26    'DEFINES_MODULE' => 'YES',
27    'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
28    'SWIFT_COMPILATION_MODE' => 'wholemodule',
29    'HEADER_SEARCH_PATHS' => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers\"",
30    'OTHER_SWIFT_FLAGS' => "$(inherited) #{fabric_enabled ? fabric_compiler_flags : ''}"
31  }
32  s.user_target_xcconfig = {
33    "HEADER_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/ExpoModulesCore/Swift Compatibility Header\" \"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers\"",
34  }
35
36  s.dependency 'React-Core'
37  s.dependency 'ReactCommon/turbomodule/core'
38
39  if fabric_enabled
40    s.compiler_flags = folly_compiler_flags + ' ' + fabric_compiler_flags
41
42    s.dependency 'React-RCTFabric'
43    s.dependency 'RCT-Folly', folly_version
44  end
45
46  if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("ios/#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
47    s.source_files = 'ios/**/*.h', 'common/cpp/**/*.h'
48    s.vendored_frameworks = "ios/#{s.name}.xcframework"
49  else
50    s.source_files = 'ios/**/*.{h,m,mm,swift,cpp}', 'common/cpp/**/*.{h,cpp}'
51  end
52
53  exclude_files = ['ios/Tests/']
54  if !fabric_enabled
55    exclude_files.append('ios/Fabric/')
56    exclude_files.append('common/cpp/fabric/')
57  end
58  s.exclude_files = exclude_files
59
60  s.private_header_files = ['ios/**/*+Private.h', 'ios/**/Swift.h']
61
62  s.test_spec 'Tests' do |test_spec|
63    test_spec.dependency 'ExpoModulesTestCore'
64
65    test_spec.source_files = 'ios/Tests/**/*.{m,swift}'
66  end
67end
68