pod-builder 1.9.3 → 2.0.0.beta.22

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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -0
  3. data/README.md +50 -13
  4. data/exe/pod_builder +39 -28
  5. data/lib/pod_builder/analyze.rb +32 -7
  6. data/lib/pod_builder/analyzer.rb +16 -0
  7. data/lib/pod_builder/command/build.rb +44 -161
  8. data/lib/pod_builder/command/build_all.rb +2 -2
  9. data/lib/pod_builder/command/clean.rb +34 -55
  10. data/lib/pod_builder/command/clear_lldbinit.rb +7 -3
  11. data/lib/pod_builder/command/deintegrate.rb +29 -7
  12. data/lib/pod_builder/command/generate_lfs.rb +3 -3
  13. data/lib/pod_builder/command/generate_podspec.rb +3 -2
  14. data/lib/pod_builder/command/info.rb +1 -1
  15. data/lib/pod_builder/command/init.rb +37 -14
  16. data/lib/pod_builder/command/install_sources.rb +21 -14
  17. data/lib/pod_builder/command/none.rb +2 -2
  18. data/lib/pod_builder/command/restore_all.rb +4 -4
  19. data/lib/pod_builder/command/switch.rb +137 -95
  20. data/lib/pod_builder/command/sync_podfile.rb +5 -3
  21. data/lib/pod_builder/command/update.rb +5 -6
  22. data/lib/pod_builder/command/update_lldbinit.rb +11 -9
  23. data/lib/pod_builder/configuration.rb +88 -13
  24. data/lib/pod_builder/core.rb +93 -12
  25. data/lib/pod_builder/info.rb +32 -98
  26. data/lib/pod_builder/install.rb +255 -195
  27. data/lib/pod_builder/licenses.rb +4 -4
  28. data/lib/pod_builder/podfile.rb +283 -73
  29. data/lib/pod_builder/podfile/post_actions.rb +9 -15
  30. data/lib/pod_builder/podfile_cp.rb +93 -0
  31. data/lib/pod_builder/podfile_item.rb +181 -82
  32. data/lib/pod_builder/podspec.rb +144 -135
  33. data/lib/pod_builder/rome/post_install.rb +240 -0
  34. data/lib/pod_builder/rome/pre_install.rb +6 -0
  35. data/lib/pod_builder/templates/build_podfile.template +3 -3
  36. data/lib/pod_builder/version.rb +1 -1
  37. data/pod-builder.gemspec +6 -6
  38. metadata +27 -80
  39. data/Example/Frameworks/PodBuilder.json +0 -32
  40. data/Example/PodBuilderExample.xcodeproj/project.pbxproj +0 -416
  41. data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  42. data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  43. data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/xcuserdata/tomas.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  44. data/Example/PodBuilderExample.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  45. data/Example/PodBuilderExample.xcworkspace/contents.xcworkspacedata +0 -10
  46. data/Example/PodBuilderExample/AppDelegate.swift +0 -47
  47. data/Example/PodBuilderExample/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -98
  48. data/Example/PodBuilderExample/Assets.xcassets/Contents.json +0 -6
  49. data/Example/PodBuilderExample/Base.lproj/LaunchScreen.storyboard +0 -25
  50. data/Example/PodBuilderExample/Base.lproj/Main.storyboard +0 -24
  51. data/Example/PodBuilderExample/Info.plist +0 -45
  52. data/Example/PodBuilderExample/ViewController.swift +0 -25
  53. data/Example/Podfile +0 -8
  54. data/Example/Podfile.lock +0 -16
  55. data/Example/Pods/Alamofire/LICENSE +0 -19
  56. data/Example/Pods/Alamofire/README.md +0 -242
  57. data/Example/Pods/Alamofire/Source/AFError.swift +0 -460
  58. data/Example/Pods/Alamofire/Source/Alamofire.swift +0 -465
  59. data/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift +0 -37
  60. data/Example/Pods/Alamofire/Source/MultipartFormData.swift +0 -580
  61. data/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift +0 -233
  62. data/Example/Pods/Alamofire/Source/Notifications.swift +0 -55
  63. data/Example/Pods/Alamofire/Source/ParameterEncoding.swift +0 -483
  64. data/Example/Pods/Alamofire/Source/Request.swift +0 -654
  65. data/Example/Pods/Alamofire/Source/Response.swift +0 -567
  66. data/Example/Pods/Alamofire/Source/ResponseSerialization.swift +0 -715
  67. data/Example/Pods/Alamofire/Source/Result.swift +0 -300
  68. data/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift +0 -307
  69. data/Example/Pods/Alamofire/Source/SessionDelegate.swift +0 -725
  70. data/Example/Pods/Alamofire/Source/SessionManager.swift +0 -896
  71. data/Example/Pods/Alamofire/Source/TaskDelegate.swift +0 -466
  72. data/Example/Pods/Alamofire/Source/Timeline.swift +0 -136
  73. data/Example/Pods/Alamofire/Source/Validation.swift +0 -315
  74. data/Example/Pods/Manifest.lock +0 -16
  75. data/Example/Pods/Pods.xcodeproj/project.pbxproj +0 -673
  76. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Alamofire.xcscheme +0 -60
  77. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Pods-PodBuilderExample.xcscheme +0 -60
  78. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +0 -21
  79. data/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m +0 -5
  80. data/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch +0 -12
  81. data/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h +0 -16
  82. data/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap +0 -6
  83. data/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig +0 -9
  84. data/Example/Pods/Target Support Files/Alamofire/Info.plist +0 -26
  85. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Info.plist +0 -26
  86. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.markdown +0 -26
  87. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.plist +0 -58
  88. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-dummy.m +0 -5
  89. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-frameworks.sh +0 -153
  90. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-resources.sh +0 -118
  91. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-umbrella.h +0 -16
  92. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.debug.xcconfig +0 -11
  93. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.modulemap +0 -6
  94. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.release.xcconfig +0 -11
  95. data/lib/pod_builder/cocoapods/specification.rb +0 -27
