Class: FrameworkCarthageArchive

Inherits:
CarthageArchive show all
Defined in:
lib/framework_carthage_archive.rb

Instance Attribute Summary

Attributes inherited from CarthageArchive

#archive_filename, #archive_path

Instance Method Summary collapse

Methods inherited from CarthageArchive

#archive_size, #delete_archive, #initialize, #unpack_archive

Constructor Details

This class inherits a constructor from CarthageArchive

Instance Method Details

#compress_archive(shell, carthage_build_dir = CARTHAGE_BUILD_DIR) ⇒ Object

Aggregate following files:

  • Carthage/Build/iOS/Alamofire.framework

  • Carthage/Build/iOS/Alamofire.framework/Alamofire

  • Carthage/Build/iOS/618BEB79-4C7F-3692-B140-131FB983AC5E.bcsymbolmap

into Alamofire-iOS.zip



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/framework_carthage_archive.rb', line 10

def compress_archive(shell, carthage_build_dir = CARTHAGE_BUILD_DIR)
  $LOG.debug("Archiving #{@framework_name} for #{@platform}")

  platform_path = File.join(carthage_build_dir, platform_to_carthage_dir_string(@platform))
  framework_path = File.join(platform_path, "#{@framework_name}.framework")
  raise MissingFrameworkDirectoryError.new, "Archive can't be created, no framework directory at #{framework_path}" unless Dir.exist?(framework_path)

  # It's very likely, that binary releases don't contain DSYMs.
  dsym_path = File.join(platform_path, "#{@framework_name}.framework.dSYM")
  unless File.exist?(dsym_path)
    $LOG.error("DSYM File #{dsym_path} not found, continuing")
    dsym_path = nil
  end

  binary_path = File.join(framework_path, @framework_name)
  raise AppError.new, "Binary #{binary_path} is missing, failed to read .bcsymbolmap files" unless File.exist?(binary_path)

  bcsymbolmap_paths = find_bcsymbolmap_paths(shell, platform_path, binary_path)

  input_paths = []
  input_paths << framework_path
  input_paths << dsym_path unless dsym_path.nil?
  input_paths += bcsymbolmap_paths

  $LOG.debug("Adding > #{input_paths.inspect}")

  delete_archive
  shell.archive(input_paths, @archive_path)
  $LOG.debug("Created #{@archive_path} archive, file size: #{formatted_archive_size}")
end