diff options
| author | ruki <[email protected]> | 2022-10-08 00:04:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-10-08 00:04:45 +0800 |
| commit | 2ac4dddd95828211c20099833353d722f7ff531e (patch) | |
| tree | 75786e6abaeced90b43fb8a2ff193a4fc4f3aef4 | |
| parent | 3af745fe82cc5ff1627a395b184908ee6d1f6907 (diff) | |
add raw package name
| -rw-r--r-- | xmake/core/project/package.lua | 12 | ||||
| -rw-r--r-- | xmake/core/project/project.lua | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/xmake/core/project/package.lua b/xmake/core/project/package.lua index a716ae9e6..0e0b4f964 100644 --- a/xmake/core/project/package.lua +++ b/xmake/core/project/package.lua @@ -62,11 +62,21 @@ function _instance:get(infoname) return self._INFO[infoname] end --- get the require name +-- get the package name (with alias name) function _instance:name() return self._NAME end +-- get raw package name +function _instance:package_name() + local packagename = self._PACKAGE_NAME + if not packagename then + packagename = self:requirestr():split("%s")[1] + self._PACKAGE_NAME = packagename + end + return packagename +end + -- get the package version function _instance:version() diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index bb1540106..8e53dbc4e 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -485,7 +485,7 @@ function project._load_requires() for _, requirestr in ipairs(table.wrap(requires_str)) do -- get the package name - local packagename = requirestr:split('%s')[1] + local packagename = requirestr:split("%s")[1] -- get alias local alias = nil |