@@ -3,8 +3,8 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class None
6
- def self.call(options)
7
- unless !options.has_key?(:version)
6
+ def self.call
7
+ unless !OPTIONS.has_key?(:version)
8
8
  puts VERSION
9
9
  return 0
10
10
  end
@@ -3,9 +3,9 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class RestoreAll
6
- def self.call(options)
6
+ def self.call
7
7
  unless Configuration.restore_enabled
8
- raise "Restore not enabled!".red
8
+ raise "\n\nRestore not enabled!".red
9
9
  end
10
10
 
11
11
  Configuration.check_inited
@@ -16,8 +16,8 @@ module PodBuilder
16
16
  File.rename(PodBuilder::basepath("Podfile.restore"), PodBuilder::basepath("Podfile"))
17
17
 
18
18
  ARGV << "*"
19
- options[:skip_prebuild_update] = true
20
- return Command::Build::call(options)
19
+ OPTIONS[:skip_prebuild_update] = true
20
+ return Command::Build::call
21
21
  rescue Exception => e
22
22
  raise e
23
23
  ensure
@@ -3,7 +3,7 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class Switch
6
- def self.call(options)
6
+ def self.call
7
7
  Configuration.check_inited
8
8
  PodBuilder::prepare_basepath
9
9
 
@@ -12,108 +12,176 @@ module PodBuilder
12
12
  unless argument_pods.count > 0
13
13
  return -1
14
14
  end
15
- unless argument_pods.count == 1
16
- raise "\n\nSpecify a single pod to switch\n\n".red
17
- end
18
-
19
- pod_name_to_switch = argument_pods.first
20
-
21
- check_not_building_subspec(pod_name_to_switch)
22
15
 
23
- installer, analyzer = Analyze.installer_at(PodBuilder::basepath, false)
24
- all_buildable_items = Analyze.podfile_items(installer, analyzer)
16
+ pod_names_to_switch = []
17
+ argument_pods.each do |pod|
18
+ pod_name_to_switch = pod
19
+ 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)
25
23
 
26
- raise "\n\nPod `#{pod_name_to_switch}` wasn't found in Podfile" unless all_buildable_items.map(&:root_name).include?(pod_name_to_switch)
27
-
28
- unless options.has_key?(:switch_mode)
29
- podfile_item = all_buildable_items.detect { |x| x.root_name == pod_name_to_switch }
30
- options[:switch_mode] = request_switch_mode(pod_name_to_switch, podfile_item)
31
-
32
- if options[:switch_mode].nil?
33
- return 0
34
- end
24
+ pod_names_to_switch.push(pod_name_to_switch)
35
25
  end
36
26
 
