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