Hi, my team is working on our robot code and one of my mentors asked if there was a way to put a version number of the code or of the last build date straight onto the dashboard. This would allow users to see what version of the code we were on. We are using git with VS Code to push and pull code, and we wanted to know if there was a way to pull a date or version number from anywhere in the code to store in a variable that we won’t have to change manually. My mentors suggested looking in files like the build.gradle to see if it left a date log for the last build time but I didn’t see anything. Any suggestions?
This feature has helped solve so many issues for our team over the past two years, and is relatively easy to implement! Here’s a few Gradle functions from one of our 2018 robots that retrieve the git hash, git branch, build time and list of files changes since the last commit.
These functions work by running various git
commands and recording their output. Then, these values are saved to resource files in src/main/resources/
and then read from our robot code and posted to the NetworkTables: