pod-builder 1.9.2 → 2.0.0.beta.21

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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -0
  3. data/Example/PodBuilder/.gitignore +6 -0
  4. data/Example/PodBuilder/.pod_builder/pod_builder +0 -0
  5. data/Example/{Frameworks → PodBuilder}/PodBuilder.json +10 -4
  6. data/Example/PodBuilder/Podfile +23 -0
  7. data/Example/PodBuilder/Podfile.restore +40 -0
  8. data/Example/PodBuilderExample.xcodeproj/project.pbxproj +3 -8
  9. data/Example/{PodBuilderExample.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist → PodBuilderExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist} +2 -8
  10. data/Example/PodBuilderExample/AppDelegate.swift +4 -0
  11. data/Example/Podfile +42 -1
  12. data/Example/Podfile.lock +426 -7
  13. data/Example/Pods-acknowledgements.md +210 -0
  14. data/Example/Pods-acknowledgements.plist +206 -0
  15. data/README.md +50 -13
  16. data/exe/pod_builder +39 -28
  17. data/lib/pod_builder/analyze.rb +32 -7
  18. data/lib/pod_builder/analyzer.rb +16 -0
  19. data/lib/pod_builder/command/build.rb +44 -161
  20. data/lib/pod_builder/command/build_all.rb +2 -2
  21. data/lib/pod_builder/command/clean.rb +34 -55
  22. data/lib/pod_builder/command/clear_lldbinit.rb +7 -3
  23. data/lib/pod_builder/command/deintegrate.rb +29 -7
  24. data/lib/pod_builder/command/generate_lfs.rb +3 -3
  25. data/lib/pod_builder/command/generate_podspec.rb +3 -2
  26. data/lib/pod_builder/command/info.rb +1 -1
  27. data/lib/pod_builder/command/init.rb +37 -14
  28. data/lib/pod_builder/command/install_sources.rb +21 -14
  29. data/lib/pod_builder/command/none.rb +2 -2
  30. data/lib/pod_builder/command/restore_all.rb +4 -4
  31. data/lib/pod_builder/command/switch.rb +137 -95
  32. data/lib/pod_builder/command/sync_podfile.rb +5 -3
  33. data/lib/pod_builder/command/update.rb +5 -6
  34. data/lib/pod_builder/command/update_lldbinit.rb +11 -9
  35. data/lib/pod_builder/configuration.rb +88 -13
  36. data/lib/pod_builder/core.rb +93 -12
  37. data/lib/pod_builder/info.rb +32 -98
  38. data/lib/pod_builder/install.rb +255 -195
  39. data/lib/pod_builder/licenses.rb +4 -4
  40. data/lib/pod_builder/podfile.rb +287 -73
  41. data/lib/pod_builder/podfile/post_actions.rb +9 -15
  42. data/lib/pod_builder/podfile_cp.rb +93 -0
  43. data/lib/pod_builder/podfile_item.rb +181 -82
  44. data/lib/pod_builder/podspec.rb +144 -135
  45. data/lib/pod_builder/rome/post_install.rb +240 -0
  46. data/lib/pod_builder/rome/pre_install.rb +6 -0
  47. data/lib/pod_builder/templates/build_podfile.template +3 -3
  48. data/lib/pod_builder/version.rb +1 -1
  49. data/pod-builder.gemspec +4 -4
  50. metadata +34 -65
  51. data/Example/Pods/Alamofire/LICENSE +0 -19
  52. data/Example/Pods/Alamofire/README.md +0 -242
  53. data/Example/Pods/Alamofire/Source/AFError.swift +0 -460
  54. data/Example/Pods/Alamofire/Source/Alamofire.swift +0 -465
  55. data/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift +0 -37
  56. data/Example/Pods/Alamofire/Source/MultipartFormData.swift +0 -580
  57. data/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift +0 -233
  58. data/Example/Pods/Alamofire/Source/Notifications.swift +0 -55
  59. data/Example/Pods/Alamofire/Source/ParameterEncoding.swift +0 -483
  60. data/Example/Pods/Alamofire/Source/Request.swift +0 -654
  61. data/Example/Pods/Alamofire/Source/Response.swift +0 -567
  62. data/Example/Pods/Alamofire/Source/ResponseSerialization.swift +0 -715
  63. data/Example/Pods/Alamofire/Source/Result.swift +0 -300
  64. data/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift +0 -307
  65. data/Example/Pods/Alamofire/Source/SessionDelegate.swift +0 -725
  66. data/Example/Pods/Alamofire/Source/SessionManager.swift +0 -896
  67. data/Example/Pods/Alamofire/Source/TaskDelegate.swift +0 -466
  68. data/Example/Pods/Alamofire/Source/Timeline.swift +0 -136
  69. data/Example/Pods/Alamofire/Source/Validation.swift +0 -315
  70. data/Example/Pods/Manifest.lock +0 -16
  71. data/Example/Pods/Pods.xcodeproj/project.pbxproj +0 -673
  72. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Alamofire.xcscheme +0 -60
  73. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Pods-PodBuilderExample.xcscheme +0 -60
  74. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +0 -21
  75. data/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m +0 -5
  76. data/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch +0 -12
  77. data/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h +0 -16
  78. data/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap +0 -6
  79. data/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig +0 -9
  80. data/Example/Pods/Target Support Files/Alamofire/Info.plist +0 -26
  81. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Info.plist +0 -26
  82. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.markdown +0 -26
  83. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.plist +0 -58
  84. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-dummy.m +0 -5
  85. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-frameworks.sh +0 -153
  86. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-resources.sh +0 -118
  87. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-umbrella.h +0 -16
  88. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.debug.xcconfig +0 -11
  89. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.modulemap +0 -6
  90. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.release.xcconfig +0 -11
  91. data/lib/pod_builder/cocoapods/specification.rb +0 -27
