pod-builder 2.0.0.beta.23 → 2.0.0.beta.24

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: 16bb73e4ce3559e587cb45b0b80e7e92b1b904a016a09ef8769bdc5f36bd3c3b
4
- data.tar.gz: 1b7990f9999ff210171bc012d2ae3d72b96b2cce7fd273906ed97351dcf74694
3
+ metadata.gz: 58d6868b29d7c33745475969ec3efc788d50e046e4507105a015dd7897eef2a2
4
+ data.tar.gz: fc638de64c1f6df8946d33a84a3f0dcf82b821c62c0bcc14c98c346f3f07b423
5
5
  SHA512:
6
- metadata.gz: 7344c45e940ba2d2ff9b9c4cef8ca43fc49e07151b17124fceb1cccad2ce7cfaafcfe20e6de71cd58792db839a4c28ea61c9928eb5511b429deda37166df0824
7
- data.tar.gz: 92b7caed18491251d38ed4f90325b968e3fb5d6dced12b98d34a96522904472231f61a31e471c3ed095863a8d489074de6ef053bcdfeb5a865a103dcf635e349
6
+ metadata.gz: 82ffb0bcbd8ea3cbd79a0bb8d0cbcca8d51799ea419c87afdd53e2832b96564f445956adccfcf79ddb1d5f4f88d2cf05a41a7e106c913f9933cf05559aa523e0
7
+ data.tar.gz: 9b59baa40cd02c07ee6a46e84f1f20becbd4588c4076056ec323e807ddafc0d53d928465a16c98ab91988aff8ea757c8892bce4dd3c184f7022edd72e2d25847
@@ -45,7 +45,9 @@ module PodBuilder
45
45
  podfile_content = Podfile.update_project_entries(podfile_content, Init.method(:podfile_path_transform))
46
46
  podfile_content = Podfile.update_require_entries(podfile_content, Init.method(:podfile_path_transform))
47
47
 
48
- podfile_content = Podfile.prepare_for_react_native(podfile_content)
48
+ if podfile_content.include?("/node_modules/react-native/")
49
+ podfile_content = Podfile.prepare_for_react_native(podfile_content)
50
+ end
49
51
 
50
52
  File.write(prebuilt_podfile_path, podfile_content)
51
53
 
@@ -19,6 +19,10 @@ module PodBuilder
19
19
  @@xcodeproj_path = nil
20
20
  @@xcodeworkspace_path = nil
21
21
 
22
+ def self.git_rootpath
23
+ return `git rev-parse --show-toplevel`.strip()
24
+ end
25
+
22
26
  def self.safe_rm_rf(path)
23
27
  unless File.exist?(path)
24
28
  return
@@ -34,8 +38,8 @@ module PodBuilder
34
38
 
35
39
  Dir.chdir(path)
36
40
 
37
- h = `git rev-parse --show-toplevel`.strip()
38
- raise "\n\nNo git repository found in '#{path}', can't delete files!\n".red if h.empty? && !path.start_with?(Configuration.build_base_path)
41
+ rootpath = git_rootpath()
42
+ raise "\n\nNo git repository found in '#{path}', can't delete files!\n".red if rootpath.empty? && !path.start_with?(Configuration.build_base_path)
39
43
 
40
44
  FileUtils.rm_rf(path)
41
45
 
@@ -45,6 +49,12 @@ module PodBuilder
45
49
  Dir.chdir(basepath)
46
50
  end
47
51
  end
52
+
53
+ def self.gitignoredfiles
54
+ Dir.chdir(git_rootpath) do
55
+ return `git status --ignored -s | grep "^\!\!" | cut -c4-`.strip().split("\n")
56
+ end
57
+ end
48
58
 
49
59
  def self.basepath(child = "")
50
60
  if child.nil?
@@ -205,8 +215,8 @@ module PodBuilder
205
215
  private
206
216
 
207
217
  def self.home
208
- h = `git rev-parse --show-toplevel`.strip()
209
- raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if h.empty?
210
- return h
218
+ rootpath = git_rootpath
219
+ raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if rootpath.empty?
220
+ return rootpath
211
221
  end