37
- if options[:switch_mode] == "prebuilt"
38
- check_prebuilded(pod_name_to_switch)
39
- end
27
+ dep_pod_names_to_switch = []
28
+ if OPTIONS[:switch_all] == true
29
+ pod_names_to_switch.each do |pod|
30
+ podspec_path = PodBuilder::prebuiltpath("#{pod}/#{pod}.podspec")
31
+ unless File.exist?(podspec_path)
32
+ next
33
+ end
40
34
 
41
- podfile_path = PodBuilder::project_path("Podfile")
42
- podfile_content = File.read(podfile_path)
35
+ podspec_content = File.read(podspec_path)
43
36
 
44
- pod_lines = []
45
- podfile_content.each_line do |line|
46
- if pod_name = Podfile.pod_definition_in(line, false)
47
- if pod_name.start_with?("PodBuilder/")
48
- pod_name = pod_name.split("PodBuilder/").last.gsub("_", "/")
49
- end
37
+ regex = "p\\d\\.dependency '(.*)'"
50
38
 
51
- unless pod_name.split("/").first == pod_name_to_switch
52
- pod_lines.push(line)
53
- next
39
+ podspec_content.each_line do |line|
40
+ matches = line.match(/#{regex}/)
41
+
42
+ if matches&.size == 2
43
+ dep_pod_names_to_switch.push(matches[1].split("/").first)
44
+ end
54
45
  end
46
+ end
55
47
 
56
- if pod_name.include?("/")
57
- podfile_items = all_buildable_items.select { |x| x.name == pod_name }
58
- else
59
- podfile_items = all_buildable_items.select { |x| x.root_name == pod_name }
48
+ dep_pod_names_to_switch.uniq!
49
+ dep_pod_names_to_switch.reverse.each do |dep_name|
50
+ podspec_path = PodBuilder::prebuiltpath("#{dep_name}/#{dep_name}.podspec")
51
+ if File.exist?(podspec_path)
52
+ if pod = Podfile::resolve_pod_names_from_podfile([dep_name]).first
53
+ pod_names_to_switch.push(pod)
54
+ next
55
+ end
60
56
  end
61
-
62
- unless podfile_items.count > 0
63
- raise "\n\nPod `#{pod_name_to_switch}` wasn't found in Podfile\n".red
57
+
58
+ dep_pod_names_to_switch.delete(dep_name)
59
+ end
60
+ pod_names_to_switch = pod_names_to_switch.map { |t| t.split("/").first }.uniq
61
+ dep_pod_names_to_switch.reject { |t| pod_names_to_switch.include?(t) }
62
+ end
63
+
64
+ pod_names_to_switch.each do |pod_name_to_switch|
65
+ development_path = ""
66
+ default_entries = Hash.new
67
+
68
+ case OPTIONS[:switch_mode]
69
+ when "development"
70
+ development_path = find_podspec(pod_name_to_switch)
71
+ when "prebuilt"
72
+ podfile_path = PodBuilder::basepath("Podfile.restore")
73
+ content = File.read(podfile_path)
74
+ if !content.include?("pod '#{pod_name_to_switch}")
75
+ raise "\n\n'#{pod_name_to_switch}' does not seem to be prebuit!".red
76
+ end
77
+ when "default"
78
+ podfile_path = PodBuilder::basepath("Podfile")
79
+ content = File.read(podfile_path)
80
+
81
+ current_section = ""
82
+ content.each_line do |line|
83
+ stripped_line = line.strip
84
+ if stripped_line.start_with?("def ") || stripped_line.start_with?("target ")
85
+ current_section = line.split(" ")[1]
86
+ next
87
+ end
88
+
89
+ matches = line.gsub("\"", "'").match(/pod '(.*?)',(.*)/)
90
+ if matches&.size == 3
91
+ if matches[1].split("/").first == pod_name_to_switch
92
+ default_entries[current_section] = line
93
+ end
94
+ end
64
95
  end
96
+
97
+ raise "\n\n'#{pod_name_to_switch}' not found in #{podfile_path}".red if default_entries.keys.count == 0
98
+ end
65
99
 
66
- matches = line.match(/(#\s*pb<)(.*?)(>)/)
67
- if matches&.size == 4
68
- default_pod_name = matches[2]
100
+ if development_path.nil?
101
+ if dep_pod_names_to_switch.include?(pod_name_to_switch)
102
+ next
69
103
  else
70
- puts "⚠️ Did not found pb<> entry, assigning default pod name #{pod_name}"
71
- default_pod_name = pod_name
104
+ raise "\n\nCouln't find `#{pod_name_to_switch}` sources in the following specified development pod paths:\n#{Configuration.development_pods_paths.join("\n")}\n".red
72
105
  end
106
+ end
73
107
 
74
- unless podfile_item = all_buildable_items.detect { |x| x.name == default_pod_name }
75
- raise "\n\nPod `#{default_pod_name}` wasn't found in Podfile\n".red
108
+ podfile_path = PodBuilder::project_path("Podfile")
109
+ content = File.read(podfile_path)
110
+
111
+ lines = []
112
+ current_section = ""
113
+ content.each_line do |line|
114
+ stripped_line = line.strip
115
+ if stripped_line.start_with?("def ") || stripped_line.start_with?("target ")
116
+ current_section = line.split(" ")[1]
76
117
  end
77
- podfile_item = podfile_item.dup
78
-
79
- indentation = line.detect_indentation
80
-
81
- case options[:switch_mode]
82
- when "prebuilt"
83
- line = indentation + podfile_item.prebuilt_entry + "\n"
84
- when "development"
85
- podfile_item.path = find_podspec(podfile_item)
86
- podfile_item.is_external = true
87
118
 
88
- line = indentation + podfile_item.entry + "\n"
89
- when "default"
90
- line = indentation + podfile_item.entry + "\n"
91
- else
92
- break
119
+ matches = line.gsub("\"", "'").match(/pod '(.*?)',(.*)/)
120
+ if matches&.size == 3
121
+ if matches[1].split("/").first == pod_name_to_switch
122
+ case OPTIONS[:switch_mode]
123
+ when "prebuilt"
124
+ indentation = line.split("pod '").first
125
+ podspec_path = File.dirname(PodBuilder::prebuiltpath("#{pod_name_to_switch}/#{pod_name_to_switch}.podspec"))
126
+ rel_path = Pathname.new(podspec_path).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
127
+ prebuilt_line = "#{indentation}pod '#{matches[1]}', :path => '#{rel_path}'\n"
128
+ if line.include?("# pb<") && marker = line.split("# pb<").last
129
+ prebuilt_line = prebuilt_line.chomp("\n") + " # pb<#{marker}"
130
+ end
131
+ lines.append(prebuilt_line)
132
+ next
133
+ when "development"
134
+ indentation = line.split("pod '").first
135
+ rel_path = Pathname.new(development_path).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
136
+ development_line = "#{indentation}pod '#{matches[1]}', :path => '#{rel_path}'\n"
137
+ if line.include?("# pb<") && marker = line.split("# pb<").last
138
+ development_line = development_line.chomp("\n") + " # pb<#{marker}"
139
+ end
140
+
141
+ lines.append(development_line)
142
+ next
143
+ when "default"
144
+ if default_line = default_entries[current_section]
145
+ if line.include?("# pb<") && marker = line.split("# pb<").last
146
+ default_line = default_line.chomp("\n") + " # pb<#{marker}"
147
+ end
148
+ lines.append(default_line)
149
+ next
150
+ elsif
151
+ raise "\n\nLine for pod '#{matches[1]}' in section '#{current_section}' not found in PodBuilder's Podfile".red
152
+ end
153
+ else
154
+ raise "\n\nUnsupported mode '#{OPTIONS[:switch_mode]}'".red
155
+ end
156
+ end
93
157
  end
158
+
159
+ lines.append(line)
94
160
  end
95
161
 
96
- pod_lines.push(line)
162
+ File.write(podfile_path, lines.join)
97
163
  end
98
164
 
99
- File.write(podfile_path, pod_lines.join)
100
-
101
165
  Dir.chdir(PodBuilder::project_path)
102
- system("pod install")
166
+ bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
167
+ system("#{bundler_prefix}pod install;")
103
168
 
104
169
  return 0
105
170
  end
106
171
 
107
172
  private
108
173
 
109
- def self.find_podspec(podfile_item)
174
+ def self.find_podspec(podname)
110
175
  unless Configuration.development_pods_paths.count > 0
111
176
  raise "\n\nPlease add the development pods path(s) in #{Configuration.dev_pods_configuration_filename} as per documentation\n".red
112
177
  end
113
178
 
114
179
  podspec_path = nil
115
180
  Configuration.development_pods_paths.each do |path|
116
- podspec = Dir.glob(File.expand_path("#{path}/**/#{podfile_item.root_name}*.podspec*"))
181
+ if Pathname.new(path).relative?
182
+ path = PodBuilder::basepath(path)
183
+ end
184
+ podspec = Dir.glob(File.expand_path("#{path}/**/#{podname}*.podspec*"))
117
185
  podspec.select! { |x| !x.include?("/Local Podspecs/") }
118
186
  podspec.select! { |x| Dir.glob(File.join(File.dirname(x), "*")).count > 1 } # exclude podspec folder (which has one file per folder)
119
187
  if podspec.count > 0
@@ -122,40 +190,14 @@ module PodBuilder
122
190
  end
123
191
  end
124
192
 
125
- if podspec_path.nil?
126
- raise "\n\nCouln't find `#{podfile_item.root_name}` sources in the following specified development pod paths: #{Configuration.development_pods_paths.join("\n")}\n".red
127
- end
128
-
129
193
  return podspec_path
130
194
  end
131
-
132
- def self.request_switch_mode(pod_name, podfile_item)
133
- matches = podfile_item.entry.match(/(pod '.*?',)(.*)('.*')/)
134
- unless matches&.size == 4
135
- raise "\n\nFailed matching pod name\n".red
136
- end
137
-
138
- default_entry = matches[3].strip
139
-
140
- modes = ["prebuilt", "development", "default"]
141
- mode_indx = ask("\n\nSwitch #{pod_name} to:\n1) Prebuilt\n2) Development pod\n3) Default (#{default_entry})\n\n") { |x| x.limit = 1, x.validate = /[1-3]/ }
142
-
143
- return modes[mode_indx.to_i - 1]
144
- end
145
-
195
+
146
196
  def self.check_not_building_subspec(pod_to_switch)
147
197
  if pod_to_switch.include?("/")
148
198
  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
149
199
  end
150
200
  end
151
-
152
- private
153
-
154
- def self.check_prebuilded(pod_name)
155
- if !Podspec.include?(pod_name)
156
- raise "\n\n#{pod_name} is not prebuilt.\n\nRun 'pod_builder build #{pod_name}'\n".red
157
- end
158
- end
159
201
  end
160
202
  end
161
203
  end
@@ -3,11 +3,11 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class SyncPodfile
6
- def self.call(options)
6
+ def self.call
7
7
  Configuration.check_inited
8
8
  PodBuilder::prepare_basepath
9
9
 
10
- install_update_repo = options.fetch(:update_repos, true)
10
+ install_update_repo = OPTIONS.fetch(:update_repos, true)
11
11
  installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
12
12
 
13
13
  all_buildable_items = Analyze.podfile_items(installer, analyzer)
@@ -21,9 +21,11 @@ module PodBuilder
21
21
  Licenses::write([], all_buildable_items)
22
22
 
23
23
  if previous_podfile_content != updated_podfile_content
24
- system("pod install")
24
+ bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
25
+ system("#{bundler_prefix}pod install;")
25
26
  end
26
27
 
28
+ puts "\n\n🎉 done!\n".green
27
29
  return 0
28
30
  end
29
31
  end
@@ -1,10 +1,9 @@
1
1
  require 'pod_builder/core'
2
- require 'cfpropertylist'
3
2
 
4
3
  module PodBuilder
5
4
  module Command
6
5
  class Update
7
- def self.call(options)
6
+ def self.call
8
7
  Configuration.check_inited
9
8
  PodBuilder::prepare_basepath
10
9
 
@@ -25,10 +24,10 @@ module PodBuilder
25
24
  pods_to_update.map! { |x| x.split("/").first }.uniq!
26
25
 
27
26
  unless pods_to_update.count > 0
28
- puts "Frameworks in sync!\n".green
27
+ puts "Prebuilt items in sync!\n".green
29
28
  return 0
30
29
  end
31
- if options.has_key?(:dry_run)
30
+ if OPTIONS.has_key?(:dry_run)
32
31
  puts "`#{pods_to_update.join("`, `")}` need to be rebuilt!\n".red
33
32
  return -2
34
33
  end
@@ -36,8 +35,8 @@ module PodBuilder
36
35
  ARGV.clear
37
36
  pods_to_update.each { |x| ARGV << x }
38
37
 
39
- options[:auto_resolve_dependencies] = true
40
- return PodBuilder::Command::Build.call(options)
38
+ # OPTIONS[:auto_resolve_dependencies] = true
39
+ return PodBuilder::Command::Build.call
41
40
  end
42
41
  end
43
42
  end
@@ -4,9 +4,12 @@ require 'digest'
4
4
  module PodBuilder
5
5
  module Command
6
6
  class UpdateLldbInit
7
- def self.call(options)
7
+ def self.call
8
8
  Configuration.check_inited
9
-
9
+ if Configuration.build_using_repo_paths
10
+ raise "\n\nlldb shenanigans not supported when 'build_using_repo_paths' is enabled".red
11
+ end
12
+
10
13
  argument_pods = ARGV.dup
11
14
 
12
15
  unless argument_pods.count > 0
@@ -22,7 +25,7 @@ module PodBuilder
22
25
  app_podfile_content = File.read(PodBuilder::project_path("Podfile"))
23
26
 
24
27
  lldbinit_path = File.expand_path(argument_pods[0])
25
- lldbinit_content = File.exists?(lldbinit_path) ? File.read(lldbinit_path) : ""
28
+ lldbinit_content = File.exist?(lldbinit_path) ? File.read(lldbinit_path) : ""
26
29
  status_hash = podfiles_status_hash(app_podfile_content, podfile_restore_content)
27
30
  if lldbinit_content.include?("# <pb_md5:#{base_path}:#{status_hash}")
28
31
  puts "\n\n🎉 already in sync!\n".green
@@ -55,10 +58,9 @@ module PodBuilder
55
58
  name = File.basename(framework_path, File.extname(framework_path))
56
59
  executable_path = File.join(framework_path, name)
57
60
 
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)
61
+ parent_framework_path = File.expand_path(File.joing(framework_path, ".."))
62
+ framework_info_path = File.join(parent_framework_path, Configuration.prebuilt_info_filename)
63
+ data = JSON.parse(File.read(framework_info_path))
62
64
 
63
65
  original_compile_path = data["original_compile_path"]
64
66
  is_prebuilt = data.fetch("is_prebuilt", true)
@@ -125,7 +127,7 @@ module PodBuilder
125
127
  puts "Writing #{lldbinit_path}".yellow
126
128
 
127
129
  FileUtils.touch(lldbinit_path)
128
- raise "\n\nDestination file should be a file" unless File.exists?(lldbinit_path)
130
+ raise "\n\nDestination file should be a file".red unless File.exist?(lldbinit_path)
129
131
 
130
132
  lldbinit_lines = []
131
133
  skipNext = false
@@ -138,7 +140,7 @@ module PodBuilder
138
140
  next
139
141
  elsif line != "\n"
140
142
  if line.include?("settings set target.source-map")
141
- raise "\n\n#{lldbinit_destination_path} already includes a manual `settings set target.source-map`. This is unsupported and you'll have to manually remove that entry\n"
143
+ raise "\n\n#{lldbinit_destination_path} already includes a manual `settings set target.source-map`. This is unsupported and you'll have to manually remove that entry\n".red
142
144
  end
143
145
  lldbinit_lines.push(line)
144
146
  end
@@ -19,13 +19,18 @@ module PodBuilder
19
19
  "module_name": "GoogleMobileAds"
20
20
  }
21
21
  }.freeze
22
- DEFAULT_SKIP_PODS = ["GoogleMaps"]
22
+ DEFAULT_SKIP_PODS = ["GoogleMaps", "Flipper", "FlipperKit", "Flipper-DoubleConversion", "Flipper-Folly", "Flipper-Glog", "Flipper-PeerTalk", "Flipper-RSocket", "React-cxxreact"]
23
23
  DEFAULT_FORCE_PREBUILD_PODS = ["Firebase", "GoogleTagManager"]
24
24
  DEFAULT_BUILD_SYSTEM = "Legacy".freeze # either Latest (New build system) or Legacy (Standard build system)
25
+ DEFAULT_LIBRARY_EVOLUTION_SUPPORT = false
25
26
  MIN_LFS_SIZE_KB = 256.freeze
27
+ DEFAULT_PLATFORMS = ["iphoneos", "iphonesimulator", "appletvos", "appletvsimulator"].freeze
28
+ DEFAULT_BUILD_FOR_APPLE_SILICON = false
29
+ DEFAULT_BUILD_USING_REPO_PATHS = false
26
30
 
27
31
  private_constant :DEFAULT_BUILD_SETTINGS
28
32
  private_constant :DEFAULT_BUILD_SYSTEM
33
+ private_constant :DEFAULT_LIBRARY_EVOLUTION_SUPPORT
29
34
  private_constant :MIN_LFS_SIZE_KB
30
35
 
31
36
  class <<self
@@ -33,6 +38,7 @@ module PodBuilder
33
38
  attr_accessor :build_settings
34
39
  attr_accessor :build_settings_overrides
35
40
  attr_accessor :build_system
41
+ attr_accessor :library_evolution_support
36
42
  attr_accessor :base_path
37
43
  attr_accessor :spec_overrides
38
44
  attr_accessor :skip_licenses
@@ -50,15 +56,23 @@ module PodBuilder
50
56
  attr_accessor :lfs_include_pods_folder
51
57
  attr_accessor :project_name
52
58
  attr_accessor :restore_enabled
53
- attr_accessor :framework_plist_filename
54
- attr_accessor :lock_filename
59
+ attr_accessor :prebuilt_info_filename
60
+ attr_accessor :lockfile_name
61
+ attr_accessor :lockfile_path
62
+ attr_accessor :use_bundler
63
+ attr_accessor :deterministic_build
64
+ attr_accessor :supported_platforms
65
+ attr_accessor :build_for_apple_silicon
66
+ attr_accessor :build_using_repo_paths
67
+ attr_accessor :react_native_project
55
68
  end
56
69
 
57
70
  @allow_building_development_pods = false
58
71
  @build_settings = DEFAULT_BUILD_SETTINGS
59
72
  @build_settings_overrides = {}
60
73
  @build_system = DEFAULT_BUILD_SYSTEM
61
- @base_path = "Frameworks" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
74
+ @library_evolution_support = DEFAULT_LIBRARY_EVOLUTION_SUPPORT
75
+ @base_path = "PodBuilder" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
62
76
  @spec_overrides = DEFAULT_SPEC_OVERRIDE
63
77
  @skip_licenses = []
64
78
  @skip_pods = DEFAULT_SKIP_PODS
@@ -66,8 +80,8 @@ module PodBuilder
66
80
  @license_filename = "Pods-acknowledgements"
67
81
  @subspecs_to_split = []
68
82
  @development_pods_paths = []
69
- @build_base_path = "/tmp/pod_builder_".freeze
70
- @build_path = "#{build_base_path}#{(Time.now.to_f * 1000).to_i}".freeze
83
+ @build_base_path = "/tmp/pod_builder".freeze
84
+ @build_path = build_base_path
71
85
  @configuration_filename = "PodBuilder.json".freeze
72
86
  @dev_pods_configuration_filename = "PodBuilderDevPodsPaths.json".freeze
73
87
  @lfs_min_file_size = MIN_LFS_SIZE_KB
@@ -75,8 +89,17 @@ module PodBuilder
75
89
  @lfs_include_pods_folder = false
