Class: XcodeArchiveCache::Injection::PodsXCFrameworkFixer

Inherits:
Object
  • Object
show all
Includes:
Logs
Defined in:
lib/injection/pods_xcframework_fixer.rb

Instance Method Summary collapse

Methods included from Logs

#debug, #error, #info, #set_log_level

Constructor Details

#initialize(storage, native_target_finder, configuration_name) ⇒ PodsXCFrameworkFixer

Returns a new instance of PodsXCFrameworkFixer.

Parameters:



11
12
13
14
15
16
17
18
# File 'lib/injection/pods_xcframework_fixer.rb', line 11

def initialize(storage, native_target_finder, configuration_name)
  @storage = storage
  @native_target_finder = native_target_finder
  @configuration_name = configuration_name
  @shell_executor = XcodeArchiveCache::Shell::Executor.new
  @build_settings_interpolator = XcodeArchiveCache::BuildSettings::StringInterpolator.new
  @checked_targets = []
end

Instance Method Details

#fix(target, build_settings_loader) ⇒ Object

Parameters:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/injection/pods_xcframework_fixer.rb', line 23

def fix(target, build_settings_loader)
  checked_targets.push(target.equatable_identifier)
  build_settings = build_settings_loader.get_settings(target.project.path, target.display_name)

  debug("fixing #{target.display_name}")
  script_path = find_copy_xcframeworks_script(target, build_settings)
  if script_path != nil
    fix_file(script_path)
    
    unless shell_executor.execute_with_env(script_path, build_settings.all)
      raise XcodeArchiveCache::Informative, "Failed to execute Pods XCFramework script #{script_path}"
    end
  end

  embed_frameworks_script_path = find_embed_frameworks_script(target, build_settings)
  if embed_frameworks_script_path != nil
    fix_file(embed_frameworks_script_path)
  end

  build_configuration = target.find_build_configuration(configuration_name)
  if build_configuration.has_xcconfig?
    fix_xcconfig_recursively(build_configuration.get_xcconfig_path, build_configuration.get_project_dir)
  end

  dependencies = native_target_finder.find_all_dependencies(target)
  dependencies.each do |dependency_target|
    if checked_targets.include?(dependency_target.equatable_identifier)
      next
    end

    fix(dependency_target, build_settings_loader)
  end
end