This repository has been archived by the owner on Jun 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
xcode4_workspace.lua
84 lines (63 loc) · 1.55 KB
/
xcode4_workspace.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
-- xcode/xcode4_workspace.lua
-- Generate an Xcode workspace.
-- Author Mihai Sebea
-- Modified by Jason Perkins
-- Copyright (c) 2014-2015 Jason Perkins and the Premake project
---
local p = premake
local m = p.modules.xcode
---
-- Generate an Xcode contents.xcworkspacedata file.
---
m.elements.workspace = function(wks)
return {
m.xmlDeclaration,
m.workspace,
m.workspaceFileRefs,
m.workspaceTail,
}
end
function m.generateWorkspace(wks)
m.prepareWorkspace(wks)
p.callArray(m.elements.workspace, wks)
end
function m.workspace()
p.push('<Workspace')
p.w('version = "1.0">')
end
function m.workspaceTail()
-- Don't output final newline. Xcode doesn't.
premake.out('</Workspace>')
end
---
-- Generate the list of project references.
---
m.elements.workspaceFileRef = function(prj)
return {
m.workspaceLocation,
}
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
end
---------------------------------------------------------------------------
--
-- Handlers for individual project elements
--
---------------------------------------------------------------------------
function m.workspaceLocation(prj)
local fname = p.filename(prj, ".xcodeproj")
fname = path.getrelative(prj.workspace.location, fname)
p.w('location = "group:%s"', fname)
end
function m.xmlDeclaration()
p.xmlUtf8(true)
end