From e3a97503c7294aec2be781482fd61893bfb6e421 Mon Sep 17 00:00:00 2001 From: Dimitris Koutsogiorgas Date: Thu, 19 Sep 2019 17:56:11 -0700 Subject: [PATCH] Fix incremental installation with plugins that include arguments with different ordering. --- CHANGELOG.md | 4 ++++ .../project_cache/project_cache_analyzer.rb | 2 +- .../project_cache/project_cache_analyzer_spec.rb | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 939f29fd1a..d2d83cd18f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ##### Bug Fixes +* Fix incremental installation with plugins that include arguments with different ordering. + [Dimitris Koutsogiorgas](https://github.com/dnkoutso) + [#9170](https://github.com/CocoaPods/CocoaPods/pull/9170) + * Move custom `Copy Headers` script phase for header mappings before `Compile Sources`. [Dimitris Koutsogiorgas](https://github.com/dnkoutso) [#9131](https://github.com/CocoaPods/CocoaPods/pull/9131) diff --git a/lib/cocoapods/installer/project_cache/project_cache_analyzer.rb b/lib/cocoapods/installer/project_cache/project_cache_analyzer.rb index 13202480eb..f1705722ef 100644 --- a/lib/cocoapods/installer/project_cache/project_cache_analyzer.rb +++ b/lib/cocoapods/installer/project_cache/project_cache_analyzer.rb @@ -78,7 +78,7 @@ def analyze # Bail out early since these properties affect all targets and their associate projects. if cache.build_configurations != build_configurations || cache.project_object_version != project_object_version || - cache.podfile_plugins != podfile_plugins + YAMLHelper.convert(cache.podfile_plugins) != YAMLHelper.convert(podfile_plugins) UI.message 'Ignoring project cache due to project configuration changes.' return full_install_results end diff --git a/spec/unit/installer/project_cache/project_cache_analyzer_spec.rb b/spec/unit/installer/project_cache/project_cache_analyzer_spec.rb index e712e166af..5d3a589a81 100644 --- a/spec/unit/installer/project_cache/project_cache_analyzer_spec.rb +++ b/spec/unit/installer/project_cache/project_cache_analyzer_spec.rb @@ -1,4 +1,5 @@ require File.expand_path('../../../../spec_helper', __FILE__) +require 'cocoapods/installer/project_cache/target_cache_key.rb' module Pod class Installer @@ -82,6 +83,17 @@ module ProjectCache result.aggregate_targets_to_generate.should.equal([@main_aggregate_target]) end + it 'returns empty list when comparing plugins with different ordering of arguments' do + cache_key_by_pod_target_labels = Hash[@pod_targets.map { |pod_target| [pod_target.label, TargetCacheKey.from_pod_target(@sandbox, pod_target)] }] + cache_key_by_aggregate_target_labels = { @main_aggregate_target.label => TargetCacheKey.from_aggregate_target(@sandbox, @main_aggregate_target) } + cache_key_target_labels = cache_key_by_pod_target_labels.merge(cache_key_by_aggregate_target_labels) + cache = ProjectInstallationCache.new(cache_key_target_labels, @build_configurations, @project_object_version, 'my-plugins' => %w[B A]) + analyzer = ProjectCacheAnalyzer.new(@sandbox, cache, @build_configurations, @project_object_version, { 'my-plugins' => %w[A B] }, @pod_targets, [@main_aggregate_target]) + result = analyzer.analyze + result.pod_targets_to_generate.should.equal([]) + result.aggregate_targets_to_generate.should.equal(nil) + end + it 'returns all pod targets and aggregate targets if the list of podfile plugins params changed' do cache_key_by_pod_target_labels = Hash[@pod_targets.map { |pod_target| [pod_target.label, TargetCacheKey.from_pod_target(@sandbox, pod_target)] }] cache_key_by_aggregate_target_labels = { @main_aggregate_target.label => TargetCacheKey.from_aggregate_target(@sandbox, @main_aggregate_target) }