Skip to content
forked from bazelRio/bazelRio

Bazel workflows for the roboRIO and WPILib

License

Notifications You must be signed in to change notification settings

Team846/bazelRio

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


BazelRIO

A collection of bazel utilities for FRC

Installation

You can include BazelRIO in your project like so:

http_archive(
    name = "bazelrio",
    url = "https://github.com/bazelRio/bazelRio/archive/refs/tags/0.10.0.zip",
    sha256 = "18b109dbd5204910600823e6c9ff405fa7ed7c43d0a78f24077f8187311745a9",
    strip_prefix = "bazelRio-0.10.0/bazelrio",
)

load("@bazelrio//:deps.bzl", "setup_bazelrio_dependencies")

setup_bazelrio_dependencies()

load("@bazelrio//:defs.bzl", "setup_bazelrio")

setup_bazelrio()

You must copy the .bazelrc file from the C++ or Java example into your project workspace and update your BUILD and WORKSPACE files in the same fashion.

Features

Support matrix

Language Compilation Simulation Deployment
C++ 🟢 🟢 🟢
Java 🟢 🔴 🟢
Kotlin 🟢 🔴 🟢
Python 🔴 🔴 🔴

Cross compilation

BazelRIO provides a RoboRIO target for easy cross-compilation.

bazel build <target> --platforms=@bazelrio//platforms/roborio

BazelRIO will automatically download an official roboRIO toolchain (from WPILib) for your host OS and use it.

Robot code rules

BazelRIO provides rules for robot code targets of multiple languages.

C++

load("@bazelrio//:defs.bzl", "robot_cc_binary")

robot_cc_binary(
    name = "hello",
    team_number = 1337,
    srcs = ["hello.cpp"],
)

BazelRIO will create a cc_binary target named hello, as well as a special target named hello.deploy that can be used to deploy your binary:

bazel run //:hello.deploy --platforms=@bazelrio//platforms/roborio
...
Attempting to connect to roborio-1337-frc.local...
Connected to roborio-1337-frc.local.
Attempting to deploy bazel-out/darwin-fastbuild/bin/hello...
Deployed bazel-out/darwin-fastbuild/bin/hello. Exiting.

Java / Kotlin

robot_java_binary(
    name = "hello",
    main_class = "frc.robot.Main",
    team_number = 1337,
    runtime_deps = [
        "//src/main/java/frc/robot",
    ],
)

BazelRIO will create a java_binary target named hello, as well as a special target named hello.deploy that can be used to deploy your binary. If you are using Kotlin, you must build your code as a kt_jvm_library and add it to runtime_deps, rather than adding Kotlin files directly to srcs.

Libraries

BazelRIO containts library targets for WPILib and some vendor libraries:

  • @bazelrio//libraries/cpp/wpilib/wpilibc
  • @bazelrio//libraries/java/wpilib/wpilibj
  • @bazelrio//libraries/cpp/ctre/phoenix
  • @bazelrio//libraries/cpp/rev/sparkmax
  • @bazelrio//libraries/cpp/rev/sparkflex
  • @bazelrio//libraries/cpp/rev/revlib
  • @bazelrio//libraries/cpp/rev/colorsensor
  • @bazelrio//libraries/cpp/kauailabs/navx

Simulations

Simulations (alongside halsim extensions) are supported! Take a look at the C++ example to get started.

About

Bazel workflows for the roboRIO and WPILib

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Starlark 89.9%
  • Python 6.4%
  • Java 2.1%
  • Jinja 1.2%
  • Other 0.4%