From a8fa27cba0aff1b17d7541f3255da962734ca303 Mon Sep 17 00:00:00 2001 From: Daniel Brondani Date: Fri, 24 Jul 2026 09:17:28 +0200 Subject: [PATCH 1/2] Allow board layer matching without a selected device Skip comparing the layer's for-device name when the current context does not specify a device. This supports layer discovery where only the board is known while preserving vendor and processor checks when available. Update the unit test to expect successful matching for a board-only context with a device-name constraint. --- tools/projmgr/src/ProjMgrWorker.cpp | 4 +++- tools/projmgr/test/src/ProjMgrWorkerUnitTests.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/projmgr/src/ProjMgrWorker.cpp b/tools/projmgr/src/ProjMgrWorker.cpp index 0bd1746dc..e605d14eb 100644 --- a/tools/projmgr/src/ProjMgrWorker.cpp +++ b/tools/projmgr/src/ProjMgrWorker.cpp @@ -3900,7 +3900,9 @@ bool ProjMgrWorker::CheckBoardDeviceInLayer(const ContextItem& context, const Cl DeviceItem forDevice, device; GetDeviceItem(clayer.forDevice, forDevice); GetDeviceItem(context.device, device); - if ((!forDevice.name.empty() && (forDevice.name != device.name)) || + // Skip the device name comparison against 'for-device' when no device is specified + // This is the case during layer discovery when only the board is specified + if ((!forDevice.name.empty() && !device.name.empty() && (forDevice.name != device.name)) || (!forDevice.vendor.empty() && !device.vendor.empty() && (forDevice.vendor != device.vendor)) || (!forDevice.pname.empty() && !device.pname.empty() && (forDevice.pname != device.pname))) { return false; diff --git a/tools/projmgr/test/src/ProjMgrWorkerUnitTests.cpp b/tools/projmgr/test/src/ProjMgrWorkerUnitTests.cpp index d3a15e2c4..8dae828aa 100644 --- a/tools/projmgr/test/src/ProjMgrWorkerUnitTests.cpp +++ b/tools/projmgr/test/src/ProjMgrWorkerUnitTests.cpp @@ -1786,7 +1786,7 @@ TEST_F(ProjMgrWorkerUnitTests, CheckBoardDeviceInLayer) { {"DeviceVendor::DeviceName:ProcessorName", "OtherVendor::DeviceName:ProcessorName" , false}, {"DeviceVendor::DeviceName:ProcessorName", "DeviceVendor::OtherName:ProcessorName" , false}, {"DeviceVendor::DeviceName:ProcessorName", "DeviceVendor::DeviceName:OtherName" , false}, - {"" , "DeviceName" , false}, + {"" , "DeviceName" , true}, {"DeviceVendor::DeviceName:ProcessorName", "DeviceVendor::DeviceName:ProcessorName", true}, {"DeviceVendor::DeviceName:ProcessorName", "DeviceVendor::DeviceName" , true}, {"DeviceVendor::DeviceName:ProcessorName", "DeviceName" , true}, From d95b43474604084f4d6ba6a34eeb2bd1c119a81a Mon Sep 17 00:00:00 2001 From: Daniel Brondani Date: Fri, 24 Jul 2026 09:57:51 +0200 Subject: [PATCH 2/2] Apply copilot suggestion Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- tools/projmgr/src/ProjMgrWorker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/projmgr/src/ProjMgrWorker.cpp b/tools/projmgr/src/ProjMgrWorker.cpp index e605d14eb..256f2adba 100644 --- a/tools/projmgr/src/ProjMgrWorker.cpp +++ b/tools/projmgr/src/ProjMgrWorker.cpp @@ -3900,8 +3900,8 @@ bool ProjMgrWorker::CheckBoardDeviceInLayer(const ContextItem& context, const Cl DeviceItem forDevice, device; GetDeviceItem(clayer.forDevice, forDevice); GetDeviceItem(context.device, device); - // Skip the device name comparison against 'for-device' when no device is specified - // This is the case during layer discovery when only the board is specified + // Skip comparing the layer's 'for-device' name when the context has no device name + // (e.g. during layer discovery when only the board is specified) if ((!forDevice.name.empty() && !device.name.empty() && (forDevice.name != device.name)) || (!forDevice.vendor.empty() && !device.vendor.empty() && (forDevice.vendor != device.vendor)) || (!forDevice.pname.empty() && !device.pname.empty() && (forDevice.pname != device.pname))) {