cocoapods-binary-cache 0.1.6 → 0.1.11

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 (47) 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 +1 -1
  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/podspec.rb +4 -2
  11. data/lib/cocoapods-binary-cache/hooks/post_install.rb +2 -12
  12. data/lib/cocoapods-binary-cache/hooks/pre_install.rb +22 -39
  13. data/lib/cocoapods-binary-cache/main.rb +0 -1
  14. data/lib/cocoapods-binary-cache/pod-binary/helper/build.rb +27 -29
  15. data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb +2 -2
  16. data/lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb +15 -14
  17. data/lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb +7 -10
  18. data/lib/cocoapods-binary-cache/pod-binary/integration.rb +1 -2
  19. data/lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb +4 -1
  20. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/embed_framework_script.rb +1 -1
  21. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/resolve_dependencies.rb +0 -3
  22. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/sandbox_analyzer_state.rb +29 -0
  23. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb +26 -12
  24. data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +57 -62
  25. data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +34 -112
  26. data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +2 -66
  27. data/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb +0 -1
  28. data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +166 -146
  29. data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +38 -33
  30. data/lib/cocoapods-binary-cache/prebuild_output/output.rb +7 -5
  31. data/lib/cocoapods-binary-cache/state_store.rb +16 -6
  32. data/lib/command/binary.rb +20 -1
  33. data/lib/command/config.rb +181 -8
  34. data/lib/command/executor/base.rb +18 -1
  35. data/lib/command/executor/fetcher.rb +21 -5
  36. data/lib/command/executor/prebuilder.rb +9 -7
  37. data/lib/command/executor/pusher.rb +20 -4
  38. data/lib/command/executor/visualizer.rb +3 -2
  39. data/lib/command/fetch.rb +0 -1
  40. data/lib/command/prebuild.rb +16 -6
  41. data/lib/command/push.rb +0 -1
  42. metadata +5 -9
  43. data/lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb +0 -52
  44. data/lib/cocoapods-binary-cache/pod-binary/helper/passer.rb +0 -25
  45. data/lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb +0 -29
  46. data/lib/cocoapods-binary-cache/pod-binary/tool/tool.rb +0 -12
  47. data/lib/cocoapods-binary-cache/scheme_editor.rb +0 -35
@@ -4,29 +4,31 @@ require_relative "pusher"
4
4
 
5
5
  module PodPrebuild
6
6
  class CachePrebuilder < CommandExecutor
7
+ attr_reader :repo_update, :fetcher, :pusher
8
+
7
9
  def initialize(options)
8
10
  super(options)
9
- @cache_branch = options[:cache_branch]
10
- @push_cache = options[:push_cache]
11
- @fetcher = PodPrebuild::CacheFetcher.new(options)
12
- @pusher = PodPrebuild::CachePusher.new(options)
11
+ @repo_update = options[:repo_update]
12
+ @fetcher = PodPrebuild::CacheFetcher.new(options) unless options[:no_fetch]
13
+ @pusher = PodPrebuild::CachePusher.new(options) if options[:push_cache]
13
14
  end
14
15
 
15
16
  def run
16
- @fetcher.run
17
+ @fetcher&.run
17
18
  prebuild
18
19
  changes = PodPrebuild::JSONFile.new(@config.prebuild_delta_path)
19
20
  return if changes.empty?
20
21
 
21
22
  sync_cache(changes)
22
- @pusher.run if @push_cache
23
+ @pusher&.run
23
24
  end
24
25
 
25
26
  private
26
27
 
27
28
  def prebuild
28
29
  Pod::UI.step("Installation") do
29
- Pod::Command::Install.new(CLAide::ARGV.new([])).run
30
+ installer.repo_update = @repo_update
31
+ installer.install!
30
32
  end
31
33
  end
32
34
 
@@ -2,6 +2,8 @@ require_relative "base"
2
2
 
3
3
  module PodPrebuild
4
4
  class CachePusher < CommandExecutor
5
+ attr_reader :cache_branch
6
+
5
7
  def initialize(options)
6
8
  super(options)
7
9
  @cache_branch = options[:cache_branch]
@@ -9,11 +11,25 @@ module PodPrebuild
9
11
 
10
12
  def run
11
13
  Pod::UI.step("Pushing cache") do
12
- commit_message = "Update prebuilt cache".shellescape
13
- git("add .")
14
- git("commit -m '#{commit_message}'")
15
- git("push origin #{@cache_branch}")
14
+ if @config.local_cache?
15
+ print_message_for_local_cache
16
+ else
17
+ commit_and_push_cache
18
+ end
16
19
  end
17
20
  end
21
+
22
+ private
23
+
24
+ def print_message_for_local_cache
25
+ Pod::UI.puts "Skip pushing cache as you're using local cache".yellow
26
+ end
27
+
28
+ def commit_and_push_cache
29
+ commit_message = "Update prebuilt cache"
30
+ git("add .")
31
+ git("commit -m '#{commit_message}'")
32
+ git("push origin #{@cache_branch}")
33
+ end
18
34
  end
19
35
  end
@@ -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
@@ -5,7 +5,6 @@ module Pod
5
5
  class Binary < Command
6
6
  class Fetch < Binary
7
7
  self.arguments = [CLAide::Argument.new("CACHE-BRANCH", false)]
8
-
9
8
  def initialize(argv)
10
9
  super
11
10
  @fetcher = PodPrebuild::CacheFetcher.new(
@@ -5,30 +5,40 @@ module Pod
5
5
  class Command
6
6
  class Binary < Command
7
7
  class Prebuild < Binary
8
+ attr_reader :prebuilder
9
+
8
10
  self.arguments = [CLAide::Argument.new("CACHE-BRANCH", false)]
9
11
  def self.options
10
12
  [
13
+ ["--config", "Config (Debug, Test...) to prebuild"],
14
+ ["--repo-update", "Update pod repo before installing"],
15
+ ["--no-fetch", "Do not perform a cache fetch beforehand"],
11
16
  ["--push", "Push cache to repo upon completion"],
12
17
  ["--all", "Prebuild all binary pods regardless of cache validation"],
13
18
  ["--targets", "Targets to prebuild. Use comma (,) to specify a list of targets"]
14
- ]
19
+ ].concat(super)
15
20
  end
16
21
 
17
22
  def initialize(argv)
18
23
  super
19
- @prebuild_all_pods = argv.flag?("all")
20
- @prebuild_targets = argv.option("targets", "").split(",")
24
+ prebuild_all_pods = argv.flag?("all")
25
+ prebuild_targets = argv.option("targets", "").split(",")
26
+ update_cli_config(
27
+ :prebuild_job => true,
28
+ :prebuild_all_pods => prebuild_all_pods,
29
+ :prebuild_config => argv.option("config")
30
+ )
31
+ update_cli_config(:prebuild_targets => prebuild_targets) unless prebuild_all_pods
21
32
  @prebuilder = PodPrebuild::CachePrebuilder.new(
22
33
  config: prebuild_config,
23
34
  cache_branch: argv.shift_argument || "master",
35
+ repo_update: argv.flag?("repo-update"),
36
+ no_fetch: argv.flag?("fetch") == false,
24
37
  push_cache: argv.flag?("push")
25
38
  )
26
39
  end
27
40
 
28
41
  def run
29
- Pod::Podfile::DSL.binary_cache_cli_config[:prebuild_job] = true
30
- Pod::Podfile::DSL.binary_cache_cli_config[:prebuild_all_pods] = @prebuild_all_pods
31
- Pod::Podfile::DSL.binary_cache_cli_config[:prebuild_targets] = @prebuild_targets unless @prebuild_all_pods
32
42
  @prebuilder.run
33
43
  end
34
44
  end
@@ -5,7 +5,6 @@ module Pod
5
5
  class Binary < Command
6
6
  class Push < Binary
7
7
  self.arguments = [CLAide::Argument.new("CACHE-BRANCH", false)]
8
-
9
8
  def initialize(argv)
10
9
  super
11
10
  @pusher = PodPrebuild::CachePusher.new(
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.6
4
+ version: 0.1.11
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-14 00:00:00.000000000 Z
11
+ date: 2020-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -70,14 +70,14 @@ dependencies:
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.3'
83
83
  - !ruby/object:Gem::Dependency
@@ -132,9 +132,7 @@ files:
132
132
  - lib/cocoapods-binary-cache/pod-binary/helper/build.rb
133
133
  - lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb
134
134
  - 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
135
  - lib/cocoapods-binary-cache/pod-binary/helper/names.rb
137
- - lib/cocoapods-binary-cache/pod-binary/helper/passer.rb
138
136
  - lib/cocoapods-binary-cache/pod-binary/helper/podfile_options.rb
139
137
  - lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb
140
138
  - lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb
@@ -142,20 +140,18 @@ files:
142
140
  - lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb
143
141
  - lib/cocoapods-binary-cache/pod-binary/integration/patch/embed_framework_script.rb
144
142
  - lib/cocoapods-binary-cache/pod-binary/integration/patch/resolve_dependencies.rb
143
+ - lib/cocoapods-binary-cache/pod-binary/integration/patch/sandbox_analyzer_state.rb
145
144
  - lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb
146
- - lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb
147
145
  - lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb
148
146
  - lib/cocoapods-binary-cache/pod-binary/integration/validation.rb
149
147
  - lib/cocoapods-binary-cache/pod-binary/prebuild.rb
150
148
  - lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb
151
149
  - lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb
152
- - lib/cocoapods-binary-cache/pod-binary/tool/tool.rb
153
150
  - lib/cocoapods-binary-cache/pod-rome/LICENSE.txt
154
151
  - lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb
155
152
  - lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb
156
153
  - lib/cocoapods-binary-cache/prebuild_output/metadata.rb
157
154
  - lib/cocoapods-binary-cache/prebuild_output/output.rb
158
- - lib/cocoapods-binary-cache/scheme_editor.rb
159
155
  - lib/cocoapods-binary-cache/state_store.rb
160
156
  - lib/cocoapods-binary-cache/ui.rb
161
157
  - lib/cocoapods_plugin.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
@@ -1,35 +0,0 @@
1
- # Copyright 2019 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved.
2
- # Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
3
-
4
- require 'rexml/document'
5
-
6
- class SchemeEditor
7
- def self.edit_to_support_code_coverage(sandbox)
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}"
10
- scheme_files = Dir["#{pod_proj_path}/**/*.xcscheme"]
11
- scheme_files.each do |file_path|
12
- scheme_name = File.basename(file_path, '.*')
13
- next unless sandbox.local?(scheme_name)
14
-
15
- puts "Modify scheme to enable coverage symbol when prebuild: #{scheme_name}"
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'
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']
29
- new_buildable_ref = buildable_ref.clone # Need to clone, otherwise the original one will be move to new place
30
- coverage_targets.add_element(new_buildable_ref)
31
- test_action.add_element(coverage_targets)
32
- File.open(file_path, 'w') { |f| doc.write(f) }
33
- end
34
- end
35
- end