File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ func (p XcodeProj) Schemes() ([]xcscheme.Scheme, error) {
6060}
6161
6262// SchemesWithAutocreateEnabled returns the schemes considered by Xcode, when opening the given project as part of a workspace.
63+ // THIS SHOULD BE CALLED ONLY BY A WORKSPACE. If you want to get the schemes directly, please call XcodeProj.Schemes.
64+ //
6365// SchemesWithAutocreateEnabled behaves similarly to XcodeProj.Schemes,
6466// the only difference is that the 'Autocreate schemes' option is coming from the workspace settings.
6567func (p XcodeProj ) SchemesWithAutocreateEnabled (isAutocreateSchemesEnabled bool ) ([]xcscheme.Scheme , error ) {
@@ -88,10 +90,15 @@ func (p XcodeProj) SchemesWithAutocreateEnabled(isAutocreateSchemesEnabled bool)
8890 return defaultSchemes , nil
8991 }
9092
91- return nil , fmt .Errorf ("no schemes found and the Xcode project's 'Autocreate schemes' option is disabled" )
93+ log .TDebugf ("No schemes found" )
94+
95+ // It is perfectly fine if a project does not contain any accessible schemes at all.
96+ // For example, the Pods.xcodeproj file generated by a newer Cocoapods version is such a project file.
97+ return nil , nil
9298 }
9399
94100 log .TDebugf ("%d scheme(s) found" , len (schemes ))
101+
95102 return schemes , nil
96103}
97104
Original file line number Diff line number Diff line change 11package xcworkspace
22
33import (
4- "fmt"
54 "path/filepath"
65 "testing"
76
@@ -53,7 +52,7 @@ func Test_GivenNewlyGeneratedWorkspaceWithWorkspaceSettings_WhenListingSchemes_T
5352 require .Equal (t , true , actualSchemes [0 ].IsShared )
5453}
5554
56- func Test_GivenNewlyGeneratedWorkspaceWithAutocreateSchemesDisabled_WhenListingSchemes_ThenReturnsError (t * testing.T ) {
55+ func Test_GivenNewlyGeneratedWorkspaceWithAutocreateSchemesDisabled_WhenListingSchemes_ThenReturnsAnEmptyList (t * testing.T ) {
5756 xcodeWorkspacePath := testhelper .NewlyGeneratedXcodeWorkspacePath (t )
5857
5958 xcodeProjectPath := filepath .Join (filepath .Dir (xcodeWorkspacePath ), "ios-sample.xcodeproj" )
@@ -67,8 +66,6 @@ func Test_GivenNewlyGeneratedWorkspaceWithAutocreateSchemesDisabled_WhenListingS
6766 require .NoError (t , err )
6867
6968 schemesByContainer , err := workspace .Schemes ()
70- expectedMessage := fmt .Sprintf (`failed to read project (%s) schemes: no schemes found and the Xcode project's 'Autocreate schemes' option is disabled` , xcodeProjectPath )
71- require .EqualError (t , err , expectedMessage )
7269 require .Equal (t , 0 , len (schemesByContainer ))
7370}
7471
You can’t perform that action at this time.
0 commit comments