Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP, DO NOT MERGE] Add version reporting #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions 2023-Robot/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,6 @@ bin/

# Simulation GUI and other tools window save file
*-window.json

# Addition for CodeVersion.java
src/main/java/frc/team670/robot/constants/CodeVersion.java
15 changes: 15 additions & 0 deletions 2023-Robot/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2023.1.1"
id "com.peterabeles.gversion" version "1.10"
}

sourceCompatibility = JavaVersion.VERSION_11
Expand Down Expand Up @@ -97,3 +98,17 @@ wpi.java.configureTestTasks(test)
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}

gversion {
srcDir = "src/main/java/" // path is relative to the sub-project by default, can use Gradle variables
classPackage = "frc.team670.robot.constants"
className = "CodeVersion" // name of constants class
dateFormat = "yyyy-MM-dd'_'HH:mm:ss" // format for timestamp
timeZone = "America/Los_Angeles" // timezone to use for timestamp
debug = false // optional. print out extra debug information
language = "java" // language to use
indent = " " // indentation type - 4 spaces here
annotate = false // adds @Generated annotation to the generated class
}

project.compileJava.dependsOn(createVersionFile)
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.wpilibj.PowerDistribution;
import edu.wpi.first.wpilibj.PowerDistribution.ModuleType;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.Notifier;
import edu.wpi.first.wpilibj2.command.Subsystem;
import frc.team670.mustanglib.RobotContainerBase;
Expand All @@ -25,6 +26,8 @@

import frc.team670.robot.subsystems.arm.Arm;

import frc.team670.mustanglib.utils.CodeVersionStringGenerator;

/**
* RobotContainer is where we put the high-level code for the robot.
* It contains subsystems, OI devices, etc, and has required methods
Expand Down Expand Up @@ -58,6 +61,9 @@ public void run() {
});

updateArbitraryFeedForwards.startPeriodic(0.01);

// Put the code version on dashboard
SmartDashboard.putString("codeVersion", CodeVersionStringGenerator.genVersionString());
}

/**
Expand Down