212
222
  end
@@ -180,12 +180,14 @@ module PodBuilder
180
180
 
181
181
  podfile_content = File.read(podfile_path)
182
182
 
183
+ gitignored_files = PodBuilder::gitignoredfiles
184
+
183
185
  # Replace prebuilt entries in Podfile for Pods that have no changes in source code which will avoid rebuilding them
184
186
  items = podfile_items.group_by { |t| t.root_name }.map { |k, v| v.first } # Return one podfile_item per root_name
185
187
  items.each do |item|
186
188
  podspec_path = item.prebuilt_podspec_path
187
189
  if last_build_folder_hash = build_folder_hash_in_prebuilt_info_file(item)
188
- if last_build_folder_hash == build_folder_hash(item)
190
+ if last_build_folder_hash == build_folder_hash(item, gitignored_files)
189
191
  puts "No changes detected to '#{item.root_name}', will skip rebuild".blue
190
192
  podfile_items.select { |t| t.root_name == item.root_name }.each do |replace_item|
191
193
  replace_regex = "pod '#{Regexp.quote(replace_item.name)}', .*"
@@ -265,6 +267,8 @@ module PodBuilder
265
267
  end
266
268
 
267
269
  def self.add_prebuilt_info_file(podfile_items)
270
+ gitignored_files = PodBuilder::gitignoredfiles
271
+
268
272
  swift_version = PodBuilder::system_swift_version
269
273
 
270
274
  root_names = podfile_items.reject(&:is_prebuilt).map(&:root_name).uniq
@@ -297,7 +301,7 @@ module PodBuilder
297
301
  data['specs'] = (specs.map(&:name) + subspec_self_deps).uniq
298
302
  data['is_static'] = podfile_item.is_static
299
303
  data['original_compile_path'] = Pathname.new(Configuration.build_path).realpath.to_s
300
- data['build_folder_hash'] = build_folder_hash(podfile_item)
304
+ data['build_folder_hash'] = build_folder_hash(podfile_item, gitignored_files)
301
305
 
302
306
  File.write(podbuilder_file, JSON.pretty_generate(data))
303
307
  end
@@ -322,18 +326,36 @@ module PodBuilder
322
326
  end
323
327
  end
324
328
 
325
- def self.build_folder_hash(podfile_item)
329
+ def self.build_folder_hash(podfile_item, exclude_files)
326
330
  if podfile_item.is_development_pod
327
331
  if Pathname.new(podfile_item.path).absolute?
328
332
  item_path = podfile_item.path
329
333
  else
330
334
  item_path = PodBuilder::basepath(podfile_item.path)
331
335
  end
336
+
337
+ rootpath = PodBuilder::git_rootpath
338
+ file_hashes = []
339
+ Dir.glob("#{item_path}/**/*", File::FNM_DOTMATCH) do |path|
340
+ unless File.file?(path)
341
+ next
342
+ end
343
+
344
+ path = File.expand_path(path)
345
+ rel_path = path.gsub(rootpath, "")[1..]
346
+ unless exclude_files.include?(rel_path)
347
+ file_hashes.push(Digest::MD5.hexdigest(File.read(path)))
348
+ else
349
+ puts path
350
+ end
351
+ end
352
+
353
+ return Digest::MD5.hexdigest(file_hashes.join)
332
354
  else
355
+ # Pod folder might be under .gitignore
333
356
  item_path = "#{Configuration.build_path}/Pods/#{podfile_item.root_name}"
357
+ return `find '#{item_path}' -type f -print0 | sort -z | xargs -0 shasum | shasum | cut -d' ' -f1`.strip()
334
358
  end
335
-
336
- return `find '#{item_path}' -type f -print0 | sort -z | xargs -0 shasum | shasum | cut -d' ' -f1`.strip()
337
359
  end
338
360
 
339
361
  def self.podfile_path_transform(path)
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "2.0.0.beta.23"
2
+ VERSION = "2.0.0.beta.24"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pod-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta.23
4
+ version: 2.0.0.beta.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin