diff options
| -rw-r--r-- | xmake/modules/package/manager/xmake/search_package.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/xmake/modules/package/manager/xmake/search_package.lua b/xmake/modules/package/manager/xmake/search_package.lua index 5b633852c..b96dc2203 100644 --- a/xmake/modules/package/manager/xmake/search_package.lua +++ b/xmake/modules/package/manager/xmake/search_package.lua @@ -19,6 +19,7 @@ -- -- imports +import("core.base.semver") import("core.package.package", {alias = "core_package"}) import("private.action.require.impl.repository") @@ -33,6 +34,10 @@ function main(name) if package then local repo = package:repo() local versions = package:versions() + if versions then + versions = table.copy(versions) + table.sort(versions, function (a, b) return semver.compare(a, b) < 0 end) + end table.insert(results, {name = package:name(), version = versions and versions[1], description = package:get("description"), reponame = repo and repo:name()}) end end |
