cocoapods-binary-cache 0.1.5 → 0.1.10

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cocoapods-binary-cache/cache/validation_result.rb +4 -0
  3. data/lib/cocoapods-binary-cache/cache/validator.rb +1 -1
  4. data/lib/cocoapods-binary-cache/cache/validator_dependencies_graph.rb +7 -2
  5. data/lib/cocoapods-binary-cache/dependencies_graph/dependencies_graph.rb +20 -25
  6. data/lib/cocoapods-binary-cache/dependencies_graph/graph_visualizer.rb +29 -38
  7. data/lib/cocoapods-binary-cache/diagnosis/diagnosis.rb +9 -1
  8. data/lib/cocoapods-binary-cache/diagnosis/integration.rb +7 -3
  9. data/lib/cocoapods-binary-cache/env.rb +1 -1
  10. data/lib/cocoapods-binary-cache/helper/checksum.rb +10 -4
  11. data/lib/cocoapods-binary-cache/helper/lockfile.rb +1 -1
  12. data/lib/cocoapods-binary-cache/helper/podspec.rb +4 -2
  13. data/lib/cocoapods-binary-cache/hooks/post_install.rb +2 -12
  14. data/lib/cocoapods-binary-cache/hooks/pre_install.rb +22 -39
  15. data/lib/cocoapods-binary-cache/main.rb +0 -1
  16. data/lib/cocoapods-binary-cache/pod-binary/helper/build.rb +37 -0
  17. data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb +2 -2
  18. data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb +2 -9
  19. data/lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb +15 -14
  20. data/lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb +7 -10
  21. data/lib/cocoapods-binary-cache/pod-binary/integration.rb +1 -2
  22. data/lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb +4 -1
  23. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/embed_framework_script.rb +1 -1
  24. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/resolve_dependencies.rb +0 -3
  25. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/sandbox_analyzer_state.rb +29 -0
  26. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb +27 -12
  27. data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +57 -62
  28. data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +45 -121
  29. data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +2 -63
  30. data/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb +0 -1
  31. data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +195 -0
  32. data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +48 -0
  33. data/lib/cocoapods-binary-cache/prebuild_output/output.rb +7 -5
  34. data/lib/cocoapods-binary-cache/state_store.rb +16 -6
  35. data/lib/command/binary.rb +20 -1
  36. data/lib/command/config.rb +177 -8
  37. data/lib/command/executor/base.rb +9 -1
  38. data/lib/command/executor/fetcher.rb +5 -3
  39. data/lib/command/executor/prebuilder.rb +9 -7
  40. data/lib/command/executor/pusher.rb +2 -0
  41. data/lib/command/executor/visualizer.rb +3 -2
  42. data/lib/command/fetch.rb +0 -1
  43. data/lib/command/prebuild.rb +19 -3
  44. data/lib/command/push.rb +0 -1
  45. metadata +9 -11
  46. data/lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb +0 -52
  47. data/lib/cocoapods-binary-cache/pod-binary/helper/passer.rb +0 -25
  48. data/lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb +0 -29
  49. data/lib/cocoapods-binary-cache/pod-binary/tool/tool.rb +0 -12
  50. data/lib/cocoapods-binary-cache/pod-rome/build_framework.rb +0 -248
  51. data/lib/cocoapods-binary-cache/scheme_editor.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7896d5bccb5c1b995271da31a02a9374ff4abc833e081bff2b38fe2401dfa2da
4
- data.tar.gz: ca520b237ddf0377a1e1ca03f90e5f4afa79f576241662ae22c3a9fc86e158c5
3
+ metadata.gz: 2d362803909e7c1d6490e6e589706882e9b8b3e1a94c58fb496f790f8a8d41a5
4
+ data.tar.gz: ed54d6a54246ac70cf8b5a55e11d76b407b8e7f75aeaf1dfa863ecd6e15972c5
5
5
  SHA512:
6
- metadata.gz: 3a7a9a3decaa6a14b80c80b77e69576a9b77ccbb3b4a5760c23c6e02b7ebc809a1e326ccf19030d6a1e091cdaa21a2a0d14c141d87457e7fdba7742c04adcf37
7
- data.tar.gz: 4b6c9a841f4b98d41b1ad1ed36aaab65e7c7b59cd4ee30b1b13b0f695b264a0ef1222007adf305cab0be216d175f41d471a61368f641653592a31b5e23ecff1f
6
+ metadata.gz: 786d8ae14ca79bd43a4d2a0fda5b56f47bf59d8ba6043855609ad14f8ca18bca5ce5c7f40d121106756bf7cf4882f0b8c158f5f73fffc521c88dcf59f2c81d32
7
+ data.tar.gz: 7f213efbebb1cf27da7ac2794d154f83abb45ec16ae0b81b8f6a510af8e44101ae1b6b10341ac57c07d7ada16161551a42bd2ebd0e7c8680dff3029739d8cc38
@@ -7,6 +7,10 @@ module PodPrebuild
7
7
  @hit = hit.to_set - missed_with_reasons.keys
8
8
  end
9
9
 
10
+ def all
11
+ (hit + missed).to_set
12
+ end
13
+
10
14
  def missed
11
15
  @missed_with_reasons.keys.to_set
12
16
  end
@@ -5,7 +5,7 @@ module PodPrebuild
5
5
  PodPrebuild::PodfileChangesCacheValidator.new(options),
6
6
  PodPrebuild::NonDevPodsCacheValidator.new(options)
7
7
  ]
8
- @validators << PodPrebuild::DevPodsCacheValidator.new(options) if Pod::Podfile::DSL.dev_pods_enabled
8
+ @validators << PodPrebuild::DevPodsCacheValidator.new(options) if PodPrebuild.config.dev_pods_enabled?
9
9
  @validators << PodPrebuild::DependenciesGraphCacheValidator.new(options)
10
10
  @validators << PodPrebuild::ExclusionCacheValidator.new(options)
11
11
  end
@@ -1,11 +1,16 @@
1
1
  module PodPrebuild
2
2
  class DependenciesGraphCacheValidator < AccumulatedCacheValidator
3
+ def initialize(options)
4
+ super(options)
5
+ @ignored_pods = options[:ignored_pods] || Set.new
6
+ end
7
+
3
8
  def validate(accumulated)
4
9
  return accumulated if library_evolution_supported? || @pod_lockfile.nil?
5
10
 
6
11
  dependencies_graph = DependenciesGraph.new(@pod_lockfile.lockfile)
7
- clients = dependencies_graph.get_clients(accumulated.missed.to_a)
8
- unless Pod::Podfile::DSL.dev_pods_enabled
12
+ clients = dependencies_graph.get_clients(accumulated.discard(@ignored_pods).missed.to_a)
13
+ unless PodPrebuild.config.dev_pods_enabled?
9
14
  clients = clients.reject { |client| @pod_lockfile.dev_pods.keys.include?(client) }
10
15
  end
11
16
 
@@ -1,56 +1,50 @@
1
1
  # Copyright 2019 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved.
2
2
  # Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
3
3
 
4
- require 'rgl/adjacency'
5
- require 'rgl/dot'
6
- require_relative 'graph_visualizer'
4
+ require "rgl/adjacency"
5
+ require "rgl/dot"
6
+ require_relative "graph_visualizer"
7
7
 
8
- # Using RGL graph because GraphViz doesn't store adjacent of a node/vertex but we need to traverse a substree from any node
8
+ # Using RGL graph because GraphViz doesn't store adjacent of a node/vertex
9
+ # but we need to traverse a substree from any node
9
10
  # https://github.com/monora/rgl/blob/master/lib/rgl/adjacency.rb
10
11
 
11
12
  class DependenciesGraph
12
13
  def initialize(lockfile)
13
14
  @lockfile = lockfile
14
- @invert_edge = true # A normal edge is an edge (one direction) from library A to library B which is a dependency of A.
15
+ # A normal edge is an edge (one direction) from library A to library B which is a dependency of A.
16
+ @invert_edge = true
15
17
  end
16
18
 
17
19
  # Input : a list of library names.
18
20
  # Output: a set of library names which are clients (directly and indirectly) of those input libraries.
19
21
  def get_clients(libnames)
20
- result = Set.new()
22
+ result = Set.new
21
23
  libnames.each do |lib|
