cocoapods-binary-cache 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 732c3a4179deba8a6f1ffe95e9035c12d80989a1b3edb0581a5d569f1b9ef542
4
- data.tar.gz: c72c2d4333f1525d2078896374b2fbe239891dc404ca35dadffc2f22fc4b8aff
3
+ metadata.gz: e14f6a05df17d10b35b5ddfb5d263cdeaed50e4e3bf348b6606c27036317c173
4
+ data.tar.gz: 856426aa42021e6fc6b69f1de0be1e1fbc2dc96f0ac50b146f380280a3dee236
5
5
  SHA512:
6
- metadata.gz: 9ff71c26afc711721ce4360999a94b03a36fcd49f51ead77583c5ef4b07e86c7c841effcfdc023a4968d26d19d33f66ed9ea0891ce046584e9c4bd50e6afa375
7
- data.tar.gz: 1c28065aefc4539864e5645d9d01c5b660c03a9df40ca72a05a07be80cba28c28906e11802ff4fcb676057628e4eb4f39a8eee72ec920a04d4acfc336589a9d2
6
+ metadata.gz: '090730e3c268eb4f3dc0a1d0d07546e9ed4bc92dae2962a4ebc1d65f58996762aa1866414a683cf94ebee6894ebaec3d916a62cd7fe65295d9e2d6a576fb7488'
7
+ data.tar.gz: ee499933ce3bb03ec19eefcd52e50dc2170ed92e7f8f9c557e8a7c8d38f9ee1730402666937a494efe655604b320b5b6d012f31a982eb21051fab891a7367a69
@@ -8,7 +8,7 @@ module PodPrebuild
8
8
  def validate(accumulated)
9
9
  return accumulated if library_evolution_supported? || @pod_lockfile.nil?
10
10
 
11
- dependencies_graph = DependenciesGraph.new(@pod_lockfile.lockfile)
11
+ dependencies_graph = DependenciesGraph.new(lockfile: @pod_lockfile.lockfile, invert_edge: true)
12
12
  clients = dependencies_graph.get_clients(accumulated.discard(@ignored_pods).missed.to_a)
13
13
  unless PodPrebuild.config.dev_pods_enabled?
14
14
  clients = clients.reject { |client| @pod_lockfile.dev_pods.keys.include?(client) }
@@ -10,10 +10,12 @@ require_relative "graph_visualizer"
10
10
  # https://github.com/monora/rgl/blob/master/lib/rgl/adjacency.rb
11
11
 
12
12
  class DependenciesGraph
13
- def initialize(lockfile)
14
- @lockfile = lockfile
13
+ def initialize(options)
14
+ @lockfile = options[:lockfile]
15
+ @devpod_only = options[:devpod_only]
16
+ @max_deps = options[:max_deps].to_i if options[:max_deps]
15
17
  # A normal edge is an edge (one direction) from library A to library B which is a dependency of A.
16
- @invert_edge = true
18
+ @invert_edge = options[:invert_edge] || false
17
19
  end
18
20
 
19
21
  # Input : a list of library names.
@@ -40,6 +42,10 @@ class DependenciesGraph
40
42
  @dependencies ||= (@lockfile && @lockfile.to_hash["PODS"])
41
43
  end
42
44
 
45
+ def dev_pod_sources
46
+ @dev_pod_sources ||= @lockfile.to_hash["EXTERNAL SOURCES"].select { |_, attributes| attributes.key?(:path) } || {}
47
+ end
48
+
43
49
  # Convert array of dictionaries -> a dictionary with format {A: [A's dependencies]}
44
50
  def pod_to_dependencies
45
51
  dependencies
@@ -49,6 +55,8 @@ class DependenciesGraph
49
55
 
50
56
  def add_vertex(graph, pod)
51
57
  node_name = sanitized_pod_name(pod)
58
+ return if @devpod_only && dev_pod_sources[node_name].nil?
59
+
52
60
  graph.add_vertex(node_name)
53
61
  node_name
54
62
  end
@@ -57,10 +65,20 @@ class DependenciesGraph
57
65
  Pod::Dependency.from_string(name).name
58
66
  end
59
67
 
