pod-builder 1.9.4 → 2.0.0.beta.18

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -0
  3. data/Example/Frameworks/.gitignore +6 -0
  4. data/Example/Frameworks/.pod_builder/pod_builder +0 -0
  5. data/Example/Frameworks/PodBuilder.json +10 -4
  6. data/Example/Frameworks/Podfile +23 -0
  7. data/Example/Frameworks/Podfile.restore +40 -0
  8. data/Example/PodBuilderExample/AppDelegate.swift +4 -0
  9. data/Example/PodBuilderExample.xcodeproj/project.pbxproj +3 -8
  10. data/Example/{PodBuilderExample.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist → PodBuilderExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist} +2 -8
  11. data/Example/Podfile +44 -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 +38 -1
  16. data/exe/pod_builder +14 -14
  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 +110 -109
  20. data/lib/pod_builder/command/clean.rb +9 -11
  21. data/lib/pod_builder/command/clear_lldbinit.rb +1 -1
  22. data/lib/pod_builder/command/deintegrate.rb +2 -1
  23. data/lib/pod_builder/command/generate_lfs.rb +2 -2
  24. data/lib/pod_builder/command/install_sources.rb +1 -1
  25. data/lib/pod_builder/command/switch.rb +99 -99
  26. data/lib/pod_builder/command/sync_podfile.rb +2 -1
  27. data/lib/pod_builder/command/update.rb +1 -1
  28. data/lib/pod_builder/command/update_lldbinit.rb +2 -2
  29. data/lib/pod_builder/configuration.rb +61 -7
  30. data/lib/pod_builder/core.rb +60 -5
  31. data/lib/pod_builder/info.rb +24 -90
  32. data/lib/pod_builder/install.rb +148 -82
  33. data/lib/pod_builder/podfile/post_actions.rb +0 -1
  34. data/lib/pod_builder/podfile.rb +83 -14
  35. data/lib/pod_builder/podfile_item.rb +152 -74
  36. data/lib/pod_builder/podspec.rb +125 -133
  37. data/lib/pod_builder/rome/post_install.rb +248 -0
  38. data/lib/pod_builder/rome/pre_install.rb +6 -0
  39. data/lib/pod_builder/templates/build_podfile.template +1 -1
  40. data/lib/pod_builder/version.rb +1 -1
  41. data/pod-builder.gemspec +3 -3
  42. metadata +28 -60
  43. data/Example/Pods/Alamofire/LICENSE +0 -19
  44. data/Example/Pods/Alamofire/README.md +0 -242
  45. data/Example/Pods/Alamofire/Source/AFError.swift +0 -460
  46. data/Example/Pods/Alamofire/Source/Alamofire.swift +0 -465
  47. data/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift +0 -37
  48. data/Example/Pods/Alamofire/Source/MultipartFormData.swift +0 -580
  49. data/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift +0 -233
  50. data/Example/Pods/Alamofire/Source/Notifications.swift +0 -55
  51. data/Example/Pods/Alamofire/Source/ParameterEncoding.swift +0 -483
  52. data/Example/Pods/Alamofire/Source/Request.swift +0 -654
  53. data/Example/Pods/Alamofire/Source/Response.swift +0 -567
  54. data/Example/Pods/Alamofire/Source/ResponseSerialization.swift +0 -715
  55. data/Example/Pods/Alamofire/Source/Result.swift +0 -300
  56. data/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift +0 -307
  57. data/Example/Pods/Alamofire/Source/SessionDelegate.swift +0 -725
  58. data/Example/Pods/Alamofire/Source/SessionManager.swift +0 -896
  59. data/Example/Pods/Alamofire/Source/TaskDelegate.swift +0 -466
  60. data/Example/Pods/Alamofire/Source/Timeline.swift +0 -136
  61. data/Example/Pods/Alamofire/Source/Validation.swift +0 -315
  62. data/Example/Pods/Manifest.lock +0 -16
  63. data/Example/Pods/Pods.xcodeproj/project.pbxproj +0 -673
  64. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Alamofire.xcscheme +0 -60
  65. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Pods-PodBuilderExample.xcscheme +0 -60
  66. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +0 -21
  67. data/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m +0 -5
  68. data/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch +0 -12
  69. data/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h +0 -16
  70. data/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap +0 -6
  71. data/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig +0 -9
  72. data/Example/Pods/Target Support Files/Alamofire/Info.plist +0 -26
  73. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Info.plist +0 -26
  74. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.markdown +0 -26
  75. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.plist +0 -58
  76. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-dummy.m +0 -5
  77. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-frameworks.sh +0 -153
  78. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-resources.sh +0 -118
  79. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-umbrella.h +0 -16
  80. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.debug.xcconfig +0 -11
  81. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.modulemap +0 -6
  82. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.release.xcconfig +0 -11
  83. data/lib/pod_builder/cocoapods/specification.rb +0 -27
