mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-04 03:11:40 +00:00
Use text blocks
This commit is contained in:
@@ -27,16 +27,19 @@ package org.photonvision.common.configuration;
|
|||||||
public final class DatabaseSchema {
|
public final class DatabaseSchema {
|
||||||
public static final String[] migrations = {
|
public static final String[] migrations = {
|
||||||
// #1 - initial schema
|
// #1 - initial schema
|
||||||
"CREATE TABLE IF NOT EXISTS global (\n"
|
// spotless:off
|
||||||
+ " filename TINYTEXT PRIMARY KEY,\n"
|
"""
|
||||||
+ " contents mediumtext NOT NULL\n"
|
CREATE TABLE IF NOT EXISTS global (
|
||||||
+ ");"
|
filename TINYTEXT PRIMARY KEY,
|
||||||
+ "CREATE TABLE IF NOT EXISTS cameras (\n"
|
contents mediumtext NOT NULL
|
||||||
+ " unique_name TINYTEXT PRIMARY KEY,\n"
|
);
|
||||||
+ " config_json text NOT NULL,\n"
|
CREATE TABLE IF NOT EXISTS cameras (
|
||||||
+ " drivermode_json text NOT NULL,\n"
|
unique_name TINYTEXT PRIMARY KEY,
|
||||||
+ " pipeline_jsons mediumtext NOT NULL\n"
|
config_json text NOT NULL,
|
||||||
+ ");",
|
drivermode_json text NOT NULL,
|
||||||
|
pipeline_jsons mediumtext NOT NULL
|
||||||
|
);""",
|
||||||
|
// spotless:on
|
||||||
// #2 - add column otherpaths_json
|
// #2 - add column otherpaths_json
|
||||||
"ALTER TABLE cameras ADD COLUMN otherpaths_json TEXT NOT NULL DEFAULT '[]';",
|
"ALTER TABLE cameras ADD COLUMN otherpaths_json TEXT NOT NULL DEFAULT '[]';",
|
||||||
// add future migrations here
|
// add future migrations here
|
||||||
|
|||||||
@@ -175,65 +175,77 @@ public class PhotonCamera implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyDependencies() {
|
public static void verifyDependencies() {
|
||||||
|
// spotless:off
|
||||||
if (!WPILibVersion.Version.equals(PhotonVersion.wpilibTargetVersion)) {
|
if (!WPILibVersion.Version.equals(PhotonVersion.wpilibTargetVersion)) {
|
||||||
String bfw =
|
String bfw = """
|
||||||
"\n\n\n\n\n"
|
|
||||||
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
|
|
||||||
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
|
||||||
+ ">>> \n"
|
|
||||||
+ ">>> You are running an incompatible version \n"
|
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s
|
||||||
+ ">>> of PhotonVision ! \n"
|
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s
|
||||||
+ ">>> \n"
|
>>> \s
|
||||||
+ ">>> PhotonLib "
|
>>> You are running an incompatible version \s
|
||||||
+ PhotonVersion.versionString
|
>>> of PhotonVision ! \s
|
||||||
+ " is built for WPILib "
|
>>> \s
|
||||||
+ PhotonVersion.wpilibTargetVersion
|
>>> PhotonLib """
|
||||||
+ "\n"
|
+ PhotonVersion.versionString
|
||||||
+ ">>> but you are using WPILib "
|
+ " is built for WPILib "
|
||||||
+ WPILibVersion.Version
|
+ PhotonVersion.wpilibTargetVersion
|
||||||
+ ">>> \n"
|
+ "\n"
|
||||||
+ ">>> This is neither tested nor supported. \n"
|
+ ">>> but you are using WPILib "
|
||||||
+ ">>> You MUST update PhotonVision, \n"
|
+ WPILibVersion.Version
|
||||||
+ ">>> PhotonLib, or both. \n"
|
+ """
|
||||||
+ ">>> Verify the output of `./gradlew dependencies` \n"
|
>>> \s
|
||||||
+ ">>> \n"
|
>>> This is neither tested nor supported. \s
|
||||||
+ ">>> Your code will now crash. \n"
|
>>> You MUST update PhotonVision, \s
|
||||||
+ ">>> We hope your day gets better. \n"
|
>>> PhotonLib, or both. \s
|
||||||
+ ">>> \n"
|
>>> Verify the output of `./gradlew dependencies`
|
||||||
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
>>> \s
|
||||||
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
|
>>> Your code will now crash. \s
|
||||||
|
>>> We hope your day gets better. \s
|
||||||
|
>>> \s
|
||||||
|
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s
|
||||||
|
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s
|
||||||
|
""";
|
||||||
|
|
||||||
DriverStation.reportWarning(bfw, false);
|
DriverStation.reportWarning(bfw, false);
|
||||||
DriverStation.reportError(bfw, false);
|
DriverStation.reportError(bfw, false);
|
||||||
throw new UnsupportedOperationException(bfw);
|
throw new UnsupportedOperationException(bfw);
|
||||||
}
|
}
|
||||||
if (!Core.VERSION.equals(PhotonVersion.opencvTargetVersion)) {
|
if (!Core.VERSION.equals(PhotonVersion.opencvTargetVersion)) {
|
||||||
String bfw =
|
String bfw = """
|
||||||
"\n\n\n\n\n"
|
|
||||||
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
|
|
||||||
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
|
||||||
+ ">>> \n"
|
|
||||||
+ ">>> You are running an incompatible version \n"
|
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s
|
||||||
+ ">>> of PhotonVision ! \n"
|
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s
|
||||||
+ ">>> \n"
|
>>> \s
|
||||||
+ ">>> PhotonLib "
|
>>> You are running an incompatible version \s
|
||||||
+ PhotonVersion.versionString
|
>>> of PhotonVision ! \s
|
||||||
+ " is built for OpenCV "
|
>>> \s
|
||||||
+ PhotonVersion.opencvTargetVersion
|
>>> PhotonLib """
|
||||||
+ "\n"
|
+ PhotonVersion.versionString
|
||||||
+ ">>> but you are using OpenCV "
|
+ " is built for OpenCV "
|
||||||
+ Core.VERSION
|
+ PhotonVersion.opencvTargetVersion
|
||||||
+ ">>> \n"
|
+ "\n"
|
||||||
+ ">>> This is neither tested nor supported. \n"
|
+ ">>> but you are using OpenCV "
|
||||||
+ ">>> You MUST update PhotonVision, \n"
|
+ Core.VERSION
|
||||||
+ ">>> PhotonLib, or both. \n"
|
+ """
|
||||||
+ ">>> Verify the output of `./gradlew dependencies` \n"
|
>>> \s
|
||||||
+ ">>> \n"
|
>>> This is neither tested nor supported. \s
|
||||||
+ ">>> Your code will now crash. \n"
|
>>> You MUST update PhotonVision, \s
|
||||||
+ ">>> We hope your day gets better. \n"
|
>>> PhotonLib, or both. \s
|
||||||
+ ">>> \n"
|
>>> Verify the output of `./gradlew dependencies`
|
||||||
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
>>> \s
|
||||||
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
|
>>> Your code will now crash. \s
|
||||||
|
>>> We hope your day gets better. \s
|
||||||
|
>>> \s
|
||||||
|
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\s
|
||||||
|
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\s
|
||||||
|
""";
|
||||||
|
// spotless:on
|
||||||
|
|
||||||
DriverStation.reportWarning(bfw, false);
|
DriverStation.reportWarning(bfw, false);
|
||||||
DriverStation.reportError(bfw, false);
|
DriverStation.reportError(bfw, false);
|
||||||
@@ -533,23 +545,30 @@ public class PhotonCamera implements AutoCloseable {
|
|||||||
// Error on a verified version mismatch
|
// Error on a verified version mismatch
|
||||||
// But stay silent otherwise
|
// But stay silent otherwise
|
||||||
|
|
||||||
String bfw =
|
// spotless:off
|
||||||
"\n\n\n\n\n"
|
String bfw = """
|
||||||
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\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"
|
>>> \s
|
||||||
+ ">>> PhotonLib, or both. \n"
|
>>> You are running an incompatible version \s
|
||||||
+ ">>> \n"
|
>>> of PhotonVision on your coprocessor! \s
|
||||||
+ ">>> Your code will now crash. \n"
|
>>> \s
|
||||||
+ ">>> We hope your day gets better. \n"
|
>>> This is neither tested nor supported. \s
|
||||||
+ ">>> \n"
|
>>> You MUST update PhotonVision, \s
|
||||||
+ ">>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
>>> PhotonLib, or both. \s
|
||||||
+ ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
|
>>> \s
|
||||||
|
>>> Your code will now crash. \s
|
||||||
|
>>> We hope your day gets better. \s
|
||||||
|
>>> \s
|
||||||
|
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
""";
|
||||||
|
// spotless:on
|
||||||
|
|
||||||
DriverStation.reportWarning(bfw, false);
|
DriverStation.reportWarning(bfw, false);
|
||||||
var versionMismatchMessage =
|
var versionMismatchMessage =
|
||||||
|
|||||||
Reference in New Issue
Block a user