76
90
  @project_name = ""
77
91
  @restore_enabled = true
78
- @framework_plist_filename = "PodBuilder.plist"
79
- @lock_filename = "PodBuilder.lock"
92
+ @prebuilt_info_filename = "PodBuilder.json"
93
+ @lockfile_name = "PodBuilder.lock"
94
+ @lockfile_path = "/tmp/#{lockfile_name}"
95
+
96
+ @use_bundler = false
97
+ @deterministic_build = false
98
+
99
+ @supported_platforms = DEFAULT_PLATFORMS
100
+ @build_for_apple_silicon = DEFAULT_BUILD_FOR_APPLE_SILICON
101
+ @build_using_repo_paths = DEFAULT_BUILD_USING_REPO_PATHS
102
+ @react_native_project = false
80
103
 
81
104
  def self.check_inited
82
105
  raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil?
@@ -106,17 +129,17 @@ module PodBuilder
106
129
  end
107
130
  end
108
131
  if value = json["skip_licenses"]
109
- if value.is_a?(Array) && value.count > 0
132
+ if value.is_a?(Array)
110
133
  Configuration.skip_licenses = value
111
134
  end
112
135
  end
113
136
  if value = json["skip_pods"]
114
- if value.is_a?(Array) && value.count > 0
137
+ if value.is_a?(Array)
115
138
  Configuration.skip_pods = value
116
139
  end
117
140
  end
118
141
  if value = json["force_prebuild_pods"]
119
- if value.is_a?(Array) && value.count > 0
142
+ if value.is_a?(Array)
120
143
  Configuration.force_prebuild_pods = value
121
144
  end
122
145
  end
@@ -135,6 +158,11 @@ module PodBuilder
135
158
  Configuration.build_system = value
136
159
  end
137
160
  end
