diff options
| author | ruki <[email protected]> | 2021-07-17 10:44:35 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-07-17 10:44:35 +0800 |
| commit | 292311dbc3a161a4ab85758e069131ac83227d47 (patch) | |
| tree | 90a8e4d1dae0b1149ae34fba50504af1839fc1c4 | |
| parent | 42b7123ea28553b2af3aed1047ff2aa4a6c62fb0 (diff) | |
improve to select artifacts
| -rw-r--r-- | xmake/modules/private/action/require/impl/package.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index daa02f401..3eb47d11f 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -548,11 +548,15 @@ function _select_artifacts_for_msvc(package, artifacts_manifest) local vs_toolset_semver = semver.new(vs_toolset) local msvc_version = "vc" .. vs_toolset_semver:major() .. tostring(vs_toolset_semver:minor()):sub(1, 1) if package:config("shared") or package:is_binary() then + -- we select a newest toolset to get better optimzed performance + local artifacts_infos = {} for key, artifacts_info in pairs(artifacts_manifest) do if key:startswith(package:plat() .. "-" .. package:arch() .. "-vc") and key:endswith("-" .. package:buildhash()) then - return artifacts_info + table.insert(artifacts_infos, artifacts_info) end end + table.sort(artifacts_infos, function (a, b) return semver.compare(a.toolset, b.toolset) > 0 end) + return artifacts_infos[1] else local buildid = package:plat() .. "-" .. package:arch() .. "-" .. msvc_version .. "-" .. package:buildhash() local artifacts_info = artifacts_manifest[buildid] |
