diff options
| author | ruki <[email protected]> | 2018-11-17 00:57:29 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-11-16 23:44:55 +0800 |
| commit | c58513ec6ded191db1d97e93d84569d1cdda1282 (patch) | |
| tree | 93d241a93af33183ffedd4323fbb1d8ae842050a /xmake/actions/run/main.lua | |
| parent | 6b6bcc5b264285b141724ef27dc0075b614cbc3e (diff) | |
improve on_build
Diffstat (limited to 'xmake/actions/run/main.lua')
| -rw-r--r-- | xmake/actions/run/main.lua | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua index d2f72acd2..bfd9e414b 100644 --- a/xmake/actions/run/main.lua +++ b/xmake/actions/run/main.lua @@ -33,25 +33,7 @@ import("core.platform.environment") import("devel.debugger") -- run target -function _on_run_target(target) - - -- has been disabled? - if target:get("enabled") == false then - return - end - - -- build target with rules - local done = false - for _, r in ipairs(target:orderules()) do - local on_run = r:script("run") - if on_run then - on_run(target) - done = true - end - end - if done then return end - - -- get kind +function _do_run_target(target) if target:targetkind() == "binary" then -- get the absolute target file path @@ -95,6 +77,29 @@ function _on_run_target(target) end end +-- run target +function _on_run_target(target) + + -- has been disabled? + if target:get("enabled") == false then + return + end + + -- build target with rules + local done = false + for _, r in ipairs(target:orderules()) do + local on_run = r:script("run") + if on_run then + on_run(target, _do_run_target) + done = true + end + end + if done then return end + + -- do run + _do_run_target(target) +end + -- run the given target function _run(target) @@ -140,7 +145,7 @@ function _run(target) for i = 1, 5 do local script = scripts[i] if script ~= nil then - script(target) + script(target, i == 3 and _do_run_target or nil) end end end |
