Added format.py to Travis config (#236)

This commit is contained in:
Tyler Veness
2016-10-23 21:37:43 -07:00
committed by Peter Johnson
parent 5ca5583fc3
commit fdebdd520a
4 changed files with 19 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ before_install:
- wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
- sudo add-apt-repository ppa:wpilib/toolchain -y
- sudo apt-get update -q || true
- sudo apt-get install frc-toolchain libgazebo7-dev protobuf-compiler libprotobuf-dev -y
- sudo apt-get install frc-toolchain libgazebo7-dev protobuf-compiler libprotobuf-dev python3 clang-format-3.8 -y
before_cache:
@@ -17,5 +17,10 @@ cache:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
before_script:
- git clone git://github.com/wpilibsuite/styleguide $HOME/styleguide
script:
- WPI_FORMAT=$HOME/styleguide python3 styleguide/format.py
- git --no-pager diff --exit-code HEAD # Ensure formatter made no changes
- ./gradlew build -PmakeSim

View File

@@ -37,7 +37,7 @@ So you want to contribute your changes back to WPILib. Great! We have a few cont
## Coding Guidelines
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Another option for C++ is running format.py in the style guide directory.
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running format.py, which is in the styleguide directory, is required for all contributions and is enforced by our continuous integration system.
While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome.

View File

@@ -22,13 +22,19 @@ The WPILib Mission is to enable FIRST Robotics teams to focus on writing game-sp
Using Gradle makes building WPILib very straightforward. It only has a few dependencies on outside tools, such as the ARM cross compiler for creating roboRIO binaries.
## Requirements
- [ARM Compiler Toolchain](http://first.wpi.edu/FRC/roborio/toolchains/)
- Doxygen (Only required if you want to build the C++ documentation)
- [format.py](https://github.com/wpilibsuite/styleguide)
## Setup
Clone the WPILib Repo. If the toolchains are not installed, install them, and make sure they are available on the system PATH.
Clone the WPILib repository. If the toolchains are not installed, install them, and make sure they are available on the system PATH.
See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/master/README.md) for format.py setup instructions.
## Building
All build steps are executed using the Gradle wrapper, `gradlew`. Each target that Gradle can build is referred to as a task. The most common Gradle task to use is `build`. This will build all the outputs created by WPILib. To run, open a console and cd into the cloned WPILib directory. Then:
```bash
@@ -61,7 +67,10 @@ The gradlew wrapper only exists in the root of the main project, so be sure to r
There are a few tasks other than `build` available. To see them, run the meta-task `tasks`. This will print a list of all available tasks, with a description of each task.
format.py can be executed in either the styleguide or root directories of the repository via `python3 format.py` or `./format.py`.
## Publishing
If you are building to test with the Eclipse plugins or just want to export the build as a Maven-style dependency, simply run the `publish` task. This task will publish all available packages to ~/releases/maven/development. If you need to publish the project to a different repo, you can specify it with `-Prepo=repo_name`. Valid options are:
- development - The default repo.
@@ -79,6 +88,7 @@ The following maven targets a published by this task:
- org.gazebosim:JavaGazebo:0.1.0-SNAPSHOT - Gazebo protocol for Java.
## Structure and Organization
The main WPILib code you're probably looking for is in WPILibJ and WPILibC. Those directories are split into shared, sim, and athena. Athena contains the WPILib code meant to run on your roboRIO. Sim is WPILib code meant to run on your computer with Gazebo, and shared is code shared between the two. Shared code must be platform-independent, since it will be compiled with both the ARM cross-compiler and whatever desktop compiler you are using (g++, msvc, etc...).
The Simulation directory contains extra simulation tools and libraries, such as gz_msgs and JavaGazebo. See sub-directories for more information.

View File

@@ -19,7 +19,7 @@ def main():
sys.exit(1)
# Run main format.py script
args = ["python", path + "/format.py"]
args = ["python3", path + "/format.py"]
args.extend(sys.argv[1:])
proc = subprocess.Popen(args)
sys.exit(proc.wait())