Better config filter matching, now using per-block relative paths
This commit is contained in:
parent
279caeac82
commit
5714085c28
@ -133,10 +133,10 @@
|
||||
-- Some settings applied at project level; can't be changed in cfg
|
||||
local cfg = project.getfirstconfig(prj)
|
||||
local filecfg = config.getfileconfig(cfg, node.abspath)
|
||||
|
||||
|
||||
local action = premake.dotnet.getbuildaction(filecfg)
|
||||
local fname = path.translate(node.relpath)
|
||||
local elements, dependency = cs2005.getrelated(prj, node.abspath, action)
|
||||
local elements, dependency = cs2005.getrelated(prj, filecfg, action)
|
||||
|
||||
if elements == "None" then
|
||||
_p(2,'<%s Include="%s" />', action, fname)
|
||||
@ -148,12 +148,10 @@
|
||||
_p(3,'<SubType>Designer</SubType>')
|
||||
_p(3,'<Generator>ResXFileCodeGenerator</Generator>')
|
||||
_x(3,'<LastGenOutput>%s.Designer.cs</LastGenOutput>', path.getbasename(node.name))
|
||||
elseif elements == "SubTypeDesigner" then
|
||||
_p(3,'<SubType>Designer</SubType>')
|
||||
elseif elements == "SubTypeForm" then
|
||||
_p(3,'<SubType>Form</SubType>')
|
||||
elseif elements == "PreserveNewest" then
|
||||
_p(3,'<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>')
|
||||
elseif elements then
|
||||
_p(3,'<SubType>%s</SubType>', elements)
|
||||
end
|
||||
if dependency then
|
||||
dependency = project.getrelative(prj, dependency)
|
||||
@ -229,13 +227,14 @@
|
||||
--
|
||||
-- @param prj
|
||||
-- The current project, which contains the source file lists.
|
||||
-- @param fname
|
||||
-- The absolute path of the file under consideration.
|
||||
-- @param filecfg
|
||||
-- The configuration of the file being generated.
|
||||
-- @param action
|
||||
-- The build action for the file under consideration.
|
||||
--
|
||||
|
||||
function cs2005.getrelated(prj, fname, action)
|
||||
function cs2005.getrelated(prj, filecfg, action)
|
||||
local fname = filecfg.abspath
|
||||
if action == "Compile" and fname:endswith(".cs") then
|
||||
if fname:endswith(".Designer.cs") then
|
||||
local basename = fname:sub(1, -13)
|
||||
@ -252,12 +251,11 @@
|
||||
return "AutoGen", testname
|
||||
end
|
||||
else
|
||||
local basename = fname:sub(1, -4)
|
||||
|
||||
-- is there a matching *.Designer.cs?
|
||||
local basename = fname:sub(1, -4)
|
||||
testname = basename .. ".Designer.cs"
|
||||
if project.hasfile(prj, testname) then
|
||||
return "AutoGenerated"
|
||||
return "Form"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1177,7 +1177,8 @@
|
||||
end
|
||||
|
||||
local cfg = { }
|
||||
cfg.terms = table.flatten({terms})
|
||||
cfg.terms = table.flatten({terms})
|
||||
cfg.basedir = os.getcwd()
|
||||
|
||||
table.insert(container.blocks, cfg)
|
||||
premake.CurrentConfiguration = cfg
|
||||
|
@ -102,16 +102,17 @@
|
||||
-- the base dir of the configuration, so single-star wildcards
|
||||
-- (i.e. "*.cpp") will work as expected, and lower-case to make
|
||||
-- the test case-insensitive.
|
||||
filename = { path.getrelative(cfg.basedir, filename):lower() }
|
||||
|
||||
for _, block in ipairs(cfg.solution.blocks) do
|
||||
if oven.filter(block, cfg.terms, filename) then
|
||||
local filter = { path.getrelative(block.basedir, filename):lower() }
|
||||
if oven.filter(block, cfg.terms, filter) then
|
||||
oven.mergefile(fcfg, cfg, block)
|
||||
end
|
||||
end
|
||||
|
||||
for _, block in ipairs(cfg.project.blocks) do
|
||||
if oven.filter(block, cfg.terms, filename) then
|
||||
local filter = { path.getrelative(block.basedir, filename):lower() }
|
||||
if oven.filter(block, cfg.terms, filter) then
|
||||
oven.mergefile(fcfg, cfg, block)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user