Class: XamarinTestCloud::Dsym

Inherits:
Object
  • Object
show all
Defined in:
lib/xamarin-test-cloud/dsym.rb

Overview

TODO validate dsym against the current application.

  1. put the dSYM.zip and .ipa in a directory

  2. $ unzip <the>.ipa

  3. $ unzip <the>.dSYM.zip

  4. $ xcrun dwarfdump –uuid Payload/My.app/My

  5. $ xcrun dwarfdump –uuid My.app.dSYM

  6. confirm that they match.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Dsym

Caller should rescue RuntimeError and re-raise.

Raises:

  • RuntimeError If the dSYM at path is invalid.


16
17
18
19
# File 'lib/xamarin-test-cloud/dsym.rb', line 16

def initialize(path)
  @path = path
  validate!
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path


12
13
14
# File 'lib/xamarin-test-cloud/dsym.rb', line 12

def path
  @path
end

Instance Method Details

#dwarf_symbol_filesObject


96
97
98
99
100
101
102
103
# File 'lib/xamarin-test-cloud/dsym.rb', line 96

def dwarf_symbol_files
  @dwarf_symbol_files ||= begin
    base = File.join(path, "Contents", "Resources", "DWARF")
    Dir.entries(base).select do |entry|
      !(entry.end_with?('..') || entry.end_with?('.'))
    end.map { |entry| File.join(base, entry) }
  end
end

#inspectObject


25
26
27
# File 'lib/xamarin-test-cloud/dsym.rb', line 25

def inspect
  to_s
end

#remote_path(path_to_app) ⇒ Object


86
87
88
# File 'lib/xamarin-test-cloud/dsym.rb', line 86

def remote_path(path_to_app)
  "#{File.basename(path_to_app)}_dSym"
end

#symbol_fileObject


90
91
92
# File 'lib/xamarin-test-cloud/dsym.rb', line 90

def symbol_file
  File.expand_path(dwarf_symbol_files[0])
end

#to_sObject


21
22
23
# File 'lib/xamarin-test-cloud/dsym.rb', line 21

def to_s
  "#<DSYM #{@path}>"
end

#validate!Object


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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/xamarin-test-cloud/dsym.rb', line 29

def validate!
  extension = File.extname(path)

  if extension != ".dSYM"
    raise RuntimeError, %Q[Invalid dSYM directory.

The --dsym-file must have a dSYM extension.  Found:

#{path}
]
  end

  if !File.exist?(path)
    raise RuntimeError, %Q[Invalid dSYM directory.

The --dsym-file does not exist:

#{path}
]
  end

  if !File.directory?(path)
    raise RuntimeError, %Q[Invalid dSYM directory.

The --dsym-file is not a directory:

#{path}
]
  end

  if dwarf_symbol_files.count > 1
    raise RuntimeError, %Q[Invalid dSYM directory.

The --dsym-file contains more than one symbol file.

Check the contents of #{File.join("Contents", "Resources", "DWARF")} in:

#{path}
]
  end

  if dwarf_symbol_files.count < 1
    raise RuntimeError, %Q[Invalid dSYM directory.

The --dsym-file contains no symbol file.

Check the contents of #{File.join("Contents", "Resources", "DWARF")} in:

#{path}

    #{Dir.glob(File.join(path, "Contents", "Resources", "DWARF", "*" ))}
]
  end

  true
end