diff options
| author | ruki <[email protected]> | 2024-10-24 22:39:51 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-10-24 22:39:51 +0800 |
| commit | 13c88acff1ee187c5df4382b0f9f603552fefc94 (patch) | |
| tree | f7fca3138128de8ebe4a8014151b23643363c6a0 | |
| parent | b3c6d968249e01ce2b00417c4d63ae524e883afd (diff) | |
improve require name
| -rw-r--r-- | xmake/core/project/project.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/private/action/require/impl/package.lua | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index b6c7e6334..6c896dde5 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -501,8 +501,12 @@ function project._load_requires() requires_extra = requires_extra or {} for _, requirestr in ipairs(table.wrap(requires_str)) do - -- get the package name + -- get the package name, e.g. packagename[foo,bar] >1.0 local packagename = requirestr:split("%s")[1] + local packagename_raw, _ = packagename:match("(.-)%[(.*)%]") + if packagename_raw and not packagename:find("::", 1, true) then + packagename = packagename_raw + end -- get alias and requireconfs local alias = nil diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 721025344..34d7f8d22 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -149,8 +149,7 @@ function _load_require(require_str, requires_extra, parentinfo) require_extra = requires_extra[require_str] or {} end - - -- parse configs from package name + -- parse configs from package name, and we need to ignore 3rd package name, e.g. vcpkg::boost[core], ... -- @see https://github.com/xmake-io/xmake/issues/5727#issuecomment-2421040107 -- -- e.g. @@ -158,7 +157,7 @@ function _load_require(require_str, requires_extra, parentinfo) -- add_requires("libplist[shared,debug,codecs=[foo,bar,zoo]]") -- local packagename_raw, configs_str = packagename:match("(.-)%[(.*)%]") - if packagename_raw and configs_str then + if packagename_raw and configs_str and not packagename:find("::", 1, true) then configs_str = configs_str:gsub("%[(.*)%]", function (w) return w:replace(",", ":") end) |
