Ported PBXNativeTarget
This commit is contained in:
parent
756d5e844a
commit
794b84c90f
@ -65,6 +65,26 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Return the Xcode product type, based target kind.
|
||||
--
|
||||
-- @param node
|
||||
-- The product node to identify.
|
||||
-- @returns
|
||||
-- An Xcode product type, string.
|
||||
--
|
||||
|
||||
function xcode.getproducttype(node)
|
||||
local types = {
|
||||
ConsoleApp = "com.apple.product-type.tool",
|
||||
WindowedApp = "com.apple.product-type.application",
|
||||
StaticLib = "com.apple.product-type.library.static",
|
||||
SharedLib = "com.apple.product-type.library.dynamic",
|
||||
}
|
||||
return types[node.cfg.kind]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Returns true if the file name represents a framework.
|
||||
--
|
||||
@ -212,6 +232,38 @@
|
||||
end
|
||||
|
||||
|
||||
function xcode.PBXNativeTarget(tr)
|
||||
_p('/* Begin PBXNativeTarget section */')
|
||||
for _, node in ipairs(tr.products.children) do
|
||||
-- trim ".app" from WindowedApps
|
||||
local name = iif(node.cfg.kind == "WindowedApp", string.sub(node.name, 1, -5), node.name)
|
||||
|
||||
_p(2,'%s /* %s */ = {', node.targetid, name)
|
||||
_p(3,'isa = PBXNativeTarget;')
|
||||
_p(3,'buildConfigurationList = %s /* Build configuration list for PBXNativeTarget "%s" */;', node.cfgsection, name)
|
||||
_p(3,'buildPhases = (')
|
||||
_p(4,'%s /* Resources */,', node.resstageid)
|
||||
_p(4,'%s /* Sources */,', node.sourcesid)
|
||||
_p(4,'%s /* Frameworks */,', node.fxstageid)
|
||||
_p(3,');')
|
||||
_p(3,'buildRules = (')
|
||||
_p(3,');')
|
||||
_p(3,'dependencies = (')
|
||||
_p(3,');')
|
||||
_p(3,'name = %s;', name)
|
||||
if node.cfg.kind == "WindowedApp" then
|
||||
_p(3,'productInstallPath = "$(HOME)/Applications";')
|
||||
end
|
||||
_p(3,'productName = %s;', name)
|
||||
_p(3,'productReference = %s /* %s */;', node.id, node.name)
|
||||
_p(3,'productType = "%s";', xcode.getproducttype(node))
|
||||
_p(2,'};')
|
||||
end
|
||||
_p('/* End PBXNativeTarget section */')
|
||||
_p('')
|
||||
end
|
||||
|
||||
|
||||
function xcode.Footer()
|
||||
_p(1,'};')
|
||||
_p('\trootObject = 08FB7793FE84155DC02AAC07 /* Project object */;')
|
||||
|
@ -153,25 +153,6 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Return the Xcode product type, based target kind.
|
||||
--
|
||||
-- @param node
|
||||
-- The product node to identify.
|
||||
-- @returns
|
||||
-- An Xcode product type, string.
|
||||
--
|
||||
|
||||
function xcode.getproducttype(node)
|
||||
local types = {
|
||||
ConsoleApp = "com.apple.product-type.tool",
|
||||
WindowedApp = "com.apple.product-type.application",
|
||||
StaticLib = "com.apple.product-type.library.static",
|
||||
SharedLib = "com.apple.product-type.library.dynamic",
|
||||
}
|
||||
return types[node.cfg.kind]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Return the Xcode target type, based on the target file extension.
|
||||
@ -225,32 +206,6 @@
|
||||
|
||||
|
||||
|
||||
function xcode.PBXNativeTarget(tr)
|
||||
_p('/* Begin PBXNativeTarget section */')
|
||||
for _, node in ipairs(tr.products.children) do
|
||||
_p(2,'%s /* %s */ = {', node.targetid, node.name)
|
||||
_p(3,'isa = PBXNativeTarget;')
|
||||
_p(3,'buildConfigurationList = %s /* Build configuration list for PBXNativeTarget "%s" */;', node.cfgsection, node.name)
|
||||
_p(3,'buildPhases = (')
|
||||
_p(4,'%s /* Resources */,', node.resstageid)
|
||||
_p(4,'%s /* Sources */,', node.sourcesid)
|
||||
_p(4,'%s /* Frameworks */,', node.fxstageid)
|
||||
_p(3,');')
|
||||
_p(3,'buildRules = (')
|
||||
_p(3,');')
|
||||
_p(3,'dependencies = (')
|
||||
_p(3,');')
|
||||
_p(3,'name = %s;', node.name)
|
||||
_p(3,'productName = %s;', node.name)
|
||||
_p(3,'productReference = %s /* %s */;', node.id, node.name)
|
||||
_p(3,'productType = "%s";', xcode.getproducttype(node))
|
||||
_p(2,'};')
|
||||
end
|
||||
_p('/* End PBXNativeTarget section */')
|
||||
_p('')
|
||||
end
|
||||
|
||||
|
||||
function xcode.PBXProject(tr)
|
||||
_p('/* Begin PBXProject section */')
|
||||
_p(2,'08FB7793FE84155DC02AAC07 /* Project object */ = {')
|
||||
@ -459,7 +414,7 @@
|
||||
xcode.PBXBuildFile(tr) -- done
|
||||
xcode.PBXFileReference(tr) -- done
|
||||
xcode.PBXFrameworksBuildPhase(tr) -- done
|
||||
xcode.PBXGroup(tr)
|
||||
xcode.PBXGroup(tr) -- done
|
||||
xcode.PBXNativeTarget(tr)
|
||||
xcode.PBXProject(tr)
|
||||
xcode.PBXResourcesBuildPhase(tr)
|
||||
|
@ -120,5 +120,6 @@
|
||||
xcode.PBXFileReference(tr)
|
||||
xcode.PBXFrameworksBuildPhase(tr)
|
||||
xcode.PBXGroup(tr)
|
||||
xcode.PBXNativeTarget(tr)
|
||||
xcode.Footer(tr)
|
||||
end
|
||||
|
@ -27,43 +27,6 @@
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- PBXGroup tests
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- PBXNativeTarget tests
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
function T.xcode3.PBXNativeTarget_OnConsoleApp()
|
||||
prepare()
|
||||
xcode.PBXNativeTarget(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXNativeTarget section */
|
||||
[MyProject:target] /* MyProject */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = [MyProject:cfg] /* Build configuration list for PBXNativeTarget "MyProject" */;
|
||||
buildPhases = (
|
||||
[MyProject:rez] /* Resources */,
|
||||
[MyProject:src] /* Sources */,
|
||||
[MyProject:fxs] /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = MyProject;
|
||||
productName = MyProject;
|
||||
productReference = [MyProject:product] /* MyProject */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- PBXProject tests
|
||||
---------------------------------------------------------------------------
|
||||
|
@ -346,3 +346,63 @@
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- PBXNativeTarget tests
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
function suite.PBXNativeTarget_OnConsoleApp()
|
||||
prepare()
|
||||
xcode.PBXNativeTarget(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXNativeTarget section */
|
||||
[MyProject:target] /* MyProject */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = [MyProject:cfg] /* Build configuration list for PBXNativeTarget "MyProject" */;
|
||||
buildPhases = (
|
||||
[MyProject:rez] /* Resources */,
|
||||
[MyProject:src] /* Sources */,
|
||||
[MyProject:fxs] /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = MyProject;
|
||||
productName = MyProject;
|
||||
productReference = [MyProject:product] /* MyProject */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXNativeTarget_OnWindowedApp()
|
||||
kind "WindowedApp"
|
||||
prepare()
|
||||
xcode.PBXNativeTarget(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXNativeTarget section */
|
||||
[MyProject.app:target] /* MyProject */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = [MyProject.app:cfg] /* Build configuration list for PBXNativeTarget "MyProject" */;
|
||||
buildPhases = (
|
||||
[MyProject.app:rez] /* Resources */,
|
||||
[MyProject.app:src] /* Sources */,
|
||||
[MyProject.app:fxs] /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = MyProject;
|
||||
productInstallPath = "$(HOME)/Applications";
|
||||
productName = MyProject;
|
||||
productReference = [MyProject.app:product] /* MyProject.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
]]
|
||||
end
|
||||
|
Reference in New Issue
Block a user