Generated source files from :pre_build: command hook aren't compiled
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
I am having the same issue too, but using pre_release on command_hooks plugin.
This is a good use-case that we'll have to look at after this upcoming release. It's going to require some thought. There's a catch-22 here. The pre_build and pre_release hooks are meant to fire just before a build or release... which we need to know what we're building/releasing before that point. Your usage makes a lot of sense, though. We'll just have to think of how to support both.
Perhaps a new generate_source hook? It's fairly common to generate sources in a project, for example a version.h file with Git and build metadata. Thanks again