Sha256: 16abf9ec992f3d5524e1e2e28098b4634f5312eaf22cf317dd1c3b30f888c3ec

Contents?: true

Size: 962 Bytes

Versions: 4

Compression:

Stored size: 962 Bytes

Contents

module Symbols
  #
  # performs symbol aliasing
  #
  # for each dependency:
  # 	- determine symbols for classes and global constants
  # 	- alias each symbol to Pod#{pod_name}_#{symbol}
  # 	- put defines into `GCC_PREPROCESSOR_DEFINITIONS` for passing to Xcode
  #
  def mangle_for_pod_dependencies(pod_name, sandbox_root)
    pod_libs = Dir.glob("#{sandbox_root}/build/libPods-*.a").select do
      |file| file !~ /#{pod_name}/
    end

    dummy_alias = alias_symbol "PodsDummy_Pods_#{pod_name}", pod_name
    all_syms = [dummy_alias]

    pod_libs.each do |pod_lib|
      syms = Symbols.symbols_from_library(pod_lib)
      all_syms += syms.map! { |sym| alias_symbol sym, pod_name }
    end

    "GCC_PREPROCESSOR_DEFINITIONS='${inherited} #{all_syms.uniq.join(' ')}'"
  end

  def alias_symbol(sym, pod_name)
    pod_name = pod_name.gsub('-', '_')
    sym + "=Pod#{pod_name}_" + sym
  end

  module_function :mangle_for_pod_dependencies, :alias_symbol
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cocoapods-packager-1.0.2 lib/cocoapods-packager/mangle.rb
cocoapods-packager-1.0.1 lib/cocoapods-packager/mangle.rb
cocoapods-packager-1.0.0 lib/cocoapods-packager/mangle.rb
cocoapods-packager-0.9.0 lib/cocoapods-packager/mangle.rb