1require 'json'
2
3package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
4
5Pod::Spec.new do |s|
6  s.name           = 'EXUpdates'
7  s.version        = package['version']
8  s.summary        = package['description']
9  s.description    = package['description']
10  s.license        = package['license']
11  s.author         = package['author']
12  s.homepage       = package['homepage']
13  s.platform       = :ios, '13.0'
14  s.swift_version  = '5.4'
15  s.source         = { git: 'https://github.com/expo/expo.git' }
16  s.static_framework = true
17
18  s.dependency 'ExpoModulesCore'
19  s.dependency 'React-Core'
20  s.dependency 'EXStructuredHeaders'
21  s.dependency 'EXUpdatesInterface'
22  s.dependency 'EXManifests'
23  s.dependency 'EASClient'
24  s.dependency 'ReachabilitySwift'
25  s.dependency 'ASN1Decoder', '~> 1.8'
26
27  ex_updates_native_debug = ENV['EX_UPDATES_NATIVE_DEBUG'] == '1'
28
29  other_c_flags = ex_updates_native_debug ? "$(inherited) -DEX_UPDATES_NATIVE_DEBUG=1" : "$(inherited)"
30  other_swift_flags = ex_updates_native_debug ? "$(inherited) -DEX_UPDATES_NATIVE_DEBUG" : "$(inherited)"
31
32  s.pod_target_xcconfig = {
33    'GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS' => 'YES',
34    'GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS' => 'YES',
35    'DEFINES_MODULE' => 'YES',
36    'SWIFT_COMPILATION_MODE' => 'wholemodule',
37    'OTHER_CFLAGS[config=Debug]' => other_c_flags,
38    'OTHER_SWIFT_FLAGS[config=Debug]' => other_swift_flags
39  }
40
41  if !ex_updates_native_debug && !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
42    s.source_files = "#{s.name}/**/*.h"
43    s.vendored_frameworks = "#{s.name}.xcframework"
44  else
45    s.source_files = "#{s.name}/**/*.{h,m,swift}"
46  end
47
48  if $expo_updates_create_manifest != false
49    force_bundling_flag = ex_updates_native_debug ? "export FORCE_BUNDLING=1\n" : ""
50    s.script_phase = {
51      :name => 'Generate app.manifest for expo-updates',
52      :script => force_bundling_flag + 'bash -l -c "$PODS_TARGET_SRCROOT/../scripts/create-manifest-ios.sh"',
53      :execution_position => :before_compile
54    }
55
56    # Generate EXUpdates.bundle without existing resources
57    # `create-manifest-ios.sh` will generate app.manifest in EXUpdates.bundle
58    s.resource_bundles = {
59      'EXUpdates' => []
60    }
61  end
62
63  s.exclude_files = 'Tests/'
64  s.test_spec 'Tests' do |test_spec|
65    test_spec.source_files = 'Tests/*.{h,m,swift}'
66    test_spec.resources = 'Tests/Support/**/*'
67
68    # ExpoModulesCore requires React-hermes or React-jsc in tests, add ExpoModulesTestCore for the underlying dependencies
69    test_spec.dependency 'ExpoModulesTestCore'
70
71    test_spec.pod_target_xcconfig = {
72      'USER_HEADER_SEARCH_PATHS' => '"${CONFIGURATION_TEMP_DIR}/EXUpdates.build/DerivedSources"',
73      'GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS' => 'YES',
74      'GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS' => 'YES',
75      'DEFINES_MODULE' => 'YES',
76      'SWIFT_COMPILATION_MODE' => 'wholemodule'
77    }
78  end
79end
80