pod-builder 1.2.1 ā†’ 1.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b4894a8c845877301fe37cba6682aeccb75893da27d05ab6ad3263654b6007d
4
- data.tar.gz: 2b6995d8db5b4a13a7a6227abfa242806d186fd5397faea75b3403807112f9da
3
+ metadata.gz: 1ed1f8c8e0a7da95f84809e493f7cb3fb7ed6d024f1b17f57e73b54e27e661f2
4
+ data.tar.gz: e210f06322e54da06ed82fc1ecea03b8dcc9ab5ae50c44beedb34df667ddb4d2
5
5
  SHA512:
6
- metadata.gz: 89e914bb125884e5a976a872275b96134fc35243e4364ae4e8f24da5ebb7c4be031542ccde07d282fccf066e60c0ea3e007800f0c1832421d337c5b7a9f14b51
7
- data.tar.gz: c2def531344ba74be17941317521f250260ba81413d86b164181cb3cf13b1a7088743afdf7b09de97da8690aabef50236b2c88c380b6e78cb719fb02ada05632
6
+ metadata.gz: '08086526e3001eced878eb22656a82b06527a247f3bc8f93d30eb9a9a5962dc8e565fc3b8cca0f5bd08aa41316500450aa49970b0773b1aa0242af90afcc6d62'
7
+ data.tar.gz: f876724cb3b9b99357e5162265c780f8e752e2287af452104910b576d9f35d1b822597f9fdf01a50d144ad0665374b78ad510082cbb167368074a0c922abfa08
data/README.md CHANGED
@@ -100,6 +100,10 @@ When using PodBuilder you loose ability to directly access to the source code of
100
100
 
101
101
  In some situations you may already have source code for your prebuilt frameworks (e.g. committed in your repo). In this case there is no need to use the `install_sources`, you can run this command passing the folder that contains the source code that you used to generate the prebuilt frameworks. This will update the `~/.lldbinit-Xcode` file which will restore the ability to use the debugger and step into the code of your prebuilt dependencies.
102
102
 
103
+ #### `clear_lldbinit` command
104
+
105
+ Run this command to remove PodBuilder's `~/.lldbinit-Xcode` customizations.
106
+
103
107
  #### `switch` command
104
108
 
105
109
  Once you prebuild a framework you can change the way it is integrated in your project.
data/exe/pod_builder CHANGED
@@ -40,6 +40,7 @@ Command:
40
40
  + restore_all Rebuild all pods declared in the Restore-Podfile
41
41
  + install_sources Install sources of pods to debug into prebuilt frameworks
42
42
  + update_lldbinit Update ~/.lldbinit-Xcode setting target.source-map to debug prebuilt frameworks
43
+ + clear_lldbinit Clear ~/.lldbinit-Xcode setting with PodBuilder's customizations
43
44
  + switch Switch between prebuilt/development/standard pod in the Application-Podfile
44
45
  + clean Remove prebuild frameworks, dSYMs and source files added by `install_sources` command that are no longer in the PodBuilder-Podfile
45
46
  + sync_podfile Update your Application-Podfile with all pods declared in the PodBuilder-Podfile
@@ -254,7 +255,7 @@ Usage:
254
255
  opts.banner = "
255
256
  Usage:
256
257
 
257
- $ pod_builder install_sources PATH
258
+ $ pod_builder update_lldbinit PATH
258
259
 
259
260
  Update ~/.lldbinit-Xcode setting target.source-map in order to be able to step into
260
261
  and debug framework's code.
@@ -268,6 +269,21 @@ Usage:
268
269
  ]
269
270
  },
270
271
 
272
+ "clear_lldbinit" => {
273
+ :opts => OptionParser.new do |opts|
274
+ opts.banner = "
275
+ Usage:
276
+
277
+ $ pod_builder clear_lldbinit
278
+
279
+ Clear ~/.lldbinit-Xcode setting target.source-map PodBuilder's customizations
280
+ "
281
+ end,
282
+ :call => [
283
+ PodBuilder::Command::ClearLldbInit
284
+ ]
285
+ },
286
+
271
287
  "switch" => {
272
288
  :opts => OptionParser.new do |opts|
273
289
  opts.banner = "
@@ -0,0 +1,32 @@
1
+ require 'pod_builder/core'
2
+ require 'digest'
3
+
4
+ module PodBuilder
5
+ module Command
6
+ class ClearLldbInit
7
+ def self.call(options)
8
+ lldbinit_path = File.expand_path('~/.lldbinit-Xcode')
9
+ lldbinit_content = File.exists?(lldbinit_path) ? File.read(lldbinit_path) : ""
10
+
11
+ lldbinit_lines = []
12
+ skipNext = false
13
+ File.read(lldbinit_path).each_line do |line|
14
+ if line.include?("# <pb")
15
+ skipNext = true
16
+ next
17
+ elsif skipNext
18
+ skipNext = false
19
+ next
20
+ elsif line != "\n"
21
+ lldbinit_lines.push(line)
22
+ end
23
+ end
24
+
25
+ File.write(lldbinit_path, lldbinit_lines.join())
26
+
27
+ puts "\n\nšŸŽ‰ done!\n".green
28
+ return 0
29
+ end
30
+ end
31
+ end
32
+ end
@@ -18,32 +18,35 @@ module PodBuilder
18
18
 
19
19
  base_path = PodBuilder::basepath("")
20
20
 
21
+ podfile_restore_content = File.read(PodBuilder::basepath("Podfile.restore"))
22
+ app_podfile_content = File.read(PodBuilder::project_path("Podfile"))
23
+
21
24
  lldbinit_path = File.expand_path('~/.lldbinit-Xcode')
22
25
  lldbinit_content = File.exists?(lldbinit_path) ? File.read(lldbinit_path) : ""
23
- restore_hash = podfile_restore_hash()
24
- if lldbinit_content.include?("# <pb_md5:#{base_path}:#{restore_hash}")
26
+ status_hash = podfiles_status_hash(app_podfile_content, podfile_restore_content)
27
+ if lldbinit_content.include?("# <pb_md5:#{base_path}:#{status_hash}")
25
28
  puts "\n\nšŸŽ‰ already in sync!\n".green
26
29
  return 0
27
30
  end
28
31
 
29
- path = argument_pods[0]
32
+ source_path = argument_pods[0]
30
33
 
31
- is_absolute = ["~", "/"].include?(path[0])
34
+ is_absolute = ["~", "/"].include?(source_path[0])
32
35
  if !is_absolute
33
- path = Pathname.new(File.join(base_path, path))
36
+ source_path = Pathname.new(File.join(base_path, source_path))
34
37
  end
35
38
 
36
- path = File.expand_path(path)
39
+ source_path = File.expand_path(source_path)
37
40
 
38
41
  framework_paths = Dir.glob("#{base_path}/**/*.framework")
39
42
 
40
43
  unless framework_paths.count > 0
41
- raise "\n\nNo prebuilt frameworks found in `#{path}`\n\n".red
44
+ raise "\n\nNo prebuilt frameworks found in `#{framework_paths}`\n\n".red
42
45
  end
43
46
 
44
47
  puts "Extracting debug information".yellow
45
48
 
46
- podspec_paths = Dir.glob("#{path}/**/*.podspec") + Dir.glob("#{path}/**/*.podspec.json")
49
+ podspec_paths = Dir.glob("#{source_path}/**/*.podspec") + Dir.glob("#{source_path}/**/*.podspec.json")
47
50
  podspec_contents = podspec_paths.map { |t| File.read(t).gsub(/\s+/, "").gsub("\"", "'") }
48
51
 
49
52
  replace_paths = []
@@ -51,49 +54,50 @@ module PodBuilder
51
54
  framework_paths.each do |framework_path|
52
55
  name = File.basename(framework_path, File.extname(framework_path))
53
56
  executable_path = File.join(framework_path, name)
57
+
58
+ podbuilder_plist = File.join(framework_path, Configuration.framework_plist_filename)
59
+
60
+ plist = CFPropertyList::List.new(:file => podbuilder_plist)
61
+ data = CFPropertyList.native_types(plist.value)
62
+
63
+ original_compile_path = data["original_compile_path"]
64
+ is_prebuilt = data.fetch("is_prebuilt", true)
65
+
66
+ if original_compile_path.nil?
67
+ puts "\n\n#{framework_path} was compiled with an older version of PodBuilder, please rebuild it to update `~/.lldbinit-Xcode`"
68
+ next
69
+ end
54
70
 
55
- dwarf_dump_lib = `dwarfdump --debug-info #{executable_path} | grep '#{Configuration.build_base_path}' | head -n 1`.strip()
56
-
57
- if (matches = dwarf_dump_lib.match(/#{Configuration.build_base_path}(.*)\/Pods/)) && matches.size == 2
58
- original_compile_path = "#{Configuration.build_base_path}#{matches[1]}/Pods/#{name}"
59
-
60
- if podspec_path = find_podspec_path_for(name, podspec_paths, podspec_contents)
61
- replace_paths.push("#{original_compile_path},#{File.dirname(podspec_path)}")
71
+ if is_prebuilt
72
+ next
73
+ end
74
+
75
+ if podspec_path = find_podspec_path_for(name, podspec_paths, podspec_contents)
76
+ if !is_development_pod(podspec_path, app_podfile_content)
77
+ replace_paths.push("#{original_compile_path}/Pods/#{name},#{File.dirname(podspec_path)}")
62
78
  else
63
- puts "Failed to find podspec for #{name}".blue
64
- end
79
+ puts "#{name} is in development pod, skipping"
80
+ end
65
81
  else
66
- # Look for path in dSYM
67
- dsym_paths = Dir.glob("#{base_path}/**/iphonesimulator/#{name}.framework.dSYM")
68
- dsym_paths.each do |dsym_path|
69
- name = File.basename(dsym_path, ".framework.dSYM")
70
- dsym_dwarf_path = File.join(dsym_path, "Contents/Resources/DWARF")
71
- dsym_dwarf_path = File.join(dsym_dwarf_path, name)
72
-
73
- dwarf_dump_lib = `dwarfdump --debug-info #{dsym_dwarf_path} | grep '#{Configuration.build_base_path}' | head -n 1`.strip()
74
-
75
- if (matches = dwarf_dump_lib.match(/#{Configuration.build_base_path}(.*)\/Pods/)) && matches.size == 2
76
- original_compile_path = "#{Configuration.build_base_path}#{matches[1]}/Pods/#{name}"
77
-
78
- if podspec_path = find_podspec_path_for(name, podspec_paths, podspec_contents)
79
- replace_paths.push("#{original_compile_path},#{File.dirname(podspec_path)}")
80
- else
81
- puts "Failed to find podspec for #{name}".blue
82
- end
83
- end
84
- end
85
- end
82
+ puts "Failed to find podspec for #{name}, skipping".blue
83
+ end
86
84
  end
87
85
 
88
86
  replace_paths.uniq!
89
87
 
90
- source_map_lines = replace_paths.flat_map { |t| ["# <pb:#{base_path}>", "settings append target.source-map '#{t.split(",").first}' '#{t.split(",").last}'"] }
91
- rewrite_lldinit(source_map_lines, base_path)
88
+ source_map_lines = replace_paths.flat_map { |t| ["# <pb:#{base_path}>\n", "settings append target.source-map '#{t.split(",").first}' '#{t.split(",").last}'\n"] }
89
+ rewrite_lldinit(source_map_lines, base_path, app_podfile_content, podfile_restore_content)
92
90
 
93
91
  puts "\n\nšŸŽ‰ done!\n".green
94
92
  return 0
95
93
  end
96
94
 
95
+ def self.is_development_pod(podspec_path, app_podfile_content)
96
+ development_path = Pathname.new(podspec_path).relative_path_from(Pathname.new(PodBuilder::project_path)).parent.to_s
97
+
98
+ return app_podfile_content.include?(":path => '#{development_path}'")
99
+ end
100
+
97
101
  def self.find_podspec_path_for(name, podspec_paths, podspec_contents)
98
102
  if (path = podspec_paths.detect { |t| File.basename(t, ".podspec") == name.gsub("_", "-") })
99
103
  return path
@@ -110,11 +114,14 @@ module PodBuilder
110
114
  end
111
115
  end
112
116
 
113
- def self.podfile_restore_hash()
114
- Digest::MD5.hexdigest(File.read(PodBuilder::basepath("Podfile.restore")))
117
+ def self.podfiles_status_hash(app_podfile_content, podfile_restore_content)
118
+ # Change to either Podfile.restore (which presumely mean new prebuilds done)
119
+ # or app's Podfile (which my occurr when pods are switched to development pod)
120
+ # should force a regeneration of the status identifier
121
+ Digest::MD5.hexdigest(podfile_restore_content + app_podfile_content)
115
122
  end
116
123
 
117
- def self.rewrite_lldinit(source_map_lines, base_path)
124
+ def self.rewrite_lldinit(source_map_lines, base_path, app_podfile_content, podfile_restore_content)
118
125
  puts "Writing ~/.lldbinit-Xcode".yellow
119
126
 
120
127
  lldbinit_path = File.expand_path('~/.lldbinit-Xcode')
@@ -123,7 +130,7 @@ module PodBuilder
123
130
  lldbinit_lines = []
124
131
  skipNext = false
125
132
  File.read(lldbinit_path).each_line do |line|
126
- if line.include?("# <pb:#{base_path}>")
133
+ if line.include?("# <pb:#{base_path}>") || line.include?("# <pb>")
127
134
  skipNext = true
128
135
  next
129
136
  elsif skipNext
@@ -137,13 +144,16 @@ module PodBuilder
137
144
  end
138
145
  end
139
146
 
140
- restore_hash = podfile_restore_hash()
141
- source_map_lines.insert(0, "# <pb_md5:#{base_path}:#{restore_hash}>")
142
- source_map_lines.insert(0, "# <pb:#{base_path}>")
147
+ status_hash = podfiles_status_hash(app_podfile_content, podfile_restore_content)
148
+
149
+ source_map_lines.insert(0, "# <pb>\n")
150
+ source_map_lines.insert(1, "settings clear target.source-map\n")
151
+ source_map_lines.insert(2, "# <pb:#{base_path}>\n")
152
+ source_map_lines.insert(3, "# <pb_md5:#{base_path}:#{status_hash}>\n")
143
153
 
144
154
  lldbinit_lines += source_map_lines
145
155
 
146
- File.write(lldbinit_path, lldbinit_lines.join("\n"))
156
+ File.write(lldbinit_path, lldbinit_lines.join())
147
157
  end
148
158
  end
149
159
  end
@@ -13,3 +13,4 @@ require 'pod_builder/command/generate_lfs'
13
13
  require 'pod_builder/command/sync_podfile'
14
14
  require 'pod_builder/command/info'
15
15
  require 'pod_builder/command/update_lldbinit'
16
+ require 'pod_builder/command/clear_lldbinit'
@@ -130,6 +130,7 @@ module PodBuilder
130
130
  result.merge!({ "version": pod_version })
131
131
  result.merge!({ "specs": (data["specs"] || []) })
132
132
  result.merge!({ "is_static": (data["is_static"] || false) })
133
+ result.merge!({ "original_compile_path": (data["original_compile_path"] || "") })
133
134
 
134
135
  return result
135
136
  end
@@ -17,6 +17,27 @@ class Pod::Specification::Linter::Analyzer
17
17
  end
18
18
  end
19
19
 
20
+ Pod::Downloader.singleton_class.send(:alias_method, :swz_download, :download)
21
+
22
+ module Pod::Downloader
23
+ def self.download(
24
+ request,
25
+ target,
26
+ can_cache: true,
27
+ cache_path: Pod::Config.instance.cache_root + 'Pods'
28
+ )
29
+ result = swz_download(request, target)
30
+
31
+ if overrides = PodBuilder::Configuration.spec_overrides[result.spec.name]
32
+ overrides.each do |k, v|
33
+ result.spec.attributes_hash[k] = v
34
+ end
35
+ end
36
+
37
+ result
38
+ end
39
+ end
40
+
20
41
  module PodBuilder
21
42
  class Install
22
43
  def self.podfile(podfile_content, podfile_items, build_configuration)
@@ -33,6 +54,11 @@ module PodBuilder
33
54
  else
34
55
  FileUtils.cp_r("#{PodBuilder::basepath(podfile_item.path)}/.", destination_path)
35
56
  end
57
+
58
+ # It is important that CocoaPods compiles the files under Configuration.build_path in order that DWARF
59
+ # debug symbols reference to those paths. Doing otherwise breaks the assumptions that make the update_lldbinit
60
+ # command work
61
+ podfile_content.gsub!(podfile_item.path, destination_path)
36
62
 
37
63
  license_files = Dir.glob("#{destination_path}/**/*acknowledgements.plist").each { |f| File.delete(f) }
38
64
  end
@@ -115,6 +141,7 @@ module PodBuilder
115
141
  subspec_self_deps = subspecs_deps.select { |x| x.start_with?("#{podfile_item.root_name}/") }
116
142
  plist_data['specs'] = (specs.map(&:name) + subspec_self_deps).uniq
117
143
  plist_data['is_static'] = podfile_item.is_static
144
+ plist_data['original_compile_path'] = Pathname.new(Configuration.build_path).realpath.to_s
118
145
 
119
146
  plist.value = CFPropertyList.guess(plist_data)
120
147
  plist.save(podbuilder_file, CFPropertyList::List::FORMAT_BINARY)
@@ -75,7 +75,7 @@ module PodBuilder
75
75
  end
76
76
 
77
77
  def self.write_restorable(updated_pods, podfile_items, analyzer)
78
- unless Configuration.restore_enabled
78
+ unless Configuration.restore_enabled && (podfile_items.count + updated_pods.count) > 0
79
79
  return
80
80
  end
81
81
 
@@ -34,6 +34,10 @@ module PodBuilder
34
34
  private_constant :PodspecItem
35
35
 
36
36
  def self.generate(all_buildable_items, analyzer)
37
+ unless all_buildable_items.count > 0
38
+ return
39
+ end
40
+
37
41
  puts "Generating PodBuilder's local podspec".yellow
38
42
 
39
43
  podspec_items = podspec_items_from(all_buildable_items)
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "1.2.1"
2
+ VERSION = "1.5.0"
3
3
  end
4
4
 
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: 1.2.1
4
+ version: 1.5.0
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-01-29 00:00:00.000000000 Z
11
+ date: 2020-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -243,6 +243,7 @@ files:
243
243
  - lib/pod_builder/command/build.rb
244
244
  - lib/pod_builder/command/build_all.rb
245
245
  - lib/pod_builder/command/clean.rb
246
+ - lib/pod_builder/command/clear_lldbinit.rb
246
247
  - lib/pod_builder/command/deintegrate.rb
247
248
  - lib/pod_builder/command/generate_lfs.rb
248
249
  - lib/pod_builder/command/generate_podspec.rb