summaryrefslogtreecommitdiff
path: root/xmake/actions/build/builder.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-04-13 22:32:17 +0800
committerruki <[email protected]>2018-04-13 09:13:43 +0800
commita5db969b72cd12419a6699ebd98f6fa5a9b85019 (patch)
tree0b72603f2a2df5fbfe06cc484180bf70e0ffb174 /xmake/actions/build/builder.lua
parentafcbad58716d9b766d77a70827f45695c9819099 (diff)
add other scripts for rule
Diffstat (limited to 'xmake/actions/build/builder.lua')
-rw-r--r--xmake/actions/build/builder.lua29
1 files changed, 28 insertions, 1 deletions
diff --git a/xmake/actions/build/builder.lua b/xmake/actions/build/builder.lua
index 056cc746e..e34067230 100644
--- a/xmake/actions/build/builder.lua
+++ b/xmake/actions/build/builder.lua
@@ -39,6 +39,17 @@ end
-- on build the given target
function _on_build_target(target)
+ -- build target with rules
+ local done = false
+ for _, r in ipairs(target:orderules()) do
+ local on_build = r:script("build")
+ if on_build then
+ on_build(target)
+ done = true
+ end
+ end
+ if done then return end
+
-- build target
if not target:isphony() then
import("kinds." .. target:targetkind()).build(target, _g)
@@ -52,7 +63,23 @@ function _build_target(target)
local scripts =
{
target:script("build_before")
+ , function (target)
+ for _, r in ipairs(target:orderules()) do
+ local before_build = r:script("build_before")
+ if before_build then
+ before_build(target)
+ end
+ end
+ end
, target:script("build", _on_build_target)
+ , function (target)
+ for _, r in ipairs(target:orderules()) do
+ local after_build = r:script("build_after")
+ if after_build then
+ after_build(target)
+ end
+ end
+ end
, target:script("build_after")
}
@@ -62,7 +89,7 @@ function _build_target(target)
end
-- run the target scripts
- for i = 1, 3 do
+ for i = 1, 5 do
local script = scripts[i]
if script ~= nil then
script(target)