From 4f42a492a396b83d51b656c066c2d2a414931b2e Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Sun, 11 Jan 2026 19:48:18 -0800 Subject: [PATCH 1/7] Add `@since` Javadoc tags to classes and APIs added in 2.0.0 --- .../lib2813/subsystems/MotorSubsystem.java | 33 +++++++++++-------- .../ParameterizedIntakeSubsystem.java | 5 +++ .../team2813/lib2813/util/BuildConstants.java | 6 +++- .../lib2813/util/BuildConstantsPublisher.java | 2 ++ .../team2813/lib2813/testing/FakeMotor.java | 2 ++ .../testing/junit/jupiter/CommandTester.java | 2 ++ .../IsolatedNetworkTablesExtension.java | 2 ++ .../junit/jupiter/WPILibExtension.java | 2 ++ .../lib2813/testing/truth/Pose2dSubject.java | 2 ++ .../lib2813/testing/truth/Pose3dSubject.java | 2 ++ .../testing/truth/Rotation2dSubject.java | 6 +++- .../testing/truth/Rotation3dSubject.java | 6 +++- .../testing/truth/TolerantComparison.java | 2 ++ .../testing/truth/Translation2dSubject.java | 6 +++- .../testing/truth/Translation3dSubject.java | 6 +++- .../vision/MultiPhotonPoseEstimator.java | 2 ++ .../vision/PhotonVisionPosePublisher.java | 2 ++ .../lib2813/vision/PoseEstimateConsumer.java | 6 +++- 18 files changed, 75 insertions(+), 19 deletions(-) diff --git a/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java b/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java index 08425cf2..2bd11e13 100644 --- a/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java +++ b/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java @@ -119,6 +119,7 @@ public final void setSetpoint(T position) { * Returns a command that sets the desired setpoint to the provided value. * * @param setpoint the position to go to. + * @since 2.0.0 */ public final Command setSetpointCommand(T setpoint) { return new InstantCommand(() -> this.setSetpoint(setpoint), this); @@ -168,6 +169,8 @@ public final void enable() { * *

The motor voltage will be set to zero, and the motor will not adjust to move towards the * current setpoint. + * + * @since 2.0.0 */ @Override public final void stopMotor() { @@ -200,23 +203,13 @@ public final void set(ControlMode mode, double demand) { motor.set(mode, demand); } - /** - * Clamps the given output value and provides it to the motor. - * - * @param output The output calculated by the PID algorithm. - * @param setpoint Ignored. - */ - private void useOutput(double output, double setpoint) { - motor.set(controlMode, clampOutput(output)); - } - /** * Clamps the given output value and provides it to the motor. * *

This is called by {@link #periodic()} if this subsystem is enabled. */ private void useOutput(double output) { - useOutput(output, controller.getSetpoint()); + motor.set(controlMode, clampOutput(output)); } /** @@ -227,6 +220,7 @@ private void useOutput(double output) { * @param output Output provided by the PID controller. * @return Output to provide to the motor. * @see edu.wpi.first.math.MathUtil#clamp(double, double, double) + * @since 2.0.0 */ protected double clampOutput(double output) { return output; @@ -384,7 +378,12 @@ public MotorSubsystemConfiguration startingPosition(Supplier startingPosi return startingPosition(startingPositionSupplier.get()); } - /** Sets the acceptable position error. */ + /** + * Sets the acceptable position error. + * + * @param error the error which is considered tolerable for use with {@code }atPosition()} + * @return {@code this} for chaining + */ public MotorSubsystemConfiguration acceptableError(double error) { this.acceptableError = error; return this; @@ -393,7 +392,8 @@ public MotorSubsystemConfiguration acceptableError(double error) { /** * Sets the unit to use for PID calculations * - * @param rotationUnit The angle unit to use for calculations + * @param rotationUnit the angle unit to use for calculations + * @return {@code this} for chaining */ public MotorSubsystemConfiguration rotationUnit(AngleUnit rotationUnit) { startingPosition = rotationUnit.convertFrom(startingPosition, this.rotationUnit); @@ -401,6 +401,13 @@ public MotorSubsystemConfiguration rotationUnit(AngleUnit rotationUnit) { return this; } + /** + * Enables publishing of data to the provided network table instance. + * + * @param ntInstance the network table instance to publish to + * @return {@code this} for chaining + * @since 2.0.0 + */ public MotorSubsystemConfiguration publishTo(NetworkTableInstance ntInstance) { this.ntInstance = ntInstance; return this; diff --git a/lib/src/main/java/com/team2813/lib2813/subsystems/ParameterizedIntakeSubsystem.java b/lib/src/main/java/com/team2813/lib2813/subsystems/ParameterizedIntakeSubsystem.java index 680aabab..508814bb 100644 --- a/lib/src/main/java/com/team2813/lib2813/subsystems/ParameterizedIntakeSubsystem.java +++ b/lib/src/main/java/com/team2813/lib2813/subsystems/ParameterizedIntakeSubsystem.java @@ -22,6 +22,11 @@ import edu.wpi.first.wpilibj2.command.InstantCommand; import edu.wpi.first.wpilibj2.command.SubsystemBase; +/** + * A subsystem for an intake. + * + * @since 2.0.0 + */ public abstract class ParameterizedIntakeSubsystem extends SubsystemBase implements AutoCloseable { private final Motor intakeMotor; private final Params params; diff --git a/lib/src/main/java/com/team2813/lib2813/util/BuildConstants.java b/lib/src/main/java/com/team2813/lib2813/util/BuildConstants.java index 52df8090..ed5c517d 100644 --- a/lib/src/main/java/com/team2813/lib2813/util/BuildConstants.java +++ b/lib/src/main/java/com/team2813/lib2813/util/BuildConstants.java @@ -17,7 +17,11 @@ import java.time.ZonedDateTime; -/** Holder for data collected at build time about the robot code. */ +/** + * Holder for data collected at build time about the robot code. + * + * @since 2.0.0 + */ public interface BuildConstants { /** The current git branch when the code was built. */ diff --git a/lib/src/main/java/com/team2813/lib2813/util/BuildConstantsPublisher.java b/lib/src/main/java/com/team2813/lib2813/util/BuildConstantsPublisher.java index 35ba9fb4..663c4896 100644 --- a/lib/src/main/java/com/team2813/lib2813/util/BuildConstantsPublisher.java +++ b/lib/src/main/java/com/team2813/lib2813/util/BuildConstantsPublisher.java @@ -52,6 +52,8 @@ * // Log the build constants in the robot console as well. * buildConstantsPublisher.log(); * } + * + * @since 2.0.0 */ public final class BuildConstantsPublisher { /** The name of the NetworkTable under which the build constants are published. */ diff --git a/testing/src/main/java/com/team2813/lib2813/testing/FakeMotor.java b/testing/src/main/java/com/team2813/lib2813/testing/FakeMotor.java index 8880ec16..0e8ee70d 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/FakeMotor.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/FakeMotor.java @@ -30,6 +30,8 @@ * *

This class simulates motor behavior by storing the most recent control mode and demand value. * It also includes methods that make it easier to verify the current state of the motor. + * + * @since 2.0.0 */ public class FakeMotor implements Motor { private boolean isStopped = true; diff --git a/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/CommandTester.java b/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/CommandTester.java index 0819ca69..645385b3 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/CommandTester.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/CommandTester.java @@ -21,6 +21,8 @@ * Allows tests to run commands. * *

Tests can get an instance by using {@link WPILibExtension}. + * + * @since 2.0.0 */ public interface CommandTester { diff --git a/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java b/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java index 7c4b47ac..c9c300c3 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java @@ -41,6 +41,8 @@ * } * } * } + * + * @since 2.0.0 */ public final class IsolatedNetworkTablesExtension implements Extension, AfterEachCallback, ParameterResolver { diff --git a/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/WPILibExtension.java b/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/WPILibExtension.java index f89f9696..7e96ddb2 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/WPILibExtension.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/WPILibExtension.java @@ -59,6 +59,8 @@ * } * } * } + * + * @since 2.0.0 */ public final class WPILibExtension implements Extension, diff --git a/testing/src/main/java/com/team2813/lib2813/testing/truth/Pose2dSubject.java b/testing/src/main/java/com/team2813/lib2813/testing/truth/Pose2dSubject.java index 235551f1..50f523f9 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/truth/Pose2dSubject.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/truth/Pose2dSubject.java @@ -28,6 +28,8 @@ * *

See Writing your own custom subject to learn about * creating custom Truth subjects. + * + * @since 2.0.0 */ public final class Pose2dSubject extends Subject { diff --git a/testing/src/main/java/com/team2813/lib2813/testing/truth/Pose3dSubject.java b/testing/src/main/java/com/team2813/lib2813/testing/truth/Pose3dSubject.java index ae84c9dd..6b151b34 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/truth/Pose3dSubject.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/truth/Pose3dSubject.java @@ -28,6 +28,8 @@ * *

See Writing your own custom subject to learn about * creating custom Truth subjects. + * + * @since 2.0.0 */ public final class Pose3dSubject extends Subject { diff --git a/testing/src/main/java/com/team2813/lib2813/testing/truth/Rotation2dSubject.java b/testing/src/main/java/com/team2813/lib2813/testing/truth/Rotation2dSubject.java index 58d9165a..428c3812 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/truth/Rotation2dSubject.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/truth/Rotation2dSubject.java @@ -24,7 +24,11 @@ import edu.wpi.first.math.geometry.Rotation2d; import javax.annotation.Nullable; -/** Truth Subject for making assertions about {@link Rotation2d} values. */ +/** + * Truth Subject for making assertions about {@link Rotation2d} values. + * + * @since 2.0.0 + */ public final class Rotation2dSubject extends Subject { // User-defined entry point public static Rotation2dSubject assertThat(@Nullable Rotation2d rotation) { diff --git a/testing/src/main/java/com/team2813/lib2813/testing/truth/Rotation3dSubject.java b/testing/src/main/java/com/team2813/lib2813/testing/truth/Rotation3dSubject.java index a9e67047..daf085f1 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/truth/Rotation3dSubject.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/truth/Rotation3dSubject.java @@ -24,7 +24,11 @@ import edu.wpi.first.math.geometry.Rotation3d; import javax.annotation.Nullable; -/** Truth Subject for making assertions about {@link Rotation3d} values. */ +/** + * Truth Subject for making assertions about {@link Rotation3d} values. + * + * @since 2.0.0 + */ public final class Rotation3dSubject extends Subject { // User-defined entry point public static Rotation3dSubject assertThat(@Nullable Rotation3d rotation) { diff --git a/testing/src/main/java/com/team2813/lib2813/testing/truth/TolerantComparison.java b/testing/src/main/java/com/team2813/lib2813/testing/truth/TolerantComparison.java index 2dd80643..c487fa13 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/truth/TolerantComparison.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/truth/TolerantComparison.java @@ -20,6 +20,8 @@ /** * A partially specified check about an approximate relationship to a {@code double} subject using a * tolerance. + * + * @since 2.0.0 */ public abstract class TolerantComparison { diff --git a/testing/src/main/java/com/team2813/lib2813/testing/truth/Translation2dSubject.java b/testing/src/main/java/com/team2813/lib2813/testing/truth/Translation2dSubject.java index 06beedfd..018bad04 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/truth/Translation2dSubject.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/truth/Translation2dSubject.java @@ -24,7 +24,11 @@ import edu.wpi.first.math.geometry.Translation2d; import javax.annotation.Nullable; -/** Truth Subject for making assertions about {@link Translation2d} values. */ +/** + * Truth Subject for making assertions about {@link Translation2d} values. + * + * @since 2.0.0 + */ public final class Translation2dSubject extends Subject { // User-defined entry point diff --git a/testing/src/main/java/com/team2813/lib2813/testing/truth/Translation3dSubject.java b/testing/src/main/java/com/team2813/lib2813/testing/truth/Translation3dSubject.java index de46d04e..22d3b89b 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/truth/Translation3dSubject.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/truth/Translation3dSubject.java @@ -24,7 +24,11 @@ import edu.wpi.first.math.geometry.Translation3d; import javax.annotation.Nullable; -/** Truth Subject for making assertions about {@link Translation3d} values. */ +/** + * Truth Subject for making assertions about {@link Translation3d} values. + * + * @since 2.0.0 + */ public final class Translation3dSubject extends Subject { // User-defined entry point diff --git a/vision/src/main/java/com/team2813/lib2813/vision/MultiPhotonPoseEstimator.java b/vision/src/main/java/com/team2813/lib2813/vision/MultiPhotonPoseEstimator.java index 9f06e4e4..f49d4e19 100644 --- a/vision/src/main/java/com/team2813/lib2813/vision/MultiPhotonPoseEstimator.java +++ b/vision/src/main/java/com/team2813/lib2813/vision/MultiPhotonPoseEstimator.java @@ -59,6 +59,8 @@ * referred to as "field-centric pose". In our libraries, field-centric poses are always specified relative to the blue origin. + * + * @since 2.0.0 */ public class MultiPhotonPoseEstimator implements AutoCloseable { private final List cameraWrappers; diff --git a/vision/src/main/java/com/team2813/lib2813/vision/PhotonVisionPosePublisher.java b/vision/src/main/java/com/team2813/lib2813/vision/PhotonVisionPosePublisher.java index 95dd63fe..03ece3d8 100644 --- a/vision/src/main/java/com/team2813/lib2813/vision/PhotonVisionPosePublisher.java +++ b/vision/src/main/java/com/team2813/lib2813/vision/PhotonVisionPosePublisher.java @@ -38,6 +38,8 @@ * Estimated robot positions are published to NetworkTables using the timestamp in the {@code * EstimatedRobotPose}. If no data is available, a position of (0, 0, 0) is published only when the * previous available value is older than the expected latency of producing vision estimates. + * + * @since 2.0.0 */ public final class PhotonVisionPosePublisher { /** diff --git a/vision/src/main/java/com/team2813/lib2813/vision/PoseEstimateConsumer.java b/vision/src/main/java/com/team2813/lib2813/vision/PoseEstimateConsumer.java index 507a35d2..f6bff896 100644 --- a/vision/src/main/java/com/team2813/lib2813/vision/PoseEstimateConsumer.java +++ b/vision/src/main/java/com/team2813/lib2813/vision/PoseEstimateConsumer.java @@ -17,7 +17,11 @@ import org.photonvision.EstimatedRobotPose; -/** Represents an operation that accepts estimated robot positions. */ +/** + * Represents an operation that accepts estimated robot positions. + * + * @since 2.0.0 + */ @FunctionalInterface public interface PoseEstimateConsumer { /** From cf01981203bbe7cc029b2d5798a595e951ecd4c7 Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Sat, 10 Jan 2026 08:30:01 -0800 Subject: [PATCH 2/7] 2.0.0-rc-1 release --- .../groovy/java-common-conventions.gradle | 19 +++++++ lib/build.gradle | 35 ++++++------ limelight/build.gradle | 52 +++++++++++++++--- testing/build.gradle | 55 ++++++++++++++----- vision/build.gradle | 51 ++++++++++++++--- 5 files changed, 166 insertions(+), 46 deletions(-) diff --git a/buildSrc/src/main/groovy/java-common-conventions.gradle b/buildSrc/src/main/groovy/java-common-conventions.gradle index 69bd59e3..6cd4c9ac 100644 --- a/buildSrc/src/main/groovy/java-common-conventions.gradle +++ b/buildSrc/src/main/groovy/java-common-conventions.gradle @@ -7,6 +7,7 @@ plugins { // Apply the java-library plugin for API and implementation separation. id 'java-library' id 'com.diffplug.spotless' + id 'idea' } java { @@ -119,5 +120,23 @@ javadoc { links += "https://codedocs.revrobotics.com/java/" // PhotonVision links += "https://javadocs.photonvision.org/release/" + + // Converts `@apiNote` paragraph to "Note: " section in the generated javadoc + tags += 'apiNote:a:Api Note:' + + // Converts `@implSpec` paragraph to "Implementation Requirements: " section in the generated javadoc + tags += 'implSpec:a:Implementation Requirements:' + } +} + +task sourceJar(type: Jar) { + from sourceSets.main.allJava + archiveClassifier = 'sources' +} + +idea { + module { + downloadJavadoc = true + downloadSources = true } } diff --git a/lib/build.gradle b/lib/build.gradle index 462d9652..99e7d95c 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -4,7 +4,7 @@ plugins { id 'maven-publish' } -version = '2.0.0-alpha.1' +version = '2.0.0-rc-1' dependencies { implementation wpi.java.deps.wpilib() @@ -39,39 +39,36 @@ tasks.named('test') { systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' } -javadoc { - options.tags = [ - // Converts `@apiNote` paragraph to "Note: " section in the generated javadoc - 'apiNote:a:Api Note:', - // Converts `@implSpec` paragraph to "Implementation Requirements: " section in the generated javadoc - 'implSpec:a:Implementation Requirements:' - ] -} - -task sourceJar(type: Jar) { - from sourceSets.main.allJava - archiveClassifier = 'sources' -} - publishing { publications { lib2813(MavenPublication) { groupId = 'com.team2813.lib2813' - artifactId = 'lib2813' + artifactId = 'lib' from components.java artifact sourceJar pom { name = '2813 Library' description = 'Frequently reused code written by team 2813' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } developers { developer { - id = 'mango' - name = 'kyle' + id = 'cuttestkittensrule' + name = 'Kyle' email = 'mangoiscute95@gmail.com' } } + scm { + connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + url = 'https://github.com/Prospect-Robotics/lib2813' + } organization { - name = '2813 Gear Heads' + name = 'FRC 2813 Gear Heads' url = 'https://team2813.com' } } diff --git a/limelight/build.gradle b/limelight/build.gradle index 579c7c13..5e6c1841 100644 --- a/limelight/build.gradle +++ b/limelight/build.gradle @@ -1,15 +1,10 @@ plugins { id 'java-common-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' - id 'idea' + id 'maven-publish' } -idea { - module { - downloadJavadoc = true - downloadSources = true - } -} +version = '2.0.0-rc-1' dependencies { implementation wpi.java.deps.wpilib() @@ -37,3 +32,46 @@ test { // Use JUnit 4 for tests useJUnit() } + +publishing { + publications { + lib2813(MavenPublication) { + groupId = 'com.team2813.lib2813' + artifactId = 'limelight' + from components.java + artifact sourceJar + pom { + name = '2813 Limelight Library' + description = 'Limelight utilities for FRC robots' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' + } + developer { + id = 'kcooney' + name = 'Kevin' + email = 'kcooney@gmail.com' + } + } + scm { + connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + url = 'https://github.com/Prospect-Robotics/lib2813' + } + organization { + name = 'FRC 2813 Gear Heads' + url = 'https://team2813.com' + } + } + } + } +} + diff --git a/testing/build.gradle b/testing/build.gradle index e64705b4..954b03f5 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -1,9 +1,10 @@ plugins { id 'java-common-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' + id 'maven-publish' } -version = '1.0.0-alpha.1' +version = '2.0.0-rc-1' dependencies { implementation wpi.java.deps.wpilib() @@ -35,16 +36,44 @@ tasks.named('test') { systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' } -javadoc { - options.tags = [ - // Converts `@apiNote` paragraph to "Note: " section in the generated javadoc - 'apiNote:a:Api Note:', - // Converts `@implSpec` paragraph to "Implementation Requirements: " section in the generated javadoc - 'implSpec:a:Implementation Requirements:' - ] -} - -task sourceJar(type: Jar) { - from sourceSets.main.allJava - archiveClassifier = 'sources' +publishing { + publications { + lib2813(MavenPublication) { + groupId = 'com.team2813.lib2813' + artifactId = 'testing' + from components.java + artifact sourceJar + pom { + name = '2813 Testing Library' + description = 'Utilities for testing FRC robots' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' + } + developer { + id = 'kcooney' + name = 'Kevin' + email = 'kcooney@gmail.com' + } + } + scm { + connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + url = 'https://github.com/Prospect-Robotics/lib2813' + } + organization { + name = 'FRC 2813 Gear Heads' + url = 'https://team2813.com' + } + } + } + } } diff --git a/vision/build.gradle b/vision/build.gradle index a72de1f0..b4b4b4d7 100644 --- a/vision/build.gradle +++ b/vision/build.gradle @@ -1,15 +1,10 @@ plugins { id 'java-common-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' - id 'idea' + id 'maven-publish' } -idea { - module { - downloadJavadoc = true - downloadSources = true - } -} +version = '2.0.0-rc-1' dependencies { implementation wpi.java.deps.wpilib() @@ -38,3 +33,45 @@ test { useJUnitPlatform() systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' } + +publishing { + publications { + lib2813(MavenPublication) { + groupId = 'com.team2813.lib2813' + artifactId = 'vision' + from components.java + artifact sourceJar + pom { + name = '2813 Vision Library' + description = 'Utilities for location and vision for FRC robots' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' + } + developer { + id = 'kcooney' + name = 'Kevin' + email = 'kcooney@gmail.com' + } + } + scm { + connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + url = 'https://github.com/Prospect-Robotics/lib2813' + } + organization { + name = 'FRC 2813 Gear Heads' + url = 'https://team2813.com' + } + } + } + } +} From 72e72ad7fb85fa5b487cc6d32c5aa68bd9477bef Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Mon, 19 Jan 2026 12:50:01 -0800 Subject: [PATCH 3/7] Update README.md and add CONTRIBUTING.md --- CONTRIBUTING.md | 129 ++++++++++++++++++++++++++++++++++++++++++++++++ MAINTAINERS.md | 12 +++++ README.md | 92 ++++++++++++++++++---------------- 3 files changed, 191 insertions(+), 42 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 MAINTAINERS.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..d0a346f5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,129 @@ +# Contributing to lib2813 + +We welcome contributions! + +## What to Contribute + +- Bug reports +- Bug fixes (consider filing a bug report first) +- Feature additions (please create an issue first) + +## Pull Request Guidelines + +- Code should be well documented. +- Please consider writing tests. Tests give us assurance that new changes do not break older functionality. +- We loosely follow the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html). Format the code + using `./gradlew spotlessApply`. +- Write a [good change description](https://google.github.io/eng-practices/review/developer/cl-descriptions.html) + +We may ask you to test locally on your robot code in simulation mode. + +## Getting Started + +If you need to make changes to lib213, you can either clone the repository directly, or you +can include it as a submodule for your robot code. + +### Option 1: Developing on a Clone + +To clone the repository, run: + +```shell +git clone --recurse-submodules https://github.com/Prospect-Robotics/Robot2025.git +``` + +### Option 2: Developing via Submodules + +#### 1. Adding the lib2813 repo as a submodule + +When making changes to lib2813, it is often helpful to build the code along with your robot code. +To do that, you can add the lib2813 repo as a submodule. + +Before adding the submodule, it is recommended that you set the `submodule.stickyRecursiveClone` +git config option to `true` to make working with submodule easier (see +[this StackOverflow answer](https://stackoverflow.com/a/53622660) for details about this option). +To do this, run the following command from any directory: +```shell +git config --global submodule.stickyRecursiveClone true +``` + +To add the lib2813 submodule, go to your robot project directory (where the `vendordeps` directory is), and run +this command: +```shell +git submodule add https://github.com/Prospect-Robotics/lib2813 +``` + +#### 2. Updating Gradle files + +Add the following lines needs to be added to your `settings.gradle`: +``` +includeBuild('lib2813') { + dependencySubstitution { + substitute module('com.team2813.lib2813:lib') using project(':lib') + } +} +``` + +Next, remove the version numbers for the lib2813 dependencies in your `build.gradle`: + +``` +implementation "com.team2813.lib2813:lib" +``` + +Next, add the following lines to your `build.gradle`: + +Finally, in order to guarantee that the library jars are created before GradleRIO referees to them, add the following +lines to your `build.gradle`: +```groovy +downloadDepsPreemptively.dependsOn gradle.includedBuild('lib2813').task(':lib:jar') +downloadDepsPreemptively.dependsOn gradle.includedBuild('lib2813').task(':testing:jar') +downloadDepsPreemptively.dependsOn gradle.includedBuild('lib2813').task(':limelight:jar') +``` + +#### 3. Fixing vscode jank +As of version 1.85.1, vscode doesn't work properly with gradle composite builds without the old buildServer. To use the old buildServer, add the following line +to your settings.json +``` +"java.gradle.buildServer.enabled": "off", +``` +This isn't strictly necessary, but without it vscode will not be able to do code completion from things in the library, and tell the user that there are errors, +when gradle builds fine. + +## Tips and Tricks + +### Publishing to Maven Local + +It can often be useful to publish jars locally and test with a real or simulated robot. + +To publish to Maven Local, run: + +```shell +./gradlew publishToMavenLocal -Pversion=2.0.0-test-123 +``` + +(replace "test-123" with some unique identifier) + +In your robot's `build.gradle` file, be sure to include Maven Local in your repositories: + +```groovy +repositories { + mavenLocal() + mavenCentral() +} +``` + +Then update your `build.gradle` to reference the version that you published locally. + +### Cloning a repository with a git submodule +When cloning a repository with a git submodule, git will not automatically get the files in the submodules. in order to do this, run the command +``` +git submodule update --init --recursive +``` +This command will recursively initialize all submodules. + +### Getting blame data + +To ignore code reformatting when running `git blame` run: + +```shell +git config blame.ignoreRevsFile .git-blame-ignore-revs +``` diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 00000000..28a7bb5b --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,12 @@ +# Maintainer Documentation + +## Publishing to Maven Central + +Before publishing to Maven Central, consider publishing to Maven Local. + +1. Run `./gradlew build` to build the code, run the tests, and verify that there are no formatting + issues +2. Update the version strings in the `build.gradle` files of the affected libraries. +3. Make sure all changes are pushed to GitHub +4. ??? +5. Celebrate! diff --git a/README.md b/README.md index 4ea5156e..2a99cb68 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,59 @@ # User Documentation -## adding submodule -In order to use, go to your WPILib project directory (the inner one, where the build.gradle file is), and run the command -``` -git submodule add https://github.com/Prospect-Robotics/lib2813 -``` -## adding submodule to gradle -The following lines needs to be added to your settings.gradle to make the lib usable: -``` -includeBuild('lib2813') { - dependencySubstitution { - substitute module('com.team2813:lib2813') using project(':lib') - } -} -``` -Whatever text that is in the module parentheses is the text that will need to be in an `implementation` statement to depend on the library. -So, after adding the lines to the settings.gradle, this line in the dependencies block will refer to the library. -``` -implementation "com.team2813:lib2813" -``` -Finally, in order to guarantee that the library jars are created before GradleRIO referees to them, add the following line to your build.gradle -``` -downloadDepsPreemptively.dependsOn gradle.includedBuild("lib2813").task(":lib:jar") -``` +## Using the libraries -## Fixing vscode jank -As of version 1.85.1, vscode doesn't work properly with gradle composite builds without the old buildServer. To use the old buildServer, add the following line -to your settings.json -``` -"java.gradle.buildServer.enabled": "off", -``` -This isn't strictly necessary, but without it vscode will not be able to do code completion from things in the library, and tell the user that there are errors, -when gradle builds fine. +### Updating your dependencies -## Cloning a repository with a git submodule -When cloning a repository with a git submodule, git will not automatically get the files in the submodules. in order to do this, run the command -``` -git submodule update --init --recursive -``` -This command will recursively initialize all submodules. +> [!NOTE] +> The lib2813 jars are not yet published to Maven Central. For the time being, you need to publish +> them to Maven Local. See [the Contributing page](CONTRIBUTING.md#publishing-to-maven-local) for details. -This code is still in development, and apis are still subject to change. The most likely thing to get removed is the swerve api, as ctre recently released their own. +In your `build.gradle`, update the `dependencies` section: -## Developer Documentation +```groovy +dependencies { + // Existing dependencies + implementation 'com.team2813.lib2813:lib:2.0.0-rc-1' + implementation 'com.team2813.lib2813:vision:2.0.0-rc-1' + implementation 'com.team2813.lib2813:limelight:2.0.0-rc-1' + testImplementation 'com.team2813.lib2813:testing:2.0.0-rc-1' +} +``` -To ignore code reformatting when running `git blame` run: +Note that you do not need to include all the dependencies. See the [Runtime dependencies](#runtime-dependencies) +section for details. -```shell -git config blame.ignoreRevsFile .git-blame-ignore-revs +In addition be sure to include Maven Local in the list of repositories in your `build.gradle` +(needed until we publish to Maven Central): + +```groovy +repositories { + mavenLocal() + mavenCentral() +} ``` + +### Runtime dependencies + +- `com.team2813.lib2813:lib`: + - Vendor deps + - `WPILibNewCommands.json` + - `Phoenix6.json` (if using Phoenix motors) + - `REVLib.json` (if using REV Robotics motors) +- `com.team2813.lib2813:vision`: + - lib2813 deps + - `com.team2813.lib2813:lib` + - Vendor deps + - `photonlib.json` +- `com.team2813.lib2813:testing`: + - lib2813 deps + - `com.team2813.lib2813:lib` + - Vendor deps + - `WPILibNewCommands.json` + - Java deps + - `org.junit.jupiter:junit-jupiter:5.13.1` + - `com.google.truth:truth:1.4.4` +- `com.team2813.lib2813:limelight`: + - Java deps + - `com.google.code.gson:gson:2.12.1` + - `org.json:json:20240205` From 1090ce2ce1ce7fe8af562a7667fdd17f2706133a Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Tue, 20 Jan 2026 21:58:59 -0800 Subject: [PATCH 4/7] Extract publishing-conventions.gradle --- .../main/groovy/publishing-conventions.gradle | 32 +++++++++++++++++++ lib/build.gradle | 23 +------------ limelight/build.gradle | 24 +------------- testing/build.gradle | 23 +------------ vision/build.gradle | 23 +------------ 5 files changed, 36 insertions(+), 89 deletions(-) create mode 100644 buildSrc/src/main/groovy/publishing-conventions.gradle diff --git a/buildSrc/src/main/groovy/publishing-conventions.gradle b/buildSrc/src/main/groovy/publishing-conventions.gradle new file mode 100644 index 00000000..a26d596b --- /dev/null +++ b/buildSrc/src/main/groovy/publishing-conventions.gradle @@ -0,0 +1,32 @@ +plugins { + id 'maven-publish' +} + +version = '2.0.0-rc-1' + +publishing { + publications { + lib2813(MavenPublication) { + groupId = 'com.team2813.lib2813' + from components.java + artifact sourceJar + pom { + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + scm { + connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + url = 'https://github.com/Prospect-Robotics/lib2813' + } + organization { + name = 'FRC 2813 Gear Heads' + url = 'https://team2813.com' + } + } + } + } +} diff --git a/lib/build.gradle b/lib/build.gradle index 99e7d95c..fb4f6e8b 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -1,11 +1,9 @@ plugins { id 'java-common-conventions' + id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' - id 'maven-publish' } -version = '2.0.0-rc-1' - dependencies { implementation wpi.java.deps.wpilib() implementation wpi.java.vendor.java() @@ -42,19 +40,9 @@ tasks.named('test') { publishing { publications { lib2813(MavenPublication) { - groupId = 'com.team2813.lib2813' - artifactId = 'lib' - from components.java - artifact sourceJar pom { name = '2813 Library' description = 'Frequently reused code written by team 2813' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } developers { developer { id = 'cuttestkittensrule' @@ -62,15 +50,6 @@ publishing { email = 'mangoiscute95@gmail.com' } } - scm { - connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - url = 'https://github.com/Prospect-Robotics/lib2813' - } - organization { - name = 'FRC 2813 Gear Heads' - url = 'https://team2813.com' - } } } } diff --git a/limelight/build.gradle b/limelight/build.gradle index 5e6c1841..47449552 100644 --- a/limelight/build.gradle +++ b/limelight/build.gradle @@ -1,11 +1,9 @@ plugins { id 'java-common-conventions' + id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' - id 'maven-publish' } -version = '2.0.0-rc-1' - dependencies { implementation wpi.java.deps.wpilib() implementation wpi.java.vendor.java() @@ -36,19 +34,9 @@ test { publishing { publications { lib2813(MavenPublication) { - groupId = 'com.team2813.lib2813' - artifactId = 'limelight' - from components.java - artifact sourceJar pom { name = '2813 Limelight Library' description = 'Limelight utilities for FRC robots' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } developers { developer { id = 'cuttestkittensrule' @@ -61,17 +49,7 @@ publishing { email = 'kcooney@gmail.com' } } - scm { - connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - url = 'https://github.com/Prospect-Robotics/lib2813' - } - organization { - name = 'FRC 2813 Gear Heads' - url = 'https://team2813.com' - } } } } } - diff --git a/testing/build.gradle b/testing/build.gradle index 954b03f5..3a32db91 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -1,11 +1,9 @@ plugins { id 'java-common-conventions' + id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' - id 'maven-publish' } -version = '2.0.0-rc-1' - dependencies { implementation wpi.java.deps.wpilib() implementation wpi.java.vendor.java() @@ -39,19 +37,9 @@ tasks.named('test') { publishing { publications { lib2813(MavenPublication) { - groupId = 'com.team2813.lib2813' - artifactId = 'testing' - from components.java - artifact sourceJar pom { name = '2813 Testing Library' description = 'Utilities for testing FRC robots' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } developers { developer { id = 'cuttestkittensrule' @@ -64,15 +52,6 @@ publishing { email = 'kcooney@gmail.com' } } - scm { - connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - url = 'https://github.com/Prospect-Robotics/lib2813' - } - organization { - name = 'FRC 2813 Gear Heads' - url = 'https://team2813.com' - } } } } diff --git a/vision/build.gradle b/vision/build.gradle index b4b4b4d7..28eb11de 100644 --- a/vision/build.gradle +++ b/vision/build.gradle @@ -1,11 +1,9 @@ plugins { id 'java-common-conventions' + id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' - id 'maven-publish' } -version = '2.0.0-rc-1' - dependencies { implementation wpi.java.deps.wpilib() implementation wpi.java.vendor.java() @@ -37,19 +35,9 @@ test { publishing { publications { lib2813(MavenPublication) { - groupId = 'com.team2813.lib2813' - artifactId = 'vision' - from components.java - artifact sourceJar pom { name = '2813 Vision Library' description = 'Utilities for location and vision for FRC robots' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } developers { developer { id = 'cuttestkittensrule' @@ -62,15 +50,6 @@ publishing { email = 'kcooney@gmail.com' } } - scm { - connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - url = 'https://github.com/Prospect-Robotics/lib2813' - } - organization { - name = 'FRC 2813 Gear Heads' - url = 'https://team2813.com' - } } } } From 48d3dc5fcc3b7a77a06008014cc361ec9dee57ea Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Tue, 20 Jan 2026 22:11:18 -0800 Subject: [PATCH 5/7] Documentation cleanups --- CONTRIBUTING.md | 4 +--- README.md | 26 ++++++-------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d0a346f5..fcd21f0e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,7 @@ To do this, run the following command from any directory: git config --global submodule.stickyRecursiveClone true ``` -To add the lib2813 submodule, go to your robot project directory (where the `vendordeps` directory is), and run +To add the lib2813 submodule, go to your robot project directory (where the `settings.gradle` file is), and run this command: ```shell git submodule add https://github.com/Prospect-Robotics/lib2813 @@ -69,8 +69,6 @@ Next, remove the version numbers for the lib2813 dependencies in your `build.gra implementation "com.team2813.lib2813:lib" ``` -Next, add the following lines to your `build.gradle`: - Finally, in order to guarantee that the library jars are created before GradleRIO referees to them, add the following lines to your `build.gradle`: ```groovy diff --git a/README.md b/README.md index 2a99cb68..ae17fae0 100644 --- a/README.md +++ b/README.md @@ -33,27 +33,13 @@ repositories { } ``` -### Runtime dependencies +### Vendordeps - `com.team2813.lib2813:lib`: - - Vendor deps - - `WPILibNewCommands.json` - - `Phoenix6.json` (if using Phoenix motors) - - `REVLib.json` (if using REV Robotics motors) + - `WPILibNewCommands.json` + - `Phoenix6.json` (if using Phoenix motors) + - `REVLib.json` (if using REV Robotics motors) - `com.team2813.lib2813:vision`: - - lib2813 deps - - `com.team2813.lib2813:lib` - - Vendor deps - - `photonlib.json` + - `photonlib.json` - `com.team2813.lib2813:testing`: - - lib2813 deps - - `com.team2813.lib2813:lib` - - Vendor deps - - `WPILibNewCommands.json` - - Java deps - - `org.junit.jupiter:junit-jupiter:5.13.1` - - `com.google.truth:truth:1.4.4` -- `com.team2813.lib2813:limelight`: - - Java deps - - `com.google.code.gson:gson:2.12.1` - - `org.json:json:20240205` + - `WPILibNewCommands.json` From 3e78d4b1c829df4d6846e019e25d4393c19213c8 Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Tue, 20 Jan 2026 22:35:21 -0800 Subject: [PATCH 6/7] Update CONTRIBUTING.md to have the user create a `libs.versions.toml` file --- CONTRIBUTING.md | 2 +- README.md | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fcd21f0e..c6c747aa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -109,7 +109,7 @@ repositories { } ``` -Then update your `build.gradle` to reference the version that you published locally. +Then update your `libs.versions.toml` to reference the version that you published locally. ### Cloning a repository with a git submodule When cloning a repository with a git submodule, git will not automatically get the files in the submodules. in order to do this, run the command diff --git a/README.md b/README.md index ae17fae0..bd029d03 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,28 @@ > The lib2813 jars are not yet published to Maven Central. For the time being, you need to publish > them to Maven Local. See [the Contributing page](CONTRIBUTING.md#publishing-to-maven-local) for details. +In your project's "gradle" directory, create a file named `libs.versions.toml` with the following content: + +```toml +[versions] +lib2813 = "2.0.0-rc-1" + +[libraries] +lib2813-lib = { module = "com.team2813.lib2813:lib", version.ref="lib2813" } +lib2813-vision = { module = "com.team2813.lib2813:vision", version.ref="lib2813" } +lib2813-limelight = { module = "com.team2813.lib2813:limelight", version.ref="lib2813" } +lib2813-testing = { module = "com.team2813.lib2813:testing", version.ref="lib2813" } +``` + In your `build.gradle`, update the `dependencies` section: ```groovy dependencies { // Existing dependencies - implementation 'com.team2813.lib2813:lib:2.0.0-rc-1' - implementation 'com.team2813.lib2813:vision:2.0.0-rc-1' - implementation 'com.team2813.lib2813:limelight:2.0.0-rc-1' - testImplementation 'com.team2813.lib2813:testing:2.0.0-rc-1' + implementation libs.lib2813.lib + implementation libs.lib2813.vision + implementation libs.lib2813.limelight + testImplementation libs.lib2813.testing } ``` @@ -33,6 +46,11 @@ repositories { } ``` +### Upgrading + +To upgrade the version of the lib2813 libraries you are using, simply update the version string for "lib2813" in +`libs.versions.toml`. + ### Vendordeps - `com.team2813.lib2813:lib`: From 1e792b1a945b7b79215766865fa3570d5ee71d00 Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Tue, 20 Jan 2026 22:39:24 -0800 Subject: [PATCH 7/7] Update MAINTAINERS.md to reference publishing-conventions.gradle --- MAINTAINERS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 28a7bb5b..3bfa71be 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -6,7 +6,7 @@ Before publishing to Maven Central, consider publishing to Maven Local. 1. Run `./gradlew build` to build the code, run the tests, and verify that there are no formatting issues -2. Update the version strings in the `build.gradle` files of the affected libraries. +2. Update the version string in `publishing-conventions.gradle`. 3. Make sure all changes are pushed to GitHub 4. ??? 5. Celebrate!