-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPodfile
64 lines (50 loc) · 1.98 KB
/
Podfile
1
2
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
# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'
target 'MapsIndoorsGettingStarted-Mapbox' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for MapsIndoorsGettingStarted-Google
pod 'MapsIndoorsMapbox', '~> 4.0.2'
end
PROJECT_ROOT_DIR = File.dirname(File.expand_path(__FILE__))
PODS_DIR = File.join(PROJECT_ROOT_DIR, 'Pods')
PODS_TARGET_SUPPORT_FILES_DIR = File.join(PODS_DIR, 'Target Support Files')
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |bc|
bc.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
remove_static_framework_duplicate_linkage({
'MapsIndoors_Mapbox' => ['GoogleMaps', 'ValueAnimator']
})
end
def remove_static_framework_duplicate_linkage(static_framework_pods)
puts "Removing duplicate linkage of static frameworks"
Dir.glob(File.join(PODS_TARGET_SUPPORT_FILES_DIR, "Pods-*")).each do |path|
pod_target = path.split('-', -1).last
static_framework_pods.each do |target, pods|
next if pod_target == target
frameworks = pods.map { |pod| identify_frameworks(pod) }.flatten
Dir.glob(File.join(path, "*.xcconfig")).each do |xcconfig|
lines = File.readlines(xcconfig)
if other_ldflags_index = lines.find_index { |l| l.start_with?('OTHER_LDFLAGS') }
other_ldflags = lines[other_ldflags_index]
frameworks.each do |framework|
other_ldflags.gsub!("-framework \"#{framework}\"", '')
end
File.open(xcconfig, 'w') do |fd|
fd.write(lines.join)
end
end
end
end
end
end
def identify_frameworks(pod)
frameworks = Dir.glob(File.join(PODS_DIR, pod, "**/*.framework")).map { |path| File.basename(path) }
if frameworks.any?
return frameworks.map { |f| f.split('.framework').first }
end
return pod
end