pod-builder 2.3.0 ā†’ 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,19 +13,23 @@ module PodBuilder
13
13
  return -1
14
14
  end
15
15
 
16
+ pods_not_found = []
16
17
  pod_names_to_switch = []
17
18
  argument_pods.each do |pod|
18
19
  pod_name_to_switch = pod
19
20
  pod_name_to_switch = Podfile::resolve_pod_names_from_podfile([pod_name_to_switch]).first
20
- raise "\n\nDid not find pod '#{pod}'".red if pod_name_to_switch.nil?
21
-
22
- check_not_building_subspec(pod_name_to_switch)
23
21
 
24
- pod_names_to_switch.push(pod_name_to_switch)
22
+ if pod_name_to_switch.nil?
23
+ raise "\n\n'#{pod}' not found in PodBuilder's Podfile.\n\nYou might need to explictly add:\n\n pod '#{pod}'\n\nto #{PodBuilder::basepath("Podfile")}\n".red
24
+ else
25
+ check_not_building_subspec(pod_name_to_switch)
26
+
27
+ pod_names_to_switch.push(pod_name_to_switch)
28
+ end
25
29
  end
26
30
 
27
31
  if OPTIONS[:resolve_parent_dependencies] == true
28
- install_update_repo = OPTIONS.fetch(:update_repos, true)
32
+ install_update_repo = OPTIONS.fetch(:update_repos, false)
29
33
  installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
30
34
 
31
35
  all_buildable_items = Analyze.podfile_items(installer, analyzer)
@@ -55,7 +59,7 @@ module PodBuilder
55
59
 
56
60
  podspec_content = File.read(podspec_path)
57
61
 
58
- regex = "p\\d\\.dependency '(.*)'"
62
+ regex = "p\\d\\.dependency ['|\"](.*)['|\"]"
59
63
 
60
64
  podspec_content.each_line do |line|
