Skip baking and validation phases for "non-configurable" actions
For actions that don't actually use the configured project information—such Premake's own embed, test, and release actions—the results of baking and validation phases aren't used, and the extra processing just takes up unnecessary time. Detect this case by checking the action for an onSolution() or onProject() call; if there isn't one, if isn't configurable. If you have a custom action that does all its work in execute() that *does* need configurable information, you can just define a empty onSolution() function.
This commit is contained in:
parent
77a4c81406
commit
8ed53ed3be
@ -217,7 +217,7 @@
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
if not os.isfile(_MAIN_SCRIPT) then
|
||||
if p.action.isConfigurable() and not os.isfile(_MAIN_SCRIPT) then
|
||||
print(string.format("No Premake script (%s) found!", path.getname(_MAIN_SCRIPT)))
|
||||
os.exit(1)
|
||||
end
|
||||
@ -230,8 +230,10 @@
|
||||
---
|
||||
|
||||
function m.preBake()
|
||||
if p.action.isConfigurable() then
|
||||
print("Building configurations...")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
@ -239,8 +241,10 @@
|
||||
---
|
||||
|
||||
function m.bake()
|
||||
if p.action.isConfigurable() then
|
||||
premake.oven.bake()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
@ -257,8 +261,10 @@
|
||||
---
|
||||
|
||||
function m.validate()
|
||||
if p.action.isConfigurable() then
|
||||
p.container.validate(p.api.rootContainer())
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
@ -287,5 +293,7 @@
|
||||
---
|
||||
|
||||
function m.postAction()
|
||||
if p.action.isConfigurable() then
|
||||
print("Done.")
|
||||
end
|
||||
end
|
||||
|
@ -160,6 +160,28 @@
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Determines if an action makes use of the configuration information
|
||||
-- provided by the project scripts (i.e. it is an exporter) or if it
|
||||
-- simply performs an action irregardless of configuration, in which
|
||||
-- case the baking and validation phases can be skipped.
|
||||
---
|
||||
|
||||
function action.isConfigurable(self)
|
||||
if not self then
|
||||
self = action.current() or {}
|
||||
end
|
||||
if self.onSolution or self.onsolution then
|
||||
return true
|
||||
end
|
||||
if self.onProject or self.onproject then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Activates a particular action.
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user