Open-CMSIS-Pack / devtools

Open-CMSIS-Pack development tools - C++
Apache License 2.0
76 stars 59 forks source link

cbuild assumes that the components element in a cprj file has at least one component sub-element, but this may be null and result in a compilation failure #1343

Closed HalfSweet closed 8 months ago

HalfSweet commented 9 months ago

Describe the bug In some small projects, we may not reference components, such as CMSIS CORE, so that when running the cbuild command, the resulting .crpj file will have only a single

<components/>

without any component sub-elements.

This will trigger an xmllint error, and the output log will look roughly as follows:

info cbuild: (1/1) Building context: "Project+PY32F002Bx5Project"
Element 'components': Missing child element(s). Expected is ( component ).
d:\OpenPuya\PY32F002B_Firmware\Templates\PY32F002Bxx_Templates_LL\MDK-ARM\Project+PY32F002Bx5Project.cprj fails to validate
error cbuild: error executing 'xmllint'
error cbuild: error building 'd:\OpenPuya\PY32F002B_Firmware\Templates\PY32F002Bxx_Templates_LL\MDK-ARM\Project+PY32F002Bx5Project. cprj'
error cbuild: exit status 3
Process failed with exit code 4294967295
Process failed with exit code 4294967295

To Reproduce Steps to reproduce the behavior: A link to a reproducible project: https://github.com/OpenPuya/PY32F002B_Firmware/tree/master/Templates/PY32F002Bxx_Templates_LL

It is a uvprojx project, so it needs to be converted with the uv2csolution tool

Expected behavior Expectedly, no errors should be reported

Environment (please complete the following information):

Additional context Add any other context about the problem here.

jkrech commented 8 months ago

In my view, in this case no <components> section should be generated.