61
65
  matches = line.match(/#{regex}/)
@@ -107,15 +111,15 @@ module PodBuilder
107
111
  next
108
112
  end
109
113
 
110
- matches = line.gsub("\"", "'").match(/pod '(.*?)',(.*)/)
111
- if matches&.size == 3
114
+ matches = line.gsub("\"", "'").match(/pod '(.*?)'/)
115
+ if matches&.size == 2
112
116
  if matches[1].split("/").first == pod_name_to_switch
113
117
  default_entries[current_section] = line
114
118
  end
115
119
  end
116
120
  end
117
121
 
118
- raise "\n\n'#{pod_name_to_switch}' not found in #{podfile_path}".red if default_entries.keys.count == 0
122
+ raise "\n\n'#{pod_name_to_switch}' not found in PodBuilder's Podfile.\n\nYou might need to explictly add:\n\n pod '#{pod_name_to_switch}'\n\nto #{podfile_path}\n".red if default_entries.keys.count == 0
119
123
  end
120
124
 
121
125
  if development_path.nil?
@@ -137,8 +141,8 @@ module PodBuilder
137
141
  current_section = line.split(" ")[1]
138
142
  end
139
143
 
140
- matches = line.gsub("\"", "'").match(/pod '(.*?)',(.*)/)
141
- if matches&.size == 3
144
+ matches = line.gsub("\"", "'").match(/pod '(.*?)'/)
145
+ if matches&.size == 2
142
146
  if matches[1].split("/").first == pod_name_to_switch
143
147
  case OPTIONS[:switch_mode]
144
148
  when "prebuilt"
@@ -166,6 +170,14 @@ module PodBuilder
166
170
  if line.include?("# pb<") && marker = line.split("# pb<").last
167
171
  default_line = default_line.chomp("\n") + " # pb<#{marker}"
168
172
  end
173
+ if (path_match = default_line.match(/:path => '(.*?)'/)) && path_match&.size == 2
174
+ original_path = path_match[1]
175
+ if !is_absolute_path(original_path)
176
+ updated_path = Pathname.new(PodBuilder::basepath(original_path)).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
177
+ default_line.gsub!(":path => '#{original_path}'", ":path => '#{updated_path}'")
178
+ end
179
+ end
180
+
169
181
  lines.append(default_line)
170
182
  next
171
183
  elsif
@@ -183,14 +195,23 @@ module PodBuilder
183
195
  File.write(podfile_path, lines.join)
184
196
  end
185
197
 
186
- Dir.chdir(PodBuilder::project_path)
187
- bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
188
- system("#{bundler_prefix}pod install;")
198
+ Dir.chdir(PodBuilder::project_path) do
199
+ bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
200
+ system("#{bundler_prefix}pod install;")
201
+ end
202
+
203
+ Configuration.post_actions[:switch]&.execute()
204
+
205
+ puts "\n\nšŸŽ‰ done!\n".green
189
206
 
190
207
  return 0
191
208
  end
192
209
 
193
- private
210
+ private
211
+
212
+ def self.is_absolute_path(path)
213
+ return ["~", "/"].any? { |t| path.start_with?(t) }
214
+ end
194
215
 
195
216
  def self.find_podspec(podname)
196
217
  unless Configuration.development_pods_paths.count > 0
@@ -216,7 +237,7 @@ module PodBuilder
216
237
 
217
238
  def self.check_not_building_subspec(pod_to_switch)
218
239
  if pod_to_switch.include?("/")
219
- raise "\n\nCan't switch subspec #{pod_to_switch} refer to podspec name.\n\nUse `pod_builder switch #{pod_to_switch.split("/").first}` instead\n\n".red
240
+ raise "\n\nCan't switch subspec #{pod_to_switch} refer to podspec name.\n\nUse `pod_builder switch #{pod_to_switch.split("/").first}` instead\n".red
220
241
  end
221
242
  end
222
243
  end
@@ -12,17 +12,17 @@ module PodBuilder
12
12
 
13
13
  all_buildable_items = Analyze.podfile_items(installer, analyzer)
14
14
 
15
- Dir.chdir(PodBuilder::project_path)
16
-
17
- previous_podfile_content = File.read("Podfile")
18
- Podfile::write_prebuilt(all_buildable_items, analyzer)
19
- updated_podfile_content = File.read("Podfile")
20
-
21
- Licenses::write([], all_buildable_items)
22
-
23
- if previous_podfile_content != updated_podfile_content
24
- bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
25
- system("#{bundler_prefix}pod install;")
15
+ Dir.chdir(PodBuilder::project_path) do
16
+ previous_podfile_content = File.read("Podfile")
17
+ Podfile::write_prebuilt(all_buildable_items, analyzer)
18
+ updated_podfile_content = File.read("Podfile")
19
+
20
+ Licenses::write([], all_buildable_items)
21
+
22
+ if previous_podfile_content != updated_podfile_content
23
+ bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
24
+ system("#{bundler_prefix}pod install;")
25
+ end
26
26
  end
27
27
 
28
28
  puts "\n\nšŸŽ‰ done!\n".green
@@ -35,7 +35,6 @@ module PodBuilder
35
35
  ARGV.clear
36
36
  pods_to_update.each { |x| ARGV << x }
37
37
 
38
- # OPTIONS[:resolve_parent_dependencies] = true
39
38
  return PodBuilder::Command::Build.call
40
39
  end
41
40
  end
@@ -39,19 +39,10 @@ module PodBuilder
39
39
  "ENABLE_BITCODE": "NO"
40
40
  }
41
41
  }.freeze
42
- DEFAULT_SKIP_PODS = ["GoogleMaps", "React-RCTFabric", "React-Core", "React-CoreModules"] # Not including React-RCTNetwork might loose some debug warnings
43
-
44
- DEFAULT_FORCE_PREBUILD_PODS = []
45
- DEFAULT_BUILD_SYSTEM = "Latest".freeze # either Latest (New build system) or Legacy (Standard build system)
46
- DEFAULT_LIBRARY_EVOLUTION_SUPPORT = false
47
- DEFAULT_PLATFORMS = ["iphoneos", "iphonesimulator", "appletvos", "appletvsimulator"].freeze
48
- DEFAULT_BUILD_USING_REPO_PATHS = false
49
- DEFAULT_BUILD_XCFRAMEWORKS = false
50
42
 
51
43
  private_constant :DEFAULT_BUILD_SETTINGS
52
44
  private_constant :DEFAULT_BUILD_SETTINGS_OVERRIDES
53
- private_constant :DEFAULT_BUILD_SYSTEM
54
- private_constant :DEFAULT_LIBRARY_EVOLUTION_SUPPORT
45
+ private_constant :DEFAULT_SPEC_OVERRIDE
55
46
 
56
47
  class <<self
