summaryrefslogtreecommitdiff
path: root/xmake/modules/private/action/require/impl/repository.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules/private/action/require/impl/repository.lua')
-rw-r--r--xmake/modules/private/action/require/impl/repository.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/xmake/modules/private/action/require/impl/repository.lua b/xmake/modules/private/action/require/impl/repository.lua
index 3df59c42c..d17bdb570 100644
--- a/xmake/modules/private/action/require/impl/repository.lua
+++ b/xmake/modules/private/action/require/impl/repository.lua
@@ -151,6 +151,9 @@ function pulled()
end
-- get package directory from repositories
+--
+-- @param packagename the package name
+-- @param opt {rootdir = "packages|addons|plugins"}
function packagedir(packagename, opt)
-- strip trailing ~tag, e.g. zlib~debug
@@ -162,7 +165,8 @@ function packagedir(packagename, opt)
-- get cache key
local reponame = opt.name
- local cachekey = packagename
+ local rootdir = opt.rootdir or "packages"
+ local cachekey = rootdir .. "/" .. packagename
local locked_repo = opt.locked_repo
if locked_repo then
cachekey = cachekey .. locked_repo.url .. (locked_repo.commit or "") .. (locked_repo.branch or "")
@@ -185,7 +189,7 @@ function packagedir(packagename, opt)
-- find the package directory from repositories
if not foundir then
for _, repo in ipairs(repositories()) do
- local dir = path.join(repo:directory(), "packages", packagename:sub(1, 1), packagename)
+ local dir = path.join(repo:directory(), rootdir, packagename:sub(1, 1), packagename)
if os.isdir(dir) and os.isfile(path.join(dir, "xmake.lua")) and (not reponame or reponame == repo:name()) then
foundir = {dir, repo}
break