Lost a commit somewhere; catching up with my local repository
This commit is contained in:
parent
9083e8a47e
commit
71cbdbdd7d
@ -53,7 +53,7 @@
|
||||
local embedded = { }
|
||||
local copypairs = { }
|
||||
|
||||
for fcfg in premake.eachfile(prj) do
|
||||
for fcfg in premake.project.eachfile(prj) do
|
||||
local action = csc.getbuildaction(fcfg)
|
||||
if action == "Compile" then
|
||||
table.insert(sources, fcfg.name)
|
||||
|
@ -21,7 +21,7 @@
|
||||
local tr = premake.tree.new(prj.name)
|
||||
tr.project = prj
|
||||
|
||||
for fcfg in premake.eachfile(prj) do
|
||||
for fcfg in premake.project.eachfile(prj) do
|
||||
local node = premake.tree.add(tr, fcfg.name)
|
||||
node.cfg = fcfg
|
||||
end
|
||||
@ -58,7 +58,7 @@
|
||||
-- Iterator for a project's files; returns a file configuration object.
|
||||
--
|
||||
|
||||
function premake.eachfile(prj)
|
||||
function premake.project.eachfile(prj)
|
||||
-- project root config contains the file config list
|
||||
if not prj.project then prj = premake.getconfig(prj) end
|
||||
local i = 0
|
||||
@ -66,7 +66,9 @@
|
||||
return function ()
|
||||
i = i + 1
|
||||
if (i <= #t) then
|
||||
return prj.__fileconfigs[t[i]]
|
||||
local fcfg = prj.__fileconfigs[t[i]]
|
||||
fcfg.vpath = premake.project.getvpath(prj, fcfg.name)
|
||||
return fcfg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -58,6 +58,7 @@
|
||||
|
||||
-- Project API tests
|
||||
dofile("test_project.lua")
|
||||
dofile("project/test_eachfile.lua")
|
||||
dofile("project/test_vpaths.lua")
|
||||
|
||||
-- Baking tests
|
||||
|
47
tests/project/test_eachfile.lua
Normal file
47
tests/project/test_eachfile.lua
Normal file
@ -0,0 +1,47 @@
|
||||
--
|
||||
-- tests/project/test_eachfile.lua
|
||||
-- Automated test suite for the file iteration function.
|
||||
-- Copyright (c) 2011 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.project_eachfile = { }
|
||||
local suite = T.project_eachfile
|
||||
local project = premake.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local sln, prj
|
||||
function suite.setup()
|
||||
sln = test.createsolution()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
premake.bake.buildconfigs()
|
||||
prj = premake.solution.getproject(sln, 1)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Tests
|
||||
--
|
||||
|
||||
function suite.ReturnsAllFiles()
|
||||
files { "hello.h", "hello.c" }
|
||||
prepare()
|
||||
local iter = project.eachfile(prj)
|
||||
test.isequal("hello.h", iter().name)
|
||||
test.isequal("hello.c", iter().name)
|
||||
test.isnil(iter())
|
||||
end
|
||||
|
||||
|
||||
function suite.ReturnedObjectIncludesVpath()
|
||||
files { "hello.h", "hello.c" }
|
||||
vpaths { ["*.h"] = "Headers" }
|
||||
prepare()
|
||||
local iter = project.eachfile(prj)
|
||||
test.isequal("Headers/hello.h", iter().vpath)
|
||||
end
|
Loading…
Reference in New Issue
Block a user