57
48
  attr_accessor :allow_building_development_pods
@@ -81,19 +72,23 @@ module PodBuilder
81
72
  attr_accessor :build_using_repo_paths
82
73
  attr_accessor :react_native_project
83
74
  attr_accessor :lldbinit_name
84
- attr_accessor :build_xcframeworks
75
+ attr_accessor :build_xcframeworks_all
76
+ attr_accessor :build_xcframeworks_include
77
+ attr_accessor :build_xcframeworks_exclude
78
+ attr_accessor :post_actions
85
79
  end
86
-
87
- @allow_building_development_pods = false
80
+
88
81
  @build_settings = DEFAULT_BUILD_SETTINGS
89
82
  @build_settings_overrides = DEFAULT_BUILD_SETTINGS_OVERRIDES
90
- @build_system = DEFAULT_BUILD_SYSTEM
91
- @library_evolution_support = DEFAULT_LIBRARY_EVOLUTION_SUPPORT
92
- @base_path = "PodBuilder" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
93
83
  @spec_overrides = DEFAULT_SPEC_OVERRIDE
84
+
85
+ @allow_building_development_pods = false
86
+ @build_system = "Latest".freeze # either Latest (New build system) or Legacy (Standard build system)
87
+ @library_evolution_support = false
88
+ @base_path = "PodBuilder" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
94
89
  @skip_licenses = []
95
- @skip_pods = DEFAULT_SKIP_PODS
96
- @force_prebuild_pods = DEFAULT_FORCE_PREBUILD_PODS
90
+ @skip_pods = ["GoogleMaps", "React-RCTFabric", "React-Core", "React-CoreModules"] # Not including React-RCTNetwork might loose some debug warnings
91
+ @force_prebuild_pods = []
97
92
  @license_filename = "Pods-acknowledgements"
98
93
  @development_pods_paths = []
99
94
  @build_base_path = "/tmp/pod_builder".freeze
@@ -110,11 +105,15 @@ module PodBuilder
110
105
  @use_bundler = false
111
106
  @deterministic_build = false
112
107
 
113
- @supported_platforms = DEFAULT_PLATFORMS
114
- @build_using_repo_paths = DEFAULT_BUILD_USING_REPO_PATHS
108
+ @supported_platforms = ["iphoneos", "iphonesimulator", "appletvos", "appletvsimulator"].freeze
109
+ @build_using_repo_paths = false
115
110
  @react_native_project = false
116
111
 
117
- @build_xcframeworks = DEFAULT_BUILD_XCFRAMEWORKS
112
+ @build_xcframeworks_all = false
113
+ @build_xcframeworks_include = []
114
+ @build_xcframeworks_exclude = []
115
+
116
+ @post_actions = {}
118
117
 
119
118
  def self.check_inited
120
119
  raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil?
@@ -218,12 +217,27 @@ module PodBuilder
218
217
  Configuration.react_native_project = value
219
218
  end
220
219
  end
221
- if value = json["build_xcframeworks"]
220
+ if value = json["build_xcframeworks_all"]
222
221
  if [TrueClass, FalseClass].include?(value.class)
223
- Configuration.build_xcframeworks = value
222
+ Configuration.build_xcframeworks_all = value
224
223
  end
225
224
  end
226
-
225
+ if value = json["build_xcframeworks_include"]
226
+ if value.is_a?(Array)
227
+ Configuration.build_xcframeworks_include = value
228
+ end
229
+ end
230
+ if value = json["build_xcframeworks_exclude"]
231
+ if value.is_a?(Array)
232
+ Configuration.build_xcframeworks_exclude = value
233
+ end
234
+ end
235
+ if value = json["post_actions"]
236
+ if value.is_a?(Hash)
237
+ Configuration.post_actions = PodBuilder::PostActions.load(value)
238
+ end
239
+ end
240
+
227
241
  Configuration.build_settings.freeze
228
242
 
229
243
  sanity_check()
@@ -279,6 +293,11 @@ module PodBuilder
279
293
  puts "PodBuilder.json contains '#{pod}' both in `force_prebuild_pods` and `skip_pods`. Will force prebuilding.".yellow
280
294
  end
281
295
  end