22
24
  if graph.has_vertex?(lib)
23
25
  result.merge(traverse_sub_tree(graph, lib))
24
26
  else
25
- puts "Warning: cannot find lib: #{lib}"
27
+ Pod::UI.puts "Warning: cannot find lib: #{lib}"
26
28
  end
27
29
  end
28
30
  result
29
31
  end
30
32
 
31
- def write_graphic_file(output_graphic_fmt, filename='graph', highlight_nodes=Set[])
32
- if !output_graphic_fmt
33
- puts 'Error: Need graphic format.'
34
- return
35
- end
36
- graph.write_to_graphic_file(output_graphic_fmt, dotfile=filename, options={}, highlight_nodes)
33
+ def write_graphic_file(options)
34
+ graph.write_to_graphic_file(options)
37
35
  end
38
36
 
39
37
  private
40
38
 
41
39
  def dependencies
42
- @dependencies ||= begin
43
- if @lockfile
44
- @lockfile.to_hash['PODS']
45
- else
46
- nil
47
- end
48
- end
40
+ @dependencies ||= (@lockfile && @lockfile.to_hash["PODS"])
49
41
  end
50
42
 
51
43
  # Convert array of dictionaries -> a dictionary with format {A: [A's dependencies]}
52
44
  def pod_to_dependencies
53
- dependencies.map { |d| d.is_a?(Hash) ? d : { d => [] } }.reduce({}) { |combined, individual| combined.merge!(individual) }
45
+ dependencies
46
+ .map { |d| d.is_a?(Hash) ? d : { d => [] } }
47
+ .reduce({}) { |combined, individual| combined.merge!(individual) }
54
48
  end
55
49
 
56
50
  def add_vertex(graph, pod)
@@ -65,14 +59,15 @@ class DependenciesGraph
65
59
 
66
60
  def graph
67
61
  @graph ||= begin
68
- graph = RGL::DirectedAdjacencyGraph.new()
69
-
62
+ graph = RGL::DirectedAdjacencyGraph.new
70
63
  pod_to_dependencies.each do |pod, dependencies|
71
64
  pod_node = add_vertex(graph, pod)
72
65
  next if pod_node.nil?
66
+
73
67
  dependencies.each do |dependency|
74
68
  dep_node = add_vertex(graph, dependency)
75
69
  next if dep_node.nil?
70
+
76
71
  if @invert_edge
77
72
  graph.add_edge(dep_node, pod_node)
78
73
  else
@@ -85,11 +80,11 @@ class DependenciesGraph
85
80
  end
86
81
 
87
82
  def traverse_sub_tree(graph, vertex)
88
- visited_nodes = Set.new()
83
+ visited_nodes = Set.new
89
84
  graph.each_adjacent(vertex) do |v|
90
85
  visited_nodes.add(v)
91
86
  visited_nodes.merge(traverse_sub_tree(graph, v))
92
87
  end
93
88
  visited_nodes
94
89
  end
95
- end
90
+ end
@@ -2,73 +2,64 @@
2
2
  # Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
3
3
  # https://github.com/monora/rgl/blob/0b526e16f9fb344abf387f4c5523d7917ce8f4b1/lib/rgl/dot.rb
4
4
 
5
- require 'rgl/rdot'
5
+ require "rgl/rdot"
6
6
 
7
7
  module RGL
8
8
  module Graph
9
- def to_dot_graph(params={}, highlight_nodes)
10
- params['name'] ||= self.class.name.gsub(/:/, '_')
11
- fontsize = params['fontsize'] ? params['fontsize'] : '12'
12
- graph = (directed? ? DOT::Digraph : DOT::Graph).new(params)
13
- edge_class = directed? ? DOT::DirectedEdge : DOT::Edge
14
- vertex_options = params['vertex'] || {}
15
- edge_options = params['edge'] || {}
9
+ def to_dot_graph(options)
10
+ highlight_nodes = options[:highlight_nodes] || Set.new
11
+ options["name"] ||= self.class.name.gsub(/:/, "_")
12
+ fontsize = options["fontsize"] || "12"
13
+ graph = (directed? ? DOT::Digraph : DOT::Graph).new(options)
14
+ edge_class = directed? ? DOT::DirectedEdge : DOT::Edge
15
+ vertex_options = options["vertex"] || {}
16
+ edge_options = options["edge"] || {}
16
17
 