161
+ if value = json["library_evolution_support"]
162
+ if [TrueClass, FalseClass].include?(value.class)
163
+ Configuration.library_evolution_support = value
164
+ end
165
+ end
138
166
  if value = json["license_filename"]
139
167
  if value.is_a?(String) && value.length > 0
140
168
  Configuration.license_filename = value
@@ -170,10 +198,35 @@ module PodBuilder
170
198
  Configuration.allow_building_development_pods = value
171
199
  end
172
200
  end
201
+ if value = json["use_bundler"]
202
+ if [TrueClass, FalseClass].include?(value.class)
203
+ Configuration.use_bundler = value
204
+ end
205
+ end
206
+ if value = json["deterministic_build"]
207
+ if [TrueClass, FalseClass].include?(value.class)
208
+ Configuration.deterministic_build = value
209
+ end
210
+ end
211
+ if value = json["build_for_apple_silicon"]
212
+ if [TrueClass, FalseClass].include?(value.class)
213
+ Configuration.build_for_apple_silicon = value
214
+ end
215
+ end
216
+ if value = json["build_using_repo_paths"]
217
+ if [TrueClass, FalseClass].include?(value.class)
218
+ Configuration.build_using_repo_paths = value
219
+ end
220
+ end
221
+ if value = json["react_native_project"]
222
+ if [TrueClass, FalseClass].include?(value.class)
223
+ Configuration.react_native_project = value
224
+ end
225
+ end
173
226
 
174
227
  Configuration.build_settings.freeze
175
- else
176
- write
228
+
229
+ sanity_check()
177
230
  end
178
231
 
179
232
  dev_pods_configuration_path = File.join(Configuration.base_path, Configuration.dev_pods_configuration_filename)
@@ -188,6 +241,11 @@ module PodBuilder
188
241
  Configuration.development_pods_paths = json || []
189
242
  Configuration.development_pods_paths.freeze
190
243
  end
244
+
245
+ if !deterministic_build
246
+ build_path = "#{build_base_path}#{(Time.now.to_f * 1000).to_i}"
247
+ lockfile_path = File.join(PodBuilder::home, lockfile_name)
248
+ end
191
249
  end
192
250
 
193
251
  def self.write
@@ -201,15 +259,31 @@ module PodBuilder
201
259
  config["build_settings"] = Configuration.build_settings
202
260
  config["build_settings_overrides"] = Configuration.build_settings_overrides
203
261
  config["build_system"] = Configuration.build_system
262
+ config["library_evolution_support"] = Configuration.library_evolution_support
204
263
  config["license_filename"] = Configuration.license_filename
205
264
  config["subspecs_to_split"] = Configuration.subspecs_to_split
206
265
  config["lfs_update_gitattributes"] = Configuration.lfs_update_gitattributes
207
266
  config["lfs_include_pods_folder"] = Configuration.lfs_include_pods_folder
267
+ config["restore_enabled"] = Configuration.restore_enabled
268
+ config["allow_building_development_pods"] = Configuration.allow_building_development_pods
269
+ config["use_bundler"] = Configuration.use_bundler
270
+ config["deterministic_build"] = Configuration.deterministic_build
271
+ config["build_for_apple_silicon"] = Configuration.build_for_apple_silicon
272
+ config["build_using_repo_paths"] = Configuration.build_using_repo_paths
273
+ config["react_native_project"] = Configuration.react_native_project
208
274
 
209
275
  File.write(config_path, JSON.pretty_generate(config))
210
276
  end
211
277
 
212
278
  private
279
+
280
+ def self.sanity_check
281
+ Configuration.skip_pods.each do |pod|
282
+ if Configuration.force_prebuild_pods.include?(pod)
283
+ puts "PodBuilder.json contains '#{pod}' both in `force_prebuild_pods` and `skip_pods`. Will force prebuilding.".yellow
284
+ end
285
+ end
286
+ end
213
287
 
214
288
  def self.config_path
215
289
  unless path = podbuilder_path
@@ -221,6 +295,7 @@ module PodBuilder
221
295
 
222
296
  def self.podbuilder_path
223
297
  paths = Dir.glob("#{PodBuilder::home}/**/.pod_builder")
298
+ paths.reject! { |t| t.match(/pod-builder-.*\/Example\/#{File.basename(Configuration.base_path)}\/\.pod_builder$/i) }
224
299
  raise "\n\nToo many .pod_builder found `#{paths.join("\n")}`\n".red if paths.count > 1
225
300
 
226
301
  return paths.count > 0 ? File.dirname(paths.first) : nil