296
+ if Configuration.build_xcframeworks_all
297
+ raise "\n\nInvalid PodBuilder.json configuration: 'build_xcframeworks_all' is true and 'build_xcframeworks_include' is not empty\n".red if Configuration.build_xcframeworks_include.count > 0
298
+ else
299
+ raise "\n\nInvalid PodBuilder.json configuration: 'build_xcframeworks_all' is false and 'build_xcframeworks_exclude' is not empty\n".red if Configuration.build_xcframeworks_exclude.count > 0
300
+ end
282
301
  end
283
302
 
284
303
  def self.config_path
@@ -12,6 +12,7 @@ require 'pod_builder/info'
12
12
  require 'pod_builder/configuration'
13
13
  require 'pod_builder/podspec'
14
14
  require 'pod_builder/licenses'
15
+ require 'pod_builder/post_actions'
15
16
 
16
17
  require 'core_ext/string'
17
18
 
@@ -132,7 +133,7 @@ module PodBuilder
132
133
  folder_in_home = x.gsub(home, "")
133
134
  !folder_in_home.include?("/Pods/") && !x.include?(PodBuilder::basepath("Sources")) && !x.include?(PodBuilder::basepath + "/")
134
135
  }
135
- raise "\n\nxcodeproj not found!".red if xcodeprojects.count == 0
136
+ raise "\n\nxcodeproj not found!\n".red if xcodeprojects.count == 0
136
137
  raise "\n\nFound multiple xcodeproj:\n#{xcodeprojects.join("\n")}".red if xcodeprojects.count > 1
137
138
 
138
139
  @@xcodeproj_path = xcodeprojects.first
@@ -148,7 +149,7 @@ module PodBuilder
148
149
  folder_in_home = x.gsub(home, "")
149
150
  !folder_in_home.include?("/Pods/") && !x.include?(PodBuilder::basepath("Sources")) && !x.include?(PodBuilder::basepath + "/") && !x.include?(".xcodeproj/")
150
151
  }
151
- raise "\n\nxcworkspace not found!".red if xcworkspaces.count == 0
152
+ raise "\n\nxcworkspace not found!\n".red if xcworkspaces.count == 0
152
153
  raise "\n\nFound multiple xcworkspaces:\n#{xcworkspaces.join("\n")}".red if xcworkspaces.count > 1
153
154
 
154
155
  @@xcodeworkspace_path = xcworkspaces.first
@@ -179,7 +180,7 @@ module PodBuilder
179
180
 
180
181
  def self.system_swift_version
181
182
  swift_version = `swiftc --version | grep -o 'swiftlang-.*\s'`.strip()
182
- raise "\n\nUnsupported swift compiler version, expecting `swiftlang` keyword in `swiftc --version`".red if swift_version.length == 0
183
+ raise "\n\nUnsupported swift compiler version, expecting `swiftlang` keyword in `swiftc --version`\n".red if swift_version.length == 0
183
184
  return swift_version
184
185
  end
185
186
 
@@ -60,7 +60,7 @@ module PodBuilder
60
60
 
61
61
  return { "repo": "local" }
62
62
  else
63
- raise "\n\nFailed extracting version from line:\n#{line}\n\n".red
63
+ raise "\n\nFailed extracting version from line:\n#{line}\n".red
64
64
  end
65
65
  end
66
66
 
@@ -45,7 +45,7 @@ begin
45
45
  elsif defined?(Pod::Target::BuildType) # CocoaPods 1.7, 1.8
46
46
  Pod::Target::BuildType.new(linkage: :dynamic, packaging: :framework)
47
47
  else
48
- raise "\n\nBuildType not found. Open an issue reporting your CocoaPods version".red
48
+ raise "\n\nBuildType not found. Open an issue reporting your CocoaPods version\n".red
49
49
  end
50
50
  else
51
51
  swz_build_type()
@@ -139,7 +139,7 @@ module PodBuilder
139
139
 
140
140
  class Install
141
141
  # This method will generate prebuilt data by building from "/tmp/pod_builder/Podfile"
142
- def self.podfile(podfile_content, podfile_items, build_configuration)
142
+ def self.podfile(podfile_content, podfile_items, argument_pods, build_configuration)
143
143
  puts "Preparing build Podfile".yellow
144
144
 
145
145
  PodBuilder::safe_rm_rf(Configuration.build_path)
@@ -160,7 +160,7 @@ module PodBuilder
160
160
  lock_file = "#{Configuration.build_path}/pod_builder.lock"