17
18
  each_vertex do |v|
18
- default_vertex_options = {
19
- 'name' => vertex_id(v),
20
- 'fontsize' => fontsize,
21
- 'label' => vertex_label(v),
22
- 'style' => 'filled',
19
+ default_vertex_options = {
20
+ "name" => vertex_id(v),
21
+ "fontsize" => fontsize,
22
+ "label" => vertex_label(v),
23
+ "style" => "filled"
23
24
  }
24
- if highlight_nodes.include?(v)
25
- default_vertex_options = default_vertex_options.merge({
26
- 'color' => 'red',
27
- 'fillcolor' => 'red'
28
- })
29
- else
30
- default_vertex_options = default_vertex_options.merge({
31
- 'color' => 'blue',
32
- 'fillcolor' => 'blue'
33
- })
34
- end
35
-
25
+ default_vertex_options.merge!("color" => "red", "fillcolor" => "red") if highlight_nodes.include?(v)
36
26
  each_vertex_options = default_vertex_options.merge(vertex_options)
37
- vertex_options.each{|option, val| each_vertex_options[option] = val.call(v) if val.is_a?(Proc)}
27
+ vertex_options.each { |option, val| each_vertex_options[option] = val.call(v) if val.is_a?(Proc) }
38
28
  graph << DOT::Node.new(each_vertex_options)
39
29
  end
40
30
 
41
31
  each_edge do |u, v|
42
32
  default_edge_options = {
43
- 'from' => vertex_id(u),
44
- 'to' => vertex_id(v),
45
- 'fontsize' => fontsize
33
+ "from" => vertex_id(u),
34
+ "to" => vertex_id(v),
35
+ "fontsize" => fontsize
46
36
  }
47
37
  each_edge_options = default_edge_options.merge(edge_options)
48
- edge_options.each{|option, val| each_edge_options[option] = val.call(u, v) if val.is_a?(Proc)}
38
+ edge_options.each { |option, val| each_edge_options[option] = val.call(u, v) if val.is_a?(Proc) }
49
39
  graph << edge_class.new(each_edge_options)
50
40
  end
51
41
 
52
42
  graph
53
43
  end
54
44
 
55
- def write_to_graphic_file(fmt='png', dotfile="graph", options={}, highlight_nodes)
56
- src = dotfile + ".dot"
57
- dot = dotfile + "." + fmt
45
+ def write_to_graphic_file(options)
46
+ output_path = Pathname.new(options[:output_path])
47
+ fmt = output_path.extname.delete_prefix(".")
48
+ dotfile = output_path.sub_ext(".dot")
58
49
 
59
- File.open(src, 'w') do |f|
60
- f << self.to_dot_graph(params=options, highlight_nodes=highlight_nodes).to_s << "\n"
50
+ File.open(dotfile, "w") do |f|
51
+ f << to_dot_graph(options).to_s
61
52
  end
62
53
 
63
- unless system("dot -T#{fmt} #{src} -o #{dot}")
64
- message = <<-HEREDOC # Use <<- to indent End of String terminator
54
+ unless system("dot -T#{fmt} #{dotfile} -o #{output_path}")
55
+ message = <<~HEREDOC
65
56
  Error executing dot. Did you install GraphViz?
66
57
  Try installing it via Homebrew: `brew install graphviz`.
67
58
  Visit https://graphviz.org/download/ for more installation instructions.
68
59
  HEREDOC
69
60
  raise message
70
61
  end
71
- dot
62
+ output_path
72
63
  end
73
64
  end
74
65
  end
@@ -10,7 +10,15 @@ module PodPrebuild
10
10
  end
11
11
 
12
12
  def run
13
- @diagnosers.each(&:run)
13
+ diagnosis = @diagnosers.map(&:run)
14
+ errors = diagnosis.select { |d| d[0] == :error }.map { |d| d[1] }
15
+ warnings = diagnosis.select { |d| d[0] == :error }.map { |d| d[1] }
16
+
17
+ warnings.each { |d| Pod::UI.puts "⚠️ #{d[1]}" }
18
+ errors.each { |d| Pod::UI.puts "🚩 #{d[1]}" }
19
+ return if errors.empty? || !PodPrebuild.config.strict_diagnosis?
20
+
21
+ raise "There are #{errors.count} error(s) spotted after the diagnosis"
14
22
  end
15
23
  end
16
24
  end
@@ -3,17 +3,21 @@ require_relative "base"
3
3
  module PodPrebuild
4
4
  class IntegrationDiagnosis < BaseDiagnosis
5
5
  def run
6
- should_be_integrated = if Pod::Podfile::DSL.prebuild_job? \
6
+ should_be_integrated = if PodPrebuild.config.prebuild_job? \
7
7
  then @cache_validation.hit + @cache_validation.missed \
8
8
  else @cache_validation.hit \
9
9
  end
10
10
  should_be_integrated = should_be_integrated.map { |name| name.split("/")[0] }.to_set
11
11
  unintegrated = should_be_integrated.reject do |name|
12
12
  module_name = spec(name)&.module_name || name
13
- framework_path = @standard_sandbox.pod_dir(name) + "#{module_name}.framework"
13
+ framework_path = \
14
+ @standard_sandbox.pod_dir(name) + \
15
+ PodPrebuild.config.prebuilt_path(path: "#{module_name}.framework")
14
16
  framework_path.exist?
15
17
  end
16
- Pod::UI.puts "🚩 Unintegrated frameworks: #{unintegrated}".yellow unless unintegrated.empty?
18
+ return [] if unintegrated.empty?
19
+
20
+ [[:error, "Unintegrated frameworks: #{unintegrated}"]]
17
21
  end
18
22
  end
19
23
  end
@@ -13,7 +13,7 @@ module PodPrebuild
13
13
  end
14
14
 
15
15
  def stages
16
- @stages ||= Pod::Podfile::DSL.prebuild_job? ? [:prebuild, :integration] : [:integration]
16
+ @stages ||= PodPrebuild.config.prebuild_job? ? [:prebuild, :integration] : [:integration]
17
17
  end
18
18
 
19
19
  def current_stage
@@ -4,9 +4,15 @@
4
4
  require "digest/md5"
5
5
 
6
6
  class FolderChecksum
7
- def self.checksum(dir)
8
- files = Dir["#{dir}/**/*"].reject { |f| File.directory?(f) }
9
- content = files.map { |f| File.read(f) }.join
10
- Digest::MD5.hexdigest(content).to_s
7
+ def self.git_checksum(dir)
8
+ checksum_of_files(`git ls-files #{dir}`.split("\n"))
9
+ rescue => e
10
+ Pod::UI.warn "Cannot get checksum of tracked files under #{dir}: #{e}"
11
+ checksum_of_files(Dir["#{dir}/**/*"].reject { |f| File.directory?(f) })
12
+ end
13
+
14
+ def self.checksum_of_files(files)
15
+ checksums = files.sort.map { |f| Digest::MD5.hexdigest(File.read(f)) }
16
+ Digest::MD5.hexdigest(checksums.join)
11
17
  end
12
18
  end
@@ -68,7 +68,7 @@ module PodPrebuild
68
68
  # Generate a map between a dev_pod and it source hash
69
69
  def dev_pod_hashes_map
70
70
  @dev_pod_hashes_map ||=
71
- dev_pod_sources.map { |name, attribs| [name, FolderChecksum.checksum(attribs[:path])] }.to_h
71
+ dev_pod_sources.map { |name, attribs| [name, FolderChecksum.git_checksum(attribs[:path])] }.to_h
72
72
  end
73
73
 
74
74
  # Parse an item under `PODS` section of a Lockfile
@@ -1,8 +1,10 @@
1
1
  module Pod
2
2
  class Specification
3
- # TODO: this detect objc lib as empty source, eg. Realm
4
3
  def empty_source_files?
5
- return subspecs.all?(&:empty_source_files?) unless subspecs.empty?
4
+ unless subspecs.empty?
5
+ # return early if there are some files in subpec(s) but process the spec itself
6
+ return false unless subspecs.all?(&:empty_source_files?)
7
+ end
6
8
 
7
9
  check = lambda do |patterns|
8
10
  patterns = [patterns] if patterns.is_a?(String)
@@ -5,29 +5,19 @@ module PodPrebuild
5
5
  end
6
6
 
7
7
  def run
8
- edit_scheme_for_code_coverage if PodPrebuild::Env.prebuild_stage?
9
8
  diagnose if PodPrebuild::Env.integration_stage?
10
9
  end
11
10
 
12
11
  private
13
12
 
14
13
  def diagnose
15
- Pod::UI.section("Diagnosing cocoapods-binary-cache") do
14
+ Pod::UI.title("Diagnosing cocoapods-binary-cache") do
16
15
  PodPrebuild::Diagnosis.new(
17
- cache_validation: PodPrebuild::StateStore.cache_validation,
16
+ cache_validation: PodPrebuild.state.cache_validation,
18
17
  standard_sandbox: @installer_context.sandbox,
19
18
  specs: @installer_context.umbrella_targets.map(&:specs).flatten
20
19
  ).run
21
20
  end
22
21
  end
23
-
24
- def edit_scheme_for_code_coverage
25
- return unless Pod::Podfile::DSL.dev_pods_enabled && @installer_context.sandbox.instance_of?(Pod::PrebuildSandbox)
26
-
27
- # Modify pods scheme to support code coverage
28
- # If we don't prebuild dev pod -> no need to care about this in Pod project
29
- # because we setup in the main project (ex. DriverCI scheme)
30
- SchemeEditor.edit_to_support_code_coverage(@installer_context.sandbox)
31
- end
32
22
  end
33
23
  end
@@ -2,32 +2,30 @@ module PodPrebuild
2
2
  class PreInstallHook
3
3
  include ObjectSpace
4
4
 
5
- attr_reader :installer_context, :podfile, :prebuild_sandbox, :cache_validation
5
+ attr_reader :installer_context, :podfile, :prebuild_sandbox, :standard_sandbox, :cache_validation
6
6
 
7
7
  def initialize(installer_context)
8
8
  @installer_context = installer_context
9
9
  @podfile = installer_context.podfile
10
10
  @pod_install_options = {}
11
11
  @prebuild_sandbox = nil
12
+ @standard_sandbox = installer_context.sandbox
12
13
  @cache_validation = nil
13
14
  end
14
15
 
15
16
  def run
16
17
  return if @installer_context.sandbox.is_a?(Pod::PrebuildSandbox)
17
18
 
18
- require_relative "../pod-binary/helper/feature_switches"
19
-
20
19
  log_section "🚀 Prebuild frameworks"
21
20
  ensure_valid_podfile
22
21
  save_installation_states
23
- Pod::UI.section("Prepare environment") { prepare_environment }
24
22
  create_prebuild_sandbox
25
- Pod::UI.section("Detect implicit dependencies") { detect_implicit_dependencies }
26
- Pod::UI.section("Validate prebuilt cache") { validate_cache }
27
- prebuild! if Pod::Podfile::DSL.prebuild_job?
28
- Pod::UI.section("Reset environment") { reset_environment }
23
+ Pod::UI.title("Detect implicit dependencies") { detect_implicit_dependencies }
24
+ Pod::UI.title("Validate prebuilt cache") { validate_cache }
25
+ prebuild! if PodPrebuild.config.prebuild_job?
29
26
 
30
27
  PodPrebuild::Env.next_stage!
28
+ prepare_for_integration
31
29
  log_section "🤖 Resume pod installation"
32
30
  require_relative "../pod-binary/integration"
33
31
  end
@@ -36,7 +34,6 @@ module PodPrebuild
36
34
 
37
35
  def save_installation_states
38
36
  save_pod_install_options
39
- save_states_from_dsl
40
37
  end
41
38
 
42
39
  def save_pod_install_options
@@ -55,28 +52,7 @@ module PodPrebuild
55
52
  end
56
53
  end
57
54
 
58
- def prepare_environment
59
- Pod::Installer.force_disable_integration true # don't integrate targets
60
- Pod::Config.force_disable_write_lockfile true # disbale write lock file for perbuild podfile
61
- Pod::Installer.disable_install_complete_message true # disable install complete message
62
- end
63
-
64
- def reset_environment
65
- Pod::Installer.force_disable_integration false
66
- Pod::Config.force_disable_write_lockfile false
67
- Pod::Installer.disable_install_complete_message false
68
- Pod::UserInterface.warnings = [] # clean the warning in the prebuild step, it's duplicated.
69
- end
70
-
71
- def save_states_from_dsl
72
- # Note: DSL is reloaded when creating an installer (Pod::Installer.new).
73
- # Any mutation to DSL is highly discouraged
74
- # --> Rather, perform mutation on PodPrebuild::StateStore instead
75
- PodPrebuild::StateStore.excluded_pods += Pod::Podfile::DSL.excluded_pods
76
- end
77
-
78
55
  def create_prebuild_sandbox
79
- standard_sandbox = installer_context.sandbox
80
56
  @prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox)
