From 9af98745fb2e57fc996593848c9bc0676d3272e0 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Thu, 21 Nov 2024 20:13:26 -0500 Subject: [PATCH 01/17] Add Java module support --- apriltag/build.gradle | 3 ++ apriltag/src/main/java/module-info.java | 14 ++++++ buildSrc/build.gradle | 1 + cameraserver/build.gradle | 1 + cameraserver/src/main/java/module-info.java | 13 ++++++ cscore/build.gradle | 1 + cscore/src/main/java/module-info.java | 11 +++++ .../src/main/java/module-info.java | 13 ++++++ .../src/main/java/module-info.java | 12 +++++ hal/src/main/java/module-info.java | 13 ++++++ ntcore/src/main/java/module-info.java | 9 ++++ romiVendordep/build.gradle | 2 + romiVendordep/src/main/java/module-info.java | 8 ++++ shared/java/javacommon.gradle | 8 ++++ shared/java/javastyle.gradle | 7 +++ shared/java/opencv-module-patches.gradle | 6 +++ shared/java/wpimath-module-patches.gradle | 34 ++++++++++++++ wpilibNewCommands/build.gradle | 2 + .../src/main/java/module-info.java | 14 ++++++ wpilibj/build.gradle | 3 ++ wpilibj/src/main/java/module-info.java | 28 +++++++++++ wpimath/build.gradle | 2 + wpimath/src/main/java/module-info.java | 46 +++++++++++++++++++ wpinet/src/main/java/module-info.java | 9 ++++ wpiunits/src/main/java/module-info.java | 10 ++++ wpiutil/src/main/java/module-info.java | 18 ++++++++ xrpVendordep/build.gradle | 2 + xrpVendordep/src/main/java/module-info.java | 8 ++++ 28 files changed, 298 insertions(+) create mode 100644 apriltag/src/main/java/module-info.java create mode 100644 cameraserver/src/main/java/module-info.java create mode 100644 cscore/src/main/java/module-info.java create mode 100644 epilogue-processor/src/main/java/module-info.java create mode 100644 epilogue-runtime/src/main/java/module-info.java create mode 100644 hal/src/main/java/module-info.java create mode 100644 ntcore/src/main/java/module-info.java create mode 100644 romiVendordep/src/main/java/module-info.java create mode 100644 shared/java/opencv-module-patches.gradle create mode 100644 shared/java/wpimath-module-patches.gradle create mode 100644 wpilibNewCommands/src/main/java/module-info.java create mode 100644 wpilibj/src/main/java/module-info.java create mode 100644 wpimath/src/main/java/module-info.java create mode 100644 wpinet/src/main/java/module-info.java create mode 100644 wpiunits/src/main/java/module-info.java create mode 100644 wpiutil/src/main/java/module-info.java create mode 100644 xrpVendordep/src/main/java/module-info.java diff --git a/apriltag/build.gradle b/apriltag/build.gradle index ffdf094ede0..ad911db169e 100644 --- a/apriltag/build.gradle +++ b/apriltag/build.gradle @@ -48,6 +48,9 @@ dependencies { implementation project(':wpimath') } +apply from: "${rootDir}/shared/java/wpimath-module-patches.gradle" +apply from: "${rootDir}/shared/java/opencv-module-patches.gradle" + sourceSets { main { resources { diff --git a/apriltag/src/main/java/module-info.java b/apriltag/src/main/java/module-info.java new file mode 100644 index 00000000000..888550e017e --- /dev/null +++ b/apriltag/src/main/java/module-info.java @@ -0,0 +1,14 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.apriltag { + requires transitive wpilib.opencv; + requires wpilib.math; + requires wpilib.util; + requires com.fasterxml.jackson.annotation; + requires com.fasterxml.jackson.databind; + + exports edu.wpi.first.apriltag; + exports edu.wpi.first.apriltag.jni; +} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 99d4892632a..767e2fc905f 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -10,4 +10,5 @@ repositories { } dependencies { implementation "edu.wpi.first:native-utils:2025.3.0" + implementation("org.gradlex:extra-java-module-info:1.9") } diff --git a/cameraserver/build.gradle b/cameraserver/build.gradle index 92925c65646..69a477460e2 100644 --- a/cameraserver/build.gradle +++ b/cameraserver/build.gradle @@ -8,6 +8,7 @@ evaluationDependsOn(':cscore') evaluationDependsOn(':hal') apply from: "${rootDir}/shared/javacpp/setupBuild.gradle" +apply from: "${rootDir}/shared/java/opencv-module-patches.gradle" dependencies { implementation project(':wpiutil') diff --git a/cameraserver/src/main/java/module-info.java b/cameraserver/src/main/java/module-info.java new file mode 100644 index 00000000000..f0ba8940fb9 --- /dev/null +++ b/cameraserver/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.cameraserver { + requires transitive wpilib.opencv; + requires wpilib.cscore; + requires wpilib.ntcore; + requires wpilib.util; + + exports edu.wpi.first.cameraserver; + exports edu.wpi.first.vision; +} diff --git a/cscore/build.gradle b/cscore/build.gradle index 5b2299548d7..db1e962ed92 100644 --- a/cscore/build.gradle +++ b/cscore/build.gradle @@ -14,6 +14,7 @@ if (OperatingSystem.current().isMacOsX()) { } apply from: "${rootDir}/shared/jni/setupBuild.gradle" +apply from: "${rootDir}/shared/java/opencv-module-patches.gradle" model { components { diff --git a/cscore/src/main/java/module-info.java b/cscore/src/main/java/module-info.java new file mode 100644 index 00000000000..b23c3ede20c --- /dev/null +++ b/cscore/src/main/java/module-info.java @@ -0,0 +1,11 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.cscore { + requires wpilib.opencv; + requires wpilib.util; + + exports edu.wpi.first.cscore; + exports edu.wpi.first.cscore.raw; +} diff --git a/epilogue-processor/src/main/java/module-info.java b/epilogue-processor/src/main/java/module-info.java new file mode 100644 index 00000000000..b27e7472e27 --- /dev/null +++ b/epilogue-processor/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +import javax.annotation.processing.Processor; + +module wpilib.epilogue.processor { + requires java.compiler; + requires wpilib.epilogue; + + provides Processor with + edu.wpi.first.epilogue.processor.AnnotationProcessor; +} diff --git a/epilogue-runtime/src/main/java/module-info.java b/epilogue-runtime/src/main/java/module-info.java new file mode 100644 index 00000000000..e3fbd138ff4 --- /dev/null +++ b/epilogue-runtime/src/main/java/module-info.java @@ -0,0 +1,12 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.epilogue { + requires wpilib.ntcore; + requires wpilib.units; + requires wpilib.util; + + exports edu.wpi.first.epilogue; + exports edu.wpi.first.epilogue.logging; +} diff --git a/hal/src/main/java/module-info.java b/hal/src/main/java/module-info.java new file mode 100644 index 00000000000..cb286761de6 --- /dev/null +++ b/hal/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.hal { + requires wpilib.util; + + exports edu.wpi.first.hal; + exports edu.wpi.first.hal.can; + exports edu.wpi.first.hal.communication; + exports edu.wpi.first.hal.simulation; + exports edu.wpi.first.hal.util; +} diff --git a/ntcore/src/main/java/module-info.java b/ntcore/src/main/java/module-info.java new file mode 100644 index 00000000000..48dc1b30046 --- /dev/null +++ b/ntcore/src/main/java/module-info.java @@ -0,0 +1,9 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.ntcore { + requires wpilib.util; + + exports edu.wpi.first.networktables; +} diff --git a/romiVendordep/build.gradle b/romiVendordep/build.gradle index b891c4de406..44b09cb5494 100644 --- a/romiVendordep/build.gradle +++ b/romiVendordep/build.gradle @@ -23,6 +23,8 @@ dependencies { implementation project(":wpilibj") } +apply from: "${rootDir}/shared/java/wpimath-module-patches.gradle" + nativeUtils.exportsConfigs { // Main library is just default empty. This will export everything romiVendordep { diff --git a/romiVendordep/src/main/java/module-info.java b/romiVendordep/src/main/java/module-info.java new file mode 100644 index 00000000000..2bec4799000 --- /dev/null +++ b/romiVendordep/src/main/java/module-info.java @@ -0,0 +1,8 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.romi { + requires transitive wpilib.wpilibj; + requires wpilib.hal; +} diff --git a/shared/java/javacommon.gradle b/shared/java/javacommon.gradle index 7802818b483..5105b2c1e5d 100644 --- a/shared/java/javacommon.gradle +++ b/shared/java/javacommon.gradle @@ -1,6 +1,7 @@ apply plugin: 'maven-publish' apply plugin: 'java-library' apply plugin: 'jacoco' +apply plugin: 'org.gradlex.extra-java-module-info' def baseArtifactId = project.baseId def artifactGroupId = project.groupId @@ -114,6 +115,13 @@ tasks.withType(JavaCompile).configureEach { "-Xlint:-serial", // ignore unclaimed annotation warning from annotation processing "-Xlint:-processing", + "-Xlint:-preview", + // ignore modules requiring automatic library modules + "-Xlint:-requires-automatic", + "-Xlint:-requires-transitive-automatic", + "-Xlint:-exports", + // Java modules warn about exposing classes without an explicitly declared constructor + "-Xlint:-missing-explicit-ctor" ] } diff --git a/shared/java/javastyle.gradle b/shared/java/javastyle.gradle index e2b713e7e6f..33c2b56fa4e 100644 --- a/shared/java/javastyle.gradle +++ b/shared/java/javastyle.gradle @@ -10,6 +10,13 @@ checkstyle { config = resources.text.fromFile(new File(configDirectory.get().getAsFile(), "checkstyle.xml")) } +tasks.withType(Checkstyle) { + // Checkstyle falls over if module-info files are included in the check scope + // The suppressions file does not appear to work for this, so we need to configure the task + // itself + exclude("**/module-info.java") +} + apply plugin: 'pmd' pmd { diff --git a/shared/java/opencv-module-patches.gradle b/shared/java/opencv-module-patches.gradle new file mode 100644 index 00000000000..d34edde8563 --- /dev/null +++ b/shared/java/opencv-module-patches.gradle @@ -0,0 +1,6 @@ +// Patch legacy non-modularized dependencies to have module info +extraJavaModuleInfo { + module('edu.wpi.first.thirdparty.frc2024.opencv:opencv-java', 'wpilib.opencv') { + exportAllPackages() + } +} diff --git a/shared/java/wpimath-module-patches.gradle b/shared/java/wpimath-module-patches.gradle new file mode 100644 index 00000000000..976136370f3 --- /dev/null +++ b/shared/java/wpimath-module-patches.gradle @@ -0,0 +1,34 @@ +// Patch legacy non-modularized dependencies to have module info +extraJavaModuleInfo { + module('org.ejml:ejml-core', 'ejml.core') { + exportAllPackages() + } + module('org.ejml:ejml-simple', 'ejml.simple') { + exportAllPackages() + requiresTransitive('ejml.core') + } + module('org.ejml:ejml-fsparse', 'ejml.fsparse') { + exportAllPackages() + requiresTransitive('ejml.core') + } + module('org.ejml:ejml-dsparse', 'ejml.dsparse') { + exportAllPackages() + requiresTransitive('ejml.core') + } + module('org.ejml:ejml-fdense', 'ejml.fdense') { + exportAllPackages() + requiresTransitive('ejml.core') + } + module('org.ejml:ejml-ddense', 'ejml.ddense') { + exportAllPackages() + requiresTransitive('ejml.core') + } + module('org.ejml:ejml-cdense', 'ejml.cdense') { + exportAllPackages() + requiresTransitive('ejml.core') + } + module('org.ejml:ejml-zdense', 'ejml.zdense') { + exportAllPackages() + requiresTransitive('ejml.core') + } +} diff --git a/wpilibNewCommands/build.gradle b/wpilibNewCommands/build.gradle index 884c18b65cb..55f6027e5ea 100644 --- a/wpilibNewCommands/build.gradle +++ b/wpilibNewCommands/build.gradle @@ -24,6 +24,8 @@ dependencies { testImplementation 'org.mockito:mockito-core:4.1.0' } +apply from: "${rootDir}/shared/java/wpimath-module-patches.gradle" + sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java" nativeUtils.exportsConfigs { diff --git a/wpilibNewCommands/src/main/java/module-info.java b/wpilibNewCommands/src/main/java/module-info.java new file mode 100644 index 00000000000..d6172015fc2 --- /dev/null +++ b/wpilibNewCommands/src/main/java/module-info.java @@ -0,0 +1,14 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.commands2 { + requires wpilib.units; + requires wpilib.wpilibj; + requires wpilib.hal; + requires wpilib.ntcore; + + exports edu.wpi.first.wpilibj2.command; + exports edu.wpi.first.wpilibj2.command.button; + exports edu.wpi.first.wpilibj2.command.sysid; +} diff --git a/wpilibj/build.gradle b/wpilibj/build.gradle index d397f934801..2680ab2dbd6 100644 --- a/wpilibj/build.gradle +++ b/wpilibj/build.gradle @@ -74,6 +74,9 @@ dependencies { devImplementation sourceSets.main.output } +apply from: "${rootDir}/shared/java/opencv-module-patches.gradle" +apply from: "${rootDir}/shared/java/wpimath-module-patches.gradle" + apply plugin: 'cpp' apply plugin: 'edu.wpi.first.NativeUtils' apply plugin: ExtraTasks diff --git a/wpilibj/src/main/java/module-info.java b/wpilibj/src/main/java/module-info.java new file mode 100644 index 00000000000..ef168706e66 --- /dev/null +++ b/wpilibj/src/main/java/module-info.java @@ -0,0 +1,28 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.wpilibj { + requires ejml.core; + requires ejml.simple; + requires transitive wpilib.math; + requires transitive wpilib.units; + requires transitive wpilib.util; + requires wpilib.hal; + requires wpilib.ntcore; + requires wpilib.cscore; + requires wpilib.cameraserver; + + exports edu.wpi.first.wpilibj; + exports edu.wpi.first.wpilibj.counter; + exports edu.wpi.first.wpilibj.drive; + exports edu.wpi.first.wpilibj.event; + exports edu.wpi.first.wpilibj.internal; + exports edu.wpi.first.wpilibj.livewindow; + exports edu.wpi.first.wpilibj.motorcontrol; + exports edu.wpi.first.wpilibj.shuffleboard; + exports edu.wpi.first.wpilibj.simulation; + exports edu.wpi.first.wpilibj.smartdashboard; + exports edu.wpi.first.wpilibj.sysid; + exports edu.wpi.first.wpilibj.util; +} diff --git a/wpimath/build.gradle b/wpimath/build.gradle index 9cb07b416ef..5cad88342e6 100644 --- a/wpimath/build.gradle +++ b/wpimath/build.gradle @@ -90,6 +90,8 @@ dependencies { api "us.hebi.quickbuf:quickbuf-runtime:1.3.3" } +apply from: "${rootDir}/shared/java/wpimath-module-patches.gradle" + sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java" sourceSets.main.resources.srcDir "${projectDir}/src/main/proto" diff --git a/wpimath/src/main/java/module-info.java b/wpimath/src/main/java/module-info.java new file mode 100644 index 00000000000..9e2592bca12 --- /dev/null +++ b/wpimath/src/main/java/module-info.java @@ -0,0 +1,46 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.math { + requires com.fasterxml.jackson.annotation; + requires ejml.core; + requires ejml.ddense; + requires ejml.simple; + requires us.hebi.quickbuf.runtime; + requires wpilib.units; + requires wpilib.util; + + exports edu.wpi.first.math; + exports edu.wpi.first.math.controller; + exports edu.wpi.first.math.controller.proto; + exports edu.wpi.first.math.controller.struct; + exports edu.wpi.first.math.estimator; + exports edu.wpi.first.math.filter; + exports edu.wpi.first.math.geometry; + exports edu.wpi.first.math.geometry.proto; + exports edu.wpi.first.math.geometry.struct; + exports edu.wpi.first.math.interpolation; + exports edu.wpi.first.math.jni; // Probably unnecessary + exports edu.wpi.first.math.kinematics; + exports edu.wpi.first.math.kinematics.proto; + exports edu.wpi.first.math.kinematics.struct; + exports edu.wpi.first.math.optimization; + exports edu.wpi.first.math.path; + exports edu.wpi.first.math.proto; + exports edu.wpi.first.math.spline; + exports edu.wpi.first.math.spline.proto; + exports edu.wpi.first.math.spline.struct; + exports edu.wpi.first.math.struct; + exports edu.wpi.first.math.system; + exports edu.wpi.first.math.system.plant; + exports edu.wpi.first.math.system.plant.proto; + exports edu.wpi.first.math.system.plant.struct; + exports edu.wpi.first.math.system.proto; + exports edu.wpi.first.math.system.struct; + exports edu.wpi.first.math.trajectory; + exports edu.wpi.first.math.trajectory.constraint; + exports edu.wpi.first.math.trajectory.proto; + exports edu.wpi.first.math.util; + exports edu.wpi.first.math.numbers; +} diff --git a/wpinet/src/main/java/module-info.java b/wpinet/src/main/java/module-info.java new file mode 100644 index 00000000000..9487fb3cec1 --- /dev/null +++ b/wpinet/src/main/java/module-info.java @@ -0,0 +1,9 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.net { + requires wpilib.util; + + exports edu.wpi.first.net; +} diff --git a/wpiunits/src/main/java/module-info.java b/wpiunits/src/main/java/module-info.java new file mode 100644 index 00000000000..d8597b04f82 --- /dev/null +++ b/wpiunits/src/main/java/module-info.java @@ -0,0 +1,10 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.units { + exports edu.wpi.first.units; + exports edu.wpi.first.units.collections; + exports edu.wpi.first.units.measure; + exports edu.wpi.first.units.mutable; +} diff --git a/wpiutil/src/main/java/module-info.java b/wpiutil/src/main/java/module-info.java new file mode 100644 index 00000000000..4e402605b6f --- /dev/null +++ b/wpiutil/src/main/java/module-info.java @@ -0,0 +1,18 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +@SuppressWarnings("requires-transitive-automatic") +module wpilib.util { + requires com.fasterxml.jackson.databind; + requires transitive us.hebi.quickbuf.runtime; + + exports edu.wpi.first.util; + exports edu.wpi.first.util.cleanup; + exports edu.wpi.first.util.concurrent; + exports edu.wpi.first.util.datalog; + exports edu.wpi.first.util.function; + exports edu.wpi.first.util.protobuf; + exports edu.wpi.first.util.sendable; + exports edu.wpi.first.util.struct; +} diff --git a/xrpVendordep/build.gradle b/xrpVendordep/build.gradle index 21278f55dee..1649cbc21e2 100644 --- a/xrpVendordep/build.gradle +++ b/xrpVendordep/build.gradle @@ -23,6 +23,8 @@ dependencies { implementation project(":wpilibj") } +apply from: "${rootDir}/shared/java/wpimath-module-patches.gradle" + nativeUtils.exportsConfigs { // Main library is just default empty. This will export everything xrpVendordep { diff --git a/xrpVendordep/src/main/java/module-info.java b/xrpVendordep/src/main/java/module-info.java new file mode 100644 index 00000000000..e6238e84262 --- /dev/null +++ b/xrpVendordep/src/main/java/module-info.java @@ -0,0 +1,8 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.xrp { + requires transitive wpilib.wpilibj; + requires wpilib.hal; +} From f47421a45fd22d2349fec344d5356f89efad70c9 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Thu, 21 Nov 2024 21:57:29 -0500 Subject: [PATCH 02/17] Suppress module name warnings --- shared/java/javacommon.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/java/javacommon.gradle b/shared/java/javacommon.gradle index 5105b2c1e5d..fc17c7ebfa5 100644 --- a/shared/java/javacommon.gradle +++ b/shared/java/javacommon.gradle @@ -121,7 +121,9 @@ tasks.withType(JavaCompile).configureEach { "-Xlint:-requires-transitive-automatic", "-Xlint:-exports", // Java modules warn about exposing classes without an explicitly declared constructor - "-Xlint:-missing-explicit-ctor" + "-Xlint:-missing-explicit-ctor", + // Java modules warn about module names with trailing digits + "-Xlint:-module" ] } From bb536c27c5f30ce6204cb31611ab3435cee86a87 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Thu, 21 Nov 2024 21:57:46 -0500 Subject: [PATCH 03/17] Add jdk.compiler to requirements for epilogue-processor --- epilogue-processor/src/main/java/module-info.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epilogue-processor/src/main/java/module-info.java b/epilogue-processor/src/main/java/module-info.java index b27e7472e27..7cb7a7fbf70 100644 --- a/epilogue-processor/src/main/java/module-info.java +++ b/epilogue-processor/src/main/java/module-info.java @@ -6,6 +6,7 @@ module wpilib.epilogue.processor { requires java.compiler; + requires jdk.compiler; requires wpilib.epilogue; provides Processor with From 3f498d767760796c56887a9b50168a3d99183ee9 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Mon, 2 Dec 2024 14:00:56 -0500 Subject: [PATCH 04/17] wip --- build.gradle | 1 + buildSrc/build.gradle | 1 + cameraserver/build.gradle | 7 +++++++ cameraserver/src/main/java/module-info.java | 10 +++++++--- cscore/src/main/java/module-info.java | 4 ++++ hal/src/main/java/module-info.java | 5 +++++ ntcore/src/main/java/module-info.java | 4 ++++ romiVendordep/src/main/java/module-info.java | 2 +- shared/java/javacommon.gradle | 1 + wpilibNewCommands/src/main/java/module-info.java | 2 +- wpilibj/src/main/java/module-info.java | 6 +++++- wpimath/src/main/java/module-info.java | 6 +++++- wpiunits/src/main/java/module-info.java | 3 +++ wpiutil/src/main/java/module-info.java | 5 +++++ xrpVendordep/src/main/java/module-info.java | 2 +- 15 files changed, 51 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 8a51182b787..f2bf858877a 100644 --- a/build.gradle +++ b/build.gradle @@ -21,6 +21,7 @@ plugins { id 'com.github.johnrengelman.shadow' version '8.1.1' apply false id 'com.diffplug.spotless' version '6.20.0' apply false id 'com.github.spotbugs' version '6.0.2' apply false + id 'org.javamodularity.moduleplugin' version '1.8.15' apply false } wpilibVersioning.buildServerMode = project.hasProperty('buildServer') diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 767e2fc905f..31d82a441ef 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -11,4 +11,5 @@ repositories { dependencies { implementation "edu.wpi.first:native-utils:2025.3.0" implementation("org.gradlex:extra-java-module-info:1.9") + implementation("org.gradlex:java-module-testing:1.5") } diff --git a/cameraserver/build.gradle b/cameraserver/build.gradle index 69a477460e2..4c68d56f012 100644 --- a/cameraserver/build.gradle +++ b/cameraserver/build.gradle @@ -29,6 +29,13 @@ ext { apply from: "${rootDir}/shared/opencv.gradle" +tasks.withType(JavaCompile).configureEach { + options.compilerArgs += [ + "--add-reads", + "wpilib.cameraserver=ALL-UNNAMED" + ] +} + nativeUtils.exportsConfigs { cameraserver { } diff --git a/cameraserver/src/main/java/module-info.java b/cameraserver/src/main/java/module-info.java index f0ba8940fb9..fc0ec1d531e 100644 --- a/cameraserver/src/main/java/module-info.java +++ b/cameraserver/src/main/java/module-info.java @@ -2,10 +2,14 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. +/** + * The WPILib cameraserver module. This defines APIs for streaming cameras from the robot for use + * by dashboards and coprocessors, and for running OpenCV pipelines (though note that the roboRIO + * is too slow to run any but the most simple pipelines at a reasonable speed). + */ module wpilib.cameraserver { - requires transitive wpilib.opencv; - requires wpilib.cscore; - requires wpilib.ntcore; + requires transitive wpilib.cscore; + requires transitive wpilib.ntcore; requires wpilib.util; exports edu.wpi.first.cameraserver; diff --git a/cscore/src/main/java/module-info.java b/cscore/src/main/java/module-info.java index b23c3ede20c..038de02230f 100644 --- a/cscore/src/main/java/module-info.java +++ b/cscore/src/main/java/module-info.java @@ -2,6 +2,10 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. +/** + * The WPILib cscore module. This defines APIs for connecting to and reading images from cameras + * connected to the robot and for configuring those cameras. + */ module wpilib.cscore { requires wpilib.opencv; requires wpilib.util; diff --git a/hal/src/main/java/module-info.java b/hal/src/main/java/module-info.java index cb286761de6..bf7f5ea4884 100644 --- a/hal/src/main/java/module-info.java +++ b/hal/src/main/java/module-info.java @@ -2,6 +2,11 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. +/** + * The WPILib HAL module. This defines APIs for interacting with hardware through the native C++ + * layer and JNI bindings. Most robot programs don't need to use this directly and should use the + * {@code wpilib} module instead. + */ module wpilib.hal { requires wpilib.util; diff --git a/ntcore/src/main/java/module-info.java b/ntcore/src/main/java/module-info.java index 48dc1b30046..13f0f0670bc 100644 --- a/ntcore/src/main/java/module-info.java +++ b/ntcore/src/main/java/module-info.java @@ -2,6 +2,10 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. +/** + * The WPILib networking module. This defines APIs for sending and receiving data over the robot + * network for communication with coprocessors and the driver station. + */ module wpilib.ntcore { requires wpilib.util; diff --git a/romiVendordep/src/main/java/module-info.java b/romiVendordep/src/main/java/module-info.java index 2bec4799000..e1b5f243dc5 100644 --- a/romiVendordep/src/main/java/module-info.java +++ b/romiVendordep/src/main/java/module-info.java @@ -3,6 +3,6 @@ // the WPILib BSD license file in the root directory of this project. module wpilib.romi { - requires transitive wpilib.wpilibj; + requires transitive wpilib; requires wpilib.hal; } diff --git a/shared/java/javacommon.gradle b/shared/java/javacommon.gradle index fc17c7ebfa5..b503db15ac1 100644 --- a/shared/java/javacommon.gradle +++ b/shared/java/javacommon.gradle @@ -2,6 +2,7 @@ apply plugin: 'maven-publish' apply plugin: 'java-library' apply plugin: 'jacoco' apply plugin: 'org.gradlex.extra-java-module-info' +apply plugin: 'org.javamodularity.moduleplugin' def baseArtifactId = project.baseId def artifactGroupId = project.groupId diff --git a/wpilibNewCommands/src/main/java/module-info.java b/wpilibNewCommands/src/main/java/module-info.java index d6172015fc2..8358584599a 100644 --- a/wpilibNewCommands/src/main/java/module-info.java +++ b/wpilibNewCommands/src/main/java/module-info.java @@ -4,7 +4,7 @@ module wpilib.commands2 { requires wpilib.units; - requires wpilib.wpilibj; + requires wpilib; requires wpilib.hal; requires wpilib.ntcore; diff --git a/wpilibj/src/main/java/module-info.java b/wpilibj/src/main/java/module-info.java index ef168706e66..75bbef6066d 100644 --- a/wpilibj/src/main/java/module-info.java +++ b/wpilibj/src/main/java/module-info.java @@ -2,7 +2,11 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -module wpilib.wpilibj { +/** + * The core WPILib module. This defines APIs for interacting with robot sensors and actuators, + * dashboard applications, and high-level program control frameworks. + */ +module wpilib { requires ejml.core; requires ejml.simple; requires transitive wpilib.math; diff --git a/wpimath/src/main/java/module-info.java b/wpimath/src/main/java/module-info.java index 9e2592bca12..0e179f17c32 100644 --- a/wpimath/src/main/java/module-info.java +++ b/wpimath/src/main/java/module-info.java @@ -2,13 +2,17 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. +/** + * The WPILib math module. This defines APIs for geometry, kinematics, odometry, path planning, + * control algorithms, and physics simulators for simple mechanisms. + */ module wpilib.math { requires com.fasterxml.jackson.annotation; requires ejml.core; requires ejml.ddense; requires ejml.simple; requires us.hebi.quickbuf.runtime; - requires wpilib.units; + requires transitive wpilib.units; requires wpilib.util; exports edu.wpi.first.math; diff --git a/wpiunits/src/main/java/module-info.java b/wpiunits/src/main/java/module-info.java index d8597b04f82..5a5acd2cbc2 100644 --- a/wpiunits/src/main/java/module-info.java +++ b/wpiunits/src/main/java/module-info.java @@ -2,6 +2,9 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. +/** + * The WPILib units module. This defines APIs for type-safe unit definitions and math operations. + */ module wpilib.units { exports edu.wpi.first.units; exports edu.wpi.first.units.collections; diff --git a/wpiutil/src/main/java/module-info.java b/wpiutil/src/main/java/module-info.java index 4e402605b6f..5213c20844b 100644 --- a/wpiutil/src/main/java/module-info.java +++ b/wpiutil/src/main/java/module-info.java @@ -2,6 +2,11 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. +/** + * The WPILib utility module. This defines miscellaneous APIs for concurrency, data logging, + * lambda functions, binary serialization and deserialization, native library interactions, and + * error reporting. + */ @SuppressWarnings("requires-transitive-automatic") module wpilib.util { requires com.fasterxml.jackson.databind; diff --git a/xrpVendordep/src/main/java/module-info.java b/xrpVendordep/src/main/java/module-info.java index e6238e84262..750810b4633 100644 --- a/xrpVendordep/src/main/java/module-info.java +++ b/xrpVendordep/src/main/java/module-info.java @@ -3,6 +3,6 @@ // the WPILib BSD license file in the root directory of this project. module wpilib.xrp { - requires transitive wpilib.wpilibj; + requires transitive wpilib; requires wpilib.hal; } From 69af2fd5c2b216cae83c1f1bc3fac3e1f17e288b Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Mon, 2 Dec 2024 19:52:41 -0500 Subject: [PATCH 05/17] Combine both color test files An older one was in the edu.wpi.first.math.util package, conflicting with the wpimath module --- .../edu/wpi/first/math/util/ColorTest.java | 45 ------------------- .../edu/wpi/first/wpilibj/util/ColorTest.java | 28 ++++++++++++ 2 files changed, 28 insertions(+), 45 deletions(-) delete mode 100644 wpilibj/src/test/java/edu/wpi/first/math/util/ColorTest.java diff --git a/wpilibj/src/test/java/edu/wpi/first/math/util/ColorTest.java b/wpilibj/src/test/java/edu/wpi/first/math/util/ColorTest.java deleted file mode 100644 index 668531427dd..00000000000 --- a/wpilibj/src/test/java/edu/wpi/first/math/util/ColorTest.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package edu.wpi.first.math.util; - -import static org.junit.jupiter.api.Assertions.assertAll; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.params.provider.Arguments.arguments; - -import edu.wpi.first.wpilibj.util.Color; -import java.util.stream.Stream; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; - -class ColorTest { - private static final double kEpsilon = 1e-3; - - void assertColorMatches(double red, double green, double blue, Color color) { - assertAll( - () -> assertEquals(red, color.red, kEpsilon), - () -> assertEquals(green, color.green, kEpsilon), - () -> assertEquals(blue, color.blue, kEpsilon)); - } - - @ParameterizedTest - @MethodSource("staticColorProvider") - void staticColorTest(double red, double green, double blue, Color color) { - assertColorMatches(red, green, blue, color); - } - - @ParameterizedTest - @MethodSource("staticColorProvider") - void colorEqualsTest(double red, double green, double blue, Color color) { - assertEquals(color, new Color(red, green, blue)); - } - - static Stream staticColorProvider() { - return Stream.of( - arguments(0.0823529412, 0.376470589, 0.7411764706, Color.kDenim), - arguments(0.0, 0.4, 0.7019607844, Color.kFirstBlue), - arguments(0.9294117648, 0.1098039216, 0.1411764706, Color.kFirstRed)); - } -} diff --git a/wpilibj/src/test/java/edu/wpi/first/wpilibj/util/ColorTest.java b/wpilibj/src/test/java/edu/wpi/first/wpilibj/util/ColorTest.java index 76901c2f403..bf33f650b96 100644 --- a/wpilibj/src/test/java/edu/wpi/first/wpilibj/util/ColorTest.java +++ b/wpilibj/src/test/java/edu/wpi/first/wpilibj/util/ColorTest.java @@ -123,4 +123,32 @@ private static Stream hsvToRgbProvider() { arguments(120, 255, 128, 0, 0, 128) // Navy ); } + + void assertColorMatches(double red, double green, double blue, Color color) { + double epsilon = 1e-3; + + assertAll( + () -> assertEquals(red, color.red, epsilon), + () -> assertEquals(green, color.green, epsilon), + () -> assertEquals(blue, color.blue, epsilon)); + } + + @ParameterizedTest + @MethodSource("staticColorProvider") + void staticColorTest(double red, double green, double blue, Color color) { + assertColorMatches(red, green, blue, color); + } + + @ParameterizedTest + @MethodSource("staticColorProvider") + void colorEqualsTest(double red, double green, double blue, Color color) { + assertEquals(color, new Color(red, green, blue)); + } + + static Stream staticColorProvider() { + return Stream.of( + arguments(0.0823529412, 0.376470589, 0.7411764706, Color.kDenim), + arguments(0.0, 0.4, 0.7019607844, Color.kFirstBlue), + arguments(0.9294117648, 0.1098039216, 0.1411764706, Color.kFirstRed)); + } } From d26885ad349b10cb8daa59d280be82f6fe123e3a Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Mon, 2 Dec 2024 19:53:13 -0500 Subject: [PATCH 06/17] Add patches for OpenCV 2025 --- shared/java/opencv-module-patches.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shared/java/opencv-module-patches.gradle b/shared/java/opencv-module-patches.gradle index d34edde8563..6e1ea749446 100644 --- a/shared/java/opencv-module-patches.gradle +++ b/shared/java/opencv-module-patches.gradle @@ -3,4 +3,7 @@ extraJavaModuleInfo { module('edu.wpi.first.thirdparty.frc2024.opencv:opencv-java', 'wpilib.opencv') { exportAllPackages() } + module('edu.wpi.first.thirdparty.frc2025.opencv:opencv-java', 'wpilib.opencv') { + exportAllPackages() + } } From 2b5c466edcc57adf45aa808ba86f9051b42e0092 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Mon, 2 Dec 2024 19:53:26 -0500 Subject: [PATCH 07/17] Add missing module info for fieldimages --- fieldImages/src/main/java/module-info.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 fieldImages/src/main/java/module-info.java diff --git a/fieldImages/src/main/java/module-info.java b/fieldImages/src/main/java/module-info.java new file mode 100644 index 00000000000..f4c145cc68f --- /dev/null +++ b/fieldImages/src/main/java/module-info.java @@ -0,0 +1,9 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +module wpilib.fieldimages { + requires com.fasterxml.jackson.databind; + + exports edu.wpi.first.fields; +} From d50ee11eae78cb424de2986be7daacf66b8d48d8 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Mon, 2 Dec 2024 19:53:59 -0500 Subject: [PATCH 08/17] Use EJML uberjars Single JAR means no split packages Depends on https://github.com/lessthanoptimal/ejml/pull/203 and local EJML artifacts --- WORKSPACE | 2 +- build.gradle | 6 ++++-- wpilibj/src/main/java/module-info.java | 2 -- wpimath/build.gradle | 2 +- wpimath/src/main/java/module-info.java | 4 +--- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 602b2ed4297..c58480b60d5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -15,7 +15,7 @@ rules_jvm_external_deps() load("@rules_jvm_external//:defs.bzl", "maven_install") maven_artifacts = [ - "org.ejml:ejml-simple:0.43.1", + "org.ejml:ejml-one:0.43.1", "com.fasterxml.jackson.core:jackson-annotations:2.15.2", "com.fasterxml.jackson.core:jackson-core:2.15.2", "com.fasterxml.jackson.core:jackson-databind:2.15.2", diff --git a/build.gradle b/build.gradle index f2bf858877a..c7a5eb03dad 100644 --- a/build.gradle +++ b/build.gradle @@ -30,8 +30,10 @@ wpilibVersioning.releaseMode = project.hasProperty('releaseMode') allprojects { repositories { maven { - url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn' - } + url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn' + } + // For testing local EJML uberjar builds + mavenLocal() } if (project.hasProperty('releaseMode')) { wpilibRepositories.addAllReleaseRepositories(it) diff --git a/wpilibj/src/main/java/module-info.java b/wpilibj/src/main/java/module-info.java index 75bbef6066d..c1265be290b 100644 --- a/wpilibj/src/main/java/module-info.java +++ b/wpilibj/src/main/java/module-info.java @@ -7,8 +7,6 @@ * dashboard applications, and high-level program control frameworks. */ module wpilib { - requires ejml.core; - requires ejml.simple; requires transitive wpilib.math; requires transitive wpilib.units; requires transitive wpilib.util; diff --git a/wpimath/build.gradle b/wpimath/build.gradle index 5cad88342e6..d090260216b 100644 --- a/wpimath/build.gradle +++ b/wpimath/build.gradle @@ -83,7 +83,7 @@ nativeUtils.exportsConfigs { dependencies { api project(":wpiunits") - api "org.ejml:ejml-simple:0.43.1" + api "org.ejml:ejml-one:0.43.1" api "com.fasterxml.jackson.core:jackson-annotations:2.15.2" api "com.fasterxml.jackson.core:jackson-core:2.15.2" api "com.fasterxml.jackson.core:jackson-databind:2.15.2" diff --git a/wpimath/src/main/java/module-info.java b/wpimath/src/main/java/module-info.java index 0e179f17c32..55f39c1d2fe 100644 --- a/wpimath/src/main/java/module-info.java +++ b/wpimath/src/main/java/module-info.java @@ -8,9 +8,7 @@ */ module wpilib.math { requires com.fasterxml.jackson.annotation; - requires ejml.core; - requires ejml.ddense; - requires ejml.simple; + requires transitive ejml.all; requires us.hebi.quickbuf.runtime; requires transitive wpilib.units; requires wpilib.util; From 0dada32d095bad7135f7c6205ec13c5d28e0ccf6 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Tue, 3 Dec 2024 21:28:59 -0500 Subject: [PATCH 09/17] Support modules in epilogue processor Place generated files in their own package, to avoid splitting the epilogue package between the runtime and user code Explicitly scope CustomLoggerFor validations to TypeElements (would break on ModuleElements) --- epilogue-processor/build.gradle | 34 +++++++++++++++++++ .../processor/AnnotationProcessor.java | 1 + .../epilogue/processor/EpilogueGenerator.java | 6 ++-- .../epilogue/processor/LoggerGenerator.java | 2 +- .../processor/EpilogueGeneratorTest.java | 30 ++++++++++------ 5 files changed, 60 insertions(+), 13 deletions(-) diff --git a/epilogue-processor/build.gradle b/epilogue-processor/build.gradle index 6a67ca3e8aa..e4c197815a8 100644 --- a/epilogue-processor/build.gradle +++ b/epilogue-processor/build.gradle @@ -8,6 +8,7 @@ ext { } apply from: "${rootDir}/shared/java/javacommon.gradle" +apply from: "${rootDir}/shared/java/opencv-module-patches.gradle" dependencies { implementation(project(':epilogue-runtime')) @@ -15,3 +16,36 @@ dependencies { testImplementation 'com.google.testing.compile:compile-testing:+' } + +extraJavaModuleInfo { + module('com.google.testing.compile:compile-testing', 'google.compile_testing') { + exportAllPackages() + } + module('com.google.truth:truth', 'google.truth') { // Somebody wants just `truth` as the module name... + exportAllPackages() + } + module('com.google.auto:auto-common', 'google.auto.common') { + exportAllPackages() + } + module('com.google.auto.value:auto-value', 'google.auto.value') { + exportAllPackages() + } + module('com.google.auto.value:auto-value-annotations', 'google.auto.value.annotations') { + exportAllPackages() + } + module('org.hamcrest:hamcrest-core', 'hamcrest.core') { + exportAllPackages() + } + module('com.google.guava:failureaccess', 'google.guava.failureaccess') { + exportAllPackages() + } + module('com.google.guava:listenablefuture', 'google.guava.listenablefuture') { + exportAllPackages() + } + module('com.google.code.findbugs:jsr305', 'findbugs.jsr305') { + exportAllPackages() + } + module('com.google.j2objc:j2objc-annotations', 'google.j2objc.annotations') { + exportAllPackages() + } +} diff --git a/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/AnnotationProcessor.java b/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/AnnotationProcessor.java index 22f0e894595..b5bac917ba7 100644 --- a/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/AnnotationProcessor.java +++ b/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/AnnotationProcessor.java @@ -66,6 +66,7 @@ public boolean process(Set annotations, RoundEnvironment }); roundEnv.getRootElements().stream() + .filter(e -> e instanceof TypeElement) .filter( e -> processingEnv diff --git a/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/EpilogueGenerator.java b/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/EpilogueGenerator.java index 24520f5647b..b6463dcb556 100644 --- a/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/EpilogueGenerator.java +++ b/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/EpilogueGenerator.java @@ -46,15 +46,17 @@ public void writeEpilogueFile( List loggerClassNames, Collection mainRobotClasses) { try { var centralStore = - m_processingEnv.getFiler().createSourceFile("edu.wpi.first.epilogue.Epilogue"); + m_processingEnv.getFiler().createSourceFile("edu.wpi.first.epilogue.generated.Epilogue"); try (var out = new PrintWriter(centralStore.openOutputStream())) { - out.println("package edu.wpi.first.epilogue;"); + out.println("package edu.wpi.first.epilogue.generated;"); out.println(); out.println("import static edu.wpi.first.units.Units.Seconds;"); out.println(); + out.println("import edu.wpi.first.epilogue.Logged;"); + out.println("import edu.wpi.first.epilogue.EpilogueConfiguration;"); out.println("import edu.wpi.first.hal.FRCNetComm;"); out.println("import edu.wpi.first.hal.HAL;"); out.println(); diff --git a/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/LoggerGenerator.java b/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/LoggerGenerator.java index 15fa2104dcd..951e7137b6e 100644 --- a/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/LoggerGenerator.java +++ b/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/LoggerGenerator.java @@ -190,7 +190,7 @@ private void writeLoggerFile( } out.println("import edu.wpi.first.epilogue.Logged;"); - out.println("import edu.wpi.first.epilogue.Epilogue;"); + out.println("import edu.wpi.first.epilogue.generated.Epilogue;"); out.println("import edu.wpi.first.epilogue.logging.ClassSpecificLogger;"); out.println("import edu.wpi.first.epilogue.logging.EpilogueBackend;"); if (requiresVarHandles) { diff --git a/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java b/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java index 1e9806d3a20..7bd6cb1bf97 100644 --- a/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java +++ b/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java @@ -20,7 +20,7 @@ class EpilogueGeneratorTest { void noFields() { String source = """ - package edu.wpi.first.epilogue; + package edu.wpi.first.epilogue.generated; @Logged class Example { @@ -29,10 +29,12 @@ class Example { String expected = """ - package edu.wpi.first.epilogue; + package edu.wpi.first.epilogue.generated; import static edu.wpi.first.units.Units.Seconds; + import edu.wpi.first.epilogue.Logged; + import edu.wpi.first.epilogue.EpilogueConfiguration; import edu.wpi.first.hal.FRCNetComm; import edu.wpi.first.hal.HAL; @@ -75,7 +77,7 @@ public static boolean shouldLog(Logged.Importance importance) { void robotBase() { String source = """ - package edu.wpi.first.epilogue; + package edu.wpi.first.epilogue.generated; @Logged class Example extends edu.wpi.first.wpilibj.RobotBase { @@ -88,10 +90,12 @@ public void endCompetition() {} String expected = """ - package edu.wpi.first.epilogue; + package edu.wpi.first.epilogue.generated; import static edu.wpi.first.units.Units.Seconds; + import edu.wpi.first.epilogue.Logged; + import edu.wpi.first.epilogue.EpilogueConfiguration; import edu.wpi.first.hal.FRCNetComm; import edu.wpi.first.hal.HAL; @@ -133,7 +137,7 @@ public static boolean shouldLog(Logged.Importance importance) { void timedRobot() { String source = """ - package edu.wpi.first.epilogue; + package edu.wpi.first.epilogue.generated; @Logged class Example extends edu.wpi.first.wpilibj.TimedRobot { @@ -142,10 +146,12 @@ class Example extends edu.wpi.first.wpilibj.TimedRobot { String expected = """ - package edu.wpi.first.epilogue; + package edu.wpi.first.epilogue.generated; import static edu.wpi.first.units.Units.Seconds; + import edu.wpi.first.epilogue.Logged; + import edu.wpi.first.epilogue.EpilogueConfiguration; import edu.wpi.first.hal.FRCNetComm; import edu.wpi.first.hal.HAL; @@ -219,7 +225,7 @@ public static void bind(edu.wpi.first.epilogue.Example robot) { void multipleRobots() { String source = """ - package edu.wpi.first.epilogue; + package edu.wpi.first.epilogue.generated; @Logged class AlphaBot extends edu.wpi.first.wpilibj.TimedRobot { } @@ -230,10 +236,12 @@ class BetaBot extends edu.wpi.first.wpilibj.TimedRobot { } String expected = """ - package edu.wpi.first.epilogue; + package edu.wpi.first.epilogue.generated; import static edu.wpi.first.units.Units.Seconds; + import edu.wpi.first.epilogue.Logged; + import edu.wpi.first.epilogue.EpilogueConfiguration; import edu.wpi.first.hal.FRCNetComm; import edu.wpi.first.hal.HAL; @@ -341,7 +349,7 @@ public static void bind(edu.wpi.first.epilogue.BetaBot robot) { void genericCustomLogger() { String source = """ - package edu.wpi.first.epilogue; + package edu.wpi.first.epilogue.generated; import edu.wpi.first.epilogue.logging.*; @@ -367,10 +375,12 @@ class Example { String expected = """ - package edu.wpi.first.epilogue; + package edu.wpi.first.epilogue.generated; import static edu.wpi.first.units.Units.Seconds; + import edu.wpi.first.epilogue.Logged; + import edu.wpi.first.epilogue.EpilogueConfiguration; import edu.wpi.first.hal.FRCNetComm; import edu.wpi.first.hal.HAL; From 06835b6bdc508384e38bdc3c63e5e5a29142c231 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Tue, 3 Dec 2024 21:31:05 -0500 Subject: [PATCH 10/17] Export packages from XRP and romi vendor deps --- romiVendordep/src/main/java/module-info.java | 2 ++ xrpVendordep/src/main/java/module-info.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/romiVendordep/src/main/java/module-info.java b/romiVendordep/src/main/java/module-info.java index e1b5f243dc5..98506cc14c8 100644 --- a/romiVendordep/src/main/java/module-info.java +++ b/romiVendordep/src/main/java/module-info.java @@ -5,4 +5,6 @@ module wpilib.romi { requires transitive wpilib; requires wpilib.hal; + + exports edu.wpi.first.wpilibj.romi; } diff --git a/xrpVendordep/src/main/java/module-info.java b/xrpVendordep/src/main/java/module-info.java index 750810b4633..971e0b2cd31 100644 --- a/xrpVendordep/src/main/java/module-info.java +++ b/xrpVendordep/src/main/java/module-info.java @@ -5,4 +5,6 @@ module wpilib.xrp { requires transitive wpilib; requires wpilib.hal; + + exports edu.wpi.first.wpilibj.xrp; } From 801030328eb07f34caee843c75903cac0aa23489 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Tue, 3 Dec 2024 21:31:32 -0500 Subject: [PATCH 11/17] Update java examples project --- wpilibjExamples/build.gradle | 3 +++ .../wpilibj/examples/rapidreactcommandbot/Robot.java | 2 +- wpilibjExamples/src/main/java/module-info.java | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 wpilibjExamples/src/main/java/module-info.java diff --git a/wpilibjExamples/build.gradle b/wpilibjExamples/build.gradle index 115b2539650..f0f8a6f7b1d 100644 --- a/wpilibjExamples/build.gradle +++ b/wpilibjExamples/build.gradle @@ -2,6 +2,8 @@ import edu.wpi.first.toolchain.NativePlatforms apply plugin: 'java' apply plugin: 'jacoco' +apply plugin: 'org.gradlex.extra-java-module-info' +apply plugin: 'org.javamodularity.moduleplugin' ext { useJava = true @@ -10,6 +12,7 @@ ext { } apply from: "${rootDir}/shared/opencv.gradle" +apply from: "${rootDir}/shared/java/opencv-module-patches.gradle" dependencies { implementation project(':wpilibj') diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/Robot.java index 463e1d6f3c8..e8e1defb8a4 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/Robot.java @@ -4,7 +4,7 @@ package edu.wpi.first.wpilibj.examples.rapidreactcommandbot; -import edu.wpi.first.epilogue.Epilogue; +import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.Logged; import edu.wpi.first.wpilibj.DataLogManager; import edu.wpi.first.wpilibj.TimedRobot; diff --git a/wpilibjExamples/src/main/java/module-info.java b/wpilibjExamples/src/main/java/module-info.java new file mode 100644 index 00000000000..ec62d95717d --- /dev/null +++ b/wpilibjExamples/src/main/java/module-info.java @@ -0,0 +1,11 @@ +module wpilib.examples { + requires wpilib.apriltag; + requires wpilib.cameraserver; + requires wpilib.commands2; + requires wpilib.cscore; + requires wpilib.epilogue; + requires wpilib.hal; + requires wpilib.ntcore; + requires wpilib.romi; + requires wpilib.xrp; +} From 51665aac8503113893311cb69f93af94aa966014 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Tue, 3 Dec 2024 21:38:44 -0500 Subject: [PATCH 12/17] Run wpilibj tests on classpath to allow JUnit extensions to be loaded Otherwise, would probably need its own module to declare a `provides` --- wpilibj/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wpilibj/build.gradle b/wpilibj/build.gradle index 2680ab2dbd6..6e4eacc36df 100644 --- a/wpilibj/build.gradle +++ b/wpilibj/build.gradle @@ -171,6 +171,9 @@ test { outputs.upToDateWhen {false} showStandardStreams = true } + moduleOptions { + runOnClasspath = true + } } apply from: "${rootDir}/shared/javaDesktopTestTask.gradle" From 93634c5a3ee98e94fd0c499d54e802b1659c0c96 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Tue, 3 Dec 2024 23:09:34 -0500 Subject: [PATCH 13/17] Finish epilogue-processor modularization Need to disable modules for tests because the google compile testing library is not modularized --- epilogue-processor/build.gradle | 37 +----- .../processor/AnnotationProcessorTest.java | 114 +++++++++--------- .../processor/EpilogueGeneratorTest.java | 50 ++++---- shared/java/javacommon.gradle | 5 +- 4 files changed, 92 insertions(+), 114 deletions(-) diff --git a/epilogue-processor/build.gradle b/epilogue-processor/build.gradle index e4c197815a8..f9cc941ab28 100644 --- a/epilogue-processor/build.gradle +++ b/epilogue-processor/build.gradle @@ -8,7 +8,7 @@ ext { } apply from: "${rootDir}/shared/java/javacommon.gradle" -apply from: "${rootDir}/shared/java/opencv-module-patches.gradle" +//apply from: "${rootDir}/shared/java/opencv-module-patches.gradle" dependencies { implementation(project(':epilogue-runtime')) @@ -17,35 +17,8 @@ dependencies { testImplementation 'com.google.testing.compile:compile-testing:+' } -extraJavaModuleInfo { - module('com.google.testing.compile:compile-testing', 'google.compile_testing') { - exportAllPackages() +test { + moduleOptions { + runOnClasspath = true } - module('com.google.truth:truth', 'google.truth') { // Somebody wants just `truth` as the module name... - exportAllPackages() - } - module('com.google.auto:auto-common', 'google.auto.common') { - exportAllPackages() - } - module('com.google.auto.value:auto-value', 'google.auto.value') { - exportAllPackages() - } - module('com.google.auto.value:auto-value-annotations', 'google.auto.value.annotations') { - exportAllPackages() - } - module('org.hamcrest:hamcrest-core', 'hamcrest.core') { - exportAllPackages() - } - module('com.google.guava:failureaccess', 'google.guava.failureaccess') { - exportAllPackages() - } - module('com.google.guava:listenablefuture', 'google.guava.listenablefuture') { - exportAllPackages() - } - module('com.google.code.findbugs:jsr305', 'findbugs.jsr305') { - exportAllPackages() - } - module('com.google.j2objc:j2objc-annotations', 'google.j2objc.annotations') { - exportAllPackages() - } -} +} \ No newline at end of file diff --git a/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/AnnotationProcessorTest.java b/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/AnnotationProcessorTest.java index cdfb99e0824..2c26d63dc7d 100644 --- a/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/AnnotationProcessorTest.java +++ b/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/AnnotationProcessorTest.java @@ -38,7 +38,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -77,7 +77,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -116,7 +116,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; import java.lang.invoke.MethodHandles; @@ -167,7 +167,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; import java.lang.invoke.MethodHandles; @@ -220,7 +220,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -268,7 +268,7 @@ enum E { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -312,7 +312,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -359,7 +359,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -404,7 +404,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -449,7 +449,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -496,7 +496,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -543,7 +543,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -593,7 +593,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -642,7 +642,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -692,7 +692,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -751,7 +751,7 @@ static class Structable implements StructSerializable { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -802,7 +802,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -852,7 +852,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -983,7 +983,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1035,7 +1035,7 @@ public class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1122,7 +1122,7 @@ public class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1185,7 +1185,7 @@ class Example { // Deliberately nonstatic package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1231,7 +1231,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1271,7 +1271,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1324,7 +1324,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1376,7 +1376,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; import java.lang.invoke.MethodHandles; @@ -1426,21 +1426,21 @@ void customLogger() { record Point(int x, int y) {} - @CustomLoggerFor(Point.class) - class CustomPointLogger extends ClassSpecificLogger { - public CustomPointLogger() { - super(Point.class); - } - - @Override - public void update(EpilogueBackend backend, Point point) { - // Implementation is irrelevant - } - } - @Logged - class Example { + public class Example { Point point; + + @CustomLoggerFor(Point.class) + public static class CustomPointLogger extends ClassSpecificLogger { + public CustomPointLogger() { + super(Point.class); + } + + @Override + public void update(EpilogueBackend backend, Point point) { + // Implementation is irrelevant + } + } } """; @@ -1449,7 +1449,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1481,21 +1481,21 @@ void customGenericLogger() { import edu.wpi.first.math.Num; import edu.wpi.first.math.Vector; - @CustomLoggerFor(Vector.class) - class VectorLogger extends ClassSpecificLogger> { - public VectorLogger() { - super((Class) Vector.class); - } - - @Override - public void update(EpilogueBackend backend, Vector object) { - // Implementation is irrelevant - } - } - @Logged - class Example { + public class Example { Vector vec; + + @CustomLoggerFor(Vector.class) + public static class VectorLogger extends ClassSpecificLogger> { + public VectorLogger() { + super((Class) Vector.class); + } + + @Override + public void update(EpilogueBackend backend, Vector object) { + // Implementation is irrelevant + } + } } """; @@ -1504,7 +1504,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1612,7 +1612,7 @@ record Example(double x, double y) { } package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1700,7 +1700,7 @@ class Example { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; @@ -1752,7 +1752,7 @@ public double optedOut() { package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.Logged; - import edu.wpi.first.epilogue.Epilogue; + import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.logging.ClassSpecificLogger; import edu.wpi.first.epilogue.logging.EpilogueBackend; diff --git a/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java b/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java index 7bd6cb1bf97..15366ef317c 100644 --- a/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java +++ b/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java @@ -20,10 +20,10 @@ class EpilogueGeneratorTest { void noFields() { String source = """ - package edu.wpi.first.epilogue.generated; + package edu.wpi.first.epilogue; @Logged - class Example { + public class Example { } """; @@ -77,10 +77,10 @@ public static boolean shouldLog(Logged.Importance importance) { void robotBase() { String source = """ - package edu.wpi.first.epilogue.generated; + package edu.wpi.first.epilogue; @Logged - class Example extends edu.wpi.first.wpilibj.RobotBase { + public class Example extends edu.wpi.first.wpilibj.RobotBase { @Override public void startCompetition() {} @Override @@ -137,10 +137,10 @@ public static boolean shouldLog(Logged.Importance importance) { void timedRobot() { String source = """ - package edu.wpi.first.epilogue.generated; + package edu.wpi.first.epilogue; @Logged - class Example extends edu.wpi.first.wpilibj.TimedRobot { + public class Example extends edu.wpi.first.wpilibj.TimedRobot { } """; @@ -226,6 +226,8 @@ void multipleRobots() { String source = """ package edu.wpi.first.epilogue.generated; + + import edu.wpi.first.epilogue.Logged; @Logged class AlphaBot extends edu.wpi.first.wpilibj.TimedRobot { } @@ -245,8 +247,8 @@ class BetaBot extends edu.wpi.first.wpilibj.TimedRobot { } import edu.wpi.first.hal.FRCNetComm; import edu.wpi.first.hal.HAL; - import edu.wpi.first.epilogue.AlphaBotLogger; - import edu.wpi.first.epilogue.BetaBotLogger; + import edu.wpi.first.epilogue.generated.AlphaBotLogger; + import edu.wpi.first.epilogue.generated.BetaBotLogger; public final class Epilogue { static { @@ -281,7 +283,7 @@ public static boolean shouldLog(Logged.Importance importance) { * new values. Alternatively, {@code bind()} can be used to update at an offset from * the main robot loop. */ - public static void update(edu.wpi.first.epilogue.AlphaBot robot) { + public static void update(edu.wpi.first.epilogue.generated.AlphaBot robot) { long start = System.nanoTime(); alphaBotLogger.tryUpdate(config.backend.getNested(config.root), robot, config.errorHandler); config.backend.log(\"Epilogue/Stats/Last Run\", (System.nanoTime() - start) / 1e6); @@ -295,7 +297,7 @@ public static void update(edu.wpi.first.epilogue.AlphaBot robot) { * directly from sensors will be slightly different from data used in the main robot * loop. */ - public static void bind(edu.wpi.first.epilogue.AlphaBot robot) { + public static void bind(edu.wpi.first.epilogue.generated.AlphaBot robot) { if (config.loggingPeriod == null) { config.loggingPeriod = Seconds.of(robot.getPeriod()); } @@ -313,7 +315,7 @@ public static void bind(edu.wpi.first.epilogue.AlphaBot robot) { * new values. Alternatively, {@code bind()} can be used to update at an offset from * the main robot loop. */ - public static void update(edu.wpi.first.epilogue.BetaBot robot) { + public static void update(edu.wpi.first.epilogue.generated.BetaBot robot) { long start = System.nanoTime(); betaBotLogger.tryUpdate(config.backend.getNested(config.root), robot, config.errorHandler); config.backend.log(\"Epilogue/Stats/Last Run\", (System.nanoTime() - start) / 1e6); @@ -327,7 +329,7 @@ public static void update(edu.wpi.first.epilogue.BetaBot robot) { * directly from sensors will be slightly different from data used in the main robot * loop. */ - public static void bind(edu.wpi.first.epilogue.BetaBot robot) { + public static void bind(edu.wpi.first.epilogue.generated.BetaBot robot) { if (config.loggingPeriod == null) { config.loggingPeriod = Seconds.of(robot.getPeriod()); } @@ -349,7 +351,7 @@ public static void bind(edu.wpi.first.epilogue.BetaBot robot) { void genericCustomLogger() { String source = """ - package edu.wpi.first.epilogue.generated; + package edu.wpi.first.epilogue; import edu.wpi.first.epilogue.logging.*; @@ -357,19 +359,19 @@ class A {} class B extends A {} class C extends A {} - @CustomLoggerFor({A.class, B.class, C.class}) - class CustomLogger extends ClassSpecificLogger { - public CustomLogger() { super(A.class); } - - @Override - public void update(EpilogueBackend backend, A object) {} // implementation is irrelevant - } - @Logged - class Example { + public class Example { A a_b_or_c; B b; C c; + + @CustomLoggerFor({A.class, B.class, C.class}) + public static class CustomLogger extends ClassSpecificLogger { + public CustomLogger() { super(A.class); } + + @Override + public void update(EpilogueBackend backend, A object) {} // implementation is irrelevant + } } """; @@ -385,7 +387,7 @@ class Example { import edu.wpi.first.hal.HAL; import edu.wpi.first.epilogue.ExampleLogger; - import edu.wpi.first.epilogue.CustomLogger; + import edu.wpi.first.epilogue.Example.CustomLogger; public final class Epilogue { static { @@ -426,7 +428,7 @@ private void assertGeneratedEpilogueContents( javac() .withOptions(kJavaVersionOptions) .withProcessors(new AnnotationProcessor()) - .compile(JavaFileObjects.forSourceString("", loggedClassContent)); + .compile(JavaFileObjects.forSourceString("edu.wpi.first.epilogue.Example", loggedClassContent)); assertThat(compilation).succeededWithoutWarnings(); var generatedFiles = compilation.generatedSourceFiles(); diff --git a/shared/java/javacommon.gradle b/shared/java/javacommon.gradle index b503db15ac1..c9efe218260 100644 --- a/shared/java/javacommon.gradle +++ b/shared/java/javacommon.gradle @@ -1,7 +1,10 @@ apply plugin: 'maven-publish' apply plugin: 'java-library' apply plugin: 'jacoco' -apply plugin: 'org.gradlex.extra-java-module-info' +if (project.name != 'epilogue-processor') { + println("Applying extra-java-module-info to project ${project.name}") + apply plugin: 'org.gradlex.extra-java-module-info' +} apply plugin: 'org.javamodularity.moduleplugin' def baseArtifactId = project.baseId From 901d44ac04be4a320f58f6e13419d71f4f104aee Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Tue, 3 Dec 2024 23:11:51 -0500 Subject: [PATCH 14/17] OpenCV module requirements --- cameraserver/src/main/java/module-info.java | 1 + cscore/src/main/java/module-info.java | 2 +- wpilibNewCommands/build.gradle | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cameraserver/src/main/java/module-info.java b/cameraserver/src/main/java/module-info.java index fc0ec1d531e..4a0358049b1 100644 --- a/cameraserver/src/main/java/module-info.java +++ b/cameraserver/src/main/java/module-info.java @@ -10,6 +10,7 @@ module wpilib.cameraserver { requires transitive wpilib.cscore; requires transitive wpilib.ntcore; + requires wpilib.opencv; requires wpilib.util; exports edu.wpi.first.cameraserver; diff --git a/cscore/src/main/java/module-info.java b/cscore/src/main/java/module-info.java index 038de02230f..e3e302033ab 100644 --- a/cscore/src/main/java/module-info.java +++ b/cscore/src/main/java/module-info.java @@ -7,7 +7,7 @@ * connected to the robot and for configuring those cameras. */ module wpilib.cscore { - requires wpilib.opencv; + requires transitive wpilib.opencv; requires wpilib.util; exports edu.wpi.first.cscore; diff --git a/wpilibNewCommands/build.gradle b/wpilibNewCommands/build.gradle index 55f6027e5ea..02ee1924260 100644 --- a/wpilibNewCommands/build.gradle +++ b/wpilibNewCommands/build.gradle @@ -25,6 +25,7 @@ dependencies { } apply from: "${rootDir}/shared/java/wpimath-module-patches.gradle" +apply from: "${rootDir}/shared/java/opencv-module-patches.gradle" sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java" From d93b0d43e526d4d5a8c19171458022e1caeefa7e Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Tue, 3 Dec 2024 23:13:00 -0500 Subject: [PATCH 15/17] Make all modules open --- apriltag/src/main/java/module-info.java | 2 +- cameraserver/src/main/java/module-info.java | 2 +- cscore/src/main/java/module-info.java | 2 +- epilogue-processor/src/main/java/module-info.java | 2 +- epilogue-runtime/src/main/java/module-info.java | 2 +- fieldImages/src/main/java/module-info.java | 2 +- hal/src/main/java/module-info.java | 2 +- ntcore/src/main/java/module-info.java | 2 +- romiVendordep/src/main/java/module-info.java | 2 +- wpilibNewCommands/src/main/java/module-info.java | 2 +- wpilibj/src/main/java/module-info.java | 2 +- wpilibjExamples/src/main/java/module-info.java | 2 +- wpimath/src/main/java/module-info.java | 2 +- wpinet/src/main/java/module-info.java | 2 +- wpiunits/src/main/java/module-info.java | 2 +- wpiutil/src/main/java/module-info.java | 2 +- xrpVendordep/src/main/java/module-info.java | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apriltag/src/main/java/module-info.java b/apriltag/src/main/java/module-info.java index 888550e017e..363d25c9e5e 100644 --- a/apriltag/src/main/java/module-info.java +++ b/apriltag/src/main/java/module-info.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -module wpilib.apriltag { +open module wpilib.apriltag { requires transitive wpilib.opencv; requires wpilib.math; requires wpilib.util; diff --git a/cameraserver/src/main/java/module-info.java b/cameraserver/src/main/java/module-info.java index 4a0358049b1..9ae12cf8dff 100644 --- a/cameraserver/src/main/java/module-info.java +++ b/cameraserver/src/main/java/module-info.java @@ -7,7 +7,7 @@ * by dashboards and coprocessors, and for running OpenCV pipelines (though note that the roboRIO * is too slow to run any but the most simple pipelines at a reasonable speed). */ -module wpilib.cameraserver { +open module wpilib.cameraserver { requires transitive wpilib.cscore; requires transitive wpilib.ntcore; requires wpilib.opencv; diff --git a/cscore/src/main/java/module-info.java b/cscore/src/main/java/module-info.java index e3e302033ab..3f446d59666 100644 --- a/cscore/src/main/java/module-info.java +++ b/cscore/src/main/java/module-info.java @@ -6,7 +6,7 @@ * The WPILib cscore module. This defines APIs for connecting to and reading images from cameras * connected to the robot and for configuring those cameras. */ -module wpilib.cscore { +open module wpilib.cscore { requires transitive wpilib.opencv; requires wpilib.util; diff --git a/epilogue-processor/src/main/java/module-info.java b/epilogue-processor/src/main/java/module-info.java index 7cb7a7fbf70..8014979cb1a 100644 --- a/epilogue-processor/src/main/java/module-info.java +++ b/epilogue-processor/src/main/java/module-info.java @@ -4,7 +4,7 @@ import javax.annotation.processing.Processor; -module wpilib.epilogue.processor { +open module wpilib.epilogue.processor { requires java.compiler; requires jdk.compiler; requires wpilib.epilogue; diff --git a/epilogue-runtime/src/main/java/module-info.java b/epilogue-runtime/src/main/java/module-info.java index e3fbd138ff4..0b87e21df57 100644 --- a/epilogue-runtime/src/main/java/module-info.java +++ b/epilogue-runtime/src/main/java/module-info.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -module wpilib.epilogue { +open module wpilib.epilogue { requires wpilib.ntcore; requires wpilib.units; requires wpilib.util; diff --git a/fieldImages/src/main/java/module-info.java b/fieldImages/src/main/java/module-info.java index f4c145cc68f..934e96f37c8 100644 --- a/fieldImages/src/main/java/module-info.java +++ b/fieldImages/src/main/java/module-info.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -module wpilib.fieldimages { +open module wpilib.fieldimages { requires com.fasterxml.jackson.databind; exports edu.wpi.first.fields; diff --git a/hal/src/main/java/module-info.java b/hal/src/main/java/module-info.java index bf7f5ea4884..4f7074e3b3d 100644 --- a/hal/src/main/java/module-info.java +++ b/hal/src/main/java/module-info.java @@ -7,7 +7,7 @@ * layer and JNI bindings. Most robot programs don't need to use this directly and should use the * {@code wpilib} module instead. */ -module wpilib.hal { +open module wpilib.hal { requires wpilib.util; exports edu.wpi.first.hal; diff --git a/ntcore/src/main/java/module-info.java b/ntcore/src/main/java/module-info.java index 13f0f0670bc..71248542d7c 100644 --- a/ntcore/src/main/java/module-info.java +++ b/ntcore/src/main/java/module-info.java @@ -6,7 +6,7 @@ * The WPILib networking module. This defines APIs for sending and receiving data over the robot * network for communication with coprocessors and the driver station. */ -module wpilib.ntcore { +open module wpilib.ntcore { requires wpilib.util; exports edu.wpi.first.networktables; diff --git a/romiVendordep/src/main/java/module-info.java b/romiVendordep/src/main/java/module-info.java index 98506cc14c8..70658622462 100644 --- a/romiVendordep/src/main/java/module-info.java +++ b/romiVendordep/src/main/java/module-info.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -module wpilib.romi { +open module wpilib.romi { requires transitive wpilib; requires wpilib.hal; diff --git a/wpilibNewCommands/src/main/java/module-info.java b/wpilibNewCommands/src/main/java/module-info.java index 8358584599a..4377159d065 100644 --- a/wpilibNewCommands/src/main/java/module-info.java +++ b/wpilibNewCommands/src/main/java/module-info.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -module wpilib.commands2 { +open module wpilib.commands2 { requires wpilib.units; requires wpilib; requires wpilib.hal; diff --git a/wpilibj/src/main/java/module-info.java b/wpilibj/src/main/java/module-info.java index c1265be290b..0f540fab63c 100644 --- a/wpilibj/src/main/java/module-info.java +++ b/wpilibj/src/main/java/module-info.java @@ -6,7 +6,7 @@ * The core WPILib module. This defines APIs for interacting with robot sensors and actuators, * dashboard applications, and high-level program control frameworks. */ -module wpilib { +open module wpilib { requires transitive wpilib.math; requires transitive wpilib.units; requires transitive wpilib.util; diff --git a/wpilibjExamples/src/main/java/module-info.java b/wpilibjExamples/src/main/java/module-info.java index ec62d95717d..77ab98ad0a8 100644 --- a/wpilibjExamples/src/main/java/module-info.java +++ b/wpilibjExamples/src/main/java/module-info.java @@ -1,4 +1,4 @@ -module wpilib.examples { +open module wpilib.examples { requires wpilib.apriltag; requires wpilib.cameraserver; requires wpilib.commands2; diff --git a/wpimath/src/main/java/module-info.java b/wpimath/src/main/java/module-info.java index 55f39c1d2fe..76db6720065 100644 --- a/wpimath/src/main/java/module-info.java +++ b/wpimath/src/main/java/module-info.java @@ -6,7 +6,7 @@ * The WPILib math module. This defines APIs for geometry, kinematics, odometry, path planning, * control algorithms, and physics simulators for simple mechanisms. */ -module wpilib.math { +open module wpilib.math { requires com.fasterxml.jackson.annotation; requires transitive ejml.all; requires us.hebi.quickbuf.runtime; diff --git a/wpinet/src/main/java/module-info.java b/wpinet/src/main/java/module-info.java index 9487fb3cec1..d14f7dafc73 100644 --- a/wpinet/src/main/java/module-info.java +++ b/wpinet/src/main/java/module-info.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -module wpilib.net { +open module wpilib.net { requires wpilib.util; exports edu.wpi.first.net; diff --git a/wpiunits/src/main/java/module-info.java b/wpiunits/src/main/java/module-info.java index 5a5acd2cbc2..a466b80ee30 100644 --- a/wpiunits/src/main/java/module-info.java +++ b/wpiunits/src/main/java/module-info.java @@ -5,7 +5,7 @@ /** * The WPILib units module. This defines APIs for type-safe unit definitions and math operations. */ -module wpilib.units { +open module wpilib.units { exports edu.wpi.first.units; exports edu.wpi.first.units.collections; exports edu.wpi.first.units.measure; diff --git a/wpiutil/src/main/java/module-info.java b/wpiutil/src/main/java/module-info.java index 5213c20844b..7a773ecf122 100644 --- a/wpiutil/src/main/java/module-info.java +++ b/wpiutil/src/main/java/module-info.java @@ -8,7 +8,7 @@ * error reporting. */ @SuppressWarnings("requires-transitive-automatic") -module wpilib.util { +open module wpilib.util { requires com.fasterxml.jackson.databind; requires transitive us.hebi.quickbuf.runtime; diff --git a/xrpVendordep/src/main/java/module-info.java b/xrpVendordep/src/main/java/module-info.java index 971e0b2cd31..562f7fd4ba7 100644 --- a/xrpVendordep/src/main/java/module-info.java +++ b/xrpVendordep/src/main/java/module-info.java @@ -2,7 +2,7 @@ // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. -module wpilib.xrp { +open module wpilib.xrp { requires transitive wpilib; requires wpilib.hal; From 6835197f113ad2f431571ac8f6be6c59087c329e Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Tue, 3 Dec 2024 23:29:42 -0500 Subject: [PATCH 16/17] Linting --- cameraserver/src/main/java/module-info.java | 6 +++--- epilogue-processor/build.gradle | 2 +- .../first/epilogue/processor/AnnotationProcessorTest.java | 4 ++-- .../first/epilogue/processor/EpilogueGeneratorTest.java | 8 +++++--- .../wpilibj/examples/rapidreactcommandbot/Robot.java | 2 +- wpiutil/src/main/java/module-info.java | 6 +++--- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cameraserver/src/main/java/module-info.java b/cameraserver/src/main/java/module-info.java index 9ae12cf8dff..f956002f08f 100644 --- a/cameraserver/src/main/java/module-info.java +++ b/cameraserver/src/main/java/module-info.java @@ -3,9 +3,9 @@ // the WPILib BSD license file in the root directory of this project. /** - * The WPILib cameraserver module. This defines APIs for streaming cameras from the robot for use - * by dashboards and coprocessors, and for running OpenCV pipelines (though note that the roboRIO - * is too slow to run any but the most simple pipelines at a reasonable speed). + * The WPILib cameraserver module. This defines APIs for streaming cameras from the robot for use by + * dashboards and coprocessors, and for running OpenCV pipelines (though note that the roboRIO is + * too slow to run any but the most simple pipelines at a reasonable speed). */ open module wpilib.cameraserver { requires transitive wpilib.cscore; diff --git a/epilogue-processor/build.gradle b/epilogue-processor/build.gradle index f9cc941ab28..d1cda4a89b6 100644 --- a/epilogue-processor/build.gradle +++ b/epilogue-processor/build.gradle @@ -21,4 +21,4 @@ test { moduleOptions { runOnClasspath = true } -} \ No newline at end of file +} diff --git a/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/AnnotationProcessorTest.java b/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/AnnotationProcessorTest.java index 2c26d63dc7d..9068abeb0e5 100644 --- a/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/AnnotationProcessorTest.java +++ b/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/AnnotationProcessorTest.java @@ -1435,7 +1435,7 @@ public static class CustomPointLogger extends ClassSpecificLogger { public CustomPointLogger() { super(Point.class); } - + @Override public void update(EpilogueBackend backend, Point point) { // Implementation is irrelevant @@ -1490,7 +1490,7 @@ public static class VectorLogger extends ClassSpecificLogger> { public VectorLogger() { super((Class) Vector.class); } - + @Override public void update(EpilogueBackend backend, Vector object) { // Implementation is irrelevant diff --git a/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java b/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java index 15366ef317c..f6c1af2bcec 100644 --- a/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java +++ b/epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/EpilogueGeneratorTest.java @@ -226,7 +226,7 @@ void multipleRobots() { String source = """ package edu.wpi.first.epilogue.generated; - + import edu.wpi.first.epilogue.Logged; @Logged @@ -368,7 +368,7 @@ public class Example { @CustomLoggerFor({A.class, B.class, C.class}) public static class CustomLogger extends ClassSpecificLogger { public CustomLogger() { super(A.class); } - + @Override public void update(EpilogueBackend backend, A object) {} // implementation is irrelevant } @@ -428,7 +428,9 @@ private void assertGeneratedEpilogueContents( javac() .withOptions(kJavaVersionOptions) .withProcessors(new AnnotationProcessor()) - .compile(JavaFileObjects.forSourceString("edu.wpi.first.epilogue.Example", loggedClassContent)); + .compile( + JavaFileObjects.forSourceString( + "edu.wpi.first.epilogue.Example", loggedClassContent)); assertThat(compilation).succeededWithoutWarnings(); var generatedFiles = compilation.generatedSourceFiles(); diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/Robot.java index e8e1defb8a4..53dc177b69c 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot/Robot.java @@ -4,8 +4,8 @@ package edu.wpi.first.wpilibj.examples.rapidreactcommandbot; -import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.epilogue.Logged; +import edu.wpi.first.epilogue.generated.Epilogue; import edu.wpi.first.wpilibj.DataLogManager; import edu.wpi.first.wpilibj.TimedRobot; import edu.wpi.first.wpilibj2.command.Command; diff --git a/wpiutil/src/main/java/module-info.java b/wpiutil/src/main/java/module-info.java index 7a773ecf122..7f8c67b112e 100644 --- a/wpiutil/src/main/java/module-info.java +++ b/wpiutil/src/main/java/module-info.java @@ -3,9 +3,9 @@ // the WPILib BSD license file in the root directory of this project. /** - * The WPILib utility module. This defines miscellaneous APIs for concurrency, data logging, - * lambda functions, binary serialization and deserialization, native library interactions, and - * error reporting. + * The WPILib utility module. This defines miscellaneous APIs for concurrency, data logging, lambda + * functions, binary serialization and deserialization, native library interactions, and error + * reporting. */ @SuppressWarnings("requires-transitive-automatic") open module wpilib.util { From 662d6826066a9fc4d0237bc208f42a2a867df23f Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Tue, 3 Dec 2024 23:29:51 -0500 Subject: [PATCH 17/17] Remove unnecessary add-reads --- cameraserver/build.gradle | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cameraserver/build.gradle b/cameraserver/build.gradle index 4c68d56f012..69a477460e2 100644 --- a/cameraserver/build.gradle +++ b/cameraserver/build.gradle @@ -29,13 +29,6 @@ ext { apply from: "${rootDir}/shared/opencv.gradle" -tasks.withType(JavaCompile).configureEach { - options.compilerArgs += [ - "--add-reads", - "wpilib.cameraserver=ALL-UNNAMED" - ] -} - nativeUtils.exportsConfigs { cameraserver { }