pod-builder 0.2.9 ā†’ 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e94c0d3d359f8e25592e0e2fc5619de65e2c2c6f75ff8a95de695bb174030179
4
- data.tar.gz: 0bbf0619eaaca7ada50417db5bafa2d635b8e18fa11a933587c89bdfc23c8aa1
3
+ metadata.gz: 7c838f4cbe15befbbc68c928298ba6ab8ad7d803d77e713002ef7e8e45dcafb9
4
+ data.tar.gz: c169f713fa235f50ca35243d94fa5ad339463d91373189c85e2394e123fb64a1
5
5
  SHA512:
6
- metadata.gz: 5a3f90940b9b043e04735bd9179f91a0463247377d4594c380c6d20f5779d33912994c2576e449de690ad20322fc5bf90310e0c5b8e50d84489075570ab240e6
7
- data.tar.gz: d2aa68b62b551ba9bc3a54fa8be33b3deac722aa14ce3953ea39edd9aa4cd1703f6957664e5c9b353a4696322c923140ae1075ed171d3b37f944978fea90be85
6
+ metadata.gz: 35ebe02dfc9e38663ff3d624d9e8fafc1e41ea05046c17f970822d29bc0697296e2c076a7af139273280d13c99bfb1071ef835dc87f42bfc3e8a9e0972e436a0
7
+ data.tar.gz: b15bf45df512b4dc5c6ca730530077f339626c6b01e5f8d58253839fa7bdb6a5bc4c93bd1468c88fa94cd809dae938455e584e896e5a1a0680791a8ef3bc1c7f
data/.vscode/launch.json CHANGED
@@ -138,7 +138,7 @@
138
138
  "args": [
139
139
  "switch",
140
140
  "-p",
141
- "SBTUITestTunnel",
141
+ "AFNetworking",
142
142
  ]
143
143
  },
