Skip to content

Commit 943e125

Browse files
committed
Merge branch 'master' of https://github.com/DeepBlueRobotics/lib199 into sendables
2 parents f2b775b + 87c7970 commit 943e125

24 files changed

Lines changed: 444 additions & 419 deletions

.github/workflows/javadoc.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy Javadoc
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-javadoc:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
submodules: 'recursive'
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
- name: Generate Javadoc
20+
run: ./gradlew javadoc
21+
- name: Build Artifact
22+
uses: actions/upload-pages-artifact@v1.0.5
23+
with:
24+
path: ./build/docs/javadoc
25+
deploy-javadoc:
26+
needs: build-javadoc
27+
permissions:
28+
pages: write
29+
id-token: write
30+
environment:
31+
name: github-pages
32+
url: ${{ steps.deployment.outputs.page_url }}
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Deploy to GitHub Pages
36+
id: deployment
37+
uses: actions/deploy-pages@v1.2.3

.wpilib/wpilib_preferences.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"enableCppIntellisense": false,
33
"currentLanguage": "java",
4-
"projectYear": "2022",
4+
"projectYear": "2023",
55
"teamNumber": 199
66
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# FRC Team 199 Library
22

3-
This projects builds `lib199.jar` which contains code that reuse across projects/years.
3+
This projects builds `lib199.jar` which contains code that reuse across projects/years. The javadocs can be found [here](https://deepbluerobotics.github.io/lib199/).

build.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO
2-
31
plugins {
42
id "java"
5-
id "edu.wpi.first.GradleRIO" version "2022.4.1"
3+
id "edu.wpi.first.GradleRIO" version "2023.1.1"
64
id "maven-publish"
75
}
86

@@ -94,7 +92,7 @@ publishing {
9492
gpr(MavenPublication) {
9593
groupId = 'org.carlmontrobotics'
9694
artifactId = 'lib199'
97-
version = '1.0.2'
95+
version = '2.0.0'
9896

9997
from components.java
10098
}
@@ -105,3 +103,8 @@ publishing {
105103
deployArtifact.jarTask = jar
106104
wpi.java.configureExecutableTasks(jar)
107105
wpi.java.configureTestTasks(test)
106+
107+
// Configure string concat to always inline compile
108+
tasks.withType(JavaCompile) {
109+
options.compilerArgs.add '-XDstringConcat=inline'
110+
}

gradle/wrapper/gradle-wrapper.jar

1.19 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=permwrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=permwrapper/dists

gradlew

Lines changed: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 8 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pluginManagement {
44
repositories {
55
mavenLocal()
66
gradlePluginPortal()
7-
String frcYear = '2022'
7+
String frcYear = '2023'
88
File frcHome
99
if (OperatingSystem.current().isWindows()) {
1010
String publicFolder = System.getenv('PUBLIC')

src/main/java/org/carlmontrobotics/lib199/Mocks.java

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,46 +39,49 @@ public final class Mocks {
3939
// 4) Mock invocations are cleared -> throws NullPointerException
4040
Lib199Subsystem.registerPeriodic(() -> MOCKS.removeIf(CLEAR_INVOCATIONS_ON_REFERENCED_MOCK_IF_REFERNCE_NOT_CLEARED));
4141
}
42-
42+
4343
/**
4444
* Attempts to create an instance of a class in which some or all of the classes methods are replaced with a mocked implementation
45-
* @param T the class type which will be mocked
46-
* @param U the class type which will be used to provide method implementations
45+
* @param <T> the class type which will be mocked
46+
* @param <U> the class type which will be used to provide method implementations
4747
* @param classToMock the class type which will be mocked
4848
* @param implClass the object to which to try to forward method calls
4949
* @param interfaces a list of interfaces which the mocked object should extend
5050
* @return an instance of <code>T</code> in which some or all of the classes methods are replaced with a mocked implementation from <code>U</code>
51-
* @see #createMock(java.lang.Class, java.lang.Object, java.lang.Class...)
51+
* @see #createMock(Class, Object, boolean, Class...)
52+
* @see #createMock(Class, Object, Answer, Class...)
5253
*/
5354
public static <T, U> T createMock(Class<T> classToMock, U implClass, Class<?>... interfaces) {
5455
return createMock(classToMock, implClass, true, interfaces);
5556
}
56-
57+
5758
/**
5859
* Attempts to create an instance of a class in which some or all of the classes methods are replaced with a mocked implementation
59-
* @param T the class type which will be mocked
60-
* @param U the class type which will be used to provide method implementations
60+
* @param <T> the class type which will be mocked
61+
* @param <U> the class type which will be used to provide method implementations
6162
* @param classToMock the class type which will be mocked
6263
* @param implClass the object to which to try to forward method calls
6364
* @param forwardUnknownCalls whether methods which are not overriden will call their real methods
6465
* @param interfaces a list of interfaces which the mocked object should extend
6566
* @return an instance of <code>T</code> in which some or all of the classes methods are replaced with a mocked implementation from <code>U</code>
66-
* @see #createMock(java.lang.Class, java.lang.Object)
67+
* @see #createMock(Class, Object, Class...)
68+
* @see #createMock(Class, Object, Answer, Class...)
6769
*/
6870
public static <T, U> T createMock(Class<T> classToMock, U implClass, boolean forwardUnknownCalls, Class<?>... interfaces) {
6971
return createMock(classToMock, implClass, forwardUnknownCalls ? InvocationOnMock::callRealMethod : new ReturnsSmartNulls(), interfaces);
7072
}
71-
73+
7274
/**
7375
* Attempts to create an instance of a class in which some or all of the classes methods are replaced with a mocked implementation
74-
* @param T the class type which will be mocked
75-
* @param U the class type which will be used to provide method implementations
76+
* @param <T> the class type which will be mocked
77+
* @param <U> the class type which will be used to provide method implementations
7678
* @param classToMock the class type which will be mocked
7779
* @param implClass the object to which to try to forward method calls
7880
* @param defaultAnswer The answer to use when no overriden implementation is found
7981
* @param interfaces a list of interfaces which the mocked object should extend
8082
* @return an instance of <code>T</code> in which some or all of the classes methods are replaced with a mocked implementation from <code>U</code>
81-
* @see #createMock(java.lang.Class, java.lang.Object)
83+
* @see #createMock(Class, Object, Class...)
84+
* @see #createMock(Class, Object, boolean, Class...)
8285
*/
8386
public static <T, U> T createMock(Class<T> classToMock, U implClass, Answer<Object> defaultAnswer, Class<?>... interfaces) {
8487
HashMap<Method, InvokableMethod> methods = new HashMap<>();
@@ -104,7 +107,13 @@ public static <T, U> T createMock(Class<T> classToMock, U implClass, Answer<Obje
104107
T mock = mock(classToMock, settings);
105108
return mock;
106109
}
107-
110+
111+
/**
112+
* Lists all of the methods available in the provided base class and interface classes
113+
* @param base The base class to search
114+
* @param interfaces Additional interface classes to search
115+
* @return An array of all the detected methods
116+
*/
108117
public static Method[] listMethods(Class<?> base, Class<?>... interfaces) {
109118
ArrayList<Method> out = new ArrayList<>();
110119
out.addAll(Arrays.asList(base.getMethods()));
@@ -114,7 +123,7 @@ public static Method[] listMethods(Class<?> base, Class<?>... interfaces) {
114123

115124
/**
116125
* A wrapper for the underlying Mockito method which automatically calls {@link Mockito#clearInvocations(Object...)} to prevent memory leaks
117-
*
126+
*
118127
* @see Mockito#mock(Class)
119128
*/
120129
public static <T> T mock(Class<T> classToMock) {
@@ -187,6 +196,6 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
187196

188197
private static interface InvokableMethod {
189198
public Object invoke(Object object, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException;
190-
}
199+
}
191200

192201
}

0 commit comments

Comments
 (0)