@@ -36,15 +36,15 @@ Command:
36
36
  + deintegrate Deintegrate prebuild folders
37
37
  + build Build a specific pod declared in the PodBuilder-Podfile
38
38
  + build_all Build all pods declared in the PodBuilder-Podfile
39
- + update Rebuild frameworks that are outdated
39
+ + update Rebuild items that are outdated
40
40
  + restore_all Rebuild all pods declared in the Restore-Podfile
41
- + install_sources Install sources of pods to debug into prebuilt frameworks
42
- + update_lldbinit Generate an lldbinit file with setting target.source-map to debug prebuilt frameworks
41
+ + install_sources Install sources of pods to debug into prebuilt items
42
+ + update_lldbinit Generate an lldbinit file with setting target.source-map to debug prebuilt items
43
43
  + clear_lldbinit Clear an lldbinit file from PodBuilder's customizations
44
44
  + switch Switch between prebuilt/development/standard pod in the Application-Podfile
45
- + clean Remove prebuild frameworks, dSYMs and source files added by `install_sources` command that are no longer in the PodBuilder-Podfile
45
+ + clean Remove prebuild items, dSYMs and source files added by `install_sources` command that are no longer in the PodBuilder-Podfile
46
46
  + sync_podfile Update your Application-Podfile with all pods declared in the PodBuilder-Podfile
47
- + info Print json-formatted informations about prebuilt frameworks
47
+ + info Print json-formatted informations about prebuilt items
48
48
 
49
49
  Options:
50
50
  "
@@ -71,12 +71,15 @@ Options:
71
71
  opts.on("-u", "--skip-repo-update", "Skip CocoaPods repo update") do |o|
72
72
  OPTIONS[:update_repos] = false
73
73
  end
74
+ opts.on("-f", "--force", "Rebuild items even when no code change is detected") do |o|
75
+ OPTIONS[:force_rebuild] = false
76
+ end
74
77
  opts.on("-w", "--allow-warnings", "Allow warnings") do |o|
75
78
  OPTIONS[:allow_warnings] = o
76
79
  end
77
- opts.on("-a", "--auto-resolve-deps", "Resolve pod dependencies automatically") do |o|
78
- OPTIONS[:auto_resolve_dependencies] = o
79
- end
80
+ # opts.on("-a", "--auto-resolve-deps", "Resolve pod dependencies automatically") do |o|
81
+ # OPTIONS[:auto_resolve_dependencies] = o
82
+ # end
80
83
  opts.on("-d", "--debug", "Don't clean build folder") do |o|
81
84
  OPTIONS[:debug] = o
82
85
  end
@@ -100,6 +103,9 @@ Options:
100
103
  opts.on("-u", "--skip-repo-update", "Skip CocoaPods repo update") do |o|
101
104
  OPTIONS[:update_repos] = false
102
105
  end
