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

Update to WPILib 2025 #2

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
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
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,27 @@ gradle-app.setting
.settings/
bin/

# IntelliJ
*.iml
*.ipr
*.iws
.idea/
out/

# Fleet
.fleet

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

# Simulation data log directory
logs/

# Folder that has CTRE Phoenix Sim device config storage
ctre_sim/

# clangd
/.cache
compile_commands.json
4 changes: 2 additions & 2 deletions .wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"currentLanguage": "java",
"enableCppIntellisense": false,
"projectYear": "2024",
"currentLanguage": "java",
"projectYear": "2025beta",
"teamNumber": 2508
}
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2024.3.2"
id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-2"
id 'com.diffplug.spotless' version '6.25.0'
}

Expand All @@ -14,6 +14,7 @@ repositories {
}

dependencies {
annotationProcessor wpi.java.deps.wpilibAnnotations()
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()

Expand All @@ -23,6 +24,7 @@ dependencies {

test {
useJUnitPlatform()
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
ignoreFailures = true // Don't fail builds or deploys because of failing tests
}

Expand Down Expand Up @@ -53,3 +55,8 @@ spotless {
endWithNewline()
}
}

// Configure string concat to always inline compile
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
67 changes: 22 additions & 45 deletions src/main/java/frc/robot/lib/logging/LogUtil.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package frc.robot.lib.logging;

import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;

import edu.wpi.first.networktables.BooleanSubscriber;
Expand All @@ -15,11 +11,6 @@
import edu.wpi.first.networktables.DoubleTopic;
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WrapperCommand;

public class LogUtil {

Expand Down Expand Up @@ -84,44 +75,30 @@ public static BooleanSubscriber getTunableBoolean(String name, boolean defaultVa
return topic.subscribe(defaultValue);
}

static Command getSequentialCommandCurrentCommand(SequentialCommandGroup command) {
try {
final Field fieldIndex = SequentialCommandGroup.class.getDeclaredField("m_currentCommandIndex");
fieldIndex.setAccessible(true);
final Field fieldCommands = SequentialCommandGroup.class.getDeclaredField("m_commands");
fieldCommands.setAccessible(true);
@SuppressWarnings("unchecked")
List<Command> list = (List<Command>) fieldCommands.get(command);
return list.get(fieldIndex.getInt(command));
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
return Commands.none();
}
public static void logDriverStation() {
// String mode = "Unknown";
// if (DriverStation.isTeleop()) {
// mode = "Teleop";
// }
// else if (DriverStation.isAutonomous()) {
// mode = "Autonomous";
// }
// else if (DriverStation.isTest()) {
// mode = "Test";
// }
// mainTable.getEntry("_DS Mode").setString(mode);
// mainTable.getEntry("_Robot Enabled").setBoolean(DriverStation.isEnabled());
// mainTable.getEntry("_Match Time").setDouble(DriverStation.getMatchTime());
// mainTable.getEntry("_is FMS Attached").setBoolean(DriverStation.isFMSAttached());
}

static List<Command> getParallelCommandCurrentCommands(ParallelCommandGroup command) {
try {
List<Command> list = new ArrayList<>();
final Field fieldCommands = ParallelCommandGroup.class.getDeclaredField("m_commands");
fieldCommands.setAccessible(true);
@SuppressWarnings("unchecked")
Map<Command, Boolean> map = (Map<Command, Boolean>) fieldCommands.get(command);
map.forEach((cmd, running) -> {
if (running) list.add(cmd);
});
return list;
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
return List.of(Commands.none());
}
}

static Command getWrapperCommandInner(WrapperCommand command) {
try {
final Field cmd = WrapperCommand.class.getDeclaredField("m_command");
cmd.setAccessible(true);
return (Command) cmd.get(command);
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
return Commands.none();
}
public static void logCommandInterrupts() {
// CommandScheduler.getInstance().onCommandInterrupt((interruptedCommand, interrupter) -> {
// Command interruptingCommand = interrupter.orElseGet(Commands::none);
// DataLogManager.log("Command: " + interruptedCommand.getName() + " was interrupted by " + interruptingCommand.getName() + ".");
// schedulerTable.getEntry("Last Interrupted Command").setString(interruptedCommand.getName());
// schedulerTable.getEntry("Last Interrupting Command").setString(interruptingCommand.getName());
// });
}

}
9 changes: 0 additions & 9 deletions src/main/java/frc/robot/lib/logging/Loggable.java

This file was deleted.

Loading