This is the Java frontend implementation to MAVSDK.
It is organized as follows:
- The sdk directory contains the different components provided by this project.
- The examples directory contains Java and Android examples using the sdk.
Please read the "Contributing" section of the specific project you are interested in.
Java/Android coding style is ensured using CheckStyle with the Google configurations.
A checkstyle
task is defined in the root build.gradle
of each project and can be run as follows:
$ ./gradlew checkstyle
The build
task depends on checkstyle
, meaning that $ ./gradlew build
runs the checks as well.
There exist a plugin for CheckStyle in JetBrains' IDEs.
- Install the plugin called "CheckStyle-IDEA" in IntelliJ / Android-Studio.
- Import the checkstyle configuration as a code style scheme in Settings > Editor > Code Style > Java > Manage... >
Import... by selecting "CheckStyle configuration" and then browsing to
config/checkstyle/checkstyle.xml
. - In Settings > Other Settings > Checkstyle, change the "Scan Scope" to "Only Java sources (including tests)".
- Still in Settings > Other Settings > Checkstyle, add a new configuration file and browse to
config/checkstyle/checkstyle.xml
.
In IntelliJ / Android-Studio's bottom task bar, you should see a "CheckStyle" tab. It will allow you to select your configuration with the "Rules" dropdown-list, and to run the analysis on your code.
Note that by default, the IDE will not run checkstyle when building the project (whereas $ ./gradlew build
always does it).
In IntelliJ / Android-Studio, the IDE might force the order of the imports in a way that is not following the checkstyle rules. For some reason, this is not set when importing checkstyle.xml
as a code style scheme. However, it can be manually updated in Settings > Code Style > Java > Import Layout.