From bb16dbc73e1726102828776ec12ce35cfaba135a Mon Sep 17 00:00:00 2001 From: Akylzhan Date: Mon, 25 May 2026 22:04:10 +0500 Subject: init --- xmake/modules/package/manager/vcpkg/find_package.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua index d14092854..e5ae5f7a0 100644 --- a/xmake/modules/package/manager/vcpkg/find_package.lua +++ b/xmake/modules/package/manager/vcpkg/find_package.lua @@ -213,14 +213,21 @@ function _find_package(vcpkg, vcpkgdir, name, opt) depend_name = name .. "[" .. table.concat(required_features, ",") .. "]" end local result = nil - local argv = {"depend-info", depend_name, "--sort=reverse", "--triplet=" .. triplet} + -- pre https://github.com/microsoft/vcpkg-tool/pull/1909 + local argv_old = {"depend-info", depend_name, "--sort=reverse", "--triplet=" .. triplet} + -- post https://github.com/microsoft/vcpkg-tool/pull/1909 + local argv_new = {"depend-info", "--sort=reverse", "--triplet=" .. triplet} -- pass feature flags to depend-info when in manifest mode, otherwise depend-info will not show the complete dependency tree with features if manifest_mode then - table.insert(argv, 1, "--feature-flags=versions") + table.insert(argv_old, 1, "--feature-flags=versions") + table.insert(argv_new, 1, "--feature-flags=versions") end - local _, dependinfo = try { function () return os.iorunv(vcpkg, argv, manifest_mode and {curdir = opt.installdir} or nil) end } + local _, dependinfo = try { function () return os.iorunv(vcpkg, argv_old, manifest_mode and {curdir = opt.installdir} or nil) end } + if not dependinfo then + _, dependinfo = try { function () return os.iorunv(vcpkg, argv_new, manifest_mode and {curdir = opt.installdir} or nil) end } + end if dependinfo then for _, line in ipairs(dependinfo:split("\n", {plain = true})) do if not line:startswith("vcpkg-") then -- cgit v1.3.1 From 9434c5acbe43352e5331771842245f851f14d316 Mon Sep 17 00:00:00 2001 From: Akylzhan Sauranbay Date: Mon, 25 May 2026 22:15:31 +0500 Subject: Update find_package.lua --- xmake/modules/package/manager/vcpkg/find_package.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua index e5ae5f7a0..91e27fa3d 100644 --- a/xmake/modules/package/manager/vcpkg/find_package.lua +++ b/xmake/modules/package/manager/vcpkg/find_package.lua @@ -225,7 +225,7 @@ function _find_package(vcpkg, vcpkgdir, name, opt) end local _, dependinfo = try { function () return os.iorunv(vcpkg, argv_old, manifest_mode and {curdir = opt.installdir} or nil) end } - if not dependinfo then + if manifest_mode and not dependinfo then _, dependinfo = try { function () return os.iorunv(vcpkg, argv_new, manifest_mode and {curdir = opt.installdir} or nil) end } end if dependinfo then -- cgit v1.3.1 From f38aacc87fd1a94fb39755c9f74b8ba143e5dd7d Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 27 May 2026 09:58:42 +0800 Subject: Refactor argv handling in find_package.lua --- xmake/modules/package/manager/vcpkg/find_package.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua index 91e27fa3d..5b515d8a2 100644 --- a/xmake/modules/package/manager/vcpkg/find_package.lua +++ b/xmake/modules/package/manager/vcpkg/find_package.lua @@ -213,20 +213,19 @@ function _find_package(vcpkg, vcpkgdir, name, opt) depend_name = name .. "[" .. table.concat(required_features, ",") .. "]" end local result = nil - -- pre https://github.com/microsoft/vcpkg-tool/pull/1909 - local argv_old = {"depend-info", depend_name, "--sort=reverse", "--triplet=" .. triplet} - -- post https://github.com/microsoft/vcpkg-tool/pull/1909 - local argv_new = {"depend-info", "--sort=reverse", "--triplet=" .. triplet} + local argv = {"depend-info", depend_name, "--sort=reverse", "--triplet=" .. triplet} -- pass feature flags to depend-info when in manifest mode, otherwise depend-info will not show the complete dependency tree with features if manifest_mode then - table.insert(argv_old, 1, "--feature-flags=versions") - table.insert(argv_new, 1, "--feature-flags=versions") + table.insert(argv, 1, "--feature-flags=versions") end - local _, dependinfo = try { function () return os.iorunv(vcpkg, argv_old, manifest_mode and {curdir = opt.installdir} or nil) end } + local _, dependinfo = try { function () return os.iorunv(vcpkg, argv, manifest_mode and {curdir = opt.installdir} or nil) end } if manifest_mode and not dependinfo then - _, dependinfo = try { function () return os.iorunv(vcpkg, argv_new, manifest_mode and {curdir = opt.installdir} or nil) end } + -- fallback: newer vcpkg-tool no longer accepts the package name as a positional argument, + -- drop it and retry. see https://github.com/microsoft/vcpkg-tool/pull/1909 + table.remove(argv, 3) + _, dependinfo = try { function () return os.iorunv(vcpkg, argv, {curdir = opt.installdir}) end } end if dependinfo then for _, line in ipairs(dependinfo:split("\n", {plain = true})) do -- cgit v1.3.1