Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workspace.load_schemes() not finding schemes in a project that is in a group #630

Closed
loufranco opened this issue Dec 5, 2018 · 0 comments · Fixed by #633
Closed

workspace.load_schemes() not finding schemes in a project that is in a group #630

loufranco opened this issue Dec 5, 2018 · 0 comments · Fixed by #633

Comments

@loufranco
Copy link
Contributor

If I have a workspace with a project that is inside a group, the schemes in that project are not found with workspace.load_schemes()

This is causing problems in fastlane, which cannot access these schemes.

This zip has a workspace with 2 projects, one in a group, and one at root.

WorkspaceWIthProjectInGroup.zip

I have the following script (using xcodeproj 1.7.0)

require 'xcodeproj'
project_path = './WorkspaceWIthProjectInGroup.xcworkspace/'
workspace = Xcodeproj::Workspace.new_from_xcworkspace(project_path)
workspace.load_schemes(project_path)
print workspace.schemes.to_s.gsub(",", "\n")

This prints

{"DummyRootProject-WORKS"=>"/Users/lfranco/src/WorkspaceWIthProjectInGroup/DummyRootProject/DummyRootProject.xcodeproj"
 "DummyRootProject"=>"/Users/lfranco/src/WorkspaceWIthProjectInGroup/WorkspaceWIthProjectInGroup.xcworkspace/DummyRootProject/DummyRootProject.xcodeproj"
 "DummyProject"=>"/Users/lfranco/src/WorkspaceWIthProjectInGroup/WorkspaceWIthProjectInGroup.xcworkspace/DummyProject/DummyProject.xcodeproj"}

But DummyProject has another shared scheme (DummyProject-NEW). Here is the result of a find for xcscheme files

$ find . -name '*.xcscheme'
./DummyProject/DummyProject/DummyProject.xcodeproj/xcshareddata/xcschemes/DummyProject-NEW.xcscheme
./DummyProject/DummyProject/DummyProject.xcodeproj/xcshareddata/xcschemes/DummyProject.xcscheme
./DummyRootProject/DummyRootProject.xcodeproj/xcshareddata/xcschemes/DummyRootProject-WORKS.xcscheme
./DummyRootProject/DummyRootProject.xcodeproj/xcshareddata/xcschemes/DummyRootProject.xcscheme

And here is xcodebuild -list

$ xcodebuild -list
Information about workspace "WorkspaceWithProjectInGroup":
    Schemes:
        DummyProject
        DummyProject-NEW
        DummyRootProject
        DummyRootProject-WORKS

It really looks to me like FileReference.absolute_path is wrong for type=group -- it doesn't take the group location into account. Here is the relevant Group/FileRef node from the workspace

   <Group
      location = "container:DummyProject"
      name = "DummyProject">
      <FileRef
         location = "group:DummyProject/DummyProject.xcodeproj">
      </FileRef>
   </Group>

The path to the project is ./DummyProject/DummyProject/DummyProject.xcodeproj

This is called from Workspace.load_schemes

kingfai added a commit to kingfai/Xcodeproj that referenced this issue Dec 14, 2018
segiddins added a commit that referenced this issue Dec 26, 2018
#630 : filerefs now take parent group location into account
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant