Output code version number in RoboRIO log
Closed this issue · 4 comments
The version number of each build should be clearly visible in the RoboRIO (could use System.out.println)
Idea: modify the gradlew.bat
file to get the hash of the current commit and store that into a file called hash.txt
in the directory \src\main\deploy
.
Add git rev-parse HEAD > .\src\main\deploy\hash.txt
to the beginning of the gradlew.bat
file.
Just need to figure out how to read from the deploy folder on the roboRio...
Will do that now
I see the PR you put up for the change and it looks good. Before I merge it though, I just wanted to know if you did any testing to ensure that the code is doing what it is supposed to?
If I was trying to test this, I would do these things:
- Verify that the file
hash.txt
was created in thesrc/main/deploy
directory - Verify that the contents of
hash.txt
is output to the robot console at the correct time (in this case, when the robot is enabled I think?) - create a new commit (can just be a dummy commit such as adding/removing a whitespace somewhere) and verify that the contents of
hash.txt
have the correct commit hash (you can check your current commit hash usinggit rev-parse HEAD
) - Remove the line
git rev-parse HEAD > .\src\main\deploy\hash.txt
fromgradlew.bat
and ensure that the code fails as it is supposed to (the code should enter the catch statement inprintVersion()
since the file should not be found)- unable to test this since removing file from
deploy
folder does not remove it from the roboRio
- unable to test this since removing file from
Those four have been tested, although removing git rev-parse still displays the version number despite hash.txt not existing...