@@ -22,10 +22,14 @@ module PodBuilder
22
22
  DEFAULT_SKIP_PODS = ["GoogleMaps"]
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
26
29
 
27
30
  private_constant :DEFAULT_BUILD_SETTINGS
28
31
  private_constant :DEFAULT_BUILD_SYSTEM
32
+ private_constant :DEFAULT_LIBRARY_EVOLUTION_SUPPORT
29
33
  private_constant :MIN_LFS_SIZE_KB
30
34
 
31
35
  class <<self
@@ -33,6 +37,7 @@ module PodBuilder
33
37
  attr_accessor :build_settings
34
38
  attr_accessor :build_settings_overrides
35
39
  attr_accessor :build_system
40
+ attr_accessor :library_evolution_support
36
41
  attr_accessor :base_path
37
42
  attr_accessor :spec_overrides
38
43
  attr_accessor :skip_licenses
@@ -51,13 +56,19 @@ module PodBuilder
51
56
  attr_accessor :project_name
52
57
  attr_accessor :restore_enabled
53
58
  attr_accessor :framework_plist_filename
54
- attr_accessor :lock_filename
59
+ attr_accessor :lockfile_name
60
+ attr_accessor :lockfile_path
61
+ attr_accessor :use_bundler
62
+ attr_accessor :deterministic_build
63
+ attr_accessor :supported_platforms
64
+ attr_accessor :build_for_apple_silicon
55
65
  end
56
66
 
57
67
  @allow_building_development_pods = false
58
68
  @build_settings = DEFAULT_BUILD_SETTINGS
59
69
  @build_settings_overrides = {}
60
70
  @build_system = DEFAULT_BUILD_SYSTEM
71
+ @library_evolution_support = DEFAULT_LIBRARY_EVOLUTION_SUPPORT
61
72
  @base_path = "Frameworks" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
62
73
  @spec_overrides = DEFAULT_SPEC_OVERRIDE
63
74
  @skip_licenses = []
@@ -66,8 +77,8 @@ module PodBuilder
66
77
  @license_filename = "Pods-acknowledgements"
67
78
  @subspecs_to_split = []
68
79
  @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
80
+ @build_base_path = "/tmp/pod_builder".freeze
81
+ @build_path = build_base_path
71
82
  @configuration_filename = "PodBuilder.json".freeze
72
83
  @dev_pods_configuration_filename = "PodBuilderDevPodsPaths.json".freeze
73
84
  @lfs_min_file_size = MIN_LFS_SIZE_KB
@@ -76,7 +87,14 @@ module PodBuilder
76
87
  @project_name = ""
77
88
  @restore_enabled = true
78
89
  @framework_plist_filename = "PodBuilder.plist"
79
- @lock_filename = "PodBuilder.lock"
90
+ @lockfile_name = "PodBuilder.lock"
91
+ @lockfile_path = "/tmp/#{lockfile_name}"
92
+
93
+ @use_bundler = false
94
+ @deterministic_build = false
95
+
96
+ @supported_platforms = DEFAULT_PLATFORMS
97
+ @build_for_apple_silicon = DEFAULT_BUILD_FOR_APPLE_SILICON
80
98
 
81
99
  def self.check_inited
82
100
  raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil?
@@ -106,17 +124,17 @@ module PodBuilder
106
124
  end
107
125
  end
108
126
  if value = json["skip_licenses"]
109
- if value.is_a?(Array) && value.count > 0
127
+ if value.is_a?(Array)
110
128
  Configuration.skip_licenses = value
111
129
  end
112
130
  end
113
131
  if value = json["skip_pods"]
114
- if value.is_a?(Array) && value.count > 0
132
+ if value.is_a?(Array)
115
133
  Configuration.skip_pods = value
116
134
  end
117
135
  end
118
136
  if value = json["force_prebuild_pods"]
119
- if value.is_a?(Array) && value.count > 0
137
+ if value.is_a?(Array)
120
138
  Configuration.force_prebuild_pods = value
121
139
  end
122
140
  end
@@ -135,6 +153,11 @@ module PodBuilder
135
153
  Configuration.build_system = value
136
154
  end
137
155
  end
156
+ if value = json["library_evolution_support"]
157
+ if [TrueClass, FalseClass].include?(value.class)
158
+ Configuration.library_evolution_support = value
159
+ end
160
+ end
138
161
  if value = json["license_filename"]
139
162
  if value.is_a?(String) && value.length > 0
140
163
  Configuration.license_filename = value
@@ -170,8 +193,25 @@ module PodBuilder
170
193
  Configuration.allow_building_development_pods = value
171
194
  end
172
195
  end
196
+ if value = json["use_bundler"]
197
+ if [TrueClass, FalseClass].include?(value.class)
198
+ Configuration.use_bundler = value
199
+ end
200
+ end
201
+ if value = json["deterministic_build"]
202
+ if [TrueClass, FalseClass].include?(value.class)
203
+ Configuration.deterministic_build = value
204
+ end
205
+ end
206
+ if value = json["build_for_apple_silicon"]
207
+ if [TrueClass, FalseClass].include?(value.class)
208
+ Configuration.build_for_apple_silicon = value
209
+ end
210
+ end
173
211
 
174
212
  Configuration.build_settings.freeze
213
+
214
+ sanity_check()
175
215
  else
176
216
  write
177
217
  end
@@ -188,6 +228,11 @@ module PodBuilder
188
228
  Configuration.development_pods_paths = json || []
189
229
  Configuration.development_pods_paths.freeze
190
230
  end
231
+
232
+ if !deterministic_build
233
+ build_path = "#{build_base_path}#{(Time.now.to_f * 1000).to_i}"
234
+ lockfile_path = File.join(PodBuilder::home, lockfile_name)
235
+ end
191
236
  end
192
237
 
193
238
  def self.write
@@ -201,6 +246,7 @@ module PodBuilder
201
246
  config["build_settings"] = Configuration.build_settings
202
247
  config["build_settings_overrides"] = Configuration.build_settings_overrides
203
248
  config["build_system"] = Configuration.build_system
249
+ config["library_evolution_support"] = Configuration.library_evolution_support
204
250
  config["license_filename"] = Configuration.license_filename
205
251
  config["subspecs_to_split"] = Configuration.subspecs_to_split
206
252
  config["lfs_update_gitattributes"] = Configuration.lfs_update_gitattributes
@@ -210,6 +256,14 @@ module PodBuilder
210
256
  end
211
257
 
212
258
  private
259
+
260
+ def self.sanity_check
261
+ Configuration.skip_pods.each do |pod|
262
+ if Configuration.force_prebuild_pods.include?(pod)
263
+ puts "PodBuilder.json contains '#{pod}' both in `force_prebuild_pods` and `skip_pods`. Will force prebuilding.".yellow
264
+ end
265
+ end
266
+ end
213
267
 
214
268
  def self.config_path
215
269
  unless path = podbuilder_path
@@ -5,6 +5,7 @@ require 'colored'
5
5
  require 'pod_builder/podfile'
6
6
  require 'pod_builder/podfile_item'
7
7
  require 'pod_builder/analyze'
8
+ require 'pod_builder/analyzer'
8
9
  require 'pod_builder/install'
9
10
  require 'pod_builder/info'
10
11
  require 'pod_builder/configuration'
@@ -19,12 +20,18 @@ module PodBuilder
19
20
  return
20
21
  end
21
22
 
23
+ unless File.directory?(path)
24
+ FileUtils.rm(path)
25
+
26
+ return
27
+ end
28
+
22
29
  current_dir = Dir.pwd
23
30
 
24
31
  Dir.chdir(path)
25
32
 
26
33
  h = `git rev-parse --show-toplevel`.strip()
27
- raise "\n\nNo git repository found, can't delete files!\n".red if h.empty?
34
+ raise "\n\nNo git repository found in '#{path}', can't delete files!\n".red if h.empty? && !path.start_with?(Configuration.build_base_path)
28
35
 
29
36
  FileUtils.rm_rf(path)
30
37
 
