cocoapods-binary-cache 0.1.7 → 0.1.8

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 (36) 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/dependencies_graph/dependencies_graph.rb +20 -25
  4. data/lib/cocoapods-binary-cache/dependencies_graph/graph_visualizer.rb +29 -38
  5. data/lib/cocoapods-binary-cache/diagnosis/diagnosis.rb +9 -1
  6. data/lib/cocoapods-binary-cache/diagnosis/integration.rb +3 -1
  7. data/lib/cocoapods-binary-cache/helper/podspec.rb +5 -2
  8. data/lib/cocoapods-binary-cache/helper/prebuild_order.rb +12 -0
  9. data/lib/cocoapods-binary-cache/hooks/post_install.rb +4 -3
  10. data/lib/cocoapods-binary-cache/hooks/pre_install.rb +7 -34
  11. data/lib/cocoapods-binary-cache/pod-binary/helper/build.rb +1 -0
  12. data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb +1 -1
  13. data/lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb +14 -13
  14. data/lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb +7 -10
  15. data/lib/cocoapods-binary-cache/pod-binary/integration.rb +1 -2
  16. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/embed_framework_script.rb +1 -1
  17. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/resolve_dependencies.rb +0 -3
  18. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/sandbox_analyzer_state.rb +29 -0
  19. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb +2 -2
  20. data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +16 -93
  21. data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +0 -2
  22. data/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb +0 -1
  23. data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +64 -48
  24. data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +3 -3
  25. data/lib/cocoapods-binary-cache/prebuild_output/output.rb +6 -4
  26. data/lib/cocoapods-binary-cache/scheme_editor.rb +16 -15
  27. data/lib/cocoapods-binary-cache/state_store.rb +16 -6
  28. data/lib/command/config.rb +25 -3
  29. data/lib/command/executor/base.rb +7 -0
  30. data/lib/command/executor/prebuilder.rb +1 -1
  31. data/lib/command/executor/visualizer.rb +3 -2
  32. metadata +4 -6
  33. data/lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb +0 -52
  34. data/lib/cocoapods-binary-cache/pod-binary/helper/passer.rb +0 -25
  35. data/lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb +0 -29
  36. data/lib/cocoapods-binary-cache/pod-binary/tool/tool.rb +0 -12
@@ -16,7 +16,7 @@ module PodPrebuild
16
16
  end
17
17
 
18
18
  def clean_delta_file
19
- puts "Clean delta file: #{prebuild_delta_path}"
19
+ Pod::UI.message "Clean delta file: #{prebuild_delta_path}"
20
20
  FileUtils.rm_rf(prebuild_delta_path)
21
21
  end
22
22
 
@@ -24,14 +24,16 @@ module PodPrebuild
24
24
  FileUtils.mkdir_p dir unless File.directory?(dir)
25
25
  end
26
26
 
27
- # Input 2 arrays of library names
28
- def write_delta_file(updated, deleted)
27
+ def write_delta_file(options)
28
+ updated = options[:updated]
29
+ deleted = options[:deleted]
30
+
29
31
  if updated.empty? && deleted.empty?
30
32
  Pod::UI.puts "No changes in prebuild"
31
33
  return
32
34
  end
33
35
 
34
- Pod::UI.puts "Write prebuild changes to: #{prebuild_delta_path}"
36
+ Pod::UI.message "Write prebuild changes to: #{prebuild_delta_path}"
35
37
  create_dir_if_needed(delta_dir)
36
38
  changes = PodPrebuild::JSONFile.new(prebuild_delta_path)
37
39
  changes["updated"] = updated
@@ -1,35 +1,36 @@
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 'rexml/document'
4
+ require "rexml/document"
5
5
 
6
6
  class SchemeEditor
7
7
  def self.edit_to_support_code_coverage(sandbox)
8
8
  pod_proj_path = sandbox.project_path
9
- puts "Modify schemes of pod project to support code coverage of prebuilt local pod: #{pod_proj_path}"
9
+ Pod::UI.message "Modify schemes of pod project to support code coverage of prebuilt local pod: #{pod_proj_path}"
10
10
  scheme_files = Dir["#{pod_proj_path}/**/*.xcscheme"]
11
11
  scheme_files.each do |file_path|
