diff options
| author | ruki <[email protected]> | 2023-11-14 00:57:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-14 00:57:41 +0800 |
| commit | 6a3e7b08da3e333b0a63b4230f5dbf79df684728 (patch) | |
| tree | 1c55128db8a0106c657cacad9fa7868aed19f2fb /xmake/plugins | |
| parent | ed01c2796c2485eb5a9ee6935605985bea6ad5aa (diff) | |
fix unknown vars
Diffstat (limited to 'xmake/plugins')
| -rw-r--r-- | xmake/plugins/pack/nsis/main.lua | 59 | ||||
| -rw-r--r-- | xmake/plugins/pack/xpack.lua | 8 |
2 files changed, 61 insertions, 6 deletions
diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua index 8058d747c..19b2a208d 100644 --- a/xmake/plugins/pack/nsis/main.lua +++ b/xmake/plugins/pack/nsis/main.lua @@ -22,6 +22,7 @@ import("core.base.option") import("core.base.semver") import("lib.detect.find_tool") +import("private.utils.batchcmds") import("private.action.require.impl.packagenv") import("private.action.require.impl.install_packages") @@ -52,14 +53,68 @@ function _get_makensis() return makensis, oldenvs end +-- get command string +function _get_command_string(package, cmd) + local kind = cmd.kind + local opt = cmd.opt + if kind == "cp" then + -- TODO + elseif kind == "rm" then + -- TODO + elseif kind == "mv" then + -- TODO + elseif kind == "cd" then + -- TODO + elseif kind == "mkdir" then + -- TODO + elseif kind == "show" then + -- TODO + end + return "" +end + +-- get commands string +function _get_commands_string(package, cmds) + local cmdstrs = {} + for _, cmd in ipairs(cmds) do + local cmdstr = _get_command_string(package, cmd) + if cmdstr then + table.insert(cmdstrs, cmdstr) + end + end + return table.concat(cmdstrs, "\n ") +end + -- get install commands function _get_installcmds(package) - return "" + local cmds = batchcmds.new() + + -- TODO + + -- get custom install commands + local script = package:script("installcmd") + if script then + script(package, cmds) + end + + -- generate command string + return _get_command_string(package, cmds) end -- get uninstall commands function _get_uninstallcmds(package) - return "" + local cmds = batchcmds.new() + + -- TODO + + -- get custom uninstall commands + local script = package:script("uninstallcmd") + if script then + script(package, cmds) + end + + -- generate command string + return _get_command_string(package, cmds) end -- get specvars diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua index 13bf924bb..cc377276e 100644 --- a/xmake/plugins/pack/xpack.lua +++ b/xmake/plugins/pack/xpack.lua @@ -21,6 +21,7 @@ -- imports import("core.base.object") import("core.base.option") +import("core.base.semver") import("core.base.hashset") import("core.project.config") import("core.project.project") @@ -220,6 +221,7 @@ function xpack:specvars() PACKAGE_NAME = self:name(), PACKAGE_DESCRIPTION = self:description() or "", PACKAGE_FILENAME = self:filename(), + PACKAGE_HOMEPAGE = self:get("homepage") or "", PACKAGE_COPYRIGHT = self:get("copyright") or "", PACKAGE_COMPANY = self:get("company") or "" } @@ -227,7 +229,7 @@ function xpack:specvars() -- get version local version, version_build = self:version() if version then - specvars.VERSION = version or "0.0.0" + specvars.PACKAGE_VERSION = version or "0.0.0" try {function () local v = semver.new(version) if v then @@ -236,9 +238,7 @@ function xpack:specvars() specvars.PACKAGE_VERSION_ALTER = v:patch() or "0" end end} - if version_build then - specvars.PACKAGE_VERSION_BUILD = version_build or "" - end + specvars.PACKAGE_VERSION_BUILD = version_build or "" end -- get git information |
