From b101ac117a34cee87989dbba913b8f044ad27aa1 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Tue, 16 Aug 2011 12:22:08 -0400 Subject: [PATCH] Fixed Xcode3 bug with sources in a subdirectory and grouped in virtual path --- src/actions/xcode/xcode_common.lua | 9 ++++++++- tests/actions/vstudio/vc200x/test_filters.lua | 5 ----- tests/actions/xcode/test_xcode_project.lua | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua index bda20e4f..5ebfb0dc 100644 --- a/src/actions/xcode/xcode_common.lua +++ b/src/actions/xcode/xcode_common.lua @@ -325,8 +325,15 @@ src = "absolute" else -- something else; probably a source code file - pth = tree.getlocalpath(node) src = "group" + + -- if the parent node is virtual, it won't have a local path + -- of its own; need to use full relative path from project + if node.parent.isvpath then + pth = node.cfg.name + else + pth = tree.getlocalpath(node) + end end _p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "<%s>"; };', diff --git a/tests/actions/vstudio/vc200x/test_filters.lua b/tests/actions/vstudio/vc200x/test_filters.lua index 0d057ef0..d2bb3cd1 100644 --- a/tests/actions/vstudio/vc200x/test_filters.lua +++ b/tests/actions/vstudio/vc200x/test_filters.lua @@ -56,8 +56,3 @@ local vc200x = premake.vstudio.vc200x ]] end - - --- TODO: should be NO filter, with uuid --- can I tell if this is a virtual folder by munging the path? --- can I build that feature into the source tree? \ No newline at end of file diff --git a/tests/actions/xcode/test_xcode_project.lua b/tests/actions/xcode/test_xcode_project.lua index 642e68e9..4ab50bae 100644 --- a/tests/actions/xcode/test_xcode_project.lua +++ b/tests/actions/xcode/test_xcode_project.lua @@ -156,6 +156,7 @@ ]] end + function suite.PBXFileReference_ListsXibCorrectly() files { "English.lproj/MainMenu.xib", "French.lproj/MainMenu.xib" } prepare() @@ -191,7 +192,7 @@ end - function suite.PBXFileReference_leavesFrameWorkLocationsAsIsWhenSupplied_pathIsSetToInput() + function suite.PBXFileReference_leavesFrameworkLocationsAsIsWhenSupplied_pathIsSetToInput() local inputFrameWork = 'somedir/Foo.framework' links(inputFrameWork) prepare() @@ -252,6 +253,18 @@ end + function suite.PBXFileReference_UsesFullPath_WhenParentIsVirtual() + files { "src/source.c" } + vpaths { ["Source Files"] = "**.c" } + prepare() + xcode.PBXFileReference(tr) + test.capture [[ +/* Begin PBXFileReference section */ + [source.c] /* source.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = "source.c"; path = "src/source.c"; sourceTree = ""; }; + ]] + end + + --------------------------------------------------------------------------- -- PBXFrameworksBuildPhase tests ---------------------------------------------------------------------------