summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-22 23:22:19 +0800
committerruki <[email protected]>2022-09-22 23:22:19 +0800
commit4139d07bac797f7775d6a3957a1aa37c67d730ff (patch)
treebf681ed2aa88e587d84dc71ab3b02294176134d5
parent583ec4db7a4e98773ec5d865090abb60de3066e0 (diff)
debug package in the given debug directory
-rw-r--r--xmake/actions/require/xmake.lua2
-rw-r--r--xmake/modules/private/action/require/impl/actions/download.lua8
-rw-r--r--xmake/modules/private/xrepo/action/install.lua8
3 files changed, 13 insertions, 5 deletions
diff --git a/xmake/actions/require/xmake.lua b/xmake/actions/require/xmake.lua
index 88ec7ca0d..150bba51f 100644
--- a/xmake/actions/require/xmake.lua
+++ b/xmake/actions/require/xmake.lua
@@ -91,7 +91,7 @@ task("require")
" $ xmake require --import --packagedir=packagesdir zlib",
" $ xmake require --import --extra=\"{debug=true}\" tbox" }
, {nil, "packagedir", "kv", "packages","Set the packages directory for exporting and importing." }
- , {nil, "sourcedir", "kv", nil, "Set the source directory of the current package for debugging." }
+ , {nil, "debugdir", "kv", nil, "Set the source directory of the current package for debugging." }
, {nil, "extra", "kv", nil, "Set the extra info of packages." }
, { }
, {nil, "requires", "vs", nil, "The package requires.",
diff --git a/xmake/modules/private/action/require/impl/actions/download.lua b/xmake/modules/private/action/require/impl/actions/download.lua
index 7d0666c4e..a70b712fc 100644
--- a/xmake/modules/private/action/require/impl/actions/download.lua
+++ b/xmake/modules/private/action/require/impl/actions/download.lua
@@ -258,6 +258,14 @@ function main(package)
{
function ()
+ -- use debug source directory directly?
+ local debugdir = package:is_toplevel() and option.get("debugdir") or nil
+ if debugdir then
+ package:set("sourcedir", debugdir)
+ tty.erase_line_to_start().cr()
+ return true
+ end
+
-- download package
local sourcedir = "source"
local script = package:script("download")
diff --git a/xmake/modules/private/xrepo/action/install.lua b/xmake/modules/private/xrepo/action/install.lua
index 3bea3cd60..19d594178 100644
--- a/xmake/modules/private/xrepo/action/install.lua
+++ b/xmake/modules/private/xrepo/action/install.lua
@@ -66,7 +66,7 @@ function menu_options()
{nil, "target_minver", "kv", nil, "The Target Minimal Version" },
{nil, "appledev", "kv", nil, "The Apple Device Type" },
{category = "Debug Configuration" },
- {'s', "sourcedir", "kv", nil, "The source directory of the current package for debugging. It will enable --force/--shallow by default."},
+ {'d', "debugdir", "kv", nil, "The source directory of the current package for debugging. It will enable --force/--shallow by default."},
{category = "Other Configuration" },
{nil, "force", "k", nil, "Force to reinstall all package dependencies."},
{nil, "shallow", "k", nil, "Does not install dependent packages."},
@@ -126,6 +126,7 @@ function _install_packages(packages)
if packagefile then
subdir = subdir .. "-" .. hash.uuid(packagefile):split('-')[1]
end
+ local origindir = os.curdir()
local workdir = path.join(os.tmpdir(), "xrepo", subdir)
if not os.isdir(workdir) then
os.mkdir(workdir)
@@ -231,11 +232,10 @@ function _install_packages(packages)
table.insert(require_argv, "--linkjobs=" .. option.get("linkjobs"))
end
local is_debug = false
- local sourcedir = option.get("sourcedir")
+ local sourcedir = option.get("debugdir")
if sourcedir then
is_debug = true
- table.insert(require_argv, "-s")
- table.insert(require_argv, path.absolute(sourcedir))
+ table.insert(require_argv, "--debugdir=" .. path.absolute(sourcedir, origindir))
end
if option.get("force") or is_debug then
table.insert(require_argv, "--force")