Skip to content

Commit

Permalink
2025 beta (#2)
Browse files Browse the repository at this point in the history
* first commit

* remove alerts

* what

* j

* more unit conversions

* things

* more units

* add ci

* more units

* format

* push

* comment out alerts bc no worky

* refactor frc.robot.extras.simulation directory

* format again

* comment out broken build thingy

* changes + format

* idk

* some stuff

* ok

* bruuuuuuuuuuuuuuuuuuuuuuuuuuuh

* clean up constants

* more constants

* constants

* yay pose estimation

* ok

* add back alerts
  • Loading branch information
Ishan1522 authored Oct 28, 2024
1 parent 8cf93f6 commit d3c04af
Show file tree
Hide file tree
Showing 53 changed files with 1,063 additions and 1,020 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build

on:
push:
pull_request:

jobs:
build:
name: Compile Java
runs-on: ubuntu-latest
container: wpilib/roborio-cross-ubuntu:2024-22.04
steps:
- uses: actions/checkout@v4
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Compile robot code
run: ./gradlew compileJava

test:
name: "Test Java"
runs-on: ubuntu-latest
container: wpilib/roborio-cross-ubuntu:2024-22.04
steps:
- uses: actions/checkout@v4
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run tests on robot code
run: ./gradlew test -PrunTests

format:
name: "Check Format Java"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Fetch all history and metadata
run: |
git checkout -b pr
git branch -f main origin/main
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Run formatter
run: ./gradlew spotlessCheck

lint:
name: "Lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- uses: pmd/pmd-github-action@v2
with:
rulesets: 'pmd-ruleset.xml'
analyzeModifiedFilesOnly: false
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This gitignore has been specially created by the WPILib team.
# If you remove items from this file, intellisense might break.

*src/main/java/frc/robot/BuildConstants.java
### C++ ###
# Prerequisites
*.d
Expand Down Expand Up @@ -176,3 +176,5 @@ logs/

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

.vscode
21 changes: 0 additions & 21 deletions .vscode/launch.json

This file was deleted.

29 changes: 0 additions & 29 deletions .vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion .wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"enableCppIntellisense": false,
"currentLanguage": "java",
"projectYear": "2024",
"projectYear": "2025beta",
"teamNumber": 4829
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# 4829-BaseRobotCode-2025
# 4829-BaseRobotCode-2025
22 changes: 8 additions & 14 deletions 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-1"
id "com.peterabeles.gversion" version "1.10"
id "com.diffplug.spotless" version "6.25.0"
id "io.freefair.lombok" version "8.4"
Expand Down Expand Up @@ -108,22 +108,16 @@ task(checkAkitInstall, dependsOn: "classes", type: JavaExec) {
}
compileJava.finalizedBy checkAkitInstall

// // Generate drive trajectories when building
// task(generateDriveTrajectories, dependsOn: "classes", type: JavaExec) {
// mainClass = "org.littletonrobotics.frc2024.subsystems.drive.trajectory.GenerateTrajectories"
// classpath = sourceSets.main.runtimeClasspath
// }
// compileJava.finalizedBy generateDriveTrajectories

// Check robot type when deploying
// task(checkRobot, dependsOn: "classes", type: JavaExec) {
// main = "frc.robot.Constants"
// classpath = sourceSets.main.runtimeClasspath
// }
//Check robot type when deploying
task(checkRobot, dependsOn: "classes", type: JavaExec) {
main = "frc.robot.Constants"
classpath = sourceSets.main.runtimeClasspath
}

// deployroborio.dependsOn(checkRobot)
deployroborio.dependsOn(checkRobot)

// Create commit with working changes on event branches
//Create commit with working changes on event branches
task(eventDeploy) {
doLast {
if (project.gradle.startParameter.taskNames.any({ it.toLowerCase().contains("deploy") })) {
Expand Down
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.10.2-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
94 changes: 94 additions & 0 deletions pmd-ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="WPILibRuleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">

<description>PMD Ruleset for WPILib</description>

<exclude-pattern>.*/LimeligtHelpers.java</exclude-pattern>

<rule ref="category/java/bestpractices.xml">
<exclude name="AccessorClassGeneration" />
<exclude name="AccessorMethodGeneration" />
<exclude name="AvoidPrintStackTrace" />
<exclude name="AvoidReassigningCatchVariables" />
<exclude name="AvoidReassigningParameters" />
<exclude name="AvoidUsingHardCodedIP" />
<exclude name="ConstantsInInterface" />
<exclude name="JUnitAssertionsShouldIncludeMessage" />
<exclude name="JUnitTestContainsTooManyAsserts" />
<exclude name="JUnitTestsShouldIncludeAssert" />
<exclude name="JUnit4TestShouldUseAfterAnnotation" />
<exclude name="JUnit4TestShouldUseBeforeAnnotation" />
<exclude name="JUnit4TestShouldUseTestAnnotation" />
<exclude name="LooseCoupling" />
<exclude name="PreserveStackTrace" />
<exclude name="ReplaceHashtableWithMap" />
<exclude name="ReplaceVectorWithList" />
<exclude name="SwitchStmtsShouldHaveDefault" />
<exclude name="SystemPrintln" />
<exclude name="UseVarargs" />
</rule>

<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod">
<properties>
<property name="violationSuppressRegex"
value=".*'.*Arguments\(\)'.*" />
</properties>
</rule>

<rule ref="category/java/bestpractices.xml/UnusedLocalVariable">
<properties>
<property name="violationSuppressXPath" value="//Resource" />
</properties>
</rule>

<rule ref="category/java/design.xml">
<exclude name="AvoidThrowingRawExceptionTypes" />
<exclude name="AvoidThrowingNewInstanceOfSameException" />
<exclude name="CognitiveComplexity" />
<exclude name="CouplingBetweenObjects" />
<exclude name="CyclomaticComplexity" />
<exclude name="DataClass" />
<exclude name="ExceptionAsFlowControl" />
<exclude name="ExcessiveImports" />
<exclude name="ExcessiveParameterList" />
<exclude name="ExcessivePublicCount" />
<exclude name="GodClass" />
<exclude name="LawOfDemeter" />
<exclude name="LoosePackageCoupling" />
<exclude name="NPathComplexity" />
<exclude name="NcssCount" />
<exclude name="TooManyFields" />
<exclude name="TooManyMethods" />
</rule>

<rule ref="category/java/errorprone.xml">
<exclude name="AssignmentToNonFinalStatic" />
<exclude name="AvoidCatchingThrowable" />
<exclude name="AvoidDuplicateLiterals" />
<exclude name="AvoidLiteralsInIfCondition" />
<exclude name="CloseResource" />
<exclude name="ConstructorCallsOverridableMethod" />
<exclude name="DoNotTerminateVM" />
<exclude name="EmptyCatchBlock" />
<exclude name="FinalizeDoesNotCallSuperFinalize" />
<exclude name="JUnitSpelling" />
<exclude name="MissingSerialVersionUID" />
<exclude name="NonSerializableClass" />
<exclude name="NullAssignment" />
</rule>

<rule ref="category/java/multithreading.xml">
<exclude name="AvoidSynchronizedAtMethodLevel" />
<exclude name="AvoidUsingVolatile" />
<exclude name="DoNotUseThreads" />
<exclude name="UseConcurrentHashMap" />
</rule>

<rule ref="category/java/performance.xml">
<exclude name="AvoidInstantiatingObjectsInLoops" />
</rule>

</ruleset>
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
String frcYear = '2024'
String frcYear = '2025'
File frcHome
if (OperatingSystem.current().isWindows()) {
String publicFolder = System.getenv('PUBLIC')
Expand Down
20 changes: 9 additions & 11 deletions src/main/java/frc/robot/BuildConstants.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
package frc.robot;

/**
* Automatically generated file containing build version information.
*/
/** Automatically generated file containing build version information. */
public final class BuildConstants {
public static final String MAVEN_GROUP = "";
public static final String MAVEN_NAME = "fuck";
public static final String MAVEN_NAME = "4829-BaseRobotCode-2025-1";
public static final String VERSION = "unspecified";
public static final int GIT_REVISION = 1;
public static final String GIT_SHA = "c788c01f09c748b73747c452d0f82b20b8bf8d5d";
public static final String GIT_DATE = "2024-10-22 22:41:55 EDT";
public static final String GIT_BRANCH = "main";
public static final String BUILD_DATE = "2024-10-22 22:45:01 EDT";
public static final long BUILD_UNIX_TIME = 1729651501218L;
public static final int GIT_REVISION = 22;
public static final String GIT_SHA = "ee746c8ba2b3fd21fde3a8e41cdd2f213deee1be";
public static final String GIT_DATE = "2024-10-27 14:01:12 EDT";
public static final String GIT_BRANCH = "k";
public static final String BUILD_DATE = "2024-10-27 14:10:44 EDT";
public static final long BUILD_UNIX_TIME = 1730052644497L;
public static final int DIRTY = 1;

private BuildConstants(){}
private BuildConstants() {}
}
Loading

0 comments on commit d3c04af

Please sign in to comment.