AIDASoft / podio

PODIO
GNU General Public License v3.0
23 stars 57 forks source link

Add ExtraCode declarationFile and implementationFile directives #601

Closed m-fila closed 3 months ago

m-fila commented 3 months ago

BEGINRELEASENOTES

ENDRELEASENOTES

Added 'ExtraCode' directives 'declarationFile' and 'implementationFile' used to include/embed files in code generated with jinja. This feature was planned but not implemented so far. Can be used to fix https://github.com/key4hep/EDM4hep/issues/296

The paths to 'declarationFile' and 'implementationFile 'can be either absolute or relative to datamodel yaml. Should this be relative to working directory?

The files declared in 'declarationFile' and 'implementationFile' are not added as configuration dependency in cmake, so the changes to these files will not automatically trigger re-generating a data model. I don't know if there is an easy way to fix this

TODO:

m-fila commented 3 months ago

Yes, during jinja step a python function is used to read a file and return its content to jinja, which just put it as is into generated file. The files itself are not copied anywhere. In the metada datamodel definitions the 'declarationFile' and 'implementationFile' are put without any modifications, which was causing problems when the paths are relative, hence I copied the files to build directory

I think appending the contents of 'declatationFile' to 'declaration' during parsing should work better and give more transparent metadata. Thanks :smiley:

hegner commented 3 months ago

If builds run through, I will merge it