require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) version =JSON.parse(File.read(File.join(__dir__, "src/build-version-ios.json"))) engagement_version = version["version"] Pod::Spec.new do |s| s.name = "PluginEngagementReactNative" s.version = package["version"] s.summary = package["description"] s.homepage = package["homepage"] s.license = package["license"] s.authors = package["author"] s.platforms = { :ios => min_ios_version_supported } s.source = { :git => "https://amplitude.com.git", :tag => "#{s.version}" } s.source_files = "ios/**/*.{h,m,mm,cpp,swift}" s.private_header_files = "ios/**/*.h" s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } # Our framework is statically linked to CQuickJS, so we need to set this to true # to avoid having the user set `use_frameworks! :linkage => :static` in their Podfile s.static_framework = true # Conditionally vendor frameworks based on CI environment variable # This functionality exists to enable development of the SDK locally in React Native/Flutter projects without having to publish the frameworks to a public repository. # Use local frameworks when NOT in CI (for local development), use CocoaPods dependency in CI use_local_frameworks = ENV['IOS_USE_LOCAL_SDK_SOURCE'] == 'true' if use_local_frameworks s.ios.vendored_frameworks = [ 'ios/Frameworks/AmplitudeEngagementSwift.xcframework', 'ios/Frameworks/CQuickJS.xcframework', ] # Keep in sync with the AmplitudeCore dependency in ios/AmplitudeEngagementSwift.podspec. # The vendored xcframework is built against that version, so a lower bound here lets # CocoaPods resolve an older AmplitudeCore and the app dies at launch on a missing symbol. s.dependency 'AmplitudeCore', '>=1.5.0', '<2.0.0' else s.dependency "AmplitudeEngagementSwift", engagement_version end install_modules_dependencies(s) end