144
144
  {
@@ -14,6 +14,7 @@ module PodBuilder
14
14
  return false
15
15
  end
16
16
 
17
+ Podfile.sanity_check()
17
18
  check_not_building_subspecs(argument_pods)
18
19
 
19
20
  install_update_repo = options.fetch(:update_repos, true)
@@ -27,22 +28,15 @@ module PodBuilder
27
28
  argument_pods = buildable_items.map(&:root_name)
28
29
  end
29
30
 
30
- argument_pods.select! { |x| buildable_items.map(&:root_name).include?(x) }
31
+ argument_pods.select! { |x| all_buildable_items.map(&:root_name).include?(x) }
31
32
  argument_pods.uniq!
32
33
 
33
- unless argument_pods.count > 0
34
- puts "\n\nNo pods to build found, `#{ARGV.join(" ")}` is/are prebuilt\n".yellow
35
- puts "\n\nšŸŽ‰ done!\n".green
36
-
37
- return true
38
- end
39
-
40
34
  Podfile.restore_podfile_clean(all_buildable_items)
41
35
 
42
36
  restore_file_error = Podfile.restore_file_sanity_check
43
37
 
44
38
  check_splitted_subspecs_are_static(all_buildable_items, options)
45
- check_pods_exists(argument_pods, buildable_items)
39
+ check_pods_exists(argument_pods, all_buildable_items)
46
40
 
47
41
  pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
48
42
  pods_to_build += other_subspecs(pods_to_build, buildable_items)
@@ -93,7 +87,7 @@ module PodBuilder
93
87
 
94
88
  builded_pods = podfiles_items.flatten
95
89
  builded_pods_and_deps = add_dependencies(builded_pods, all_buildable_items).select { |x| !x.is_prebuilt }
96
- Podfile::write_restorable(builded_pods_and_deps, all_buildable_items, analyzer)
90
+ Podfile::write_restorable(builded_pods_and_deps + prebuilt_items, all_buildable_items, analyzer)
97
91
  if !options.has_key?(:skip_prebuild_update)
98
92
  Podfile::write_prebuilt(all_buildable_items, analyzer)
99
93
  end
@@ -138,12 +138,10 @@ module PodBuilder
138
138
 
139
139
  podbuilder_podfile_path = PodBuilder::basepath("Podfile")
140
140
  rel_path = Pathname.new(podbuilder_podfile_path).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
141
-
142
- frameworks_base_path = PodBuilder::basepath("Rome")
143
-
141
+
144
142
  podfile_content = File.read(podbuilder_podfile_path)
145
143
 
146
- exclude_lines = Podfile::PODBUILDER_LOCK_ACTION.map { |x| Podfile.strip_line(x) }
144
+ exclude_lines = Podfile::PODBUILDER_LOCK_ACTION.map { |x| strip_line(x) }
147
145
 
148
146
  prebuilt_lines = ["# Autogenerated by PodBuilder (https://github.com/Subito-it/PodBuilder)\n", "# Any change to this file should be done on #{rel_path}\n", "\n"]
149
147
  podfile_content.each_line do |line|
@@ -152,7 +150,9 @@ module PodBuilder
152
150
  if pod_name = pod_definition_in(line, true)
153
151
  if podfile_item = all_buildable_items.detect { |x| x.name == pod_name }
154
152
  if Podspec.include?(podfile_item.name)
155
- line = "#{line.detect_indentation}#{podfile_item.prebuilt_entry}\n"
153
+ if podfile_item.is_prebuilt == false
154
+ line = "#{line.detect_indentation}#{podfile_item.prebuilt_entry}\n"
155
+ end
156
156
  end
157
157
  end
158
158
  end
@@ -259,6 +259,26 @@ module PodBuilder
259
259
  return error
260
260
  end
261
261
 
262
+ def self.sanity_check
263
+ podfile_path = PodBuilder::basepath("Podfile")
264
+ unless File.exist?(podfile_path)
265
+ return
266
+ end
267
+
268
+ lines = File.read(podfile_path).split("\n")
269
+ lines.each do |line|
270
+ stripped_line = strip_line(line)
271
+ unless !stripped_line.start_with?("#")
272
+ next
273
+ end
274
+
275
+ if stripped_line.match(/(pod')(.*?)(')/) != nil
276
+ starting_def_found = stripped_line.start_with?("def") && (line.match("\s*def\s") != nil)
277
+ raise "Unsupported single line def/pod. `def` and `pod` shouldn't be on the same line, please modify the following line:\n#{line}" if starting_def_found
278
+ end
279
+ end
280
+ end
281
+
262
282
  private
263
283
 
264
284
  def self.indentation_from_file(path)
@@ -337,7 +357,7 @@ module PodBuilder
337
357
  marker_found = false
338
358
  podfile_lines = []
339
359
  podfile_content.each_line do |line|
340
- stripped_line = Podfile::strip_line(line)
360
+ stripped_line = strip_line(line)
341
361
 
342
362
  podfile_lines.push(line)
343
363
  if stripped_line.start_with?("#{marker}do|")
@@ -82,9 +82,9 @@ module PodBuilder
82
82
  #
83
83
  attr_accessor :libraries
84
84
 
85
- # @return [Bool] Returns true if the source_files key is present
85
+ # @return [String] source_files
86
86
  #
87
- attr_accessor :has_source_files_key
87
+ attr_accessor :source_files
88
88
 
89
89
  # Initialize a new instance
90
90
  #
@@ -152,7 +152,10 @@ module PodBuilder
152
152
  @is_static = spec.root.attributes_hash["static_framework"] || false
153
153
  @xcconfig = spec.root.attributes_hash["xcconfig"] || {}
154
154
 
155
- @has_source_files_key = spec.root.attributes_hash.has_key?("source_files") || spec.attributes_hash.has_key?("source_files")
155
+ @source_files = spec.root.attributes_hash.fetch("source_files", [])
156
+ if @source_files.is_a? String
157
+ @source_files = @source_files.split(",")
158
+ end
156
159
 
157
160
  @build_configuration = spec.root.attributes_hash.dig("pod_target_xcconfig", "prebuild_configuration") || "release"
158
161
  @build_configuration.downcase!
@@ -216,13 +219,16 @@ module PodBuilder
216
219
  return true
217
220
  end
218
221
 
219
- # checking if there's a vendored_item matching the module name is a pretty good guess for a prebuilt pod.
220
- # Still suboptimal, maybe it should be more appropriate to use FileAccessor and check that no source code is provided (no *.{m,mm,c,cpp,swift, etc})
221
- if vendored_items.map { |x| File.basename(x) }.include?("#{@module_name}.framework")
222
- return true
223
- else
224
- return !@has_source_files_key && @vendored_items.count > 0
225
- end
222
+ # Podspecs aren't always properly written (source_file key is often used instead of header_files)
223
+ # Therefore it can become tricky to understand which pods are already precompiled by boxing a .framework or .a
224
+ vendored_items_paths = vendored_items.map { |x| File.basename(x) }
225
+ embedded_as_vendored = vendored_items_paths.include?("#{@module_name}.framework")
226
+ embedded_as_static_lib = vendored_items_paths.any? { |x| x.match(/#{module_name}.*\\.a/) != nil }
227
+
228
+ only_headers = @source_files.include?("*.h")
229
+ no_sources = (@source_files.count == 0 || only_headers) && @vendored_items.count > 0
230
+
231
+ return embedded_as_static_lib || embedded_as_vendored || only_headers || no_sources
226
232
  end
227
233
 
228
234
  # @return [Bool] True if it's a subspec
@@ -56,7 +56,7 @@ module PodBuilder
56
56
 
57
57
  # (_.*) will include prebuild podnames like s.subspec 'Podname_Subspec' do |p|
58
58
  subspec_regex = "s.subspec '#{pod_name}(_.*)?' do |p|"
59
- return podspec_content.match(/#{subspec_regex}/)
59
+ return (podspec_content.match(/#{subspec_regex}/) != nil)
60
60
  end
61
61
 
62
62
  private
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "0.2.9"
2
+ VERSION = "0.3.0"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pod-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-23 00:00:00.000000000 Z
11
+ date: 2018-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler