diff options
| author | ruki <[email protected]> | 2025-11-17 23:23:03 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-17 23:23:03 +0800 |
| commit | 80b4ebb7033748c8cf1b132b1c0a68c3810229ef (patch) | |
| tree | 986d97db7a7b924878e100c457773022049a1ea1 /xmake/core/project | |
| parent | 934b2f410cf91fd54003576e615faa8db65f4aa3 (diff) | |
improve to parse require
Diffstat (limited to 'xmake/core/project')
| -rw-r--r-- | xmake/core/project/project.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index 1bdba46ca..f10cdc894 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -1138,14 +1138,17 @@ function project.requireconfs_str() local requires_extra = project._memcache():get("requires_extra") local sync_requires_to_deps = project._memcache():get("package.sync_requires_to_deps") if requires_str and not sync_requires_to_deps then + local package_utils = project._package_utils + if package_utils == nil then + package_utils = sandbox_module.import("private.utils.package", {anonymous = true}) + project._package_utils = package_utils + end requires_extra = requires_extra and table.wrap(requires_extra) or {} requireconfs_str = requireconfs_str and table.wrap(requireconfs_str) or {} requireconfs_extra = requireconfs_extra and table.wrap(requireconfs_extra) or {} for _, require_str in ipairs(table.wrap(requires_str)) do if not require_str:find("::", 1, true) then - local splitinfo = require_str:split("%s") - local packagename = splitinfo[1] - local packageversion = splitinfo[2] + local packagename, packageversion = package_utils.parse_requirestr(require_str) local requireconf_str = "**." .. packagename local requireconf_extra = table.clone(requires_extra[require_str]) if requireconf_extra then |
