/rules_ruby

Ruby ruleset for Bazel

Primary LanguageStarlarkApache License 2.0Apache-2.0

Ruby Rules for Bazel

Overview

This repository hosts Ruby language ruleset for Bazel.

The ruleset is known to work with Bazel 5 and 6.

Getting Started

Pending the first release.

Documentation

  • See repository rules for the documentation of WORKSPACE rules.
  • See rules for the documentation of BUILD rules.

Toolchains

The following toolchains are known to work and tested on CI.

Ruby Linux macOS Windows
MRI 3.2 🟩 🟩 🟩
MRI 3.1 🟩 🟩 🟩
MRI 3.0 🟩 🟩 🟩
MRI 2.7 🟩 🟩 🟩
JRuby 9.4 🟩 🟩 🟩
JRuby 9.3 🟩 🟩 🟩
TruffleRuby 22.3 🟩 🟩 🟥

MRI

On Linux and macOS, ruby-build is used to install MRI from sources. Keep in mind, that it takes some time for compilation to complete.

On Windows, RubyInstaller is used to install MRI.

JRuby

On all operating systems, JRuby is downloaded manually. It uses Bazel runtime Java toolchain as JDK.

Note: You might need to expose HOME variable for JRuby to work. See examples/gem/.bazelrc to learn how to do that. This is to be fixed in jruby/jruby#5661.

Note: If you get Errno::EACCES: Permission denied - NUL error on Windows, you might need to configure JDK to allow access. See examples/gem/.bazelrc to learn how to do that. This is described in jruby/jruby#7182 (comment).

TruffleRuby

On Linux and macOS, ruby-build is used to install TruffleRuby. Windows is not supported.

Note: You might need to expose HOME variable for JRuby to work. See examples/gem/.bazelrc to learn how to do that. This is to be fixed in oracle/truffleruby#2784.

Other

On Linux and macOS, you can potentially use any Ruby distribution that is supported by ruby-build. However, some are known not to work or work only partially (e.g. mRuby has no bundler support).