diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 83faff04..232e7227 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -3,8 +3,11 @@ plugins { } dependencies { - // Spotless code formatter. + // Spotless code formatter - https://github.com/diffplug/spotless implementation('com.diffplug.spotless:com.diffplug.spotless.gradle.plugin:6.25.0') + + // Gradle Maven Publish Plugin - https://vanniktech.github.io/gradle-maven-publish-plugin/ + implementation('com.vanniktech.maven.publish.base:com.vanniktech.maven.publish.base.gradle.plugin:0.34.0') } repositories { diff --git a/buildSrc/src/main/groovy/java-common-conventions.gradle b/buildSrc/src/main/groovy/java-common-conventions.gradle index 0f75e559..4ec7486e 100644 --- a/buildSrc/src/main/groovy/java-common-conventions.gradle +++ b/buildSrc/src/main/groovy/java-common-conventions.gradle @@ -114,7 +114,7 @@ spotless { javadoc { options { // CTRE (Phoenix 5 & 6) - links += "https://api.ctr-electronics.com/phoenix6/release/java/" + links += "https://api.ctr-electronics.com/phoenix6/stable/java/" // WPILib links += "https://github.wpilib.org/allwpilib/docs/release/java/" // REVLib diff --git a/buildSrc/src/main/groovy/publishing-conventions.gradle b/buildSrc/src/main/groovy/publishing-conventions.gradle index b22f05d2..f724de96 100644 --- a/buildSrc/src/main/groovy/publishing-conventions.gradle +++ b/buildSrc/src/main/groovy/publishing-conventions.gradle @@ -1,32 +1,31 @@ plugins { - id 'maven-publish' + id 'com.vanniktech.maven.publish' } version = '2.0.0-rc-2' -publishing { - publications { - lib2813(MavenPublication) { - groupId = 'com.team2813.lib2813' - from components.java - artifact sourceJar - pom { - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - scm { - connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - url = 'https://github.com/Prospect-Robotics/lib2813' - } - organization { - name = 'FRC 2813 Gear Heads' - url = 'https://team2813.com' - } +mavenPublishing { + publishToMavenCentral() + if (gradle.startParameter.taskNames.any { it.contains('MavenCentral') }) { + signAllPublications() + } + + coordinates('com.team2813.lib2813', project.name, project.version) + + pom { + inceptionYear = '2023' + url = 'https://github.com/Prospect-Robotics/lib2813' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution = 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } + scm { + url = 'https://github.com/Prospect-Robotics/lib2813' + connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + } } } diff --git a/lib/build.gradle b/lib/build.gradle index fb4f6e8b..d1338351 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -37,19 +37,15 @@ tasks.named('test') { systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' } -publishing { - publications { - lib2813(MavenPublication) { - pom { - name = '2813 Library' - description = 'Frequently reused code written by team 2813' - developers { - developer { - id = 'cuttestkittensrule' - name = 'Kyle' - email = 'mangoiscute95@gmail.com' - } - } +mavenPublishing { + pom { + name = '2813 Library' + description = 'Frequently reused code written by team 2813' + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' } } } diff --git a/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java b/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java index b9be8530..08acf270 100644 --- a/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java +++ b/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java @@ -26,6 +26,7 @@ */ final class IsolatedPreferences extends ExternalResource { private NetworkTableInstance tempInstance; + private NetworkTableInstance prevInstance; /** Gets the {@link NetworkTable} that contains the preference values. */ public NetworkTable getPreferencesTable() { @@ -34,7 +35,7 @@ public NetworkTable getPreferencesTable() { @Override protected void before() { - NetworkTableInstance.getDefault(); + prevInstance = Preferences.getNetworkTable().getInstance(); tempInstance = NetworkTableInstance.create(); tempInstance.startLocal(); Preferences.setNetworkTableInstance(tempInstance); @@ -42,10 +43,10 @@ protected void before() { @Override protected void after() { - Preferences.setNetworkTableInstance(NetworkTableInstance.getDefault()); - if (!tempInstance.waitForListenerQueue(.2)) { + Preferences.setNetworkTableInstance(prevInstance); + if (!tempInstance.waitForListenerQueue(.6)) { System.err.println( - "Timed out waiting for the NetworkTableInstance listener queue to empty (waited 200ms);" + "Timed out waiting for the NetworkTableInstance listener queue to empty (waited 600ms);" + " JVM may crash"); } tempInstance.close(); diff --git a/limelight/build.gradle b/limelight/build.gradle index 47449552..a4f1489c 100644 --- a/limelight/build.gradle +++ b/limelight/build.gradle @@ -31,24 +31,20 @@ test { useJUnit() } -publishing { - publications { - lib2813(MavenPublication) { - pom { - name = '2813 Limelight Library' - description = 'Limelight utilities for FRC robots' - developers { - developer { - id = 'cuttestkittensrule' - name = 'Kyle' - email = 'mangoiscute95@gmail.com' - } - developer { - id = 'kcooney' - name = 'Kevin' - email = 'kcooney@gmail.com' - } - } +mavenPublishing { + pom { + name = '2813 Limelight Library' + description = 'Limelight utilities for FRC robots' + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' + } + developer { + id = 'kcooney' + name = 'Kevin' + email = 'kcooney@gmail.com' } } } diff --git a/testing/build.gradle b/testing/build.gradle index 3a32db91..97419232 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -34,24 +34,20 @@ tasks.named('test') { systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' } -publishing { - publications { - lib2813(MavenPublication) { - pom { - name = '2813 Testing Library' - description = 'Utilities for testing FRC robots' - developers { - developer { - id = 'cuttestkittensrule' - name = 'Kyle' - email = 'mangoiscute95@gmail.com' - } - developer { - id = 'kcooney' - name = 'Kevin' - email = 'kcooney@gmail.com' - } - } +mavenPublishing { + pom { + name = '2813 Testing Library' + description = 'Utilities for testing FRC robots' + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' + } + developer { + id = 'kcooney' + name = 'Kevin' + email = 'kcooney@gmail.com' } } } diff --git a/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java b/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java index 4b90a8a3..f7fe1228 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java @@ -71,9 +71,9 @@ public void afterEach(ExtensionContext context) { // This works around a race condition in WPILib where a listener registered by Preferences can // be called after the NetworkTableInstance was closed (see // https://github.com/wpilibsuite/allwpilib/issues/8215). - if (!data.testInstance.waitForListenerQueue(.2)) { + if (!data.testInstance.waitForListenerQueue(.6)) { System.err.println( - "Timed out waiting for the NetworkTableInstance listener queue to empty (waited 200ms);" + "Timed out waiting for the NetworkTableInstance listener queue to empty (waited 600ms);" + " JVM may crash"); } data.testInstance.close(); diff --git a/vision/build.gradle b/vision/build.gradle index 28eb11de..3f79748e 100644 --- a/vision/build.gradle +++ b/vision/build.gradle @@ -32,24 +32,20 @@ test { systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' } -publishing { - publications { - lib2813(MavenPublication) { - pom { - name = '2813 Vision Library' - description = 'Utilities for location and vision for FRC robots' - developers { - developer { - id = 'cuttestkittensrule' - name = 'Kyle' - email = 'mangoiscute95@gmail.com' - } - developer { - id = 'kcooney' - name = 'Kevin' - email = 'kcooney@gmail.com' - } - } +mavenPublishing { + pom { + name = '2813 Vision Library' + description = 'Utilities for location and vision for FRC robots' + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' + } + developer { + id = 'kcooney' + name = 'Kevin' + email = 'kcooney@gmail.com' } } }