From 23ffe01a0b47f0d9e827c3cb6e0c57749a9ac0de Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 9 Apr 2017 14:18:42 +0800 Subject: support not kind --- xmake/actions/build/builder.lua | 6 ++++-- xmake/actions/clean/main.lua | 5 +++++ xmake/actions/package/main.lua | 3 +++ xmake/actions/run/main.lua | 3 +++ xmake/platforms/installer.lua | 20 ++++++++++++++++++++ 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/xmake/actions/build/builder.lua b/xmake/actions/build/builder.lua index beef67c41..a910e6107 100644 --- a/xmake/actions/build/builder.lua +++ b/xmake/actions/build/builder.lua @@ -31,8 +31,10 @@ import("core.platform.environment") function _on_build_target(target) -- the target kind - local kind = target:get("kind") - assert(kind, "target(%s).kind not found!", target:name()) + local kind = target:targetkind() + if not kind then + return + end -- build target import("kinds." .. kind).build(target, _g) diff --git a/xmake/actions/clean/main.lua b/xmake/actions/clean/main.lua index eb5f85cab..37e7d0788 100644 --- a/xmake/actions/clean/main.lua +++ b/xmake/actions/clean/main.lua @@ -51,6 +51,11 @@ end -- on clean target function _on_clean_target(target) + -- no target kind? + if not target:targetkind() then + return + end + -- remove the target file _remove(target:targetfile()) diff --git a/xmake/actions/package/main.lua b/xmake/actions/package/main.lua index 0e0566c92..25328a25c 100644 --- a/xmake/actions/package/main.lua +++ b/xmake/actions/package/main.lua @@ -117,6 +117,9 @@ function _package_target(target) -- get kind local kind = target:get("kind") + if not kind then + return + end -- get script local scripts = diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua index 3082783fe..b2b13ae96 100644 --- a/xmake/actions/run/main.lua +++ b/xmake/actions/run/main.lua @@ -51,6 +51,9 @@ function _run_target(target) -- get kind local kind = target:get("kind") + if not kind then + return + end -- get script local scripts = diff --git a/xmake/platforms/installer.lua b/xmake/platforms/installer.lua index 0cc388edb..12aa9132c 100644 --- a/xmake/platforms/installer.lua +++ b/xmake/platforms/installer.lua @@ -29,6 +29,11 @@ import("core.platform.platform") -- install binary function install_binary_on_unix(target) + -- check kind + if not target:targetkind() then + return + end + -- the install directory local installdir = option.get("installdir") or platform.get("installdir") assert(installdir, "unknown install directory!") @@ -46,6 +51,11 @@ end -- install library function install_library_on_unix(target) + -- check kind + if not target:targetkind() then + return + end + -- the install directory local installdir = option.get("installdir") or platform.get("installdir") assert(installdir, "unknown install directory!") @@ -88,6 +98,11 @@ end -- uninstall binary function uninstall_binary_on_unix(target) + -- check kind + if not target:targetkind() then + return + end + -- the install directory local installdir = option.get("installdir") or platform.get("installdir") assert(installdir, "unknown install directory!") @@ -102,6 +117,11 @@ end -- uninstall library function uninstall_library_on_unix(target) + -- check kind + if not target:targetkind() then + return + end + -- the install directory local installdir = option.get("installdir") or platform.get("installdir") assert(installdir, "unknown install directory!") -- cgit v1.3.1