( Solved - help wanted ) Want to include GitHub tag/version into project.
Posted: Sun Apr 01, 2018 2:49 pm
EDIT: - The scripts I made and a proper explanation and how-to can be found here.
The scripts can also be found in the last post of this thread.
The scripts work for Linux only.
If anyone could port these scripts to Windows and/or OSX and post them in this thread it would be greatly appreciated.
/EDIT
I want to auto include a version number in my project that tells me exactly which version is running on a device.
Preferably a string value like something like the output from:.
Above is very basic example and a somewhat nicer way would be to generate a file that looks like:
so it can be included as a .h file in the sketch.
I could run a script like the above manually every time I make a commit, but that is too error prone and not the lazy easy way.
Can I edit the build process from the Arduino IDE so that it produces this data every time I compile a project?
Or is it possible to let git somehow produce this data every time I make a commit?
I found this thread on this forum, and others elsewhere on the net, but these all were targeted at makefiles and/or ESP-IDF.
I was also thinking/dreaming along the lines of a bash script file that executes the above script and then starts the Arduino IDE and auto compiles/uploads my sketch.
I made this very simple poc. Put it in the sketch folder and execute it.
If anyone is interested I could use some help with formatting the output from git so that it can be included as a header file.
Or am I re-inventing the wheel and have others done this already?
The scripts can also be found in the last post of this thread.
The scripts work for Linux only.
If anyone could port these scripts to Windows and/or OSX and post them in this thread it would be greatly appreciated.
/EDIT
I want to auto include a version number in my project that tells me exactly which version is running on a device.
Preferably a string value like something like the output from:
Code: Select all
git --no-pager describe --tags --always --dirty > version.txt
Above is very basic example and a somewhat nicer way would be to generate a file that looks like:
Code: Select all
const char * sketchVersion "3.1.001-11-g2f50fc1-dirty";
I could run a script like the above manually every time I make a commit, but that is too error prone and not the lazy easy way.
Can I edit the build process from the Arduino IDE so that it produces this data every time I compile a project?
Or is it possible to let git somehow produce this data every time I make a commit?
I found this thread on this forum, and others elsewhere on the net, but these all were targeted at makefiles and/or ESP-IDF.
I was also thinking/dreaming along the lines of a bash script file that executes the above script and then starts the Arduino IDE and auto compiles/uploads my sketch.
I made this very simple poc. Put it in the sketch folder and execute it.
Code: Select all
git --no-pager describe --tags --always --dirty > versiontest.txt
~/arduino-1.8.5/arduino --upload test.ino
Or am I re-inventing the wheel and have others done this already?