Add support kind:Utility
in xcode4
This commit is contained in:
parent
11e11268db
commit
fd49222a82
@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
-- The capabilities of this action
|
-- The capabilities of this action
|
||||||
|
|
||||||
valid_kinds = { "ConsoleApp", "WindowedApp", "SharedLib", "StaticLib", "Makefile", "None" },
|
valid_kinds = { "ConsoleApp", "WindowedApp", "SharedLib", "StaticLib", "Makefile", "Utility", "None" },
|
||||||
valid_languages = { "C", "C++" },
|
valid_languages = { "C", "C++" },
|
||||||
valid_tools = {
|
valid_tools = {
|
||||||
cc = { "gcc", "clang" },
|
cc = { "gcc", "clang" },
|
||||||
|
@ -686,6 +686,62 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
-- PBXAggregateTarget tests
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function suite.PBXAggregateTarget_OnUtility()
|
||||||
|
kind "Utility"
|
||||||
|
prepare()
|
||||||
|
xcode.PBXAggregateTarget(tr)
|
||||||
|
test.capture [[
|
||||||
|
/* Begin PBXAggregateTarget section */
|
||||||
|
[MyProject:target] /* MyProject */ = {
|
||||||
|
isa = PBXAggregateTarget;
|
||||||
|
buildConfigurationList = [MyProject:cfg] /* Build configuration list for PBXAggregateTarget "MyProject" */;
|
||||||
|
buildPhases = (
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = MyProject;
|
||||||
|
productName = MyProject;
|
||||||
|
};
|
||||||
|
/* End PBXAggregateTarget section */
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function suite.PBXAggregateTarget_OnBuildCommands()
|
||||||
|
kind "Utility"
|
||||||
|
prebuildcommands { "prebuildcmd" }
|
||||||
|
prelinkcommands { "prelinkcmd" }
|
||||||
|
postbuildcommands { "postbuildcmd" }
|
||||||
|
prepare()
|
||||||
|
xcode.PBXAggregateTarget(tr)
|
||||||
|
test.capture [[
|
||||||
|
/* Begin PBXAggregateTarget section */
|
||||||
|
[MyProject:target] /* MyProject */ = {
|
||||||
|
isa = PBXAggregateTarget;
|
||||||
|
buildConfigurationList = [MyProject:cfg] /* Build configuration list for PBXAggregateTarget "MyProject" */;
|
||||||
|
buildPhases = (
|
||||||
|
9607AE1010C857E500CD1376 /* Prebuild */,
|
||||||
|
9607AE3510C85E7E00CD1376 /* Prelink */,
|
||||||
|
9607AE3710C85E8F00CD1376 /* Postbuild */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = MyProject;
|
||||||
|
productName = MyProject;
|
||||||
|
};
|
||||||
|
/* End PBXAggregateTarget section */
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
-- PBXProject tests
|
-- PBXProject tests
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
@ -575,6 +575,14 @@
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function isAggregateTarget(node)
|
||||||
|
local productsId = xcode.newid("Products")
|
||||||
|
return node.id == productsId and node.parent.project and node.parent.project.kind == "Utility"
|
||||||
|
end
|
||||||
|
if isAggregateTarget(node) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
settings[node.productgroupid or node.id] = function()
|
settings[node.productgroupid or node.id] = function()
|
||||||
-- project references get special treatment
|
-- project references get special treatment
|
||||||
if node.parent == tr.projects then
|
if node.parent == tr.projects then
|
||||||
@ -586,8 +594,10 @@
|
|||||||
_p(3,'isa = PBXGroup;')
|
_p(3,'isa = PBXGroup;')
|
||||||
_p(3,'children = (')
|
_p(3,'children = (')
|
||||||
for _, childnode in ipairs(node.children) do
|
for _, childnode in ipairs(node.children) do
|
||||||
|
if not isAggregateTarget(childnode) then
|
||||||
_p(4,'%s /* %s */,', childnode.id, childnode.name)
|
_p(4,'%s /* %s */,', childnode.id, childnode.name)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
_p(3,');')
|
_p(3,');')
|
||||||
|
|
||||||
if node.parent == tr.projects then
|
if node.parent == tr.projects then
|
||||||
@ -621,8 +631,30 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function xcode.PBXNativeTarget(tr)
|
local function xcode_PBXAggregateOrNativeTarget(tr, pbxTargetName)
|
||||||
_p('/* Begin PBXNativeTarget section */')
|
local kinds = {
|
||||||
|
Aggregate = {
|
||||||
|
"Utility",
|
||||||
|
},
|
||||||
|
Native = {
|
||||||
|
"ConsoleApp",
|
||||||
|
"WindowedApp",
|
||||||
|
"SharedLib",
|
||||||
|
"StaticLib",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
local hasTarget = false
|
||||||
|
for _, node in ipairs(tr.products.children) do
|
||||||
|
hasTarget = table.contains(kinds[pbxTargetName], node.cfg.kind)
|
||||||
|
if hasTarget then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not hasTarget then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
_p('/* Begin PBX%sTarget section */', pbxTargetName)
|
||||||
for _, node in ipairs(tr.products.children) do
|
for _, node in ipairs(tr.products.children) do
|
||||||
local name = tr.project.name
|
local name = tr.project.name
|
||||||
|
|
||||||
@ -644,18 +676,22 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
_p(2,'%s /* %s */ = {', node.targetid, name)
|
_p(2,'%s /* %s */ = {', node.targetid, name)
|
||||||
_p(3,'isa = PBXNativeTarget;')
|
_p(3,'isa = PBX%sTarget;', pbxTargetName)
|
||||||
_p(3,'buildConfigurationList = %s /* Build configuration list for PBXNativeTarget "%s" */;', node.cfgsection, escapeSetting(name))
|
_p(3,'buildConfigurationList = %s /* Build configuration list for PBX%sTarget "%s" */;', node.cfgsection, pbxTargetName, escapeSetting(name))
|
||||||
_p(3,'buildPhases = (')
|
_p(3,'buildPhases = (')
|
||||||
if hasBuildCommands('prebuildcommands') then
|
if hasBuildCommands('prebuildcommands') then
|
||||||
_p(4,'9607AE1010C857E500CD1376 /* Prebuild */,')
|
_p(4,'9607AE1010C857E500CD1376 /* Prebuild */,')
|
||||||
end
|
end
|
||||||
|
if pbxTargetName == "Native" then
|
||||||
_p(4,'%s /* Resources */,', node.resstageid)
|
_p(4,'%s /* Resources */,', node.resstageid)
|
||||||
_p(4,'%s /* Sources */,', node.sourcesid)
|
_p(4,'%s /* Sources */,', node.sourcesid)
|
||||||
|
end
|
||||||
if hasBuildCommands('prelinkcommands') then
|
if hasBuildCommands('prelinkcommands') then
|
||||||
_p(4,'9607AE3510C85E7E00CD1376 /* Prelink */,')
|
_p(4,'9607AE3510C85E7E00CD1376 /* Prelink */,')
|
||||||
end
|
end
|
||||||
|
if pbxTargetName == "Native" then
|
||||||
_p(4,'%s /* Frameworks */,', node.fxstageid)
|
_p(4,'%s /* Frameworks */,', node.fxstageid)
|
||||||
|
end
|
||||||
if hasBuildCommands('postbuildcommands') then
|
if hasBuildCommands('postbuildcommands') then
|
||||||
_p(4,'9607AE3710C85E8F00CD1376 /* Postbuild */,')
|
_p(4,'9607AE3710C85E8F00CD1376 /* Postbuild */,')
|
||||||
end
|
end
|
||||||
@ -671,6 +707,7 @@
|
|||||||
|
|
||||||
_p(3,'name = %s;', stringifySetting(name))
|
_p(3,'name = %s;', stringifySetting(name))
|
||||||
|
|
||||||
|
if pbxTargetName == "Native" then
|
||||||
local p
|
local p
|
||||||
if node.cfg.kind == "ConsoleApp" then
|
if node.cfg.kind == "ConsoleApp" then
|
||||||
p = "$(HOME)/bin"
|
p = "$(HOME)/bin"
|
||||||
@ -680,17 +717,30 @@
|
|||||||
if p then
|
if p then
|
||||||
_p(3,'productInstallPath = %s;', stringifySetting(p))
|
_p(3,'productInstallPath = %s;', stringifySetting(p))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
_p(3,'productName = %s;', stringifySetting(name))
|
_p(3,'productName = %s;', stringifySetting(name))
|
||||||
|
if pbxTargetName == "Native" then
|
||||||
_p(3,'productReference = %s /* %s */;', node.id, node.name)
|
_p(3,'productReference = %s /* %s */;', node.id, node.name)
|
||||||
_p(3,'productType = %s;', stringifySetting(xcode.getproducttype(node)))
|
_p(3,'productType = %s;', stringifySetting(xcode.getproducttype(node)))
|
||||||
|
end
|
||||||
_p(2,'};')
|
_p(2,'};')
|
||||||
end
|
end
|
||||||
_p('/* End PBXNativeTarget section */')
|
_p('/* End PBX%sTarget section */', pbxTargetName)
|
||||||
_p('')
|
_p('')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function xcode.PBXAggregateTarget(tr)
|
||||||
|
xcode_PBXAggregateOrNativeTarget(tr, "Aggregate")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function xcode.PBXNativeTarget(tr)
|
||||||
|
xcode_PBXAggregateOrNativeTarget(tr, "Native")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function xcode.PBXProject(tr)
|
function xcode.PBXProject(tr)
|
||||||
_p('/* Begin PBXProject section */')
|
_p('/* Begin PBXProject section */')
|
||||||
_p(2,'08FB7793FE84155DC02AAC07 /* Project object */ = {')
|
_p(2,'08FB7793FE84155DC02AAC07 /* Project object */ = {')
|
||||||
|
@ -177,6 +177,7 @@
|
|||||||
xcode.PBXFrameworksBuildPhase(tr)
|
xcode.PBXFrameworksBuildPhase(tr)
|
||||||
xcode.PBXGroup(tr)
|
xcode.PBXGroup(tr)
|
||||||
xcode.PBXNativeTarget(tr)
|
xcode.PBXNativeTarget(tr)
|
||||||
|
xcode.PBXAggregateTarget(tr)
|
||||||
xcode.PBXProject(tr)
|
xcode.PBXProject(tr)
|
||||||
xcode.PBXReferenceProxy(tr)
|
xcode.PBXReferenceProxy(tr)
|
||||||
xcode.PBXResourcesBuildPhase(tr)
|
xcode.PBXResourcesBuildPhase(tr)
|
||||||
|
Reference in New Issue
Block a user