diff --git a/CHANGELOG.md b/CHANGELOG.md index e3f7014a4e..8fcde45ac8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ##### Enhancements +* Schemes of development pods will now be shared. + [Boris Bügling](https://github.com/neonichu) + [#3600](https://github.com/CocoaPods/CocoaPods/issues/3600) + * Allow opting out of pod source locking, meaning `pod try` yields editable projects. [Samuel Giddins](https://github.com/segiddins) diff --git a/lib/cocoapods/installer.rb b/lib/cocoapods/installer.rb index d064cd90e4..ab7a8f466e 100644 --- a/lib/cocoapods/installer.rb +++ b/lib/cocoapods/installer.rb @@ -136,6 +136,7 @@ def generate_pods_project set_target_dependencies run_podfile_post_install_hooks write_pod_project + share_development_pod_schemes write_lockfiles end end @@ -604,6 +605,20 @@ def write_pod_project end end + # Shares schemes of development Pods. + # + # @return [void] + # + def share_development_pod_schemes + development_pod_targets = sandbox.development_pods.keys.map do |pod| + pods_project.targets.select { |target| target.name =~ /^Pods-.*-#{pod}$/ } + end.flatten + + development_pod_targets.each do |pod_target| + Xcodeproj::XCScheme.share_scheme(pods_project.path, pod_target.name) + end + end + # Writes the Podfile and the lock files. # # @todo Pass the checkout options to the Lockfile. diff --git a/spec/unit/installer_spec.rb b/spec/unit/installer_spec.rb index 9e32cd5ef0..49ebf695ad 100644 --- a/spec/unit/installer_spec.rb +++ b/spec/unit/installer_spec.rb @@ -590,6 +590,21 @@ def test_extension_target(symbol_type) @installer.send(:write_pod_project) end + it 'shares schemes of development pods' do + spec = fixture_spec('banana-lib/BananaLib.podspec') + target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile) + pod_target = PodTarget.new([spec], target_definition, config.sandbox) + + @installer.pods_project.stubs(:targets).returns([pod_target]) + @installer.sandbox.stubs(:development_pods).returns('BananaLib' => nil) + + Xcodeproj::XCScheme.expects(:share_scheme).with( + @installer.pods_project.path, + 'Pods-default-BananaLib') + + @installer.send(:share_development_pod_schemes) + end + it "uses the user project's object version for the pods project" do tmp_directory = Pathname(Dir.tmpdir) + 'CocoaPods' FileUtils.mkdir_p(tmp_directory)