Merge pull request #801 from ricka-github/master

Groups in XCode workspace working.
This commit is contained in:
Tom van Dijck 2017-06-18 15:12:34 -07:00 committed by GitHub
commit b22de644b7
3 changed files with 52 additions and 12 deletions

View File

@ -44,7 +44,10 @@
return prj
end
function m.createGroup(wks)
local prj = group ("MyGroup" .. (#wks.groups + 1))
return prj
end
function m.getWorkspace(wks)

View File

@ -75,6 +75,28 @@
]]
end
function suite.onMultipleProjectsGrouped()
test.createGroup(wks)
test.createproject(wks)
prepare()
test.capture [[
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:MyProject.xcodeproj">
</FileRef>
<Group
location = "container:"
name = "MyGroup1">
<FileRef
location = "group:MyProject2.xcodeproj">
</FileRef>
</Group>
</Workspace>
]]
end
--

View File

@ -8,7 +8,7 @@
local p = premake
local m = p.modules.xcode
local tree = p.tree
---
@ -53,18 +53,33 @@
end
function m.workspaceFileRefs(wks)
for prj in p.workspace.eachproject(wks) do
p.push('<FileRef')
local contents = p.capture(function()
p.callArray(m.elements.workspaceFileRef, prj)
end)
p.outln(contents .. ">")
p.pop('</FileRef>')
end
local tr = p.workspace.grouptree(wks)
tree.traverse(tr, {
onleaf = function(n)
local prj = n.project
p.push('<FileRef')
local contents = p.capture(function()
p.callArray(m.elements.workspaceFileRef, prj)
end)
p.outln(contents .. ">")
p.pop('</FileRef>')
end,
onbranchenter = function(n)
local prj = n.project
p.push('<Group')
p.w('location = "container:"')
p.w('name = "%s">', n.name)
end,
onbranchexit = function(n)
p.pop('</Group>')
end,
})
end
---------------------------------------------------------------------------
--
-- Handlers for individual project elements