Ported PBXGroup
This commit is contained in:
parent
8ebddad6b0
commit
756d5e844a
@ -178,7 +178,39 @@
|
||||
_p('/* End PBXFrameworksBuildPhase section */')
|
||||
_p('')
|
||||
end
|
||||
|
||||
|
||||
|
||||
function xcode.PBXGroup(tr)
|
||||
_p('/* Begin PBXGroup section */')
|
||||
|
||||
tree.traverse(tr, {
|
||||
onnode = function(node)
|
||||
-- Skip over anything that isn't a proper group
|
||||
if (node.path and #node.children == 0) or node.kind == "vgroup" then
|
||||
return
|
||||
end
|
||||
|
||||
_p(2,'%s /* %s */ = {', node.id, node.name)
|
||||
_p(3,'isa = PBXGroup;')
|
||||
_p(3,'children = (')
|
||||
for _, childnode in ipairs(node.children) do
|
||||
_p(4,'%s /* %s */,', childnode.id, childnode.name)
|
||||
end
|
||||
_p(3,');')
|
||||
_p(3,'name = %s;', node.name)
|
||||
if node.path then
|
||||
_p(3,'path = %s;', node.path)
|
||||
end
|
||||
_p(3,'sourceTree = "<group>";')
|
||||
_p(2,'};')
|
||||
end
|
||||
|
||||
}, true)
|
||||
|
||||
_p('/* End PBXGroup section */')
|
||||
_p('')
|
||||
end
|
||||
|
||||
|
||||
function xcode.Footer()
|
||||
_p(1,'};')
|
||||
|
@ -224,37 +224,6 @@
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
function xcode.PBXGroup(tr)
|
||||
_p('/* Begin PBXGroup section */')
|
||||
|
||||
tree.traverse(tr, {
|
||||
onnode = function(node)
|
||||
-- Skip over anything that isn't a proper group
|
||||
if (node.path and #node.children == 0) or node.kind == "vgroup" then
|
||||
return
|
||||
end
|
||||
|
||||
_p(2,'%s /* %s */ = {', node.id, node.name)
|
||||
_p(3,'isa = PBXGroup;')
|
||||
_p(3,'children = (')
|
||||
for _, childnode in ipairs(node.children) do
|
||||
_p(4,'%s /* %s */,', childnode.id, childnode.name)
|
||||
end
|
||||
_p(3,');')
|
||||
_p(3,'name = %s;', node.name)
|
||||
if node.path then
|
||||
_p(3,'path = %s;', node.path)
|
||||
end
|
||||
_p(3,'sourceTree = "<group>";')
|
||||
_p(2,'};')
|
||||
end
|
||||
|
||||
}, true)
|
||||
|
||||
_p('/* End PBXGroup section */')
|
||||
_p('')
|
||||
end
|
||||
|
||||
|
||||
function xcode.PBXNativeTarget(tr)
|
||||
_p('/* Begin PBXNativeTarget section */')
|
||||
@ -489,7 +458,7 @@
|
||||
xcode.Header(tr) -- done
|
||||
xcode.PBXBuildFile(tr) -- done
|
||||
xcode.PBXFileReference(tr) -- done
|
||||
xcode.PBXFrameworksBuildPhase(tr)
|
||||
xcode.PBXFrameworksBuildPhase(tr) -- done
|
||||
xcode.PBXGroup(tr)
|
||||
xcode.PBXNativeTarget(tr)
|
||||
xcode.PBXProject(tr)
|
||||
|
@ -119,5 +119,6 @@
|
||||
xcode.PBXBuildFile(tr)
|
||||
xcode.PBXFileReference(tr)
|
||||
xcode.PBXFrameworksBuildPhase(tr)
|
||||
xcode.PBXGroup(tr)
|
||||
xcode.Footer(tr)
|
||||
end
|
||||
|
@ -31,186 +31,6 @@
|
||||
-- PBXGroup tests
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
function T.xcode3.PBXGroup_OnOneProjectNoFiles()
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[Products] /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[MyProject:product] /* MyProject */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function T.xcode3.PBXGroup_OnMultipleProjectsNoFiles()
|
||||
test.createproject(sln)
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MySolution] /* MySolution */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[MyProject] /* MyProject */,
|
||||
[MyProject2] /* MyProject2 */,
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MySolution;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[MyProject2] /* MyProject2 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = MyProject2;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[Products] /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[MyProject:product] /* MyProject */,
|
||||
[MyProject2:product] /* MyProject2 */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function T.xcode3.PBXGroup_OnSourceFiles()
|
||||
files { "source.h" }
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[source.h] /* source.h */,
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[Products] /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[MyProject:product] /* MyProject */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function T.xcode3.PBXGroup_OnSourceSubdirs()
|
||||
files { "include/source.h" }
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[include] /* include */,
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[include] /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[source.h] /* source.h */,
|
||||
);
|
||||
name = include;
|
||||
path = include;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function T.xcode3.PBXGroup_OnResourceFiles()
|
||||
files { "English.lproj/MainMenu.xib", "French.lproj/MainMenu.xib", "Info.plist" }
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[Info.plist] /* Info.plist */,
|
||||
[MainMenu.xib] /* MainMenu.xib */,
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[Products] /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[MyProject:product] /* MyProject */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function T.xcode3.PBXGroup_OnFrameworks()
|
||||
links { "Cocoa.framework" }
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[Frameworks] /* Frameworks */,
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[Frameworks] /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[Cocoa.framework] /* Cocoa.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
@ -204,3 +204,145 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- PBXGroup tests
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
function suite.PBXGroup_OnNoFiles()
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[Products] /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[MyProject:product] /* MyProject */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXGroup_OnSourceFiles()
|
||||
files { "source.h" }
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[source.h] /* source.h */,
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[Products] /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[MyProject:product] /* MyProject */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXGroup_OnSourceSubdirs()
|
||||
files { "include/source.h" }
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[include] /* include */,
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[include] /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[source.h] /* source.h */,
|
||||
);
|
||||
name = include;
|
||||
path = include;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXGroup_OnResourceFiles()
|
||||
files { "English.lproj/MainMenu.xib", "French.lproj/MainMenu.xib", "Info.plist" }
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[Info.plist] /* Info.plist */,
|
||||
[MainMenu.xib] /* MainMenu.xib */,
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[Products] /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[MyProject:product] /* MyProject */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXGroup_OnFrameworks()
|
||||
links { "Cocoa.framework" }
|
||||
prepare()
|
||||
xcode.PBXGroup(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXGroup section */
|
||||
[MyProject] /* MyProject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[Frameworks] /* Frameworks */,
|
||||
[Products] /* Products */,
|
||||
);
|
||||
name = MyProject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
[Frameworks] /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
[Cocoa.framework] /* Cocoa.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
Reference in New Issue
Block a user