106
+ opts.on("-f", "--force", "Rebuild items even when no code change is detected") do |o|
107
+ OPTIONS[:force_rebuild] = false
108
+ end
103
109
  opts.on("-w", "--allow-warnings", "Allow warnings") do |o|
104
110
  OPTIONS[:allow_warnings] = o
105
111
  end
@@ -119,7 +125,7 @@ Usage:
119
125
 
120
126
  $ pod_builder update [OPTIONS]
121
127
 
122
- Rebuild frameworks that are outdated
128
+ Rebuild items that are outdated
123
129
 
124
130
  Options:
125
131
  "
@@ -129,7 +135,7 @@ Options:
129
135
  opts.on("-w", "--allow-warnings", "Allow warnings") do |o|
130
136
  OPTIONS[:allow_warnings] = o
131
137
  end
132
- opts.on("-r", "--dry", "Determine which frameworks need update") do |o|
138
+ opts.on("-r", "--dry", "Determine which items need to be updated") do |o|
133
139
  OPTIONS[:dry_run] = o
134
140
  end
135
141
  opts.on("-d", "--debug", "Don't clean build folder") do |o|
@@ -224,10 +230,13 @@ Usage:
224
230
 
225
231
  $ pod_builder clean
226
232
 
227
- Remove unused framework, dSYM and source folders.
233
+ Remove unused prebuild data, dSYM and source folders.
228
234
 
229
235
  Options:
230
- "
236
+ "
237
+ opts.on("-u", "--skip-repo-update", "Skip CocoaPods repo update") do |o|
238
+ OPTIONS[:update_repos] = false
239
+ end
231
240
  end,
