diff options
| -rw-r--r-- | xmake/includes/xpack/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/plugins/pack/main.lua | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua index 3026e57e9..5227c360a 100644 --- a/xmake/includes/xpack/xmake.lua +++ b/xmake/includes/xpack/xmake.lua @@ -56,6 +56,8 @@ local apis = { "xpack.add_installfiles" }, script = { + -- add custom load script + "xpack.on_load", -- add custom commands script before installing "xpack.before_installcmd", -- add custom commands script before uninstalling diff --git a/xmake/plugins/pack/main.lua b/xmake/plugins/pack/main.lua index e5c50e4b2..09160fda0 100644 --- a/xmake/plugins/pack/main.lua +++ b/xmake/plugins/pack/main.lua @@ -26,10 +26,18 @@ import("private.service.remote_build.action", {alias = "remote_build_action"}) import("actions.build.main", {rootdir = os.programdir(), alias = "build_action"}) import("xpack") +function _load_package(package, format) + package:format_set(format) + local script = package:script("load") + if script then + script(package) + end +end + function _pack_package(package) assert(package:formats(), "xpack(%s): formats not found, please use `set_formats()` to set it.", package:name()) for _, format in package:formats():keys() do - package:format_set(format) + _load_package(package, format) import(format)(package) end end |
