aakash-sahai / nanopb

Automatically exported from code.google.com/p/nanopb
zlib License
0 stars 0 forks source link

traceability: nanopb product version in the generated files #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Can you please add a comment in the generated files xx.pb.c/.h with the version 
of nanopb that was used to generate them?
It would enhance local traceability for end-user.
seen on nanopb-0.1.5

Original issue reported on code.google.com by cea.max....@gmail.com on 17 Oct 2012 at 4:34

GoogleCodeExporter commented 9 years ago
I guess so, and a date in the header would be useful also.

Currently the generator (nor the code otherwise) doesn't know its own version. 
I will have to research a bit to find a good way to implement this. git 
describe gives the needed info, but there is no obvious point where to run a 
script to add that info to the nanopb_generator.py.

Original comment by Petteri.Aimonen on 17 Oct 2012 at 4:42

GoogleCodeExporter commented 9 years ago
1/
I never tried with GIT.
With tortoise svn (not so far from Git), there is a command line tool 
SubWCRev.exe
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-subwcrev.html

It allows to create a file, based on a template, retrieving some information 
from database.
We use it to create a version.h, containing defines as figures and strings like 
#define SVN_REVISION    "1182"
#define SVN_LOCAL_MODS  1
#define SVN_REPOSITORY  "svn://xxx..."
You should be able to create an equivalent for python.

2/
You may also use the C compiler defines like:
char compilTime[]= __DATE__ " at " __TIME__ "\0";

Original comment by cea.max....@gmail.com on 19 Oct 2012 at 12:08

GoogleCodeExporter commented 9 years ago
This issue was updated by revision 08391f35eeea.

Original comment by Petteri.Aimonen on 29 Oct 2012 at 5:17

GoogleCodeExporter commented 9 years ago
Fixed in nanopb-0.1.7

Original comment by Petteri.Aimonen on 12 Nov 2012 at 7:33