232
241
  :call => [
233
242
  PodBuilder::Command::Clean
@@ -241,7 +250,7 @@ Usage:
241
250
 
242
251
  $ pod_builder install_sources
243
252
 
244
- Install source of prebuilt pods to be able to step into and debug framework's code.
253
+ Install source of prebuilt pods to be able to step into and debug prebuilt's code.
245
254
 
246
255
  "
247
256
  end,
@@ -258,9 +267,9 @@ Usage:
258
267
  $ pod_builder update_lldbinit <LLDBINIT_PATH> <PATH>
259
268
 
260
269
  Update LLDBINIT_PATH setting target.source-map in order to be able to step into
261
- and debug prebuilt framework's code.
270
+ and debug prebuilt prebuilt's code.
262
271
 
263
- Specify the PATH of the folder containing the source code of prebuilt frameworks. PATH can be relative to PodBuilder's Framework folder.
272
+ Specify the PATH of the folder containing the source code of prebuilt items. PATH can be relative to PodBuilder's Prebuilt folder.
264
273
 
265
274
  "
266
275
  end,
@@ -289,9 +298,9 @@ Usage:
289
298
  opts.banner = "
290
299
  Usage:
291
300
 
292
- $ pod_builder switch PODNAME [OPTIONS]
301
+ $ pod_builder switch [OPTIONS] PODNAME[s]
293
302
 
294
- Switch integration between prebuilt/development/default pod version.
303
+ Switch integration between prebuilt/development/default pod version. Multiple space separated pods can be passed
295
304
 
296
305
  Options:
297
306
  "
@@ -304,6 +313,9 @@ Options:
304
313
  opts.on("-s", "--default", "Default version specified in PodBuilder-Podfile") do |o|
305
314
  OPTIONS[:switch_mode] = "default"
306
315
  end
316
+ opts.on("-a", "--all", "Include dependencies") do |o|
317
+ OPTIONS[:switch_all] = true
318
+ end
307
319
  end,
308
320
  :call => [
309
321
  PodBuilder::Command::Switch
@@ -321,7 +333,12 @@ Usage:
321
333
  You may want to run this command when you add a new pod to the PodBuilder-Podfile
322
334
  and you want to integrate it in the project without rebuilding it.
323
335
 
324
- " end,
336
+ Options:
337
+ "
338
+ opts.on("-u", "--skip-repo-update", "Skip CocoaPods repo update") do |o|
339
+ OPTIONS[:update_repos] = false
340
+ end
341
+ end,
325
342
  :call => [
326
343
  PodBuilder::Command::SyncPodfile
327
344
  ]
@@ -357,9 +374,11 @@ Usage:
357
374
  else
358
375
  PodBuilder::Configuration.load
359
376
 
377
+ PodBuilder::add_lockfile
378
+
360
379
  subcommand[:opts].order!
361
380
  subcommand[:call].each do |k|
362
- if (ret = k.call(OPTIONS)) && ret == -1
381
+ if (ret = k.call) && ret == -1
363
382
  puts subcommand[:opts].help
364
383
  end
365
384
  end
@@ -374,8 +393,6 @@ begin
374
393
  raise "\n\nFor safety do not run this as root\n".red
375
394
  end
376
395
 
377
- PodBuilder::add_lock_file
378
- valid_lock_file = true
379
396
  command_ret = parse_commandline
380
397
  rescue Exception => e
381
398
  error = e.to_s
@@ -392,14 +409,8 @@ rescue Exception => e
392
409
  ensure
393
410
  if command_ret == 0
394
411
  PodBuilder::clean_basepath
395
-
396
- if !OPTIONS.has_key?(:debug)
397
- PodBuilder::safe_rm_rf(PodBuilder::Configuration.build_path)
398
- end
399
- end
400
- if valid_lock_file
401
- PodBuilder::remove_lock_file
402
412
  end
413
+ PodBuilder::remove_lockfile
403
414
 
404
415
  exit(command_ret)
405
416
  end
@@ -1,4 +1,6 @@
1
- require 'pod_builder/cocoapods/specification'
1
+ require 'rubygems/specification'
2
+ require 'pod_builder/rome/pre_install.rb'
3
+ require 'pod_builder/rome/post_install.rb'
2
4
 
3
5
  module PodBuilder
4
6
  class Analyze
@@ -6,6 +8,14 @@ module PodBuilder
6
8
  #
7
9
  def self.installer_at(path, repo_update = false)
8
10
  CLAide::Command::PluginManager.load_plugins("cocoapods")
11
+
12
+ # Manually load inline podbuilder-rome plugin
13
+ pluginspec = Gem::Specification.new("podbuilder-rome", PodBuilder::VERSION)
14
+ pluginspec.activate
15
+
16
+ if !CLAide::Command::PluginManager.loaded_plugins["cocoapods"].map(&:name).include?(pluginspec.name)
17
+ CLAide::Command::PluginManager.loaded_plugins["cocoapods"].push(pluginspec)
18
+ end
9
19
 
10
20
  current_dir = Dir.pwd
11
21
  Dir.chdir(path)
@@ -40,15 +50,30 @@ module PodBuilder
40
50
  checkout_options.merge!(analyzer.sandbox.checkout_sources)
41
51
 
42
52
  all_specs = analysis_result.specifications
53
+
54
+ supported_platforms = analyzer.instance_variable_get("@result").targets.map { |t| t.platform.safe_string_name.downcase }
55
+ all_podfile_items = all_specs.map { |spec| PodfileItem.new(spec, all_specs, checkout_options, supported_platforms) }
43
56
 
44
- all_podfile_specs = all_specs.select { |x| all_podfile_pods.map(&:name).include?(x.name) }
57
+ names = analyzer.explicit_pods().map(&:name)
45
58
 
46
- deps_names = all_podfile_specs.map { |x| x.recursive_dep_names(all_specs) }.flatten.uniq
59
+ podfile_pods = []
60
+ last_count = -1
61
+ while podfile_pods.count != last_count do
62
+ last_count = podfile_pods.count
47
63
 
48
- all_podfile_specs += all_specs.select { |x| deps_names.include?(x.name) }
49
- all_podfile_specs.uniq!
50
-
51
- return all_podfile_specs.map { |spec| PodfileItem.new(spec, all_specs, checkout_options) }
64
+ updated_names = []
65
+ names.each do |name|
66
+ if pod = all_podfile_items.detect { |t| t.name == name }
67
+ podfile_pods.push(pod)
68
+ updated_names += pod.dependency_names
69
+ end
70
+ end
71
+
72
+ names = updated_names.uniq
73
+ podfile_pods.uniq!
74
+ end
75
+
76
+ return podfile_pods.sort_by(&:name)
52
77
  end
53
78
  end
54
79
  end
@@ -0,0 +1,16 @@
1
+ require 'cocoapods/installer/analyzer.rb'
2
+
3
+ module Pod
4
+ class Installer
5
+ class Analyzer
6
+ def explicit_pods
7
+ pods = []
8
+ podfile.root_target_definitions[0].children.each do |children|
9
+ pods += children.dependencies
10
+ end
11
+
12
+ pods.flatten.uniq.sort
13
+ end
14
+ end
15
+ end
16
+ end
@@ -3,7 +3,7 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class Build
6
- def self.call(options)
6
+ def self.call
7
7
  Configuration.check_inited
8
8
  PodBuilder::prepare_basepath
9
9
 
@@ -13,20 +13,28 @@ module PodBuilder
13
13
  return -1
14
14
  end
15
15
 
16
- raise "\n\nPlease rename your Xcode installation path removing spaces, current `#{`xcode-select -p`.strip()}`\n" if `xcode-select -p`.strip().include?(" ")
16
+ raise "\n\nPlease rename your Xcode installation path removing spaces, current `#{`xcode-select -p`.strip()}`\n".red if `xcode-select -p`.strip().include?(" ")
17
17
 
18
18
  Podfile.sanity_check()
19
19
  check_not_building_subspecs(argument_pods)
20
20
 
21
- install_update_repo = options.fetch(:update_repos, true)
21
+ puts "Loading Podfile".yellow
22
+
23
+ install_update_repo = OPTIONS.fetch(:update_repos, true)
22
24
  installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
23
25
 
24
26
  all_buildable_items = Analyze.podfile_items(installer, analyzer)
25
27
  prebuilt_items = all_buildable_items.select { |x| x.is_prebuilt }
26
28
  buildable_items = all_buildable_items - prebuilt_items
27
29
 
28
- if argument_pods.first == "*"
29
- argument_pods = buildable_items.map(&:root_name)
30
+ build_all = argument_pods.first == "*"
31
+ if build_all
32
+ argument_pods = all_buildable_items.map(&:root_name).uniq
33
+ else
34
+ argument_pods = Podfile::resolve_pod_names(argument_pods, all_buildable_items)
35
+ deps = all_buildable_items.select { |t| argument_pods.include?(t.root_name) }.map(&:dependency_names).flatten.map { |t| t.split("/").first }
36
+ argument_pods += deps
37
+ argument_pods.uniq!
30
38
  end
31
39
 
32
40
  available_argument_pods = argument_pods.select { |x| all_buildable_items.map(&:root_name).include?(x) }
@@ -41,10 +49,10 @@ module PodBuilder
41
49
 
42
50
  restore_file_error = Podfile.restore_file_sanity_check
43
51
 
44
- check_splitted_subspecs_are_static(all_buildable_items, options)
52
+ check_splitted_subspecs_are_static(all_buildable_items)
45
53
  check_pods_exists(argument_pods, all_buildable_items)
46
54
 
47
- pods_to_build = resolve_pods_to_build(argument_pods, buildable_items, options)
55
+ pods_to_build = resolve_pods_to_build(argument_pods, buildable_items)
48
56
  buildable_items -= pods_to_build
49
57
 
50
58
  # We need to split pods to build in 3 groups
@@ -52,7 +60,7 @@ module PodBuilder
52
60
  # 2. pods to build in release
53
61
  # 3. pods to build in debug
54
62
 
55
- check_not_building_development_pods(pods_to_build, options)
63
+ check_not_building_development_pods(pods_to_build)
56
64
 
57
65
  pods_to_build_subspecs = pods_to_build.select { |x| x.is_subspec && Configuration.subspecs_to_split.include?(x.name) }
58
66
 
@@ -73,34 +81,37 @@ module PodBuilder
73
81
  licenses = []
74
82
 
75
83
  podfiles_items.select { |x| x.count > 0 }.each do |podfile_items|
76
- podfile_items = add_dependencies(podfile_items, all_buildable_items)
77
- podfile_content = Podfile.from_podfile_items(podfile_items, analyzer)
84
+ build_configuration = podfile_items.map(&:build_configuration).uniq.first
78
85
 
79
- Install.podfile(podfile_content, podfile_items, podfile_items.first.build_configuration)
80
-
81
- licenses += license_specifiers
86
+ podfile_items = podfile_items.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
87
+ podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration)
88
+
89
+ licenses += Install.podfile(podfile_content, podfile_items, podfile_items.first.build_configuration)
82
90
 
83
91
  # remove lockfile which gets unexplicably created
84
92
  FileUtils.rm_f(PodBuilder::basepath("Podfile.lock"))
85
93
  end
86
94
 
87
- clean_frameworks_folder(all_buildable_items)
95
+ Clean::prebuilt_items(all_buildable_items)
88
96
 
89
97
  Licenses::write(licenses, all_buildable_items)
90
98
 
91
- GenerateLFS::call(nil)
99
+ GenerateLFS::call()
92
100
  Podspec::generate(all_buildable_items, analyzer)
93
101
 
94
102
  builded_pods = podfiles_items.flatten
95
- builded_pods_and_deps = add_dependencies(builded_pods, all_buildable_items).select { |x| !x.is_prebuilt }
103
+
104
+ builded_pods_and_deps = podfiles_items.flatten.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
105
+ builded_pods_and_deps.select! { |x| !x.is_prebuilt }
106
+
96
107
  Podfile::write_restorable(builded_pods_and_deps + prebuilt_pods_to_install, all_buildable_items, analyzer)
97
- if !options.has_key?(:skip_prebuild_update)
108
+ if !OPTIONS.has_key?(:skip_prebuild_update)
98
109
  Podfile::write_prebuilt(all_buildable_items, analyzer)
99
110
  end
100
111
 
101
112
  Podfile::install
102
113
 
103
- sanity_checks(options)
114
+ sanity_checks
104
115
 
105
116
  if (restore_file_error = restore_file_error) && Configuration.restore_enabled
106
117
  puts "\n\n⚠️ Podfile.restore was found invalid and was overwritten. Error:\n #{restore_file_error}".red
@@ -112,88 +123,6 @@ module PodBuilder
112
123
 
113
124
  private
114
125
 
115
- def self.license_specifiers
116
- acknowledge_files = Dir.glob("#{PodBuilder::Configuration.build_path}/Pods/**/*acknowledgements.plist")
117
- raise "Too many ackwnoledge files found" if acknowledge_files.count > 1
118
-
119
- if acknowledge_file = acknowledge_files.first
120
- plist = CFPropertyList::List.new(:file => acknowledge_file)
121
- data = CFPropertyList.native_types(plist.value)
122
-
123
- return data["PreferenceSpecifiers"]
124
- end
125
-
126
- return []
127
- end
128
-
129
- def self.add_dependencies(pods, buildable_items)
130
- pods.dup.each do |pod|
131
- build_configuration = pods.first.build_configuration
132
-
133
- dependencies = pod.dependencies(buildable_items).select { |x| !pods.include?(x) && !pod.has_common_spec(x.name) }
134
- dependencies.each { |x| x.build_configuration = build_configuration }
135
- pods = dependencies + pods # dependencies should come first
136
- end
137
-
138
- return pods
139
- end
140
-
141
- def self.expected_common_dependencies(pods_to_build, buildable_items, options)
142
- warned_expected_pod_list = []
143
- expected_pod_list = []
144
- errors = []
145
-
146
- pods_to_build.each do |pod_to_build|
147
- pod_to_build.dependency_names.each do |dependency|
148
- unless buildable_items.detect { |x| x.root_name == dependency || x.name == dependency } != nil
149
- next
150
- end
151
-
152
- buildable_items.each do |buildable_pod|
153
- unless !pod_to_build.dependency_names.include?(buildable_pod.name)
154
- next
155
- end
156
-
157
- if buildable_pod.dependency_names.include?(dependency) && !buildable_pod.has_subspec(dependency) && !buildable_pod.has_common_spec(dependency) then
158
- expected_pod_list += pods_to_build.map(&:root_name) + [buildable_pod.root_name]
159
- expected_pod_list.uniq!
160
-
161
- expected_list = expected_pod_list.join(" ")
162
- if !warned_expected_pod_list.include?(expected_list)
163
- errors.push("Can't build #{pod_to_build.name} because it has common dependencies (#{dependency}) with #{buildable_pod.name}.\n\nUse `pod_builder build #{expected_list}` instead or use `pod_builder build -a #{pod_to_build.name}` to automatically resolve missing dependencies\n\n")
164
- errors.uniq!
165
- warned_expected_pod_list.push(expected_list)
166
-
167
- if options.has_key?(:auto_resolve_dependencies)
168
- puts "`#{pod_to_build.name}` has the following dependencies:\n`#{pod_to_build.dependency_names.join("`, `")}`\nWhich are in common with `#{buildable_pod.name}` and requires it to be recompiled\n\n".yellow
169
- end
170
- end
171
- end
172
- end
173
- end
174
- end
175
-
176
- return expected_pod_list, errors
177
- end
178
-
179
- def self.expected_parent_dependencies(pods_to_build, buildable_items, options)
180
- expected_pod_list = []
181
- errors = []
182
-
183
- buildable_items_dependencies = buildable_items.map(&:dependency_names).flatten.uniq
184
- pods_to_build.each do |pod_to_build|
185
- if buildable_items_dependencies.include?(pod_to_build.name)
186
- parent = buildable_items.detect { |x| x.dependency_names.include?(pod_to_build.name) }
187
-
188
- expected_pod_list += (pods_to_build + [parent]).map(&:root_name)
189
- expected_pod_list.uniq!
190
- errors.push("Can't build #{pod_to_build.name} because it is a dependency of #{parent.name}.\n\nUse `pod_builder build #{expected_pod_list.join(" ")}` instead\n\n")
191
- end
192
- end
193
-
194
- return expected_pod_list, errors
195
- end
196
-
197
126
  def self.check_not_building_subspecs(pods_to_build)
198
127
  pods_to_build.each do |pod_to_build|
199
128
  if pod_to_build.include?("/")
@@ -203,7 +132,7 @@ module PodBuilder
203
132
  end
204
133
 
205
134
  def self.check_pods_exists(pods, buildable_items)
206
- raise "Empty Podfile?" if buildable_items.nil?
135
+ raise "\n\nEmpty Podfile?".red if buildable_items.nil?
207
136
 
208
137
  buildable_items = buildable_items.map(&:root_name)
209
138
  pods.each do |pod|
@@ -211,7 +140,7 @@ module PodBuilder
211
140
  end
212
141
  end
213
142
 
214
- def self.check_splitted_subspecs_are_static(all_buildable_items, options)
143
+ def self.check_splitted_subspecs_are_static(all_buildable_items)
215
144
  non_static_subspecs = all_buildable_items.select { |x| x.is_subspec && x.is_static == false }
216
145
  non_static_subspecs_names = non_static_subspecs.map(&:name)
217
146
 
@@ -221,11 +150,11 @@ module PodBuilder
221
150
  return
222
151
  end
223
152
 
224
- warn_message = "The following pods `#{invalid_subspecs.join(" ")}` are non static frameworks which are being splitted over different targets. Beware that this is an unsafe setup as per https://github.com/CocoaPods/CocoaPods/issues/5708 and https://github.com/CocoaPods/CocoaPods/issues/5643\n\nYou can ignore this error by passing the `--allow-warnings` flag to the build command\n"
225
- if options[:allow_warnings]
153
+ warn_message = "The following pods `#{invalid_subspecs.join(" ")}` are non static binaries which are being splitted over different targets. Beware that this is an unsafe setup as per https://github.com/CocoaPods/CocoaPods/issues/5708 and https://github.com/CocoaPods/CocoaPods/issues/5643\n\nYou can ignore this error by passing the `--allow-warnings` flag to the build command\n"
154
+ if OPTIONS[:allow_warnings]
226
155
  puts "\n\n⚠️ #{warn_message}".yellow
227
156
  else
228
- raise "\n\n🚨️ #{warn_message}".yellow
157
+ raise "\n\n🚨️ #{warn_message}".red
229
158
  end
230
159
  end
231
160
 
@@ -239,14 +168,14 @@ module PodBuilder
239
168
  pods_with_unaligned_build_configuration = pods_with_common_deps.select { |x| x.build_configuration != pod.build_configuration }
240
169
  pods_with_unaligned_build_configuration.map!(&:name)
241
170
 
242
- raise "Dependencies of `#{pod.name}` don't have the same build configuration (#{pod.build_configuration}) of `#{pods_with_unaligned_build_configuration.join(",")}`'s dependencies" if pods_with_unaligned_build_configuration.count > 0
171
+ raise "\n\nDependencies of `#{pod.name}` don't have the same build configuration (#{pod.build_configuration}) of `#{pods_with_unaligned_build_configuration.join(",")}`'s dependencies".red if pods_with_unaligned_build_configuration.count > 0
243
172
  end
244
173
  end
245
174
 
246
- def self.check_not_building_development_pods(pods, options)
247
- if (development_pods = pods.select { |x| x.is_development_pod }) && development_pods.count > 0 && (options[:allow_warnings].nil? && Configuration.allow_building_development_pods == false)
175
+ def self.check_not_building_development_pods(pods)
176
+ if (development_pods = pods.select { |x| x.is_development_pod }) && development_pods.count > 0 && (OPTIONS[:allow_warnings].nil? && Configuration.allow_building_development_pods == false)
248
177
  pod_names = development_pods.map(&:name).join(", ")
249
- raise "The following pods are in development mode: `#{pod_names}`, won't proceed building.\n\nYou can ignore this error by passing the `--allow-warnings` flag to the build command\n"
178
+ raise "\n\nThe following pods are in development mode: `#{pod_names}`, won't proceed building.\n\nYou can ignore this error by passing the `--allow-warnings` flag to the build command\n".red
250
179
  end
251
180
  end
252
181
 
@@ -259,7 +188,7 @@ module PodBuilder
259
188
  return buildable_subspecs - pods_to_build
260
189
  end
261
190
 
262
- def self.sanity_checks(options)
191
+ def self.sanity_checks
263
192
  lines = File.read(PodBuilder::project_path("Podfile")).split("\n")
264
193
  stripped_lines = lines.map { |x| Podfile.strip_line(x) }.select { |x| !x.start_with?("#")}
265
194
 
@@ -267,7 +196,7 @@ module PodBuilder
267
196
 
268
197
  if !expected_stripped.all? { |x| stripped_lines.include?(x) }
269
198
  warn_message = "PodBuilder's post install actions missing from application Podfile!\n"
270
- if options[:allow_warnings]
199
+ if OPTIONS[:allow_warnings]
271
200
  puts "\n\n⚠️ #{warn_message}".yellow
272
201
  else
273
202
  raise "\n\n🚨️ #{warn_message}".red
@@ -275,60 +204,14 @@ module PodBuilder
275
204
  end
276
205
  end
277
206
 
278
- def self.resolve_pods_to_build(argument_pods, buildable_items, options)
207
+ def self.resolve_pods_to_build(argument_pods, buildable_items)
279
208
  pods_to_build = []
280
209
 
281
- fns = [method(:expected_common_dependencies), method(:expected_parent_dependencies)]
282
- fns.each do |fn|
283
- loop do
284
- pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
285
- pods_to_build += other_subspecs(pods_to_build, buildable_items)
286
- tmp_buildable_items = buildable_items - pods_to_build
287
-
288
- expected_pods, errors = fn.call(pods_to_build, tmp_buildable_items, options)
289
- if expected_pods.count > 0
290
- if !options.has_key?(:auto_resolve_dependencies) && expected_pods.count > 0
291
- raise "\n\n#{errors.join("\n")}".red
292
- else
293
- argument_pods = expected_pods.uniq
294
- end
295
- end
296
-
297
- if !options.has_key?(:auto_resolve_dependencies) || expected_pods.count == 0
298
- break
299
- end
300
- end
301
- end
210
+ pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
211
+ pods_to_build += other_subspecs(pods_to_build, buildable_items)
302
212
 
303
213
  return pods_to_build
304
- end
305
-
306
- def self.clean_frameworks_folder(buildable_items)
307
- puts "Cleaning framework folder".yellow
308
-
309
- expected_frameworks = buildable_items.map { |x| "#{x.module_name}.framework" }
310
- expected_frameworks += buildable_items.map { |x| x.vendored_items }.flatten.map { |x| File.basename(x) }
311
- expected_frameworks.uniq!
312
-
313
- existing_frameworks = Dir.glob("#{PodBuilder::basepath("Rome")}/*.framework")
314
-
315
- existing_frameworks.each do |existing_framework|
316
- existing_framework_name = File.basename(existing_framework)
317
- if !expected_frameworks.include?(existing_framework_name)
318
- puts "Cleanining up `#{existing_framework_name}`, no longer found among dependencies".blue
319
- FileUtils.rm_rf(existing_framework)
320
- end
321
- end
322
-
323
- existing_dsyms = Dir.glob("#{PodBuilder::basepath("dSYM")}/**/*.dSYM")
324
- existing_dsyms.each do |existing_dsym|
325
- existing_dsym_name = File.basename(existing_dsym)
326
- if !expected_frameworks.include?(existing_dsym_name.gsub(".dSYM", ""))
327
- puts "Cleanining up `#{existing_dsym_name}`, no longer found among dependencies".blue
328
- FileUtils.rm_rf(existing_dsym)
329
- end
330
- end
331
- end
214
+ end
332
215
  end
333
216
  end
334
217
  end