Merge new and improved action callback functions (h/t Richard Geary)

This commit is contained in:
Jason Perkins 2015-01-22 13:18:17 -05:00
commit 623c5d3d79
7 changed files with 48 additions and 36 deletions

View File

@ -28,12 +28,12 @@
dotnet = { "mono", "msnet", "pnet" }
},
onsolution = function(sln)
onSolution = function(sln)
premake.escaper(make.esc)
premake.generate(sln, make.getmakefilename(sln, false), make.generate_solution)
end,
onproject = function(prj)
onProject = function(prj)
premake.escaper(make.esc)
local makefile = make.getmakefilename(prj, true)
if project.isdotnet(prj) then
@ -43,11 +43,11 @@
end
end,
oncleansolution = function(sln)
onCleanSolution = function(sln)
premake.clean.file(sln, make.getmakefilename(sln, false))
end,
oncleanproject = function(prj)
onCleanProject = function(prj)
premake.clean.file(prj, make.getmakefilename(prj, true))
end
}

View File

@ -84,12 +84,12 @@
-- Solution and project generation logic
onsolution = vstudio.vs2005.generateSolution,
onproject = vstudio.vs2005.generateProject,
onSolution = vstudio.vs2005.generateSolution,
onProject = vstudio.vs2005.generateProject,
oncleansolution = vstudio.cleanSolution,
oncleanproject = vstudio.cleanProject,
oncleantarget = vstudio.cleanTarget,
onCleanSolution = vstudio.cleanSolution,
onCleanProject = vstudio.cleanProject,
onCleanTarget = vstudio.cleanTarget,
-- This stuff is specific to the Visual Studio exporters

View File

@ -35,12 +35,12 @@
-- Solution and project generation logic
onsolution = vstudio.vs2005.generateSolution,
onproject = vstudio.vs2005.generateProject,
onSolution = vstudio.vs2005.generateSolution,
onProject = vstudio.vs2005.generateProject,
oncleansolution = vstudio.cleanSolution,
oncleanproject = vstudio.cleanProject,
oncleantarget = vstudio.cleanTarget,
onCleanSolution = vstudio.cleanSolution,
onCleanProject = vstudio.cleanProject,
onCleanTarget = vstudio.cleanTarget,
-- This stuff is specific to the Visual Studio exporters

View File

@ -94,13 +94,13 @@
-- Solution and project generation logic
onsolution = vstudio.vs2005.generateSolution,
onproject = vstudio.vs2010.generateProject,
onrule = vstudio.vs2010.generateRule,
onSolution = vstudio.vs2005.generateSolution,
onProject = vstudio.vs2010.generateProject,
onRule = vstudio.vs2010.generateRule,
oncleansolution = vstudio.cleanSolution,
oncleanproject = vstudio.cleanProject,
oncleantarget = vstudio.cleanTarget,
onCleanSolution = vstudio.cleanSolution,
onCleanProject = vstudio.cleanProject,
onCleanTarget = vstudio.cleanTarget,
-- This stuff is specific to the Visual Studio exporters

View File

@ -37,12 +37,12 @@
-- Solution and project generation logic
onsolution = vstudio.vs2005.generateSolution,
onproject = vstudio.vs2010.generateProject,
onSolution = vstudio.vs2005.generateSolution,
onProject = vstudio.vs2010.generateProject,
oncleansolution = vstudio.cleanSolution,
oncleanproject = vstudio.cleanProject,
oncleantarget = vstudio.cleanTarget,
onCleanSolution = vstudio.cleanSolution,
onCleanProject = vstudio.cleanProject,
onCleanTarget = vstudio.cleanTarget,
-- This stuff is specific to the Visual Studio exporters

View File

@ -39,12 +39,12 @@
-- Solution and project generation logic
onsolution = vstudio.vs2005.generateSolution,
onproject = vstudio.vs2010.generateProject,
onSolution = vstudio.vs2005.generateSolution,
onProject = vstudio.vs2010.generateProject,
oncleansolution = vstudio.cleanSolution,
oncleanproject = vstudio.cleanProject,
oncleantarget = vstudio.cleanTarget,
onCleanSolution = vstudio.cleanSolution,
onCleanProject = vstudio.cleanProject,
onCleanTarget = vstudio.cleanTarget,
-- This stuff is specific to the Visual Studio exporters

View File

@ -77,26 +77,38 @@
function action.call(name)
local act = action._list[name]
if act.onStart then
act.onStart()
end
for sln in p.global.eachSolution() do
if act.onsolution then
act.onsolution(sln)
local onSolution = act.onSolution or act.onsolution
if onSolution then
onSolution(sln)
end
for prj in p.solution.eachproject(sln) do
if act.onproject and not prj.external then
act.onproject(prj)
local onProject = act.onProject or act.onproject
if onProject and not prj.external then
onProject(prj)
end
end
end
for rule in p.global.eachRule() do
if act.onrule then
act.onrule(rule)
local onRule = act.onRule or act.onrule
if onRule then
onRule(rule)
end
end
if act.execute then
act.execute()
end
if act.onEnd then
act.onEnd()
end
end