The given issue will occur in operating systems that ship with a stub git executable, that does not do anything (like MacOS). Then, if the user decides to use GitHub desktop, even though it ships with a git executable, it is not on the path, so the stub executable will still be used, causing the git information to not be found by the gradle task that creates BuildConstants.
Under these circumstances, the two BuildConstantsPublisherTests will fail.
Error Output
com.team2813.BuildConstantsPublisherTest.logsBuildConstantsToConsole
expected to contain a match for:
MavenName: Robot2025
?
GitRevision: [0-9]+
?
GitSha: (NA|[0-9a-f]{40})
?
GitDate: \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.+
?
GitBranch: .+
?
BuildDate: \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.+
?
BuildUnixTime: \d+
?
Dirty: [01]
?
but was:
MavenName: Robot2025
GitRevision: -1
GitSha: UNKNOWN
GitDate: UNKNOWN
GitBranch: UNKNOWN
BuildDate: 2025-06-09 14:27:42 PDT
BuildUnixTime: 1749504462255
Dirty: 101
at app//com.team2813.BuildConstantsPublisherTest.logsBuildConstantsToConsole(BuildConstantsPublisherTest.java:127)
com.team2813.BuildConstantsPublisherTest.publishesBuildConstantsToNetworkTables
value of : getIntegerEntryOrDefault(...)
expected to be greater than: 0
but was : -1
at app//com.team2813.BuildConstantsPublisherTest.publishesBuildConstantsToNetworkTables(BuildConstantsPublisherTest.java:94)
Here are some steps to reproduce (On Linux):
- Create a minimal Linux installation
- This must not have git installed.
- For Arch Linux, you can run the following commands:
DIR=# put the directory you want (must not exist yet) here
mkarchroot $DIR base jdk17-openjdk
- Create a stub git executable (example coded in rust below)
- Any programming language can be used, but if it requires a runtime, that must also be installed to the minimal installation. The executable must unconditionally return a non-zero exit code.
fn main() {
panic!("Git not installed");
}
- Copy the compiled stub git executable to
$DIR/bin/git
- Clone the repository to
$DIR/Robot2025, and make sure it is owned by root
sudo mkdir $DIR/Robot2025
sudo chown $(whoami):$(whoami) $DIR/Robot2025
git clone --recurse-submodules https://github.com/Prospect-Robotics/Robot2025.git $DIR/Robot2025
sudo chroot $DIR chown root:root /Robot2025
- Run the tests
sudo mount --bind $DIR $DIR # to make arch-chroot work properly
sudo arch-chroot $DIR bash -c "cd /Robot2025; ./gradlew test"
sudo umount $DIR
Note: arch-chroot is required because it binds some additional things that would otherwise make java fail to load a shared library. Also, on my machine, 8 tests that use mocking fail when run this way; They succeed under normal installations, so I don't think we need to worry about them.
The given issue will occur in operating systems that ship with a stub git executable, that does not do anything (like MacOS). Then, if the user decides to use GitHub desktop, even though it ships with a git executable, it is not on the path, so the stub executable will still be used, causing the git information to not be found by the gradle task that creates
BuildConstants.Under these circumstances, the two
BuildConstantsPublisherTests will fail.Error Output
com.team2813.BuildConstantsPublisherTest.logsBuildConstantsToConsole
com.team2813.BuildConstantsPublisherTest.publishesBuildConstantsToNetworkTables
Here are some steps to reproduce (On Linux):
$DIR/bin/git$DIR/Robot2025, and make sure it is owned by rootNote:
arch-chrootis required because it binds some additional things that would otherwise make java fail to load a shared library. Also, on my machine, 8 tests that use mocking fail when run this way; They succeed under normal installations, so I don't think we need to worry about them.