pod-builder 1.3.0 ā†’ 1.4.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: c85e97d04a8167d4e639f6e4b632d8dfbb54b6e879057e203b95806ea1b3bddd
4
- data.tar.gz: 37bdc97bc43c8589f537e796a1f9f577589df901772cae64c704e7701a7ed00c
3
+ metadata.gz: 91a5ccf7fb23793e2ecf8718184ee974243d54d9b409f461258ccda6b0b3555d
4
+ data.tar.gz: 9a1165d7add34652970ae37075dccfd5f0eac075c572d68e87e987c8b37e21eb
5
5
  SHA512:
6
- metadata.gz: 26d4d8d4e14c0dcbc69bf530d8f19ff370c930467f6a4956283072d24268f08ce58713afb8309031e9da58855fa2e9c3c83b14af7308d83913dbe2bbde85743f
7
- data.tar.gz: c3acacaaf6d5ee81b04ccb508807e1d0be2764dd7bc85fb484cf076a81c913a609bcdd3f7a520585b067aa26a247f7b9bddf451c0dbeb491d3c2f1a387ff65c5
6
+ metadata.gz: cb1b9dd1e39b15ccd02dd8fefccb4c2804e6fac2c1583f97fe07af411c450d88d973771dead2382fe5ce8f2582f391c944c95c9deb81f0560bedbff0fd5f0391
7
+ data.tar.gz: ece28a885c32def12c37543b9ebd1df476e568ee324b711500112701576b1fe28ce57c13dfe3938385d599fdbc34dfd5f607c24e5180a6606a0703708168df04
@@ -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)
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)
61
77
  replace_paths.push("#{original_compile_path},#{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
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"] }
91
- rewrite_lldinit(source_map_lines, base_path)
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')
@@ -137,12 +144,12 @@ module PodBuilder
137
144
  end
138
145
  end
139
146
 
140
- restore_hash = podfile_restore_hash()
147
+ status_hash = podfiles_status_hash(app_podfile_content, podfile_restore_content)
141
148
 
142
149
  source_map_lines.insert(0, "# <pb>\n")
143
150
  source_map_lines.insert(1, "settings clear target.source-map\n")
144
151
  source_map_lines.insert(2, "# <pb:#{base_path}>\n")
145
- source_map_lines.insert(3, "# <pb_md5:#{base_path}:#{restore_hash}>\n")
152
+ source_map_lines.insert(3, "# <pb_md5:#{base_path}:#{status_hash}>\n")
146
153
 
147
154
  lldbinit_lines += source_map_lines
148
155
 
@@ -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)
@@ -115,6 +136,7 @@ module PodBuilder
115
136
  subspec_self_deps = subspecs_deps.select { |x| x.start_with?("#{podfile_item.root_name}/") }
116
137
  plist_data['specs'] = (specs.map(&:name) + subspec_self_deps).uniq
117
138
  plist_data['is_static'] = podfile_item.is_static
139
+ plist_data['original_compile_path'] = Configuration.build_path
118
140
 
119
141
  plist.value = CFPropertyList.guess(plist_data)
120
142
  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.3.0"
2
+ VERSION = "1.4.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.3.0
4
+ version: 1.4.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-31 00:00:00.000000000 Z
11
+ date: 2020-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler