diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c3e39b62..b9be36229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ [nickgravelyn](https://github.com/nickgravelyn) [#757](https://github.com/CocoaPods/Xcodeproj/pull/757) +* Include non-shared schemes in `Project.schemes`. + [Serge Lebedev](https://github.com/lebedev) + [#680](https://github.com/CocoaPods/Xcodeproj/pull/680) + ## 1.16.0 (2020-04-10) diff --git a/lib/xcodeproj/project.rb b/lib/xcodeproj/project.rb index 39ca52321..dc096dc37 100644 --- a/lib/xcodeproj/project.rb +++ b/lib/xcodeproj/project.rb @@ -821,7 +821,7 @@ def sort(options = nil) # @return [Array] # def self.schemes(project_path) - schemes = Dir[File.join(project_path, 'xcshareddata', 'xcschemes', '*.xcscheme')].map do |scheme| + schemes = Dir[File.join(project_path, '**', 'xcschemes', '*.xcscheme')].map do |scheme| File.basename(scheme, '.xcscheme') end schemes << File.basename(project_path, '.xcodeproj') if schemes.empty? diff --git a/spec/project_spec.rb b/spec/project_spec.rb index 1f8541b2b..10968a8e6 100644 --- a/spec/project_spec.rb +++ b/spec/project_spec.rb @@ -639,7 +639,7 @@ module ProjectSpecs #-------------------------------------------------------------------------# describe 'Project schemes' do - it 'return project name as scheme if there are no shared schemes' do + it 'return project name as scheme if there are no schemes' do schemes = Xcodeproj::Project.schemes(fixture_path('SharedSchemes/Pods/Pods.xcodeproj')) schemes[0].should == 'Pods' end @@ -649,6 +649,11 @@ module ProjectSpecs schemes.sort.should == %w(SharedSchemes SharedSchemesForTest) end + it 'finds a non-shared scheme' do + schemes = Xcodeproj::Project.schemes(fixture_path('Sample Project/Cocoa Application.xcodeproj')) + schemes.include?('Cocoa ApplicationImporter').should == true + end + describe '#recreate_user_schemes' do it 'can recreate the user schemes' do sut = Xcodeproj::Project.new(SpecHelper.temporary_directory + 'Pods.xcodeproj')