Use text blocks

This commit is contained in:
Gold856
2025-03-16 23:42:03 -04:00
committed by Matt Morley
parent 4ffd1fc600
commit b86217a59a
2 changed files with 101 additions and 79 deletions

View File

@@ -175,65 +175,77 @@ public class PhotonCamera implements AutoCloseable {
}
public static void verifyDependencies() {
// spotless:off
if (!WPILibVersion.Version.equals(PhotonVersion.wpilibTargetVersion)) {
String bfw =
"\n\n\n\n\n"
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
+ ">>> \n"
+ ">>> You are running an incompatible version \n"
+ ">>> of PhotonVision ! \n"
+ ">>> \n"
+ ">>> PhotonLib "
+ PhotonVersion.versionString
+ " is built for WPILib "
+ PhotonVersion.wpilibTargetVersion
+ "\n"
+ ">>> but you are using WPILib "
+ WPILibVersion.Version
+ ">>> \n"
+ ">>> This is neither tested nor supported. \n"
+ ">>> You MUST update PhotonVision, \n"
+ ">>> PhotonLib, or both. \n"
+ ">>> Verify the output of `./gradlew dependencies` \n"
+ ">>> \n"
+ ">>> Your code will now crash. \n"
+ ">>> We hope your day gets better. \n"
+ ">>> \n"
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
String bfw = """
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s
>>> \s
>>> You are running an incompatible version \s
>>> of PhotonVision ! \s
>>> \s
>>> PhotonLib """
+ PhotonVersion.versionString
+ " is built for WPILib "
+ PhotonVersion.wpilibTargetVersion
+ "\n"
+ ">>> but you are using WPILib "
+ WPILibVersion.Version
+ """
>>> \s
>>> This is neither tested nor supported. \s
>>> You MUST update PhotonVision, \s
>>> PhotonLib, or both. \s
>>> Verify the output of `./gradlew dependencies`
>>> \s
>>> Your code will now crash. \s
>>> We hope your day gets better. \s
>>> \s
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s
""";
DriverStation.reportWarning(bfw, false);
DriverStation.reportError(bfw, false);
throw new UnsupportedOperationException(bfw);
}
if (!Core.VERSION.equals(PhotonVersion.opencvTargetVersion)) {
String bfw =
"\n\n\n\n\n"
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
+ ">>> \n"
+ ">>> You are running an incompatible version \n"
+ ">>> of PhotonVision ! \n"
+ ">>> \n"
+ ">>> PhotonLib "
+ PhotonVersion.versionString
+ " is built for OpenCV "
+ PhotonVersion.opencvTargetVersion
+ "\n"
+ ">>> but you are using OpenCV "
+ Core.VERSION
+ ">>> \n"
+ ">>> This is neither tested nor supported. \n"
+ ">>> You MUST update PhotonVision, \n"
+ ">>> PhotonLib, or both. \n"
+ ">>> Verify the output of `./gradlew dependencies` \n"
+ ">>> \n"
+ ">>> Your code will now crash. \n"
+ ">>> We hope your day gets better. \n"
+ ">>> \n"
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
String bfw = """
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s
>>> \s
>>> You are running an incompatible version \s
>>> of PhotonVision ! \s
>>> \s
>>> PhotonLib """
+ PhotonVersion.versionString
+ " is built for OpenCV "
+ PhotonVersion.opencvTargetVersion
+ "\n"
+ ">>> but you are using OpenCV "
+ Core.VERSION
+ """
>>> \s
>>> This is neither tested nor supported. \s
>>> You MUST update PhotonVision, \s
>>> PhotonLib, or both. \s
>>> Verify the output of `./gradlew dependencies`
>>> \s
>>> Your code will now crash. \s
>>> We hope your day gets better. \s
>>> \s
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s
""";
// spotless:on
DriverStation.reportWarning(bfw, false);
DriverStation.reportError(bfw, false);
@@ -533,23 +545,30 @@ public class PhotonCamera implements AutoCloseable {
// Error on a verified version mismatch
// But stay silent otherwise
String bfw =
"\n\n\n\n\n"
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
+ ">>> \n"
+ ">>> You are running an incompatible version \n"
+ ">>> of PhotonVision on your coprocessor! \n"
+ ">>> \n"
+ ">>> This is neither tested nor supported. \n"
+ ">>> You MUST update PhotonVision, \n"
+ ">>> PhotonLib, or both. \n"
+ ">>> \n"
+ ">>> Your code will now crash. \n"
+ ">>> We hope your day gets better. \n"
+ ">>> \n"
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
// spotless:off
String bfw = """
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>>> \s
>>> You are running an incompatible version \s
>>> of PhotonVision on your coprocessor! \s
>>> \s
>>> This is neither tested nor supported. \s
>>> You MUST update PhotonVision, \s
>>> PhotonLib, or both. \s
>>> \s
>>> Your code will now crash. \s
>>> We hope your day gets better. \s
>>> \s
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
""";
// spotless:on
DriverStation.reportWarning(bfw, false);
var versionMismatchMessage =