161
161
  FileUtils.touch(lock_file)
162
162
 
163
- prebuilt_entries = use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items)
163
+ prebuilt_entries = use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items, argument_pods)
164
164
 
165
165
  install
166
166
 
@@ -247,7 +247,7 @@ module PodBuilder
247
247
  def self.license_specifiers
248
248
  acknowledge_file = "#{Configuration.build_path}/Pods/Target Support Files/Pods-DummyTarget/Pods-DummyTarget-acknowledgements.plist"
249
249
  unless File.exist?(acknowledge_file)
250
- raise "\n\nLicense file not found".red
250
+ raise "\n\nLicense file not found\n".red
251
251
  end
252
252
 
253
253
  plist = CFPropertyList::List.new(:file => acknowledge_file)
@@ -280,44 +280,66 @@ module PodBuilder
280
280
  return podfile_content
281
281
  end
282
282
 
283
- def self.use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items)
283
+ def self.use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items, argument_pods)
284
284
  podfile_content = File.read(podfile_path)
285
285
 
286
286
  replaced_items = []
287
287
 
288
- if OPTIONS.has_key?(:force_rebuild)
289
- podfile_content.gsub!("%%%prebuilt_root_paths%%%", "{}")
290
- else
291
- download # Copy files under #{Configuration.build_path}/Pods so that we can determine build folder hashes
288
+ download # Copy files under #{Configuration.build_path}/Pods so that we can determine build folder hashes
292
289
 
293
- gitignored_files = PodBuilder::gitignoredfiles
290
+ gitignored_files = PodBuilder::gitignoredfiles
294
291
 
295
- prebuilt_root_paths = Hash.new
292
+ prebuilt_root_paths = Hash.new
296
293
 
297
- # Replace prebuilt entries in Podfile for Pods that have no changes in source code which will avoid rebuilding them
298
- items = podfile_items.group_by { |t| t.root_name }.map { |k, v| v.first } # Return one podfile_item per root_name
299
- items.each do |item|
300
- podspec_path = item.prebuilt_podspec_path
301
- if last_build_folder_hash = build_folder_hash_in_prebuilt_info_file(item)
302
- if last_build_folder_hash == build_folder_hash(item, gitignored_files)
303
- puts "No changes detected to '#{item.root_name}', will skip rebuild".blue
294
+ puts "Optimizing build".yellow
295
+ puts "Build strategy".blue
304
296
 
305
- replaced_items.push(item)
297
+ prebuild_log = lambda { |item, reason|
298
+ if item.is_prebuilt
299
+ puts "#{item.root_name} is prebuilt"
300
+ else
301
+ puts "#{item.root_name} from source #{reason}".blue
302
+ end
303
+ }
306
304
 
