Open-CMSIS-Pack / cmsis-toolbox

CMSIS-Toolbox
https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/README.md#cmsis-toolbox
Apache License 2.0
67 stars 18 forks source link

[Bug ?] "executes:" not handled correctly #168

Closed saperlot closed 1 month ago

saperlot commented 1 month ago

Is there an existing issue for this?

Unusable feature

Post Build scripts are not executed corretly.

Current Behavior

For example:

Included in csolution.yml:

 executes:
    - execute: include CRC
      run: somebat.bat $input$ $output$
      always:
      input:
        - $hex()$
      output:
        - $hex()$_crc
      for-context:
        - .Debug

Now if we remove the for-context in executes: config:

Now if we set the for-context to - .Release in executes: config:

Another issue is, that build script execution direction is tmp/ I would assume that base directory to be on root.

Expected Behavior

Executes handled correctly.

Steps To Reproduce

--> see current behavior

Affected tools

Affected operating systems

Environment

Windows 11 cmsis-toolbox: 2.5.0

ReinhardKeil commented 1 month ago

@saperlot do you apply execute: in the .cproject.yml file or in the .csolution.yml file?

Forget the request, the information is there.

saperlot commented 1 month ago

I've just tried it again within cproject.yml. But here it will fail when the batch file does not return Status OK. So then, i've included EXIT /B 0 at the end of the batch, and it does execute on both buildtypes with correct files.

But it still only execute without --contex builds.

brondani commented 1 month ago

As documented here please note for-context and not-for-context are only supported when the execute node is in *.cproject.yml, in such case the execute is iterated and runs for each context: https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/2.5.0/docs/YML-Input-Format.md#executes

The execute nodes in *.csolution.yml are considered at solution level and for this reason they run just once, they are not iterated over multiple contexts.

jkrech commented 1 month ago

@saperlot I have removed the critical label for now. Given Daniel's link to the documentation, do you still believe the behavior of the tools is different from what has been documented?

saperlot commented 1 month ago

@jkrech I do not have a for-context directive in the executes config. What i mean with "But it still only execute without --contex builds." is that when i issue a build command from vsocode cmsis extensions build button, then it only builds the current active context with cbuild *** --context-set --context ***.Debug*** in this scenario, the execute command wont be executed.

ReinhardKeil commented 1 month ago

Thank for raising this issues. We improved the description https://github.com/ReinhardKeil/cmsis-toolbox/blob/main/docs/YML-Input-Format.md#executes. The executes: node are only processed on full application builds. Using --context triggers only project builds. Using --context-set works fine.

We will work on better messaging for the user to indicate when execute: commands are performed.

jkrech commented 1 month ago

Can this issue be closed?

jkrech commented 1 month ago

This issue https://github.com/Open-CMSIS-Pack/cbuild2cmake/issues/185 will probably address your concern.