Repository navigation
Expand file tree
/
Copy pathstripe-react-native.podspec
More file actions
102 lines (91 loc) · 4.86 KB
/
Copy pathstripe-react-native.podspec
File metadata and controls
102 lines (91 loc) · 4.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
require 'json'
require_relative 'stripe_spm'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
# Keep stripe_version in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/stripe-identity-react-native.podspec
stripe_version = '26.13.0'
if ENV['RCT_NEW_ARCH_ENABLED'] == '0'
raise 'stripe-react-native requires the React Native new architecture. Use RCT_NEW_ARCH_ENABLED=1 in your Podfile.'
end
Pod::Spec.new do |s|
s.name = 'stripe-react-native'
s.version = package['version']
s.summary = package['description']
s.homepage = package['homepage']
s.license = package['license']
s.authors = package['author']
s.platforms = { ios: '13.0' }
s.source = { git: 'https://github.com/stripe/stripe-react-native.git', tag: s.version.to_s }
# On React Native >= 0.75 the Stripe iOS SDK is resolved through Swift
# Package Manager (the Stripe iOS SDK is deprecating CocoaPods support);
# older React Native versions and apps that set `$StripeDisableSPM = true`
# fall back to the CocoaPods registry via the `unless stripe_spm_enabled?`
# dependency blocks below. stripe_spm.rb documents the full mechanism.
# `stripe_version` pins both paths to the same stripe-ios release.
stripe_spm_activate!(s, version: stripe_version) if stripe_spm_enabled?
s.header_dir = 'stripe_react_native'
s.pod_target_xcconfig = {
'USE_HEADERMAP' => 'YES',
'DEFINES_MODULE' => 'YES',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20',
'SWIFT_COMPILATION_MODE' => 'wholemodule',
}
s.default_subspecs = 'Core', 'NewArch'
s.subspec 'Core' do |core|
core.source_files = 'ios/**/*.{h,m,mm,swift}'
core.exclude_files = [ 'ios/Tests/', 'ios/NewArch/', 'ios/StripeOnrampSdk.h', 'ios/StripeOnrampSdk.mm', 'ios/OnrampErrors.swift' ]
# Headers listed here stay out of the public umbrella header, for two
# reasons:
# - StripeSdk.h and StripeSwiftInterop.h contain c++ code, and the umbrella
# header is used by swift interop; StripeSwiftInterop.h in the umbrella
# will cause circular dependency issues.
# - StripeSdkEventEmitterCompat.h imports React headers, which are
# non-modular. When the pod builds as a framework, a public header that
# imports React breaks every target that imports the module from native
# code (unit tests, for example) with "include of non-modular header
# inside framework module", unless that target sets
# CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES. Keeping every
# React-importing header private keeps the framework module
# self-contained.
core.private_header_files = [ 'ios/StripeSdk.h', 'ios/StripeSwiftInterop.h', 'ios/StripeSdkEventEmitterCompat.h' ]
core.dependency 'React-Core'
unless stripe_spm_enabled?
# CocoaPods fallback for React Native < 0.75 and $StripeDisableSPM users.
# Keep in sync with StripeSPM::CORE_PRODUCTS in stripe_spm.rb — these are
# two spellings of the same dependency set.
core.dependency 'Stripe', stripe_version
core.dependency 'StripePaymentSheet', stripe_version
core.dependency 'StripePayments', stripe_version
core.dependency 'StripePaymentsUI', stripe_version
core.dependency 'StripeApplePay', stripe_version
core.dependency 'StripeFinancialConnections', stripe_version
end
end
s.subspec 'Onramp' do |onramp|
onramp.source_files = [ 'ios/StripeOnrampSdk.h', 'ios/StripeOnrampSdk.mm', 'ios/OnrampErrors.swift' ]
# Private for the same reasons as Core's StripeSdk.h: the header imports
# the codegen umbrella (<rnstripe/rnstripe.h>, c++) and the React-importing
# event emitter compat header, so exporting it would put non-modular
# includes in the public umbrella header (see Core's private_header_files
# comment).
onramp.private_header_files = 'ios/StripeOnrampSdk.h'
onramp.dependency 'stripe-react-native/Core'
unless stripe_spm_enabled?
# CocoaPods fallback. In SPM mode the StripeCryptoOnramp product is
# linked at install time by stripe_spm.rb (link_onramp_product), because
# spm_dependency declarations on subspecs are silently ignored.
onramp.dependency 'StripeCryptoOnramp', stripe_version
end
end
install_modules_dependencies(s)
s.subspec "NewArch" do |ss|
ss.source_files = "ios/NewArch/**/*.{h,m,mm}"
# These headers contain c++ code so make sure they are private to avoid
# being exported to the umbrella header, which is used by swift interop.
# The pattern must stay scoped to this subspec's own files: CocoaPods
# globs private_header_files against the entire pod root (for a
# development pod, the whole repo), and an unscoped '**/*.h' can match
# dangling header-store symlinks in example/ios/Pods left from a
# previous install, crashing `pod install` on realpath.
ss.private_header_files = 'ios/NewArch/**/*.h'
end
end