diff --git a/.wpilib/wpilib_preferences.json b/.wpilib/wpilib_preferences.json index 5e810ac..8d69462 100644 --- a/.wpilib/wpilib_preferences.json +++ b/.wpilib/wpilib_preferences.json @@ -1,6 +1,6 @@ { "enableCppIntellisense": false, "currentLanguage": "java", - "projectYear": "2027_alpha5", + "projectYear": "2027_alpha7", "teamNumber": 10101 } \ No newline at end of file diff --git a/README.md b/README.md index f0de89d..857a070 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,5 @@ repositories { Where `TAG` is the version of the library to include in your project. Make sure the vendor dependency versions in your project match those in the version you're trying to use. For this version of the library, those are: -- REVLib 2027.0.0-alpha-6 \ No newline at end of file +- WPILib 2027 alpha 7 +- REVLib 2027.0.0-alpha-7 diff --git a/build.gradle b/build.gradle index fa5b0a1..bc9ce2a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,9 @@ plugins { - id "java-library" id 'maven-publish' id "java" - id "org.wpilib.GradleRIO" version "2027.0.0-alpha-6" + id "application" + id "org.wpilib.GradleRIO" version "2027.0.0-alpha-7" id 'com.diffplug.spotless' version '8.10.1' - id "com.gradleup.shadow" version "9.3.0" } java { @@ -32,7 +31,7 @@ deploy { } def deployArtifact = deploy.targets.systemcore.artifacts.wpilibJava -wpi.java.debugJni = false +wpi.java.runSimWithDebugJni = false def includeDesktopSupport = true // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. @@ -69,20 +68,6 @@ test { wpi.sim.addGui().defaultEnabled = true wpi.sim.addDriverstation() -// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') -// in order to make them all available at runtime. Also adding the manifest so WPILib -// knows where to look for our Robot Class. -shadowJar { - mergeServiceFiles() - from('src') { into 'backup/src' } - from('vendordeps') { into 'backup/vendordeps' } - from('build.gradle') { into 'backup' } - duplicatesStrategy = DuplicatesStrategy.INCLUDE -} - -// Configure jar and deploy tasks -deployArtifact.jarTask = shadowJar -wpi.java.configureExecutableTasks(shadowJar) wpi.java.configureTestTasks(test) // Configure string concat to always inline compile diff --git a/settings.gradle b/settings.gradle index e2626a8..a17bda0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,18 +2,26 @@ import org.gradle.internal.os.OperatingSystem pluginManagement { repositories { - String wpilibYear = '2027_alpha5' + String wpilibYear = '2027_alpha7' File wpilibHome - if (OperatingSystem.current().isWindows()) { + def os = OperatingSystem.current() + if (os.isWindows()) { String publicFolder = System.getenv('PUBLIC') if (publicFolder == null) { publicFolder = "C:\\Users\\Public" } def homeRoot = new File(publicFolder, "wpilib") wpilibHome = new File(homeRoot, wpilibYear) + } else if (os.isLinux()) { + String xdgDataHome = System.getenv('XDG_DATA_HOME') + if (xdgDataHome == null || xdgDataHome.trim().isEmpty() || !new File(xdgDataHome).isAbsolute()) { + xdgDataHome = new File(System.getProperty("user.home"), ".local/share").getPath() + } + def homeRoot = new File(xdgDataHome, "wpilib") + wpilibHome = new File(homeRoot, wpilibYear) } else { def userFolder = System.getProperty("user.home") - def homeRoot = new File(userFolder, "wpilib") + def homeRoot = new File(userFolder, ".wpilib") wpilibHome = new File(homeRoot, wpilibYear) } def wpilibHomeMaven = new File(wpilibHome, 'maven') diff --git a/src/main/java/org/frc10101/womp/can/SparkMaxWrapper.java b/src/main/java/org/frc10101/womp/can/SparkMaxWrapper.java index 08e9fd2..a16ab88 100644 --- a/src/main/java/org/frc10101/womp/can/SparkMaxWrapper.java +++ b/src/main/java/org/frc10101/womp/can/SparkMaxWrapper.java @@ -2,6 +2,7 @@ import com.revrobotics.spark.SparkLowLevel.MotorType; import com.revrobotics.spark.SparkMax; +import org.wpilib.hardware.bus.CANPort; /** A REV SPARK Max */ public class SparkMaxWrapper { @@ -10,14 +11,14 @@ public class SparkMaxWrapper { /** * Creates a REV SPARK Max. * - * @param busId the ID of the Systemcore Bus + * @param bus the Systemcore Bus * @param canId the CAN ID of the SPARK Max * @param motorType the type of motor to control (brushed or brushless) */ - public SparkMaxWrapper(int busId, int canId, MotorType motorType) { + public SparkMaxWrapper(CANPort bus, int canId, MotorType motorType) { if (canId < 1) throw new IllegalArgumentException("CAN ID must be greater than or equal to 1."); if (motorType == null) throw new IllegalArgumentException("Motor Type must be specified."); - _sparkMax = new SparkMax(busId, canId, motorType); + _sparkMax = new SparkMax(bus, canId, motorType); } /** diff --git a/src/test/java/org/frc10101/womp/can/SparkMaxWrapperTest.java b/src/test/java/org/frc10101/womp/can/SparkMaxWrapperTest.java index 04fdf88..60d5fbd 100644 --- a/src/test/java/org/frc10101/womp/can/SparkMaxWrapperTest.java +++ b/src/test/java/org/frc10101/womp/can/SparkMaxWrapperTest.java @@ -4,12 +4,13 @@ import com.revrobotics.spark.SparkLowLevel.MotorType; import org.junit.jupiter.api.Test; +import org.wpilib.hardware.bus.CANPort; public class SparkMaxWrapperTest { @Test void create() { - new SparkMaxWrapper(0, 1, MotorType.kBrushed); - new SparkMaxWrapper(0, 2, MotorType.kBrushless); + new SparkMaxWrapper(CANPort.CAN_S0, 1, MotorType.kBrushed); + new SparkMaxWrapper(CANPort.CAN_S0, 2, MotorType.kBrushless); } @Test @@ -17,7 +18,7 @@ void illegalCanId() { assertThrows( IllegalArgumentException.class, () -> { - new SparkMaxWrapper(0, 0, MotorType.kBrushed); + new SparkMaxWrapper(CANPort.CAN_S0, 0, MotorType.kBrushed); }); } @@ -26,7 +27,7 @@ void missingMotorType() { assertThrows( IllegalArgumentException.class, () -> { - new SparkMaxWrapper(0, 1, null); + new SparkMaxWrapper(CANPort.CAN_S0, 1, null); }); } } diff --git a/vendordeps/REVLib.json b/vendordeps/REVLib.json index 2861f9e..33ed264 100644 --- a/vendordeps/REVLib.json +++ b/vendordeps/REVLib.json @@ -1,8 +1,8 @@ { "fileName": "REVLib.json", "name": "REVLib", - "version": "2027.0.0-alpha-6", - "wpilibYear": "2027_alpha5", + "version": "2027.0.0-alpha-7", + "wpilibYear": "2027_alpha7", "uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", "mavenUrls": [ "https://maven.revrobotics.com/" @@ -12,14 +12,14 @@ { "groupId": "com.revrobotics.frc", "artifactId": "REVLib-java", - "version": "2027.0.0-alpha-6" + "version": "2027.0.0-alpha-7" } ], "jniDependencies": [ { "groupId": "com.revrobotics.frc", "artifactId": "REVLib-driver", - "version": "2027.0.0-alpha-6", + "version": "2027.0.0-alpha-7", "skipInvalidPlatforms": true, "isJar": false, "validPlatforms": [ @@ -33,7 +33,7 @@ { "groupId": "com.revrobotics.frc", "artifactId": "RevLibBackendDriver", - "version": "2027.0.0-alpha-6", + "version": "2027.0.0-alpha-7", "skipInvalidPlatforms": true, "isJar": false, "validPlatforms": [ @@ -47,7 +47,7 @@ { "groupId": "com.revrobotics.frc", "artifactId": "RevLibWpiBackendDriver", - "version": "2027.0.0-alpha-6", + "version": "2027.0.0-alpha-7", "skipInvalidPlatforms": true, "isJar": false, "validPlatforms": [ @@ -63,7 +63,7 @@ { "groupId": "com.revrobotics.frc", "artifactId": "REVLib-cpp", - "version": "2027.0.0-alpha-6", + "version": "2027.0.0-alpha-7", "libName": "REVLib", "headerClassifier": "headers", "sharedLibrary": false, @@ -79,7 +79,7 @@ { "groupId": "com.revrobotics.frc", "artifactId": "REVLib-driver", - "version": "2027.0.0-alpha-6", + "version": "2027.0.0-alpha-7", "libName": "REVLibDriver", "headerClassifier": "headers", "sharedLibrary": false, @@ -95,7 +95,7 @@ { "groupId": "com.revrobotics.frc", "artifactId": "RevLibBackendDriver", - "version": "2027.0.0-alpha-6", + "version": "2027.0.0-alpha-7", "libName": "BackendDriver", "sharedLibrary": true, "skipInvalidPlatforms": true, @@ -110,7 +110,7 @@ { "groupId": "com.revrobotics.frc", "artifactId": "RevLibWpiBackendDriver", - "version": "2027.0.0-alpha-6", + "version": "2027.0.0-alpha-7", "libName": "REVLibWpi", "sharedLibrary": true, "skipInvalidPlatforms": true,