Skip to content

Generated source files from :pre_build: command hook aren't compiled #959

@alofthouse

Description

@alofthouse

Hi,

Firstly, I want to say thanks for all your work on Ceedling.

I have a (probably niche) issue when using Ceedling with the command_hooks plugin, specifically with the pre_build hook.

Due to the nature of the project, we have some source files (.c and .h) that need to be generated before running our tests. I've setup a command hook which just calls a script to generate these files. They are created in the test/support folder.

:command_hooks:
  :pre_build:
    :executable: cmd.exe
    :arguments:
      - /c
      - "scripts\\pre_build.bat"

This all works as expected and the hook runs successfully. However, it appears that Ceedling generates its list of source/support files before the pre_build hook is run. This means that the generated files aren't compiled as they weren't picked up earlier.

This only happens the first time you run the Ceedling project with a clean repository. By the second time you run it, then the source files have already been generated, and everything works as expected.

Without being familiar with the code base, an easy fix for this seems to be just to move the invocation of the pre_build hook to somewhere closer to Ceedling starting up.

Thanks,
Adam


Environment:

  • Windows 11
  • Ceedling Version:
ceedling version
Welcome to Ceedling!

  Ceedling => 1.0.0-f899db8
  ----------------------
  C:/tools/ruby33/lib/ruby/gems/3.3.0/gems/ceedling-1.0.0/

  Build Frameworks
  ----------------------
       CMock => 2.6.0
       Unity => 2.6.0
  CException => 1.3.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions