summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-22 23:16:24 +0800
committerruki <[email protected]>2022-09-22 23:16:24 +0800
commit583ec4db7a4e98773ec5d865090abb60de3066e0 (patch)
tree448bab9c919d3f9005c693bb9e115c2d0404d811
parent9473e491160500cda2670e5140cfd2bfe2c1adbb (diff)
add sourcedir for debugging
-rw-r--r--xmake/actions/require/xmake.lua1
-rw-r--r--xmake/modules/private/xrepo/action/install.lua15
2 files changed, 13 insertions, 3 deletions
diff --git a/xmake/actions/require/xmake.lua b/xmake/actions/require/xmake.lua
index 3ffd17fe3..88ec7ca0d 100644
--- a/xmake/actions/require/xmake.lua
+++ b/xmake/actions/require/xmake.lua
@@ -91,6 +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, "extra", "kv", nil, "Set the extra info of packages." }
, { }
, {nil, "requires", "vs", nil, "The package requires.",
diff --git a/xmake/modules/private/xrepo/action/install.lua b/xmake/modules/private/xrepo/action/install.lua
index bd77e7b00..3bea3cd60 100644
--- a/xmake/modules/private/xrepo/action/install.lua
+++ b/xmake/modules/private/xrepo/action/install.lua
@@ -65,6 +65,8 @@ function menu_options()
{nil, "xcode_sdkver", "kv", nil, "The SDK Version for Xcode" },
{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."},
{category = "Other Configuration" },
{nil, "force", "k", nil, "Force to reinstall all package dependencies."},
{nil, "shallow", "k", nil, "Does not install dependent packages."},
@@ -228,13 +230,20 @@ function _install_packages(packages)
if option.get("linkjobs") then
table.insert(require_argv, "--linkjobs=" .. option.get("linkjobs"))
end
- if option.get("force") then
+ local is_debug = false
+ local sourcedir = option.get("sourcedir")
+ if sourcedir then
+ is_debug = true
+ table.insert(require_argv, "-s")
+ table.insert(require_argv, path.absolute(sourcedir))
+ end
+ if option.get("force") or is_debug then
table.insert(require_argv, "--force")
end
- if option.get("shallow") then
+ if option.get("shallow") or is_debug then
table.insert(require_argv, "--shallow")
end
- if option.get("build") then
+ if option.get("build") or is_debug then
table.insert(require_argv, "--build")
end
local extra = {system = false}