Module: CocoapodsRnToolkit::LibrarySearchPaths

Defined in:
lib/cocoapods-rn-toolkit/library_search_paths.rb

Class Method Summary collapse

Class Method Details

.apply(installer) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cocoapods-rn-toolkit/library_search_paths.rb', line 3

def self.apply(installer)
  projects = installer.aggregate_targets
    .map{ |t| t.user_project }
    .uniq{ |p| p.path }
    .push(installer.pods_project)

  projects.each do |project|
    project.build_configurations.each do |config|
      fix_config(config)
    end
    project.native_targets.each do |target|
      target.build_configurations.each do |config|
        fix_config(config)
      end
    end
    project.save()
  end
end

.fix_config(config) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cocoapods-rn-toolkit/library_search_paths.rb', line 24

def self.fix_config(config)
  lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
  if lib_search_paths
    if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
      lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
      lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
      if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
        lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
      end
    end
  end
end