Add build-scope to include/exclude component files#2436
Add build-scope to include/exclude component files#2436brondani merged 3 commits intoOpen-CMSIS-Pack:mainfrom
build-scope to include/exclude component files#2436Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new build-scope attribute on component definitions to control whether component source files are emitted into generated build files depending on build type (library vs executable), aligning CMSIS-Toolbox behavior with uVision for library generation.
Changes:
- Extended YAML parsing and JSON schema to accept/validate
build-scope: include | excludeon components. - Updated cbuild generation to omit component source files by default for library outputs (with per-component overrides via
build-scope). - Added/updated unit test coverage and reference outputs to verify library behavior and explicit
build-scopeoverrides.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/projmgr/src/ProjMgrCbuild.cpp | Emits build-scope into generated cbuild YAML and filters component source files for library outputs. |
| tools/projmgr/src/ProjMgrYamlParser.cpp | Parses build-scope from component entries and allows the key during YAML validation. |
| tools/projmgr/include/ProjMgrYamlParser.h | Adds the build-scope YAML key constant. |
| tools/projmgr/include/ProjMgrParser.h | Extends ComponentItem with buildScope. |
| tools/projmgr/schemas/common.schema.json | Defines and wires BuildScope into component schemas (input + resolved). |
| libs/rtemodel/include/RteFile.h | Declares RteFile::IsSourceCategory helper. |
| libs/rtemodel/src/RteFile.cpp | Implements IsSourceCategory used for filtering source categories. |
| tools/projmgr/test/src/ProjMgrUnitTests.cpp | Adds test invocation and reference comparison for build-scope behavior. |
| tools/projmgr/test/data/TestSolution/ref/outputFiles.Library+Target.cbuild.yml | Updates expected output to exclude component source files in library builds. |
| tools/projmgr/test/data/TestSolution/StandardLibrary/ref/library.Debug+RteTest_ARMCM3.cbuild.yml | Updates expected output to exclude startup/system sources for library builds. |
| tools/projmgr/test/data/TestSolution/StandardLibrary/ref/library_componentBuildScope.Debug+RteTest_ARMCM3.cbuild.yml | Adds new reference output verifying build-scope include/exclude behavior. |
| tools/projmgr/test/data/TestSolution/StandardLibrary/library_componentBuildScope/library_componentBuildScope.cproject.yml | Adds a new test project using build-scope overrides. |
| tools/projmgr/test/data/TestSolution/StandardLibrary/library.csolution.yml | Includes the new test project in the standard library solution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test Results 7 files 53 suites 5m 30s ⏱️ Results for commit 5127087. ♻️ This comment has been updated with latest results. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2436 +/- ##
==========================================
+ Coverage 64.73% 64.75% +0.01%
==========================================
Files 145 145
Lines 26147 26157 +10
Branches 15783 15788 +5
==========================================
+ Hits 16927 16937 +10
Misses 7066 7066
Partials 2154 2154
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
To address: #2216
Introduces support for a new
build-scopeattribute for components to control whether component source files are included in different build types (library vs. executable). By default, component source files are:Changes
build-scopeattribute (include | exclude) to component definitions.build-scopeand build type.IsSourceCategoryto identify compatible source files.