@@ -36,8 +43,51 @@ module PodBuilder
36
43
  end
37
44
 
38
45
  def self.basepath(child = "")
46
+ if child.nil?
47
+ return nil
48
+ end
49
+
39
50
  return "#{Configuration.base_path}/#{child}".gsub("//", "/").gsub(/\/$/, '')
40
51
  end
52
+
53
+ def self.prebuiltpath(child = "")
54
+ if child.nil?
55
+ return nil
56
+ end
57
+
58
+ path = basepath("Rome")
59
+ if child.length > 0
60
+ path += "/#{child}"
61
+ end
62
+
63
+ return path
64
+ end
65
+
66
+ def self.buildpath_prebuiltpath(child = "")
67
+ if child.nil?
68
+ return nil
69
+ end
70
+
71
+ path = "#{Configuration.build_path}/Rome"
72
+ if child.length > 0
73
+ path += "/#{child}"
74
+ end
75
+
76
+ return path
77
+ end
78
+
79
+ def self.dsympath(child = "")
80
+ if child.nil?
81
+ return nil
82
+ end
83
+
84
+ path = basepath("dSYM")
85
+ if child.length > 0
86
+ path += "/#{child}"
87
+ end
88
+
89
+ return path
90
+ end
41
91
 
42
92
  def self.project_path(child = "")
43
93
  project = PodBuilder::find_xcodeworkspace
@@ -97,14 +147,18 @@ module PodBuilder
97
147
  return swift_version
98
148
  end
99
149
 
100
- def self.add_lock_file
101
- lockfile_path = File.join(home, Configuration.lock_filename)
150
+ def self.add_lockfile
151
+ lockfile_path = Configuration.lockfile_path
102
152
 
103
153
  if File.exist?(lockfile_path)
104
154
  if pid = File.read(lockfile_path)
105
155
  begin
106
156
  if Process.getpgid(pid)
157
+ if Configuration.deterministic_build
158
+ raise "\n\nAnother PodBuilder pending task is running\n".red
159
+ else
107
160
  raise "\n\nAnother PodBuilder pending task is running on this project\n".red
161
+ end
108
162
  end
109
163
  rescue
110
164
  end
@@ -114,8 +168,9 @@ module PodBuilder
114
168
  File.write(lockfile_path, Process.pid, mode: "w")
115
169
  end
116
170
 
117
- def self.remove_lock_file
118
- lockfile_path = File.join(home, Configuration.lock_filename)
171
+ def self.remove_lockfile
172
+ lockfile_path = Configuration.lockfile_path
173
+
119
174
  if File.exist?(lockfile_path)
120
175
  FileUtils.rm(lockfile_path)
121
176
  end
@@ -3,67 +3,33 @@ require 'cfpropertylist'
3
3
  module PodBuilder
4
4
  class Info
5
5
  def self.generate_info
6
- restore_path = PodBuilder::basepath("Podfile.restore")
7
- unless File.exist?(restore_path)
8
- raise "No Podfile.restore file found"
9
- return false
10
- end
11
-
12
- podspec_path = PodBuilder::basepath("PodBuilder.podspec")
13
- unless File.exist?(podspec_path)
14
- raise "No PodBuilder.podspec file found"
15
- return false
16
- end
17
-
18
- restore_content = File.read(restore_path)
19
-
20
6
  swift_version = PodBuilder::system_swift_version
21
7
  result = {}
22
8
  name = nil
23
- File.read(podspec_path).each_line do |line|
24
- if (matches = line.match(/s.subspec '(.*)' do \|p\|/)) && matches.size == 2
25
- name = matches[1]
26
- elsif (matches = line.match(/p.vendored_frameworks = '(.*)'/)) && matches.size == 2
27
- path = matches[1].split("'").first
28
- plist_path = File.join(PodBuilder::basepath(path), Configuration.framework_plist_filename)
29
9
 
30
- # fix name if it's a subspec
31
- if (subspec_items = name.split("_")) && (subspec = subspec_items.last) && subspec_items.count > 1
32
- if path.include?("/#{subspec}")
33
- name = name.sub(/_#{subspec}$/, "/#{subspec}")
34
- end
35
- end
36
-
37
- base = PodBuilder::basepath.gsub(PodBuilder::home + "/", "")
38
- framework_path = File.join(base, matches[1].split("'").first)
39
- result[name] = { framework_path: framework_path }
10
+ Dir.glob(PodBuilder::prebuiltpath("**/*.framework")).each do |path|
11
+ plist_path = File.join(path, Configuration.framework_plist_filename)
40
12
 
41
- specs = restore_podspecs(name.split("/").first, restore_content)
42
- unless specs.count > 0
43
- raise "pod `#{name}` not found in restore file"
44
- end
45
-
46
- restore_line = restore_line(name, restore_content)
47
- version = version_info(restore_line)
48
- is_static = is_static(restore_line)
49
- result[name].merge!({ "restore_info": { "version": version, "specs": specs, "is_static": is_static }})
50
- if swift_version = swift_version(restore_line)
51
- result[name][:restore_info].merge!({ "swift_version": swift_version })
52
- end
53
-
54
- prebuilt_info = prebuilt_info(plist_path)
55
- if prebuilt_info.count > 0
56
- result[name].merge!({ "prebuilt_info": prebuilt_info })
57
- end
58
- end
13
+ name, prebuilt_info = prebuilt_info(plist_path)
14
+ result[name] = prebuilt_info
59
15
  end
60
16
 
61
17
  return result
62
18
  end
63
19
 
64
20
  private
21
+
22
+ def self.pod_name_from_entry(line)
23
+ if (matches = line&.match(/pod '(.*?)'/)) && matches.size == 2
24
+ pod_name = matches[1]
25
+
26
+ return pod_name
27
+ end
28
+
29
+ return "unknown_podname"
30
+ end
65
31
 
66
- def self.version_info(line)
32
+ def self.version_info_from_entry(line)
67
33
  if (matches = line&.match(/pod '(.*)', '=(.*)'/)) && matches.size == 3
68
34
  pod_name = matches[1]
69
35
  tag = matches[2]
@@ -87,31 +53,15 @@ module PodBuilder
87
53
  tag = matches[3]
88
54
 
89
55
  return { "repo": repo, "tag": tag }
56
+ elsif (matches = line&.match(/pod '(.*)', :path => '(.*)'/)) && matches.size == 3
57
+ pod_name = matches[1]
58
+
59
+ return { "repo": "local" }
90
60
  else
91
61
  raise "Failed extracting version from line:\n#{line}\n\n"
92
62
  end
93
63
  end
94
64
 
95
- def self.swift_version(line)
96
- return podbuilder_tag("sv", line)
97
- end
98
-
99
- def self.is_static(line)
100
- if str_tag = podbuilder_tag("is", line)
101
- return str_tag == "true"
102
- end
103
-
104
- return nil
105
- end
106
-
107
- def self.podbuilder_tag(name, line)
108
- if (matches = line&.match(/#{name}<(.*?)?>/)) && matches.size == 2
109
- return matches[1]
110
- end
111
-
112
- return nil
113
- end
114
-
115
65
  def self.prebuilt_info(path)
116
66
  unless File.exist?(path)
117
67
  return {}
@@ -125,32 +75,16 @@ module PodBuilder
125
75
  result.merge!({ "swift_version": swift_version})
126
76
  end
127
77
 
128
- pod_version = version_info(data["entry"])
78
+ pod_version = version_info_from_entry(data["entry"])
79
+ pod_name = pod_name_from_entry(data["entry"])
80
+
129
81
 
130
82
  result.merge!({ "version": pod_version })
131
83
  result.merge!({ "specs": (data["specs"] || []) })
132
84
  result.merge!({ "is_static": (data["is_static"] || false) })
133
85
  result.merge!({ "original_compile_path": (data["original_compile_path"] || "") })
134
86
 
135
- return result
136
- end
137
-
138
- def self.restore_podspecs(root_name, restore_content)
139
- specs = []
140
- restore_content.each_line do |line|
141
- if (matches = line.match(/pod '(#{root_name})(\/.*?)?'/)) && matches.size == 3
142
- specs.push(matches[1] + (matches[2] || ""))
143
- end
144
- end
145
-
146
- return specs.uniq
147
- end
148
-
149
- def self.restore_line(name, restore_content)
150
- unless (matches = restore_content.match(/pod '#{name}(\/.*)?'.*/)) && matches.size == 2
151
- raise "pod `#{name}` not found in restore file"
152
- end
153
- return matches[0]
154
- end
87
+ return pod_name, result
88
+ end
155
89
  end
156
90
  end