81
57
  Pod::UI.message "Create prebuild sandbox at #{@prebuild_sandbox.root}"
82
58
  end
@@ -88,11 +64,9 @@ module PodPrebuild
88
64
  .group_by { |spec| spec.name.split("/")[0] }
89
65
  .select { |_, specs| specs.all?(&:empty_source_files?) }
90
66
  .keys
91
-
92
- PodPrebuild::StateStore.excluded_pods += pods_with_empty_source_files
67
+ PodPrebuild.config.update_detected_excluded_pods!(pods_with_empty_source_files)
68
+ PodPrebuild.config.update_detected_prebuilt_pod_names!(@original_installer.prebuilt_pod_names)
93
69
  Pod::UI.puts "Exclude pods with empty source files: #{pods_with_empty_source_files.to_a}"
94
-
95
- # TODO (thuyen): Detect dependencies of a prebuilt pod and treat them as prebuilt pods as well
96
70
  end
97
71
 
98
72
  def validate_cache
@@ -101,16 +75,16 @@ module PodPrebuild
101
75
  podfile: podfile,
102
76
  pod_lockfile: installer_context.lockfile,
103
77
  prebuilt_lockfile: prebuilt_lockfile,
104
- validate_prebuilt_settings: Pod::Podfile::DSL.validate_prebuilt_settings,
78
+ validate_prebuilt_settings: PodPrebuild.config.validate_prebuilt_settings,
105
79
  generated_framework_path: prebuild_sandbox.generate_framework_path,
106
80
  sandbox_root: prebuild_sandbox.root,
107
- ignored_pods: PodPrebuild::StateStore.excluded_pods,
108
- prebuilt_pod_names: @original_installer.prebuilt_pod_names
81
+ ignored_pods: PodPrebuild.config.excluded_pods,
82
+ prebuilt_pod_names: PodPrebuild.config.prebuilt_pod_names
109
83
  ).validate
110
- path_to_save_cache_validation = Pod::Podfile::DSL.save_cache_validation_to
84
+ path_to_save_cache_validation = PodPrebuild.config.save_cache_validation_to
111
85
  @cache_validation.update_to(path_to_save_cache_validation) unless path_to_save_cache_validation.nil?
112
86
  cache_validation.print_summary
113
- PodPrebuild::StateStore.cache_validation = cache_validation
87
+ PodPrebuild.state.update(:cache_validation => cache_validation)
114
88
  end
115
89
 
116
90
  def prebuild!
@@ -129,6 +103,15 @@ module PodPrebuild
129
103
  end
130
104
  end
131
105
 
106
+ def prepare_for_integration
107
+ # Remove local podspec of external sources so that it downloads sources correctly.
108
+ # Otherwise, with incremental pod installation, CocoaPods downloads the sources
109
+ # based on the `s.source` declaration in the podspecs which are sometimes incorrect.
110
+ PodPrebuild.config.prebuilt_pod_names.each do |name|
111
+ @standard_sandbox.remove_local_podspec(name) if @standard_sandbox.checkout_sources.key?(name)
112
+ end
113
+ end
114
+
132
115
  def log_section(message)
133
116
  Pod::UI.puts "-----------------------------------------"
134
117
  Pod::UI.puts message