68
+ def reach_max_deps(deps)
69
+ return unless @max_deps
70
+ return deps.count > @max_deps unless @devpod_only
71
+
72
+ deps = deps.reject { |name| dev_pod_sources[name].nil? }
73
+ deps.count > @max_deps
74
+ end
75
+
60
76
  def graph
61
77
  @graph ||= begin
62
78
  graph = RGL::DirectedAdjacencyGraph.new
63
79
  pod_to_dependencies.each do |pod, dependencies|
80
+ next if reach_max_deps(dependencies)
81
+
64
82
  pod_node = add_vertex(graph, pod)
65
83
  next if pod_node.nil?
66
84
 
@@ -5,7 +5,7 @@ require "digest/md5"
5
5
 
6
6
  class FolderChecksum
7
7
  def self.git_checksum(dir)
8
- checksum_of_files(`git ls-files #{dir}`.split("\n"))
8
+ checksum_of_files(`git ls-files #{File.realdirpath(dir).shellescape}`.split("\n"))
9
9
  rescue => e
10
10
  Pod::UI.warn "Cannot get checksum of tracked files under #{dir}: #{e}"
11
11
  checksum_of_files(Dir["#{dir}/**/*"].reject { |f| File.directory?(f) })
@@ -2,6 +2,11 @@ module Pod
2
2
  class Installer
3
3
  def alter_specs_for_prebuilt_pods
4
4
  cache = []
5
+
6
+ @original_specs = analysis_result.specifications
7
+ .map { |spec| [spec.name, Pod::Specification.from_file(spec.defined_in_file)] }
8
+ .to_h
9
+
5
10
  analysis_result.specifications
6
11
  .select { |spec| should_integrate_prebuilt_pod?(spec.root.name) }
7
12
  .group_by(&:root)
@@ -18,8 +18,18 @@ module Pod
18
18
  original_create_pod_installer(name)
19
19
  end
20
20
 
21
+ def original_specs_by_platform(name)
22
+ specs_for_pod(name).map do |platform, specs|
23
+ specs_ = specs.map { |spec| @original_specs[spec.name] }
24
+ [platform, specs_]
25
+ end.to_h
26
+ end
27
+
21
28
  def create_prebuilt_source_installer(name)
22
- source_installer = PodSourceInstaller.new(sandbox, podfile, specs_for_pod(name))
29
+ # A source installer needs to install with the original spec (instead of the altered spec).
30
+ # Otherwise, the cache will be corrupted because CocoaPods packs necessary dirs/files from temp dir
31
+ # to the cache dir based on the spec.
32
+ source_installer = PodSourceInstaller.new(sandbox, podfile, original_specs_by_platform(name))
23
33
  pod_installer = PrebuiltSourceInstaller.new(
24
34
  sandbox,
25
35
  podfile,
@@ -58,6 +58,7 @@ module Pod
58
58
  bitcode_enabled: PodPrebuild.config.bitcode_enabled?,
59
59
  device_build_enabled: PodPrebuild.config.device_build_enabled?,
60
60
  disable_dsym: PodPrebuild.config.disable_dsym?,
61
+ log_path: PodPrebuild.config.xcodebuild_log_path,
61
62
  args: PodPrebuild.config.build_args
62
63
  )
63
64
  PodPrebuild.remove_build_dir(sandbox_path)
@@ -43,6 +43,10 @@ module PodPrebuild
43
43
  end
44
44
  end
45
45
 
46
+ def preferred_sdk
47
+ @preferred_sdk ||= sdks.include?(device) ? device : sdks[0]
48
+ end
49
+
46
50
  def build_types
47
51
  @build_types ||= begin
48
52
  # TODO (thuyen): Add DSL options `build_for_types` to specify build types
@@ -78,15 +82,16 @@ module PodPrebuild
78
82
  configuration: configuration,
79
83
  sdk: sdk,
80
84
  deployment_target: targets.map { |t| t.platform.deployment_target }.max.to_s,
85
+ log_path: log_path(sdk),
81
86
  args: sdk == simulator ? @build_args[:simulator] : @build_args[:device]
82
87
  )
83
88
  end
84
89
 
85
90
  def create_xcframework(target)
86
- non_framework_paths = Dir[target_products_dir_of(target, sdks[0]) + "/*"] \
87
- - [framework_path_of(target, sdks[0])] \
88
- - dsym_paths_of(target, sdks[0]) \
89
- - bcsymbolmap_paths_of(target, sdks[0])
91
+ non_framework_paths = Dir[target_products_dir_of(target, preferred_sdk) + "/*"] \
92
+ - [framework_path_of(target, preferred_sdk)] \
93
+ - dsym_paths_of(target, preferred_sdk) \
94
+ - bcsymbolmap_paths_of(target, preferred_sdk)
90
95
  collect_output(target, non_framework_paths)
91
96
 
92
97
  output = "#{output_path(target)}/#{target.product_module_name}.xcframework"
@@ -248,5 +253,9 @@ module PodPrebuild
248
253
  def disable_dsym?
249
254
  @options[:disable_dsym]
250
255
  end
256
+
257
+ def log_path(sdk)
258
+ @options[:log_path].nil? ? nil : "#{@options[:log_path]}_#{sdk}"
259
+ end
251
260
  end
252
261
  end
@@ -32,7 +32,13 @@ module PodPrebuild
32
32
  end
33
33
  cmd += options[:args] if options[:args]
34
34
  cmd << "build"
35
- cmd << "2>&1"
35
+
36
+ if options[:log_path].nil?
37
+ cmd << "2>&1"
38
+ else
39
+ FileUtils.mkdir_p(File.dirname(options[:log_path]))
40
+ cmd << "> #{options[:log_path].shellescape}"
41
+ end
36
42
  cmd = cmd.join(" ")
37
43
 
38
44
  Pod::UI.puts_indented "$ #{cmd}" unless PodPrebuild.config.silent_build?
@@ -117,6 +117,10 @@ module PodPrebuild
117
117
  @dsl_config[:dont_remove_source_code]
118
118
  end
119
119
 
120
+ def xcodebuild_log_path
121
+ @dsl_config[:xcodebuild_log_path]
122
+ end
123
+
120
124
  def build_args
121
125
  @dsl_config[:build_args]
122
126
  end
@@ -178,6 +182,7 @@ module PodPrebuild
178
182
  :xcframework,
179
183
  :disable_dsym,
180
184
  :dont_remove_source_code,
185
+ :xcodebuild_log_path,
181
186
  :build_args,
182
187
  :save_cache_validation_to,
183
188
  :validate_prebuilt_settings,
@@ -8,11 +8,13 @@ module PodPrebuild
8
8
  @lockfile = options[:lockfile]
9
9
  @open = options[:open]
10
10
  @output_dir = options[:output_dir]
11
+ @devpod_only = options[:devpod_only]
12
+ @max_deps = options[:max_deps]
11
13
  end
12
14
 
13
15
  def run
14
16
  FileUtils.mkdir_p(@output_dir)
15
- graph = DependenciesGraph.new(@lockfile)
17
+ graph = DependenciesGraph.new(lockfile: @lockfile, devpod_only: @devpod_only, max_deps: @max_deps)
16
18
  output_path = "#{@output_dir}/graph.png"
17
19
  graph.write_graphic_file(output_path: output_path)
18
20
  system("open #{@output_path}") if @open
@@ -7,7 +7,9 @@ module Pod
7
7
  self.arguments = [CLAide::Argument.new("OUTPUT-DIR", false)]
8
8
  def self.options
9
9
  [
10
- ["--open", "Open the graph upon completion"]
10
+ ["--open", "Open the graph upon completion"],
11
+ ["--devpod_only", "Only include development pod"],
12
+ ["--max_deps", "Only include pod with number of dependencies <= max_deps"]
11
13
  ]
12
14
  end
13
15
 
@@ -17,7 +19,9 @@ module Pod
17
19
  config: prebuild_config,
18
20
  lockfile: config.lockfile,
19
21
  output_dir: argv.shift_argument || ".",
20
- open: argv.flag?("open")
22
+ open: argv.flag?("open"),
23
+ devpod_only: argv.flag?("devpod_only"),
24
+ max_deps: argv.option("max_deps")
21
25
  )
22
26
  end
23
27
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-binary-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bang Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-16 00:00:00.000000000 Z
11
+ date: 2021-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
202
  requirements: []
203
- rubygems_version: 3.0.3
203
+ rubygems_version: 3.1.2
204
204
  signing_key:
205
205
  specification_version: 4
206
206
  summary: Reduce build time by building pod frameworks and cache to remote storage,