12
- scheme_name = File.basename(file_path, '.*')
12
+ scheme_name = File.basename(file_path, ".*")
13
13
  next unless sandbox.local?(scheme_name)
14
14
 
15
15
  Pod::UI.message "Modify scheme to enable coverage symbol when prebuild: #{scheme_name}"
16
16
 
17
- doc = File.open(file_path, 'r') { |f| REXML::Document.new(f) }
18
- scheme = doc.elements['Scheme']
19
- test_action = scheme.elements['TestAction']
20
- next if test_action.attributes['codeCoverageEnabled'] == 'YES'
17
+ doc = File.open(file_path, "r") { |f| REXML::Document.new(f) }
18
+ scheme = doc.elements["Scheme"]
19
+ test_action = scheme.elements["TestAction"]
20
+ next if test_action.attributes["codeCoverageEnabled"] == "YES"
21
21
 
22
- test_action.add_attribute('codeCoverageEnabled', 'YES')
23
- test_action.add_attribute('onlyGenerateCoverageForSpecifiedTargets', 'YES')
24
- coverage_targets = REXML::Element.new('CodeCoverageTargets')
25
- buildable_ref = scheme.elements['BuildAction'] \
26
- .elements['BuildActionEntries'] \
27
- .elements['BuildActionEntry'] \
28
- .elements['BuildableReference']
22
+ test_action.add_attribute("codeCoverageEnabled", "YES")
23
+ test_action.add_attribute("onlyGenerateCoverageForSpecifiedTargets", "YES")
24
+ coverage_targets = REXML::Element.new("CodeCoverageTargets")
25
+ buildable_ref = scheme
26
+ .elements["BuildAction"]
27
+ .elements["BuildActionEntries"]
28
+ .elements["BuildActionEntry"]
29
+ .elements["BuildableReference"]
29
30
  new_buildable_ref = buildable_ref.clone # Need to clone, otherwise the original one will be move to new place
30
31
  coverage_targets.add_element(new_buildable_ref)
31
32
  test_action.add_element(coverage_targets)
32
- File.open(file_path, 'w') { |f| doc.write(f) }
33
+ File.open(file_path, "w") { |f| doc.write(f) }
33
34
  end
34
35
  end
35
36
  end
@@ -1,11 +1,21 @@
1
1
  module PodPrebuild
2
- class StateStore
3
- @excluded_pods = Set.new
4
- @cache_validation = CacheValidationResult.new
2
+ def self.state
3
+ @state ||= State.new
4
+ end
5
+
6
+ class State
7
+ def initialize
8
+ @store = {
9
+ :cache_validation => CacheValidationResult.new
10
+ }
11
+ end
12
+
13
+ def update(data)
14
+ @store.merge!(data)
15
+ end
5
16
 
6
- class << self
7
- attr_accessor :excluded_pods
8
- attr_accessor :cache_validation
17
+ def cache_validation
18
+ @store[:cache_validation]
9
19
  end
10
20
  end
11
21
  end
@@ -5,13 +5,14 @@ module PodPrebuild
5
5
  PodPrebuild::Config.instance
6
6
  end
7
7
 
8
- class Config
8
+ class Config # rubocop:disable Metrics/ClassLength
9
9
  attr_accessor :dsl_config, :cli_config
10
10
 
11
11
  def initialize(path)
12
12
  @deprecated_config = File.exist?(path) ? PodPrebuild::JSONFile.new(path).data : {}
13
13
  @dsl_config = {}
14
14
  @cli_config = {}
15
+ @detected_config = {}
15
16
  end
16
17
 
17
18
  def self.instance
@@ -83,7 +84,7 @@ module PodPrebuild
83
84
  end
84
85
 
85
86
  def excluded_pods
86
- @dsl_config[:excluded_pods] || Set.new
87
+ ((@dsl_config[:excluded_pods] || Set.new) + (@detected_config[:excluded_pods] || Set.new)).to_set
87
88
  end
88
89
 
89
90
  def dev_pods_enabled?
@@ -122,10 +123,30 @@ module PodPrebuild
122
123
  @dsl_config[:prebuild_code_gen]
123
124
  end
124
125
 
126
+ def strict_diagnosis?
127
+ @dsl_config[:strict_diagnosis]
128
+ end
129
+
125
130
  def targets_to_prebuild_from_cli
126
131
  @cli_config[:prebuild_targets] || []
127
132
  end
128
133
 
134
+ def update_detected_prebuilt_pod_names!(value)
135
+ @detected_config[:prebuilt_pod_names] = value
136
+ end
137
+
138
+ def update_detected_excluded_pods!(value)
139
+ @detected_config[:excluded_pods] = value
140
+ end
141
+
142
+ def prebuilt_pod_names
143
+ @detected_config[:prebuilt_pod_names] || Set.new
144
+ end
145
+
146
+ def tracked_prebuilt_pod_names
147
+ prebuilt_pod_names - excluded_pods
148
+ end
149
+
129
150
  private
130
151
 
131
152
  def applicable_dsl_config
@@ -145,7 +166,8 @@ module PodPrebuild
145
166
  :build_args,
146
167
  :save_cache_validation_to,
147
168
  :validate_prebuilt_settings,
148
- :prebuild_code_gen
169
+ :prebuild_code_gen,
170
+ :strict_diagnosis
149
171
  ]
150
172
  end
151
173
 
@@ -4,6 +4,13 @@ module PodPrebuild
4
4
  @config = options[:config]
5
5
  end
6
6
 
7
+ def installer
8
+ @installer ||= begin
9
+ pod_config = Pod::Config.instance
10
+ Pod::Installer.new(pod_config.sandbox, pod_config.podfile, pod_config.lockfile)
11
+ end
12
+ end
13
+
7
14
  def git(cmd, options = {})
8
15
  comps = ["git"]
9
16
  comps << "-C" << @config.cache_path unless options[:cache_repo] == false
@@ -26,7 +26,7 @@ module PodPrebuild
26
26
 
27
27
  def prebuild
28
28
  Pod::UI.step("Installation") do
29
- Pod::Command::Install.new(CLAide::ARGV.new([])).run
29
+ installer.install!
30
30
  end
31
31
  end
32
32
 
@@ -13,8 +13,9 @@ module PodPrebuild
13
13
  def run
14
14
  FileUtils.mkdir_p(@output_dir)
15
15
  graph = DependenciesGraph.new(@lockfile)
16
- graph.write_graphic_file("png", "#{@output_dir}/graph", Set.new)
17
- `open #{@output_dir}/graph.png` if @open
16
+ output_path = "#{@output_dir}/graph.png"
17
+ graph.write_graphic_file(output_path: output_path)
18
+ system("open #{@output_path}") if @open
18
19
  end
19
20
  end
20
21
  end
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.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bang Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-18 00:00:00.000000000 Z
11
+ date: 2020-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -125,6 +125,7 @@ files:
125
125
  - lib/cocoapods-binary-cache/helper/lockfile.rb
126
126
  - lib/cocoapods-binary-cache/helper/path_utils.rb
127
127
  - lib/cocoapods-binary-cache/helper/podspec.rb
128
+ - lib/cocoapods-binary-cache/helper/prebuild_order.rb
128
129
  - lib/cocoapods-binary-cache/hooks/post_install.rb
129
130
  - lib/cocoapods-binary-cache/hooks/pre_install.rb
130
131
  - lib/cocoapods-binary-cache/main.rb
@@ -132,9 +133,7 @@ files:
132
133
  - lib/cocoapods-binary-cache/pod-binary/helper/build.rb
133
134
  - lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb
134
135
  - lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb
135
- - lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb
136
136
  - lib/cocoapods-binary-cache/pod-binary/helper/names.rb
137
- - lib/cocoapods-binary-cache/pod-binary/helper/passer.rb
138
137
  - lib/cocoapods-binary-cache/pod-binary/helper/podfile_options.rb
139
138
  - lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb
140
139
  - lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb
@@ -142,14 +141,13 @@ files:
142
141
  - lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb
143
142
  - lib/cocoapods-binary-cache/pod-binary/integration/patch/embed_framework_script.rb
144
143
  - lib/cocoapods-binary-cache/pod-binary/integration/patch/resolve_dependencies.rb
144
+ - lib/cocoapods-binary-cache/pod-binary/integration/patch/sandbox_analyzer_state.rb
145
145
  - lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb
146
- - lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb
147
146
  - lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb
148
147
  - lib/cocoapods-binary-cache/pod-binary/integration/validation.rb
149
148
  - lib/cocoapods-binary-cache/pod-binary/prebuild.rb
150
149
  - lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb
151
150
  - lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb
152
- - lib/cocoapods-binary-cache/pod-binary/tool/tool.rb
153
151
  - lib/cocoapods-binary-cache/pod-rome/LICENSE.txt
154
152
  - lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb
155
153
  - lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb
@@ -1,52 +0,0 @@
1
- require_relative "../tool/tool"
2
- require_relative "prebuild_sandbox"
3
-
4
- module Pod
5
- # a force disable option for integral
6
- class Installer
7
- def self.force_disable_integration(value)
8
- @@force_disable_integration = value
9
- end
10
-
11
- old_method = instance_method(:integrate_user_project)
12
- define_method(:integrate_user_project) do
13
- if @@force_disable_integration
14
- return
15
- end
16
- old_method.bind(self).()
17
- end
18
- end
19
-
20
- # a option to disable install complete message
21
- class Installer
22
- def self.disable_install_complete_message(value)
23
- @@disable_install_complete_message = value
24
- end
25
-
26
- old_method = instance_method(:print_post_install_message)
27
- define_method(:print_post_install_message) do
28
- if @@disable_install_complete_message
29
- return
30
- end
31
- old_method.bind(self).()
32
- end
33
- end
34
-
35
- # option to disable write lockfiles
36
- class Config
37
- @@force_disable_write_lockfile = false
38
- def self.force_disable_write_lockfile(value)
39
- @@force_disable_write_lockfile = value
40
- end
41
-
42
- old_method = instance_method(:lockfile_path)
43
- define_method(:lockfile_path) do
44
- if @@force_disable_write_lockfile
45
- # As config is a singleton, sandbox_root refer to the standard sandbox.
46
- return PrebuildSandbox.from_standard_sanbox_path(sandbox_root).root + "Manifest.lock.tmp"
47
- else
48
- return old_method.bind(self).()
49
- end
50
- end
51
- end
52
- end
@@ -1,25 +0,0 @@
1
- require_relative "../tool/tool"
2
-
3
- module Pod
4
- class Prebuild
5
- # Pass the data between the 2 steps
6
- #
7
- # At step 2, the normal pod install, it needs some info of the
8
- # prebuilt step. So we store it here.
9
- #
10
- class Passer
11
- # indicate the add/remove/update of prebuit pods
12
- # @return [Analyzer::SpecsState]
13
- #
14
- class_attr_accessor :prebuild_pods_changes
15
-
16
- # Some pod won't be build in prebuild stage even if it have `binary=>true`.
17
- # The targets of this pods have `oshould_build? == true`.
18
- # We should skip integration (patch spec) for this pods
19
- #
20
- # @return [Array<String>]
21
- class_attr_accessor :target_names_to_skip_integration_framework
22
- self.target_names_to_skip_integration_framework = []
23
- end
24
- end
25
- end
@@ -1,29 +0,0 @@
1
- module Pod
2
- class Installer
3
- # Remove the old target files if prebuild frameworks changed
4
- def remove_target_files_if_needed
5
- changes = Pod::Prebuild::Passer.prebuild_pods_changes
6
- updated_names = []
7
- if changes.nil?
8
- updated_names = PrebuildSandbox.from_standard_sandbox(sandbox).exsited_framework_pod_names
9
- else
10
- added = changes.added
11
- changed = changes.changed
12
- deleted = changes.deleted
13
- updated_names = added + changed + deleted
14
- end
15
-
16
- updated_names.each do |name|
17
- root_name = Specification.root_name(name)
18
- next if sandbox.local?(root_name)
19
-
20
- UI.message "Delete cached files: #{root_name}"
21
- target_path = sandbox.pod_dir(root_name)
22
- target_path.rmtree if target_path.exist?
23
-
24
- support_path = sandbox.target_support_files_dir(root_name)
25
- support_path.rmtree if support_path.exist?
26
- end
27
- end
28
- end
29
- end
@@ -1,12 +0,0 @@
1
- # attr_accessor for class variable.
2
- # usage:
3
- #
4
- # ```
5
- # class Pod
6
- # class_attr_accessor :is_prebuild_stage
7
- # end
8
- # ```
9
- #
10
- def class_attr_accessor(symbol)
11
- self.class.send(:attr_accessor, symbol)
12
- end