summaryrefslogtreecommitdiff
path: root/xmake/actions/package/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-11-17 00:57:29 +0800
committerruki <[email protected]>2018-11-16 23:44:55 +0800
commitc58513ec6ded191db1d97e93d84569d1cdda1282 (patch)
tree93d241a93af33183ffedd4323fbb1d8ae842050a /xmake/actions/package/main.lua
parent6b6bcc5b264285b141724ef27dc0075b614cbc3e (diff)
improve on_build
Diffstat (limited to 'xmake/actions/package/main.lua')
-rw-r--r--xmake/actions/package/main.lua42
1 files changed, 27 insertions, 15 deletions
diff --git a/xmake/actions/package/main.lua b/xmake/actions/package/main.lua
index f8c63c7ed..0c6171dd6 100644
--- a/xmake/actions/package/main.lua
+++ b/xmake/actions/package/main.lua
@@ -113,19 +113,8 @@ option("[targetname]")
end
end
--- package target
-function _on_package(target)
-
- -- build target with rules
- local done = false
- for _, r in ipairs(target:orderules()) do
- local on_package = r:script("package")
- if on_package then
- on_package(target)
- done = true
- end
- end
- if done then return end
+-- do package target
+function _do_package_target(target)
-- is phony target?
if target:isphony() then
@@ -150,6 +139,29 @@ function _on_package(target)
scripts[kind](target)
end
+-- package target
+function _on_package_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_package = r:script("package")
+ if on_package then
+ on_package(target, _do_package_target)
+ done = true
+ end
+ end
+ if done then return end
+
+ -- do package
+ _do_package_target(target)
+end
+
-- package the given target
function _package(target)
@@ -168,7 +180,7 @@ function _package(target)
end
end
end
- , target:script("package", _on_package)
+ , target:script("package", _on_package_target)
, function (target)
for _, r in ipairs(target:orderules()) do
local after_package = r:script("package_after")
@@ -184,7 +196,7 @@ function _package(target)
for i = 1, 5 do
local script = scripts[i]
if script ~= nil then
- script(target)
+ script(target, i == 3 and _do_package_target or nil)
end
end