# frozen_string_literal: true require 'json' package_json_path = File.expand_path('../package.json', __dir__) package = JSON.parse(File.read(package_json_path)) version = package['version'] Pod::Spec.new do |s| s.name = 'XrayLogger' s.version = version s.summary = 'Applicaster Logger' s.ios.deployment_target = '16.0' s.tvos.deployment_target = '16.0' s.swift_versions = '5.5' s.description = <<-DESC 'Applicaster Logger' DESC s.homepage = 'git@github.com:applicaster/x-ray.git' s.license = 'Appache 2.0' s.author = { 'a.kononenko@applicaster.com' => 'a.kononenko@applicaster.com' } s.source = { git: 'git@github.com:applicaster/x-ray.git', tag: version } s.default_subspec = 'Core' s.subspec 'Core' do |core| core.source_files = 'Xray/XrayLogger/**/*.{swift}' end # Bridge-only subspec for SPM builds — no source files so the pod framework stays empty and # CocoaPods does not try to link the SPM XrayLogger product into itself. s.subspec 'spm' do |sp| sp.source_files = [] sp.preserve_paths = 'Xray/Package.swift' end # The bridge must NOT depend on Core. Subspecs of one pod share one target, so Core would be # compiled into XrayLoggerBridge, giving it a second `Xray.shared` with no sinks attached: JS # logs landed there and never reached the app's sinks. Depending on the empty `spm` subspec # makes `import XrayLogger` resolve to the SPM product, the one singleton the app configures. # Same shape as ZappCore/ReactBridge. s.subspec 'ReactBridge' do |sp| sp.dependency 'XrayLogger/spm' sp.dependency 'React' sp.dependency 'React-Core' sp.source_files = 'Xray/ReactBridge/**/*.{swift,m}' sp.pod_target_xcconfig = { 'PRODUCT_MODULE_NAME' => 'XrayLoggerBridge', 'PRODUCT_NAME' => 'XrayLoggerBridge', } end s.subspec 'ReactNative' do |sp| sp.dependency 'React' sp.dependency 'React-Core' sp.source_files = 'Xray/ReactBridge/**/*.{swift,m}' end end