Ported resource handling in build files
This commit is contained in:
parent
505efec180
commit
5f48d7414e
@ -589,8 +589,8 @@
|
||||
|
||||
function premake.xcode.pbxproj(sln)
|
||||
tr = xcode.buildtree(sln)
|
||||
xcode.Header(tr)
|
||||
xcode.PBXBuildFile(tr)
|
||||
xcode.Header(tr) -- done
|
||||
xcode.PBXBuildFile(tr) -- done
|
||||
xcode.PBXFileReference(tr)
|
||||
xcode.PBXFrameworksBuildPhase(tr)
|
||||
xcode.PBXGroup(tr)
|
||||
@ -601,5 +601,5 @@
|
||||
xcode.PBXVariantGroup(tr)
|
||||
xcode.XCBuildConfiguration(tr)
|
||||
xcode.XCBuildConfigurationList(tr)
|
||||
xcode.Footer(tr)
|
||||
xcode.Footer(tr) -- done
|
||||
end
|
||||
|
@ -20,6 +20,32 @@
|
||||
function xcode.buildprjtree(prj)
|
||||
local tr = premake.project.buildsourcetree(prj)
|
||||
|
||||
-- convert localized resources from their filesystem layout (English.lproj/MainMenu.xib)
|
||||
-- to Xcode's display layout (MainMenu.xib/English).
|
||||
tree.traverse(tr, {
|
||||
onbranch = function(node)
|
||||
if path.getextension(node.name) == ".lproj" then
|
||||
local lang = path.getbasename(node.name) -- "English", "French", etc.
|
||||
|
||||
-- create a new language group for each file it contains
|
||||
for _, filenode in ipairs(node.children) do
|
||||
local grpnode = node.parent.children[filenode.name]
|
||||
if not grpnode then
|
||||
grpnode = tree.insert(node.parent, tree.new(filenode.name))
|
||||
grpnode.kind = "vgroup"
|
||||
end
|
||||
|
||||
-- convert the file node to a language node and add to the group
|
||||
filenode.name = path.getbasename(lang)
|
||||
tree.insert(grpnode, filenode)
|
||||
end
|
||||
|
||||
-- remove this directory from the tree
|
||||
tree.remove(node)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Final setup
|
||||
tree.traverse(tr, {
|
||||
onnode = function(node)
|
||||
|
@ -27,23 +27,6 @@
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- PBXBuildFile tests
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
function T.xcode3.PBXBuildFile_ListsResourceFilesOnlyOnceWithGroupID()
|
||||
files { "English.lproj/MainMenu.xib", "French.lproj/MainMenu.xib" }
|
||||
prepare()
|
||||
xcode.PBXBuildFile(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXBuildFile section */
|
||||
[MainMenu.xib:build] /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = [MainMenu.xib] /* MainMenu.xib */; };
|
||||
/* End PBXBuildFile section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- PBXFileReference tests
|
||||
---------------------------------------------------------------------------
|
||||
|
@ -44,3 +44,15 @@
|
||||
/* End PBXBuildFile section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXBuildFile_ListsResourceFilesOnlyOnceWithGroupID()
|
||||
files { "English.lproj/MainMenu.xib", "French.lproj/MainMenu.xib" }
|
||||
prepare()
|
||||
xcode.PBXBuildFile(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXBuildFile section */
|
||||
[MainMenu.xib:build] /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = [MainMenu.xib] /* MainMenu.xib */; };
|
||||
/* End PBXBuildFile section */
|
||||
]]
|
||||
end
|
||||
|
Reference in New Issue
Block a user