require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) # MapLibreReactNative owns the package reference. This helper only adds its # already-configured MapLibre product to this pod target, so ObjC++ sources can # import the same module without introducing another binary dependency. $MLRN_PARTICLE = Object.new def $MLRN_PARTICLE.post_install(installer) unless defined?($MLRN) && $MLRN.respond_to?(:_add_spm_to_target) raise "MapLibreParticleRN requires MapLibreReactNative's $MLRN._add_spm_to_target helper. Ensure MapLibreReactNative 11.5.0 is installed before calling $MLRN_PARTICLE.post_install." end unless defined?($MLRN_SPM_SPEC) && $MLRN_SPM_SPEC.is_a?(Hash) raise "MapLibreParticleRN requires $MLRN_SPM_SPEC from MapLibreReactNative or the host Podfile before calling $MLRN_PARTICLE.post_install." end spm_spec = $MLRN_SPM_SPEC [:url, :requirement, :product_name].each do |key| raise "MapLibreParticleRN requires $MLRN_SPM_SPEC[:#{key}]." if spm_spec[key].nil? end project = installer.pods_project target = project.targets.find { |candidate| candidate.name == "MapLibreParticleRN" } raise "MapLibreParticleRN pod target was not found in the Pods project." unless target $MLRN._add_spm_to_target( project, target, spm_spec[:url], spm_spec[:requirement], spm_spec[:product_name] ) end Pod::Spec.new do |s| s.name = "MapLibreParticleRN" s.version = package["version"] s.summary = package["description"] s.homepage = package.dig("repository", "url") s.license = package["license"] s.authors = { "NavSea" => "dev@navsea.invalid" } s.platforms = { :ios => "15.1" } s.source = { :git => package.dig("repository", "url"), :tag => s.version.to_s } s.source_files = "ios/**/*.{h,m,mm,cpp}" s.dependency "MapLibreReactNative", "11.5.0" # $MLRN_PARTICLE.post_install reuses MapLibreReactNative's one MapLibre SPM # product. Do not declare a MapLibre pod, vendored framework, or SPM product here. install_modules_dependencies(s) end