307
- podfile_items.select { |t| t.root_name == item.root_name }.each do |replace_item|
308
- replace_regex = "pod '#{Regexp.quote(replace_item.name)}', .*"
309
- replace_line_found = podfile_content =~ /#{replace_regex}/i
310
- raise "\n\nFailed finding pod entry for '#{replace_item.name}'".red unless replace_line_found
311
- podfile_content.gsub!(/#{replace_regex}/, replace_item.prebuilt_entry(true, true))
305
+ # Replace prebuilt entries in Podfile for Pods that have no changes in source code which will avoid rebuilding them
306
+ items = podfile_items.group_by { |t| t.root_name }.map { |k, v| v.first }.sort_by { |t| t.root_name } # Return one podfile_item per root_name
307
+ if OPTIONS.has_key?(:force_rebuild)
308
+ rebuild_pods = items.select { |t| argument_pods.include?(t.root_name) }
312
309
 
313
- prebuilt_root_paths[replace_item.root_name] = PodBuilder::prebuiltpath
314
- end
315
- end
316
- end
310
+ rebuild_pods.each do |item|
311
+ prebuild_log.call(item, "")
317
312
  end
318
313
 
319
- podfile_content.gsub!("%%%prebuilt_root_paths%%%", prebuilt_root_paths.to_s)
314
+ items -= rebuild_pods
320
315
  end
316
+
317
+ items.each do |item|
318
+ podspec_path = item.prebuilt_podspec_path
319
+ unless last_build_folder_hash = build_folder_hash_in_prebuilt_info_file(item)
320
+ prebuild_log.call(item, "(folder hash missing)")
321
+ next
322
+ end
323
+
324
+ if last_build_folder_hash == build_folder_hash(item, gitignored_files)
325
+ puts "#{item.root_name} reuse PodBuilder cache"
326
+
327
+ replaced_items.push(item)
328
+
329
+ podfile_items.select { |t| t.root_name == item.root_name }.each do |replace_item|
330
+ replace_regex = "pod '#{Regexp.quote(replace_item.name)}', .*"
331
+ replace_line_found = podfile_content =~ /#{replace_regex}/i
332
+ raise "\n\nFailed finding pod entry for '#{replace_item.name}'\n".red unless replace_line_found
333
+ podfile_content.gsub!(/#{replace_regex}/, replace_item.prebuilt_entry(true, true))
334
+
335
+ prebuilt_root_paths[replace_item.root_name] = PodBuilder::prebuiltpath
336
+ end
337
+ else
338
+ prebuild_log.call(item, "(folder hash mismatch)")
339
+ end
340
+ end
341
+
342
+ podfile_content.gsub!("%%%prebuilt_root_paths%%%", prebuilt_root_paths.to_s)
321
343
 
322
344
  File.write(podfile_path, podfile_content)
323
345
 
@@ -379,6 +401,7 @@ module PodBuilder
379
401
  pod_names.each do |pod_name|
380
402
  root_name = pod_name.split("/").first
381
403
 
404
+ # Remove existing files
382
405
  items_to_delete = Dir.glob("#{PodBuilder::prebuiltpath(root_name)}/**/*")
383
406
  items_to_delete.each { |t| PodBuilder::safe_rm_rf(t) }
384
407
  end
@@ -393,6 +416,21 @@ module PodBuilder
393
416
  next
394
417
  end
395
418
 
419
+ if podfile_item = podfile_items.detect { |t| t.root_name == pod_name }
420
+ if Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.swiftinterface").count > 0
421
+ # We can safely remove .swiftmodule if .swiftinterface exists
422
+ swiftmodule_files = Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.swiftmodule")
423
+ swiftmodule_files.each { |t| PodBuilder::safe_rm_rf(t) }
424
+ end
425
+ end
426
+
427
+ # Cleanup unneeded files (see https://github.com/bazelbuild/rules_apple/pull/1113)
428
+ ignore_files = Dir.glob(["#{source_path}/**/Modules/**/*.swiftmodule/*.swiftdoc", "#{source_path}/**/Modules/**/*.swiftmodule/**/*.swiftsourceinfo"])
429
+ ignore_files.each { |t| PodBuilder::safe_rm_rf(t) }
430
+
431
+ project_folder = Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/Project")
432
+ project_folder.select { |t| File.directory?(t) && Dir.empty?(t) }.each { |t| PodBuilder::safe_rm_rf(t) }
433
+
396
434
  unless Dir.glob("#{source_path}/**/*").select { |t| File.file?(t) }.empty?
397
435
  destination_folder = PodBuilder::prebuiltpath(root_name)
398
436
  FileUtils.mkdir_p(destination_folder)
@@ -416,11 +454,9 @@ module PodBuilder
416
454
  end
417
455
 
418
456
  def self.init_git(path)
419
- current_dir = Dir.pwd
420
-
421
- Dir.chdir(path)
422
- system("git init")
423
- Dir.chdir(current_dir)
457
+ Dir.chdir(path) do
458
+ system("git init")
459
+ end
424
460
  end
425
461
 
426
462
  def self.build_folder_hash_in_prebuilt_info_file(podfile_item)
@@ -448,15 +484,16 @@ module PodBuilder
448
484
  unless File.file?(path)
449
485
  next
450
486
  end
451
-
487
+
452
488
  path = File.expand_path(path)
453
489
  rel_path = path.gsub(rootpath, "")[1..]
454
- unless exclude_files.include?(rel_path)
490
+
491
+ unless exclude_files.any? { |t| rel_path.start_with?(t) }
455
492
  file_hashes.push(Digest::MD5.hexdigest(File.read(path)))
456
493
  end
457
494
  end
458
495
 
459
- return Digest::MD5.hexdigest(file_hashes.join)
496
+ return Digest::MD5.hexdigest(file_hashes.sort.join)
460
497
  else
461
498
  # Pod folder might be under .gitignore
462
499
  item_path = "#{Configuration.build_path}/Pods/#{podfile_item.root_name}"