Skip to content

Commit 225a97f

Browse files
authored
Special case image check top ignore 2024_v2.0 (#708)
The beta image would be detected as valid without this.
1 parent ef13b34 commit 225a97f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/main/java/edu/wpi/first/gradlerio/deploy/roborio/InvalidImageException.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ public List<String> getAllowedImageVersions() {
1616
return allowedImageVersions;
1717
}
1818

19+
private static String parseMessage(String imageVersion) {
20+
return "Invalid RoboRIO Image Version!" +
21+
"\nRoboRIO image and GradleRIO versions are incompatible:" +
22+
"\n\tCurrent image version: " + imageVersion +
23+
"\n\tGradleRIO-compatible image versions: 2024_v2.* except 2024_v2.0" +
24+
"\nSee https://docs.wpilib.org/en/stable/docs/zero-to-robot/step-3/imaging-your-roborio.html" +
25+
"for information about upgrading the RoboRIO image." +
26+
"\nSee https://docs.wpilib.org/en/stable/docs/zero-to-robot/step-2/wpilib-setup.html and" +
27+
"\nhttps://docs.wpilib.org/en/stable/docs/software/vscode-overview/importing-gradle-project.html" +
28+
"\nfor information about updating WPILib and GradleRIO.";
29+
}
30+
1931
private static String parseMessage(String imageVersion, List<String> allowedImageVersions) {
2032
return "Invalid RoboRIO Image Version!" +
2133
"\nRoboRIO image and GradleRIO versions are incompatible:" +
@@ -34,6 +46,12 @@ public InvalidImageException(String imageVersion, List<String> allowedImageVersi
3446
this.allowedImageVersions = new ArrayList<>(allowedImageVersions);
3547
}
3648

49+
public InvalidImageException(String imageVersion, boolean isSpecialCase) {
50+
super(parseMessage(imageVersion));
51+
this.imageVersion = imageVersion;
52+
this.allowedImageVersions = new ArrayList<>();
53+
}
54+
3755
public InvalidImageException() {
3856
super("Could not parse image version!");
3957
allowedImageVersions = List.of();

src/main/java/edu/wpi/first/gradlerio/deploy/roborio/RoboRIO.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ private void readAndVerifyImage(DeployContext context) {
146146
}
147147

148148
private void verifyImageVersion(String image) {
149+
if (image.equalsIgnoreCase("2024_v2.0")) {
150+
throw new InvalidImageException(image, true);
151+
}
152+
149153
boolean foundMatch = validImageVersions.stream().filter(x -> {
150154
int index = x.indexOf("*");
151155
if (index == -1) {

0 commit comments

Comments
 (0)