[projmgr] Global Generator: update context selection, defer partial processing failures#2504
Conversation
…rocessing failures
Test Results 3 files - 55 21 suites - 155 17m 50s ⏱️ - 6m 0s Results for commit e27a5fa. ± Comparison against base commit 2054682. This pull request removes 451 and adds 3 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull request overview
This PR updates projmgr’s global generator and context processing flow to support deferred-failure semantics (process all selected contexts, then fail) and to honor --active context selection by avoiding unnecessary context re-derivation.
Changes:
- Implement deferred-failure behavior in pack/context processing paths (
LoadPacks,ListGenerators,ProcessGlobalGenerators). - Update pack loading policy checks to use “no pack requirements across contexts” rather than relying on an empty PDSC list.
- Fix unused-pack collection to use the correct full pack identifier, and extend tests + reference outputs accordingly.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/projmgr/src/ProjMgrWorker.cpp | Implements deferred-failure behavior, adjusts context selection rules for global generators, and fixes unused-pack ID collection. |
| tools/projmgr/test/src/ProjMgrUnitTests.cpp | Adds unit tests validating deferred-failure semantics and --active behavior for global generators. |
| tools/projmgr/test/data/TestSolution/PackMissing/ref/project+Gen.cbuild.yml | Updates reference cbuild output with device/pack/component/license details. |
| tools/projmgr/test/data/TestSolution/PackMissing/ref/project+CM0.cbuild.yml | Updates reference cbuild output with device/pack/component/license details. |
| tools/projmgr/test/data/TestSolution/PackMissing/ref/missing_pack.cbuild-idx.yml | Updates reference idx output (error message expectations). |
| tools/projmgr/test/data/TestGenerator/RTE/Device/RteTestGen_ARMCM0/regions_RteTestGen_ARMCM0.h | Adds device-specific regions header test data. |
| tools/projmgr/test/data/TestGenerator/RTE/Device/RteTestGen_ARMCM0/ac6_linker_script.sct.src | Adds device-specific linker script template test data. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2504 +/- ##
==========================================
+ Coverage 65.24% 65.27% +0.03%
==========================================
Files 147 147
Lines 26677 26687 +10
Branches 16166 16169 +3
==========================================
+ Hits 17406 17421 +15
+ Misses 7071 7070 -1
+ Partials 2200 2196 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Fixes
csolution run test.csolution.yml -g myGeneratorreports board not found if a none selected cproject.yml lists a missing pack cmsis-toolbox#619Implement deferred-failure semantics in context processing and update
ProcessGlobalGeneratorsto conditionally skip context re-derivation based on active target type.Rationale
Deferred-Failure Pattern: The codebase now implements a robust error-accumulation pattern where multiple context processing failures are collected before reporting, rather than failing fast on the first error. This enables better error visibility and user experience.
Active target-set selection: The
--activeflag allows users to explicitly select contexts. When used,ProcessGlobalGeneratorstakes the target-set context selection rather than re-deriving contexts from build/target type matching, improving predictability.Changes
Deferred-Failure Pattern for Partial Processing
LoadPacks(): Changed failure handling to defer reporting. When context/pack loading fails, the function now continues processing instead of returning immediately. This allows all contexts to be processed before the function returnsfalse.ListGenerators(): Implemented deferred-failure semantics. WhenProcessContext()fails for a context, the function collects all errors by processing all selected contexts before reporting failure.Context Selection in
ProcessGlobalGeneratorsProcessGlobalGeneratorsnow only re-derives contexts whenm_activeTargetTypeis empty. Whenm_activeTargetTypeis non-empty (set via --active flag), it uses pre-populatedm_selectedContextsas-is.Bug Fix
CollectUnusedPacks(): Fixed incorrect iteration over filtered packages. Now correctly retrieves full pack identifier.Pack Path Validation
LoadAllRelevantPacks(): Changed logic to tracknoPackRequirements(all contexts have no pack requirements) instead of just checking ifpdscFilesis empty. This ensures proper handling of pack loading policies.New tests
ListGenerators_DeferredFailure: Validates deferred-failure semanticsListGenerators_AllContextsIterated: Validates that all contexts are processed before failure is reportedProcessGlobalGenerators_ActiveTargetType: Tests context selection with--activeflagTest data updates
Checklist