Skip to content

Commit 72e72ad

Browse files
committed
Update README.md and add CONTRIBUTING.md
1 parent cf01981 commit 72e72ad

3 files changed

Lines changed: 191 additions & 42 deletions

File tree

CONTRIBUTING.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Contributing to lib2813
2+
3+
We welcome contributions!
4+
5+
## What to Contribute
6+
7+
- Bug reports
8+
- Bug fixes (consider filing a bug report first)
9+
- Feature additions (please create an issue first)
10+
11+
## Pull Request Guidelines
12+
13+
- Code should be well documented.
14+
- Please consider writing tests. Tests give us assurance that new changes do not break older functionality.
15+
- We loosely follow the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html). Format the code
16+
using `./gradlew spotlessApply`.
17+
- Write a [good change description](https://google.github.io/eng-practices/review/developer/cl-descriptions.html)
18+
19+
We may ask you to test locally on your robot code in simulation mode.
20+
21+
## Getting Started
22+
23+
If you need to make changes to lib213, you can either clone the repository directly, or you
24+
can include it as a submodule for your robot code.
25+
26+
### Option 1: Developing on a Clone
27+
28+
To clone the repository, run:
29+
30+
```shell
31+
git clone --recurse-submodules https://github.com/Prospect-Robotics/Robot2025.git
32+
```
33+
34+
### Option 2: Developing via Submodules
35+
36+
#### 1. Adding the lib2813 repo as a submodule
37+
38+
When making changes to lib2813, it is often helpful to build the code along with your robot code.
39+
To do that, you can add the lib2813 repo as a submodule.
40+
41+
Before adding the submodule, it is recommended that you set the `submodule.stickyRecursiveClone`
42+
git config option to `true` to make working with submodule easier (see
43+
[this StackOverflow answer](https://stackoverflow.com/a/53622660) for details about this option).
44+
To do this, run the following command from any directory:
45+
```shell
46+
git config --global submodule.stickyRecursiveClone true
47+
```
48+
49+
To add the lib2813 submodule, go to your robot project directory (where the `vendordeps` directory is), and run
50+
this command:
51+
```shell
52+
git submodule add https://github.com/Prospect-Robotics/lib2813
53+
```
54+
55+
#### 2. Updating Gradle files
56+
57+
Add the following lines needs to be added to your `settings.gradle`:
58+
```
59+
includeBuild('lib2813') {
60+
dependencySubstitution {
61+
substitute module('com.team2813.lib2813:lib') using project(':lib')
62+
}
63+
}
64+
```
65+
66+
Next, remove the version numbers for the lib2813 dependencies in your `build.gradle`:
67+
68+
```
69+
implementation "com.team2813.lib2813:lib"
70+
```
71+
72+
Next, add the following lines to your `build.gradle`:
73+
74+
Finally, in order to guarantee that the library jars are created before GradleRIO referees to them, add the following
75+
lines to your `build.gradle`:
76+
```groovy
77+
downloadDepsPreemptively.dependsOn gradle.includedBuild('lib2813').task(':lib:jar')
78+
downloadDepsPreemptively.dependsOn gradle.includedBuild('lib2813').task(':testing:jar')
79+
downloadDepsPreemptively.dependsOn gradle.includedBuild('lib2813').task(':limelight:jar')
80+
```
81+
82+
#### 3. Fixing vscode jank
83+
As of version 1.85.1, vscode doesn't work properly with gradle composite builds without the old buildServer. To use the old buildServer, add the following line
84+
to your settings.json
85+
```
86+
"java.gradle.buildServer.enabled": "off",
87+
```
88+
This isn't strictly necessary, but without it vscode will not be able to do code completion from things in the library, and tell the user that there are errors,
89+
when gradle builds fine.
90+
91+
## Tips and Tricks
92+
93+
### Publishing to Maven Local
94+
95+
It can often be useful to publish jars locally and test with a real or simulated robot.
96+
97+
To publish to Maven Local, run:
98+
99+
```shell
100+
./gradlew publishToMavenLocal -Pversion=2.0.0-test-123
101+
```
102+
103+
(replace "test-123" with some unique identifier)
104+
105+
In your robot's `build.gradle` file, be sure to include Maven Local in your repositories:
106+
107+
```groovy
108+
repositories {
109+
mavenLocal()
110+
mavenCentral()
111+
}
112+
```
113+
114+
Then update your `build.gradle` to reference the version that you published locally.
115+
116+
### Cloning a repository with a git submodule
117+
When cloning a repository with a git submodule, git will not automatically get the files in the submodules. in order to do this, run the command
118+
```
119+
git submodule update --init --recursive
120+
```
121+
This command will recursively initialize all submodules.
122+
123+
### Getting blame data
124+
125+
To ignore code reformatting when running `git blame` run:
126+
127+
```shell
128+
git config blame.ignoreRevsFile .git-blame-ignore-revs
129+
```

MAINTAINERS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Maintainer Documentation
2+
3+
## Publishing to Maven Central
4+
5+
Before publishing to Maven Central, consider publishing to Maven Local.
6+
7+
1. Run `./gradlew build` to build the code, run the tests, and verify that there are no formatting
8+
issues
9+
2. Update the version strings in the `build.gradle` files of the affected libraries.
10+
3. Make sure all changes are pushed to GitHub
11+
4. ???
12+
5. Celebrate!

README.md

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,59 @@
11
# User Documentation
22

3-
## adding submodule
4-
In order to use, go to your WPILib project directory (the inner one, where the build.gradle file is), and run the command
5-
```
6-
git submodule add https://github.com/Prospect-Robotics/lib2813
7-
```
8-
## adding submodule to gradle
9-
The following lines needs to be added to your settings.gradle to make the lib usable:
10-
```
11-
includeBuild('lib2813') {
12-
dependencySubstitution {
13-
substitute module('com.team2813:lib2813') using project(':lib')
14-
}
15-
}
16-
```
17-
Whatever text that is in the module parentheses is the text that will need to be in an `implementation` statement to depend on the library.
18-
So, after adding the lines to the settings.gradle, this line in the dependencies block will refer to the library.
19-
```
20-
implementation "com.team2813:lib2813"
21-
```
22-
Finally, in order to guarantee that the library jars are created before GradleRIO referees to them, add the following line to your build.gradle
23-
```
24-
downloadDepsPreemptively.dependsOn gradle.includedBuild("lib2813").task(":lib:jar")
25-
```
3+
## Using the libraries
264

27-
## Fixing vscode jank
28-
As of version 1.85.1, vscode doesn't work properly with gradle composite builds without the old buildServer. To use the old buildServer, add the following line
29-
to your settings.json
30-
```
31-
"java.gradle.buildServer.enabled": "off",
32-
```
33-
This isn't strictly necessary, but without it vscode will not be able to do code completion from things in the library, and tell the user that there are errors,
34-
when gradle builds fine.
5+
### Updating your dependencies
356

36-
## Cloning a repository with a git submodule
37-
When cloning a repository with a git submodule, git will not automatically get the files in the submodules. in order to do this, run the command
38-
```
39-
git submodule update --init --recursive
40-
```
41-
This command will recursively initialize all submodules.
7+
> [!NOTE]
8+
> The lib2813 jars are not yet published to Maven Central. For the time being, you need to publish
9+
> them to Maven Local. See [the Contributing page](CONTRIBUTING.md#publishing-to-maven-local) for details.
4210
43-
This code is still in development, and apis are still subject to change. The most likely thing to get removed is the swerve api, as ctre recently released their own.
11+
In your `build.gradle`, update the `dependencies` section:
4412

45-
## Developer Documentation
13+
```groovy
14+
dependencies {
15+
// Existing dependencies
16+
implementation 'com.team2813.lib2813:lib:2.0.0-rc-1'
17+
implementation 'com.team2813.lib2813:vision:2.0.0-rc-1'
18+
implementation 'com.team2813.lib2813:limelight:2.0.0-rc-1'
19+
testImplementation 'com.team2813.lib2813:testing:2.0.0-rc-1'
20+
}
21+
```
4622

47-
To ignore code reformatting when running `git blame` run:
23+
Note that you do not need to include all the dependencies. See the [Runtime dependencies](#runtime-dependencies)
24+
section for details.
4825

49-
```shell
50-
git config blame.ignoreRevsFile .git-blame-ignore-revs
26+
In addition be sure to include Maven Local in the list of repositories in your `build.gradle`
27+
(needed until we publish to Maven Central):
28+
29+
```groovy
30+
repositories {
31+
mavenLocal()
32+
mavenCentral()
33+
}
5134
```
35+
36+
### Runtime dependencies
37+
38+
- `com.team2813.lib2813:lib`:
39+
- Vendor deps
40+
- `WPILibNewCommands.json`
41+
- `Phoenix6.json` (if using Phoenix motors)
42+
- `REVLib.json` (if using REV Robotics motors)
43+
- `com.team2813.lib2813:vision`:
44+
- lib2813 deps
45+
- `com.team2813.lib2813:lib`
46+
- Vendor deps
47+
- `photonlib.json`
48+
- `com.team2813.lib2813:testing`:
49+
- lib2813 deps
50+
- `com.team2813.lib2813:lib`
51+
- Vendor deps
52+
- `WPILibNewCommands.json`
53+
- Java deps
54+
- `org.junit.jupiter:junit-jupiter:5.13.1`
55+
- `com.google.truth:truth:1.4.4`
56+
- `com.team2813.lib2813:limelight`:
57+
- Java deps
58+
- `com.google.code.gson:gson:2.12.1`
59+
- `org.json:json:20240205`

0 commit comments

Comments
 (0)