pod-builder 2.0.0.beta.25 ā 2.0.0.beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -22
- data/exe/pod_builder +10 -32
- data/lib/pod_builder/command.rb +1 -3
- data/lib/pod_builder/command/build.rb +0 -1
- data/lib/pod_builder/command/generate_lldbinit.rb +151 -0
- data/lib/pod_builder/command/init.rb +23 -11
- data/lib/pod_builder/configuration.rb +2 -20
- data/lib/pod_builder/install.rb +113 -69
- data/lib/pod_builder/podfile.rb +1 -1
- data/lib/pod_builder/rome/post_install.rb +50 -40
- data/lib/pod_builder/version.rb +1 -1
- metadata +3 -5
- data/lib/pod_builder/command/clear_lldbinit.rb +0 -48
- data/lib/pod_builder/command/generate_lfs.rb +0 -70
- data/lib/pod_builder/command/update_lldbinit.rb +0 -162
data/lib/pod_builder/podfile.rb
CHANGED
@@ -593,7 +593,7 @@ module PodBuilder
|
|
593
593
|
base = File.expand_path(File.join(PodBuilder::project_path, ".."))
|
594
594
|
bin_js = Dir.glob("#{base}/node_modules/@react-native-community/cli/build/bin.js")
|
595
595
|
|
596
|
-
raise "\n\nReact native cli bin_js not found!".red unless bin_js.count == 1
|
596
|
+
raise "\n\nReact native cli bin_js not found! Did you run yarn install?".red unless bin_js.count == 1
|
597
597
|
bin_js = bin_js.first
|
598
598
|
|
599
599
|
config_dest_path = PodBuilder::basepath("rn_config.json")
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'fourflusher'
|
4
4
|
require 'colored'
|
5
|
+
require 'pathname'
|
5
6
|
|
6
7
|
module PodBuilder
|
7
8
|
def self.build_for_iosish_platform_framework(sandbox, build_dir, target, device, simulator, configuration, deterministic_build, build_for_apple_silicon)
|
@@ -80,10 +81,10 @@ module PodBuilder
|
|
80
81
|
def self.build_for_iosish_platform_lib(sandbox, build_dir, target, device, simulator, configuration, deterministic_build, build_for_apple_silicon)
|
81
82
|
raise "\n\nApple silicon hardware still unsupported since it requires to migrate to xcframeworks".red if build_for_apple_silicon
|
82
83
|
|
83
|
-
|
84
|
-
|
85
|
-
FileUtils.mkdir_p(
|
86
|
-
FileUtils.mkdir_p(
|
84
|
+
device_headers_path = File.join(build_dir, "Headers", device)
|
85
|
+
simulator_headers_path = File.join(build_dir, "Headers", simulator)
|
86
|
+
FileUtils.mkdir_p(device_headers_path)
|
87
|
+
FileUtils.mkdir_p(simulator_headers_path)
|
87
88
|
|
88
89
|
deployment_target = target.platform_deployment_target
|
89
90
|
target_label = target.cocoapods_target_label
|
@@ -92,43 +93,39 @@ module PodBuilder
|
|
92
93
|
|
93
94
|
xcodebuild(sandbox, target_label, device, deployment_target, configuration, deterministic_build, [])
|
94
95
|
spec_names.each do |root_name, module_name|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
|
99
|
-
device_lib = "#{device_base}/lib#{module_name}.a"
|
96
|
+
headers_path = "#{sandbox.headers_root.to_s}/Public/#{root_name}"
|
97
|
+
dest_path = "#{device_headers_path}/#{root_name}"
|
98
|
+
FileUtils.mkdir_p(dest_path)
|
100
99
|
|
101
|
-
|
102
|
-
|
100
|
+
Dir.glob("#{headers_path}/*") do |path|
|
101
|
+
real_path = Pathname.new(path).realpath
|
102
|
+
FileUtils.cp_r(real_path, dest_path)
|
103
|
+
end
|
103
104
|
end
|
104
105
|
|
105
106
|
excluded_archs = build_for_apple_silicon ? [] : ["arm64"]
|
106
107
|
xcodebuild(sandbox, target_label, simulator, deployment_target, configuration, deterministic_build, excluded_archs)
|
107
108
|
spec_names.each do |root_name, module_name|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
109
|
+
headers_path = "#{sandbox.headers_root.to_s}/Public/#{root_name}"
|
110
|
+
dest_path = "#{simulator_headers_path}/#{root_name}"
|
111
|
+
FileUtils.mkdir_p(dest_path)
|
112
|
+
|
113
|
+
Dir.glob("#{headers_path}/*") do |path|
|
114
|
+
real_path = Pathname.new(path).realpath
|
115
|
+
FileUtils.cp_r(real_path, dest_path)
|
116
|
+
end
|
116
117
|
end
|
117
118
|
|
118
119
|
spec_names.each do |root_name, module_name|
|
119
|
-
|
120
|
-
|
121
|
-
simulator_headers_private = ""
|
122
|
-
simulator_headers_public = ""
|
120
|
+
simulator_base = "#{build_dir}/#{configuration}-#{simulator}/#{root_name}"
|
121
|
+
simulator_lib = "#{simulator_base}/lib#{module_name}.a"
|
123
122
|
|
124
123
|
device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
|
125
124
|
device_lib = "#{device_base}/lib#{module_name}.a"
|
126
|
-
simulator_base = "#{build_dir}/#{configuration}-#{simulator}/#{root_name}"
|
127
|
-
simulator_lib = "#{simulator_base}/lib#{module_name}.a"
|
128
125
|
|
129
126
|
next unless File.file?(device_lib) && File.file?(simulator_lib)
|
130
127
|
|
131
|
-
|
128
|
+
# Starting with Xcode 12b3 the simulator binary contains an arm64 slice as well which conflict with the one in the device_lib
|
132
129
|
# when creating the fat library. A naive workaround is to remove the arm64 from the simulator_lib however this is wrong because
|
133
130
|
# we might actually need to have 2 separated arm64 slices, one for simulator and one for device each built with different
|
134
131
|
# compile time directives (e.g #if targetEnvironment(simulator))
|
@@ -139,22 +136,34 @@ module PodBuilder
|
|
139
136
|
end
|
140
137
|
|
141
138
|
raise "Lipo failed on #{device_lib}" unless system("xcrun lipo -create -output #{device_lib} #{device_lib} #{simulator_lib}")
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
139
|
+
|
140
|
+
device_headers = Dir.glob("#{device_headers_path}/**/*.h")
|
141
|
+
simulator_headers = Dir.glob("#{simulator_headers_path}/**/*.h")
|
142
|
+
device_headers.each do |device_path|
|
143
|
+
simulator_path = device_path.gsub(device_headers_path, simulator_headers_path)
|
144
|
+
if File.exist?(simulator_path)
|
145
|
+
device_content = File.read(device_path)
|
146
|
+
simulator_content = File.read(simulator_path)
|
147
|
+
merged_content = %{
|
148
|
+
#if TARGET_OS_SIMULATOR
|
149
|
+
#{simulator_content}
|
150
|
+
#else
|
151
|
+
#{device_content}
|
152
|
+
#endif
|
153
|
+
}
|
154
|
+
File.write(device_path, merged_content)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
simulator_only_headers = simulator_headers - device_headers.map { |t| t.gsub(device_headers_path, simulator_headers_path) }
|
158
|
+
simulator_only_headers.each do |path|
|
159
|
+
simulator_content = File.read(path)
|
160
|
+
content = %{
|
148
161
|
#if TARGET_OS_SIMULATOR
|
149
162
|
#{simulator_content}
|
150
|
-
#else
|
151
|
-
#{device_content}
|
152
163
|
#endif
|
153
164
|
}
|
154
|
-
File.write(
|
165
|
+
File.write(path, content)
|
155
166
|
end
|
156
|
-
|
157
|
-
|
158
167
|
end
|
159
168
|
|
160
169
|
|
@@ -306,8 +315,6 @@ module PodBuilder
|
|
306
315
|
end
|
307
316
|
project.save
|
308
317
|
end
|
309
|
-
|
310
|
-
|
311
318
|
end
|
312
319
|
|
313
320
|
Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_context, user_options|
|
@@ -389,7 +396,10 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
|
|
389
396
|
end
|
390
397
|
|
391
398
|
if enable_dsym
|
392
|
-
|
399
|
+
dsym_source = "#{build_dir}/dSYM"
|
400
|
+
if File.directory?(dsym_source)
|
401
|
+
FileUtils.mv(dsym_source, sandbox_root.parent)
|
402
|
+
end
|
393
403
|
else
|
394
404
|
raise "Not implemented"
|
395
405
|
end
|
data/lib/pod_builder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pod-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.beta.
|
4
|
+
version: 2.0.0.beta.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Camin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -187,9 +187,8 @@ files:
|
|
187
187
|
- lib/pod_builder/command/build.rb
|
188
188
|
- lib/pod_builder/command/build_all.rb
|
189
189
|
- lib/pod_builder/command/clean.rb
|
190
|
-
- lib/pod_builder/command/clear_lldbinit.rb
|
191
190
|
- lib/pod_builder/command/deintegrate.rb
|
192
|
-
- lib/pod_builder/command/
|
191
|
+
- lib/pod_builder/command/generate_lldbinit.rb
|
193
192
|
- lib/pod_builder/command/generate_podspec.rb
|
194
193
|
- lib/pod_builder/command/info.rb
|
195
194
|
- lib/pod_builder/command/init.rb
|
@@ -199,7 +198,6 @@ files:
|
|
199
198
|
- lib/pod_builder/command/switch.rb
|
200
199
|
- lib/pod_builder/command/sync_podfile.rb
|
201
200
|
- lib/pod_builder/command/update.rb
|
202
|
-
- lib/pod_builder/command/update_lldbinit.rb
|
203
201
|
- lib/pod_builder/configuration.rb
|
204
202
|
- lib/pod_builder/core.rb
|
205
203
|
- lib/pod_builder/info.rb
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'pod_builder/core'
|
2
|
-
require 'digest'
|
3
|
-
|
4
|
-
module PodBuilder
|
5
|
-
module Command
|
6
|
-
class ClearLldbInit
|
7
|
-
def self.call
|
8
|
-
Configuration.check_inited
|
9
|
-
if Configuration.build_using_repo_paths
|
10
|
-
raise "\n\nlldb shenanigans not supported when 'build_using_repo_paths' is enabled".red
|
11
|
-
end
|
12
|
-
|
13
|
-
argument_pods = ARGV.dup
|
14
|
-
|
15
|
-
unless argument_pods.count > 0
|
16
|
-
return -1
|
17
|
-
end
|
18
|
-
unless argument_pods.count == 1
|
19
|
-
raise "\n\nExpecting LLDBINIT_PATH\n\n".red
|
20
|
-
end
|
21
|
-
|
22
|
-
lldbinit_path = File.expand_path(argument_pods[0])
|
23
|
-
lldbinit_content = File.exist?(lldbinit_path) ? File.read(lldbinit_path) : ""
|
24
|
-
|
25
|
-
lldbinit_lines = []
|
26
|
-
skipNext = false
|
27
|
-
File.read(lldbinit_path).each_line do |line|
|
28
|
-
if line.include?("# <pb")
|
29
|
-
skipNext = true
|
30
|
-
next
|
31
|
-
elsif skipNext
|
32
|
-
skipNext = false
|
33
|
-
next
|
34
|
-
elsif line != "\n"
|
35
|
-
lldbinit_lines.push(line)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
File.write(lldbinit_path, lldbinit_lines.join())
|
40
|
-
|
41
|
-
if OPTIONS.nil? == false
|
42
|
-
puts "\n\nš done!\n".green
|
43
|
-
end
|
44
|
-
return 0
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'pod_builder/core'
|
2
|
-
|
3
|
-
module PodBuilder
|
4
|
-
module Command
|
5
|
-
class GenerateLFS
|
6
|
-
def self.call
|
7
|
-
Configuration.check_inited
|
8
|
-
|
9
|
-
unless Configuration.lfs_update_gitattributes
|
10
|
-
return -1
|
11
|
-
end
|
12
|
-
|
13
|
-
gitattributes_excludes = ["*.h", "*.hh", "*.m", "*.mm", "*.i", "*.c", "*.cc", "*.cxx", "*.cpp", "*.def", "*.inc", "*.inl", "*.swift", "*.modulemap", "*.strings", "*.png", "*.jpg", "*.gif", "*.html", "*.htm", "*.js", "*.json", "*.xml", "*.txt", "*.md", "*.rb", "*.sh", "*.py", "*.plist", "*.resolved", ".*", "README*", "LICENSE*"]
|
14
|
-
|
15
|
-
gitattributes_includes_frameworks = ["**/* filter=lfs diff=lfs merge=lfs !text"]
|
16
|
-
write_attributes(PodBuilder::prebuiltpath, gitattributes_includes_frameworks, gitattributes_excludes)
|
17
|
-
write_attributes(PodBuilder::dsympath, gitattributes_includes_frameworks, gitattributes_excludes)
|
18
|
-
|
19
|
-
if Configuration.lfs_include_pods_folder
|
20
|
-
gitattributes_includes_pods = ["**/*.framework/**/* filter=lfs diff=lfs merge=lfs !text"]
|
21
|
-
write_attributes(PodBuilder::project_path("Pods"), gitattributes_includes_pods, gitattributes_excludes)
|
22
|
-
end
|
23
|
-
|
24
|
-
return 0
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def self.filter_files_by_size(files, size_kb)
|
30
|
-
return files.select { |x| File.size(x) / 1024 > Configuration.lfs_min_file_size }
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.write_attributes(path, gitattributes_includes, gitattributes_excludes)
|
34
|
-
stop_marker = "# pb<stop>"
|
35
|
-
start_marker = "# pb<start> (lines up to `#{stop_marker}` are autogenerated, don't modify this section)"
|
36
|
-
|
37
|
-
gitattributes_items = [start_marker]
|
38
|
-
gitattributes_items += gitattributes_includes + gitattributes_excludes.map { |x| "#{x} !filter !merge !diff" }
|
39
|
-
gitattributes_items += [stop_marker]
|
40
|
-
|
41
|
-
gitattributes_path = File.join(gitattributes_path, ".gitattributes")
|
42
|
-
|
43
|
-
if !File.exist?(gitattributes_path)
|
44
|
-
FileUtils.touch(gitattributes_path)
|
45
|
-
end
|
46
|
-
|
47
|
-
gitattributes_content = File.read(gitattributes_path)
|
48
|
-
|
49
|
-
podbuilder_start_line_found = false
|
50
|
-
gitattributes_content.each_line do |line|
|
51
|
-
stripped_line = line.strip
|
52
|
-
if stripped_line.start_with?(stop_marker)
|
53
|
-
podbuilder_start_line_found = false
|
54
|
-
next
|
55
|
-
elsif stripped_line.start_with?(start_marker)
|
56
|
-
podbuilder_start_line_found = true
|
57
|
-
end
|
58
|
-
|
59
|
-
unless !podbuilder_start_line_found
|
60
|
-
next
|
61
|
-
end
|
62
|
-
|
63
|
-
gitattributes_items.push(line.strip)
|
64
|
-
end
|
65
|
-
|
66
|
-
File.write(gitattributes_path, gitattributes_items.join("\n"))
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,162 +0,0 @@
|
|
1
|
-
require 'pod_builder/core'
|
2
|
-
require 'digest'
|
3
|
-
|
4
|
-
module PodBuilder
|
5
|
-
module Command
|
6
|
-
class UpdateLldbInit
|
7
|
-
def self.call
|
8
|
-
Configuration.check_inited
|
9
|
-
if Configuration.build_using_repo_paths
|
10
|
-
raise "\n\nlldb shenanigans not supported when 'build_using_repo_paths' is enabled".red
|
11
|
-
end
|
12
|
-
|
13
|
-
argument_pods = ARGV.dup
|
14
|
-
|
15
|
-
unless argument_pods.count > 0
|
16
|
-
return -1
|
17
|
-
end
|
18
|
-
unless argument_pods.count == 2
|
19
|
-
raise "\n\nExpecting LLDBINIT_PATH and a single PATH to the folder containing the prebuilt framework's source code\n\n".red
|
20
|
-
end
|
21
|
-
|
22
|
-
base_path = PodBuilder::basepath("")
|
23
|
-
|
24
|
-
podfile_restore_content = File.read(PodBuilder::basepath("Podfile.restore"))
|
25
|
-
app_podfile_content = File.read(PodBuilder::project_path("Podfile"))
|
26
|
-
|
27
|
-
lldbinit_path = File.expand_path(argument_pods[0])
|
28
|
-
lldbinit_content = File.exist?(lldbinit_path) ? File.read(lldbinit_path) : ""
|
29
|
-
status_hash = podfiles_status_hash(app_podfile_content, podfile_restore_content)
|
30
|
-
if lldbinit_content.include?("# <pb_md5:#{base_path}:#{status_hash}")
|
31
|
-
puts "\n\nš already in sync!\n".green
|
32
|
-
return 0
|
33
|
-
end
|
34
|
-
|
35
|
-
source_path = argument_pods[1]
|
36
|
-
|
37
|
-
is_absolute = ["~", "/"].include?(source_path[0])
|
38
|
-
if !is_absolute
|
39
|
-
source_path = Pathname.new(File.join(base_path, source_path))
|
40
|
-
end
|
41
|
-
|
42
|
-
source_path = File.expand_path(source_path)
|
43
|
-
|
44
|
-
framework_paths = Dir.glob("#{base_path}/**/*.framework")
|
45
|
-
|
46
|
-
unless framework_paths.count > 0
|
47
|
-
raise "\n\nNo prebuilt frameworks found in `#{framework_paths}`\n\n".red
|
48
|
-
end
|
49
|
-
|
50
|
-
puts "Extracting debug information".yellow
|
51
|
-
|
52
|
-
podspec_paths = Dir.glob("#{source_path}/**/*.podspec") + Dir.glob("#{source_path}/**/*.podspec.json")
|
53
|
-
podspec_contents = podspec_paths.map { |t| File.read(t).gsub(/\s+/, "").gsub("\"", "'") }
|
54
|
-
|
55
|
-
replace_paths = []
|
56
|
-
|
57
|
-
framework_paths.each do |framework_path|
|
58
|
-
name = File.basename(framework_path, File.extname(framework_path))
|
59
|
-
executable_path = File.join(framework_path, name)
|
60
|
-
|
61
|
-
parent_framework_path = File.expand_path(File.joing(framework_path, ".."))
|
62
|
-
framework_info_path = File.join(parent_framework_path, Configuration.prebuilt_info_filename)
|
63
|
-
data = JSON.parse(File.read(framework_info_path))
|
64
|
-
|
65
|
-
original_compile_path = data["original_compile_path"]
|
66
|
-
is_prebuilt = data.fetch("is_prebuilt", true)
|
67
|
-
|
68
|
-
if original_compile_path.nil?
|
69
|
-
puts "\n\n#{framework_path} was compiled with an older version of PodBuilder, please rebuild it to update `#{lldbinit_path}`"
|
70
|
-
next
|
71
|
-
end
|
72
|
-
|
73
|
-
if is_prebuilt
|
74
|
-
next
|
75
|
-
end
|
76
|
-
|
77
|
-
if podspec_path = find_podspec_path_for(name, podspec_paths, podspec_contents)
|
78
|
-
if !is_development_pod(podspec_path, app_podfile_content)
|
79
|
-
replace_paths.push("#{original_compile_path}/Pods/#{name},#{File.dirname(podspec_path)}")
|
80
|
-
else
|
81
|
-
puts "#{name} is in development pod, skipping"
|
82
|
-
end
|
83
|
-
else
|
84
|
-
puts "Failed to find podspec for #{name}, skipping".blue
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
replace_paths.uniq!
|
89
|
-
|
90
|
-
source_map_lines = replace_paths.flat_map { |t| ["# <pb:#{base_path}>\n", "settings append target.source-map '#{t.split(",").first}' '#{t.split(",").last}'\n"] }
|
91
|
-
rewrite_lldinit(lldbinit_path, source_map_lines, base_path, app_podfile_content, podfile_restore_content)
|
92
|
-
|
93
|
-
puts "\n\nš done!\n".green
|
94
|
-
return 0
|
95
|
-
end
|
96
|
-
|
97
|
-
def self.is_development_pod(podspec_path, app_podfile_content)
|
98
|
-
development_path = Pathname.new(podspec_path).relative_path_from(Pathname.new(PodBuilder::project_path)).parent.to_s
|
99
|
-
|
100
|
-
return app_podfile_content.include?(":path => '#{development_path}'")
|
101
|
-
end
|
102
|
-
|
103
|
-
def self.find_podspec_path_for(name, podspec_paths, podspec_contents)
|
104
|
-
if (path = podspec_paths.detect { |t| File.basename(t, ".podspec") == name.gsub("_", "-") })
|
105
|
-
return path
|
106
|
-
elsif (path_index = podspec_contents.find_index { |t| t.include?(".module_name='#{name}'") })
|
107
|
-
return podspec_paths[path_index]
|
108
|
-
elsif (path_index = podspec_contents.find_index { |t| t.include?(".name='#{name}") }) # kind of optimistic,, but a last resort
|
109
|
-
return podspec_paths[path_index]
|
110
|
-
elsif (path_index = podspec_contents.find_index { |t| t.include?("'module_name':'#{name}'") }) # [json podspec]
|
111
|
-
return podspec_paths[path_index]
|
112
|
-
elsif (path_index = podspec_contents.find_index { |t| t.include?("'name':'#{name}") }) # [json podspec] kind of optimistic,, but a last resort
|
113
|
-
return podspec_paths[path_index]
|
114
|
-
else
|
115
|
-
return nil
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def self.podfiles_status_hash(app_podfile_content, podfile_restore_content)
|
120
|
-
# Change to either Podfile.restore (which presumely mean new prebuilds done)
|
121
|
-
# or app's Podfile (which my occurr when pods are switched to development pod)
|
122
|
-
# should force a regeneration of the status identifier
|
123
|
-
Digest::MD5.hexdigest(podfile_restore_content + app_podfile_content)
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.rewrite_lldinit(lldbinit_path, source_map_lines, base_path, app_podfile_content, podfile_restore_content)
|
127
|
-
puts "Writing #{lldbinit_path}".yellow
|
128
|
-
|
129
|
-
FileUtils.touch(lldbinit_path)
|
130
|
-
raise "\n\nDestination file should be a file".red unless File.exist?(lldbinit_path)
|
131
|
-
|
132
|
-
lldbinit_lines = []
|
133
|
-
skipNext = false
|
134
|
-
File.read(lldbinit_path).each_line do |line|
|
135
|
-
if line.include?("# <pb:#{base_path}>") || line.include?("# <pb>")
|
136
|
-
skipNext = true
|
137
|
-
next
|
138
|
-
elsif skipNext
|
139
|
-
skipNext = false
|
140
|
-
next
|
141
|
-
elsif line != "\n"
|
142
|
-
if line.include?("settings set target.source-map")
|
143
|
-
raise "\n\n#{lldbinit_destination_path} already includes a manual `settings set target.source-map`. This is unsupported and you'll have to manually remove that entry\n".red
|
144
|
-
end
|
145
|
-
lldbinit_lines.push(line)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
status_hash = podfiles_status_hash(app_podfile_content, podfile_restore_content)
|
150
|
-
|
151
|
-
source_map_lines.insert(0, "# <pb>\n")
|
152
|
-
source_map_lines.insert(1, "settings clear target.source-map\n")
|
153
|
-
source_map_lines.insert(2, "# <pb:#{base_path}>\n")
|
154
|
-
source_map_lines.insert(3, "# <pb_md5:#{base_path}:#{status_hash}>\n")
|
155
|
-
|
156
|
-
lldbinit_lines += source_map_lines
|
157
|
-
|
158
|
-
File.write(lldbinit_path, lldbinit_lines.join())
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|