This document describes essential knowledge for contributors to SlimeVR.
First, clone the codebase using git
. If you don't have git
installed, go install it.
# Clone repositories
git clone --recursive https://github.com/SlimeVR/SlimeVR-Server.git
# Enter the directory of the codebase
cd SlimeVR-Server
Now you can open the codebase in your favorite IDE or text editor.
The code is built with gradle
, a cli tool that manages java projects and their
dependencies. You can build the code with ./gradlew build
and run it with
./gradlew run
.
Code is autoformatted with spotless.
Code is checked for autoformatting whenever you build, but you can also run
./gradlew spotlessCheck
if you prefer.
To autoformat your code from the command line, you can run ./gradlew spotlessApply
.
We recommend installing support for spotless in your IDE of choice, and formatting
whenever you save a file, to make things easy.
If you need to prevent autoformatting for a particular region of code, use
// @formatter:off
and // @formatter:on
- Install the
richardwillis.vscode-spotless-gradle
extension - Add the following to your workspace settings, at
.vscode/settings.json
:
"spotlessGradle.format.enable": true,
"editor.formatOnSave": true,
"[java]": {
"editor.defaultFormatter": "richardwillis.vscode-spotless-gradle"
}
- Install https://plugins.jetbrains.com/plugin/18321-spotless-gradle.
- Add a keyboard shortcut for
Code
>Reformat Code with Spotless
- They are working on support to do this on save without a keybind here
Import the formatting settings defined in spotless.xml
, like this:
- Go to
File > Properties
, thenJava Code Style > Formatter
- Check
Enable project specific settings
- Click
Import
, then openspotless.xml
, thenApply
- Go to
Java Editor > Save Actions
- Select
Enable project specific settings
,Perform the selected actions on save
,Format source code
,Format all lines
Eclipse will only do a subset of the checks in spotless
, so you may still want to do
./gradlew spotlessApply
if you ever see an error from spotless.
SlimeVR uses an MIT license, and some parts of the project use a dual MIT/Apache 2.0
license. Be sure that any code that you reference, or dependencies you add, are
compatible with these licenses. GPL-v3
for example is not compatible because it
requires any and all code that depends on it to also be licensed under GPL-v3
.
We use discord a lot to coordinate and discuss development. Come join us at https://discord.gg/SlimeVR!