From fec55c549fc40e904fce417da25c1ca14ca15cf6 Mon Sep 17 00:00:00 2001 From: Sebastian Kylander Date: Tue, 22 May 2018 00:30:58 +0200 Subject: [PATCH 1/2] Implement CodeLite workspace folders --- modules/codelite/codelite_workspace.lua | 29 ++++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/modules/codelite/codelite_workspace.lua b/modules/codelite/codelite_workspace.lua index dc2f63a42b..7ea326c94a 100755 --- a/modules/codelite/codelite_workspace.lua +++ b/modules/codelite/codelite_workspace.lua @@ -26,11 +26,11 @@ -- -- Header -- - _p('') + p.w('') local tagsdb = "" -- local tagsdb = "./" .. wks.name .. ".tags" - _p('', wks.name, tagsdb) + p.push('', wks.name, tagsdb) -- -- Project list @@ -45,15 +45,18 @@ prjpath = path.getrelative(prj.workspace.location, prjpath) if (prj.name == wks.startproject) then - _x(1, '', prj.name, prjpath) + p.w('', prj.name, prjpath) else - _x(1, '', prj.name, prjpath) + p.w('', prj.name, prjpath) end end, - onbranch = function(n) - -- TODO: not sure what situation this appears...? - -- premake5.lua emit's one of these for 'contrib', which is a top-level folder with the zip projects + onbranchenter = function(n) + p.push('', n.name) + end, + + onbranchexit = function(n) + p.pop('') end, }) @@ -78,23 +81,23 @@ end -- for each workspace config - _p(1, '') + p.push('') for cfg in workspace.eachconfig(wks) do local cfgname = codelite.cfgname(cfg) - _p(2, '', cfgname) + p.push('', cfgname) local tr = workspace.grouptree(wks) tree.traverse(tr, { onleaf = function(n) local prj = n.project - _p(3, '', prj.name, cfgname) + p.w('', prj.name, cfgname) end }) - _p(2, '') + p.pop('') end - _p(1, '') + p.pop('') - _p('') + p.pop('') end From 531437901dcdeb7bcc07f909ea41d71c087d26f1 Mon Sep 17 00:00:00 2001 From: Sebastian Kylander Date: Tue, 22 May 2018 00:31:27 +0200 Subject: [PATCH 2/2] Add tests for CodeLite workspace folders --- .../tests/test_codelite_workspace.lua | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/modules/codelite/tests/test_codelite_workspace.lua b/modules/codelite/tests/test_codelite_workspace.lua index cd56fd0734..f36b8508ae 100644 --- a/modules/codelite/tests/test_codelite_workspace.lua +++ b/modules/codelite/tests/test_codelite_workspace.lua @@ -151,3 +151,42 @@ ]]) end + + + function suite.onGroupedProjects() + wks.projects = {} + project "MyGrouplessProject" + group "MyGroup" + project "MyGroupedProject" + group "My/Nested/Group" + project "MyNestedGroupedProject" + prepare() + test.capture([[ + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]) + end