From 9083e8a47ef7604002035635d7186f6a392e0cca Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Thu, 9 Jun 2011 15:19:44 -0400 Subject: [PATCH] Removed deprecated walksources() function --- src/base/project.lua | 51 ------------------------- tests/test_project.lua | 85 ------------------------------------------ 2 files changed, 136 deletions(-) diff --git a/src/base/project.lua b/src/base/project.lua index 261f0fad..6a41c54b 100644 --- a/src/base/project.lua +++ b/src/base/project.lua @@ -611,54 +611,3 @@ function premake.isdotnetproject(prj) return (prj.language == "C#") end - - - --- --- Walk the list of source code files, breaking them into "groups" based --- on the directory hierarchy. --- - - local function walksources(cfg, fn, group, nestlevel, finished) - local grouplen = group:len() - local gname = iif(group:endswith("/"), group:sub(1, -2), group) - - -- open this new group - if (nestlevel >= 0) then - fn(cfg, gname, "GroupStart", nestlevel) - end - - -- scan the list of files for items which belong in this group - for _,fname in ipairs(cfg.files) do - if (fname:startswith(group)) then - - -- is there a subgroup within this item? - local _,split = fname:find("[^\.]/", grouplen + 1) - if (split) then - local subgroup = fname:sub(1, split) - if (not finished[subgroup]) then - finished[subgroup] = true - walksources(cfg, fn, subgroup, nestlevel + 1, finished) - end - end - - end - end - - -- process all files that belong in this group - for _,fname in ipairs(cfg.files) do - if (fname:startswith(group) and not fname:find("[^\.]/", grouplen + 1)) then - fn(cfg, fname, "GroupItem", nestlevel + 1) - end - end - - -- close the group - if (nestlevel >= 0) then - fn(cfg, gname, "GroupEnd", nestlevel) - end - end - - - function premake.walksources(cfg, fn) - walksources(cfg, fn, "", -1, {}) - end diff --git a/tests/test_project.lua b/tests/test_project.lua index fffeceff..223cba3f 100644 --- a/tests/test_project.lua +++ b/tests/test_project.lua @@ -62,88 +62,3 @@ result = premake.getlinks(cfg, "all", "fullpath") test.isequal("user32.lib gdi32.lib", table.concat(result, " ")) end - - - - --- --- premake.walksources() tests --- - - local function walktest(prj, fname, state, nestlevel) - local item - if (state == "GroupStart") then - item = "<" .. fname .. ">" - elseif (state == "GroupEnd") then - item = "" - else - item = fname - end - result = result .. string.rep("-", nestlevel) .. item .. "\n" - end - - - function T.project.walksources_OnNoFiles() - premake.walksources(cfg, walktest) - test.isequal("\n" - .. "" - ,result) - end - - - function T.project.walksources_OnSingleFile() - cfg.files = { - "hello.cpp" - } - premake.walksources(cfg, walktest) - test.isequal("\n" - .. "hello.cpp\n" - ,result) - end - - - function T.project.walksources_OnNestedGroups() - cfg.files = { - "rootfile.c", - "level1/level1.c", - "level1/level2/level2.c" - } - premake.walksources(cfg, walktest) - test.isequal("\n" - .. "\n" - .. "-\n" - .. "--level1/level2/level2.c\n" - .. "-\n" - .. "-level1/level1.c\n" - .. "\n" - .. "rootfile.c\n" - ,result) - end - - - function T.project.walksources_OnDottedFolders() - cfg.files = { - "src/lua-5.1.2/lapi.c" - } - premake.walksources(cfg, walktest) - test.isequal("\n" - .. "\n" - .. "-\n" - .. "--src/lua-5.1.2/lapi.c\n" - .. "-\n" - .. "\n" - ,result) - end - - - function T.project.walksources_OnDotDotLeaders() - cfg.files = { - "../src/hello.c", - } - premake.walksources(cfg, walktest) - test.isequal("\n" - .. "<../src>\n" - .. "-../src/hello.c\n" - .. "\n" - ,result) - end