Open-CMSIS-Pack / devtools

Open-CMSIS-Pack development tools - C++
Apache License 2.0
74 stars 56 forks source link

Generator run fails due to broken dependency check #1812

Open RobertRostohar opened 5 days ago

RobertRostohar commented 5 days ago

Describe the bug It seems that when running the generator on a specific context the whole solution is being validated. This should not be the case. Only the selected context should be validated. But even worse, the dependency check fails when multiple contexts are available despite that every context on its own has no dependency issues.

To Reproduce A solution with multiple projects where projects have different components from different packs (packs are specified in the project). Running the generator on a context fails due to false dependency validation failure on a different context.

Example: https://github.com/RobertRostohar/Debug_VSC/tree/main/STM32F769I-EVAL/Network

Running the generator on a context from BSD_Client project: csolution run Network.csolution.yml -g CubeMX -c BSD_Client.Debug+STM32F769I-EVAL

fails with the following error for the HTTPS_Server project:

error csolution: no component was found with identifier 'Security:mbed TLS'
HTTPS_Server.cproject.yml - warning csolution: dependency validation for context 'HTTPS_Server.Debug+STM32F769I-EVAL' failed:
MISSING Keil::Network&MDK:Service:Web Server Compact&HTTPS@8.0.0
  require Security:mbed TLS@3.1.0

However the HTTPS_Server project has no dependency issues.

When only a single project is part of the solution, running the generator on BSD_Client or HTTPS_Server project is successful.

Expected behavior When running a generator on a context, only that context should be checked. Also the dependency check should work correctly on a context and not be influenced by other contexts in the solution.

Environment:

brondani commented 5 days ago

I cannot access https://github.com/RobertRostohar/Debug_VSC/tree/main/STM32F769I-EVAL/Network, is this a private repository?

When running a generator on a context, only that context should be checked.

Actually all contexts sharing the same path and generator id are siblings and will be checked. https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/YML-Input-Format.md#generators---options

Once I have access to the repository I can investigate further.

RobertRostohar commented 5 days ago

The repo is now public, so you should be able to try it out.

brondani commented 5 days ago

The failure concerning the missing component and consequently the dependency check comes from a defect when processing sibling contexts that are not selected: packs that are additionally required by such contexts are not loaded.

As a workaround the call csolution run -g <generator> -c <context>... should select all sibling contexts. In this example all contexts are siblings because all share the same generator id, base-dir and cgen-file (as can be seen by csolution list generators Network.csolution.yml -v) so omitting the -c is the workaround here:

csolution run Network.csolution.yml -g CubeMX
RobertRostohar commented 5 days ago

The command for the generator is from the VSC extension which means that you cannot use the extension out of the box.

I still believe that if you run a generator for a context from one project, other projects should not be checked.

jkrech commented 5 days ago

I still believe that if you run a generator for a context from one project, other projects should not be checked.

I tend to disagree here. If a single generator (one *.ioc project and one *.cgen.yml) is used by multiple cproject.yml the csolution run -G ... will produce one cbuild-gen-idx.yml and all associated cbuild-gen.yml files.

csolution list generators project.csolution.yml -v displays the contexts that share the identical generator and will select the set of contexts based on that.

csolution list generators USB_Device.csolution.yml -v 
CubeMX (Global Registered Generator)
  base-dir: Board/STM32F769I-EVAL/CubeMX
    cgen-file: Board/STM32F769I-EVAL/CubeMX/Board.cgen.yml
      context: HID.Debug+STM32F769NIHx
      context: HID.Release+STM32F769NIHx
      context: MassStorage.Debug+STM32F769NIHx
      context: MassStorage.Release+STM32F769NIHx
      context: VirtualCOM.Debug+STM32F769NIHx
      context: VirtualCOM.Release+STM32F769NIHx
RobertRostohar commented 1 day ago

Actually all contexts sharing the same path and generator id are siblings and will be checked.

I would add another condition for the siblings (in addition to the above):