3
4
5
6
7
8
9
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
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
|
# File 'lib/pod-pipeline/util/binary.rb', line 3
def self.combine(output, inputs, include_list=[], exclude_list=[])
puts "\n目标文件:#{output}\n"
input_file_queue=""
inputs.each do |input|
puts "\n合并路径:#{input}"
Dir[input].each do |input_file|
next if Dir.exists? input_file
info_log = `lipo -info "#{input_file}" > /dev/null 2>&1
echo result:$?`
next unless info_log.include? 'result:0'
unless include_list.empty?
is_include = false
include_list.each { |include|
input_file_basename = File.basename(input_file)
include_basename = File.basename(include)
if input_file_basename == include_basename || input_file_basename == "lib#{include_basename}.a"
is_include = true
break
end
}
next unless is_include
end
unless exclude_list.empty?
is_exclude = false
exclude_list.each { |exclude|
input_file_basename = File.basename(input_file)
exclude_basename = File.basename(exclude)
if input_file_basename == exclude_basename || input_file_basename == "lib#{exclude_basename}.a"
is_exclude = true
break
end
}
next if is_exclude
end
next if input_file_queue.include? input_file
puts "=> #{input_file}"
input_file_queue += " \"#{input_file}\""
end
end
unless input_file_queue.empty?
if File.exists? output
output_temp = output+'.temp'
File.rename(output, output_temp)
combine_log =
`libtool -static -o "#{output}" "#{output_temp}" #{input_file_queue} > /dev/null 2>&1
echo result:$?`
raise "\ncombine log:\n#{combine_log}" unless combine_log.include? 'result:0'
File.delete(output_temp)
else
combine_log =
`libtool -static -o "#{output}" #{input_file_queue} > /dev/null 2>&1
echo result:$?`
raise "\ncombine log:\n#{combine_log}" unless combine_log.include? 'result:0'
end
end
end
|