-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Repro: https://github.com/noahkawasakigoogle/rules_ruby_bug
I've run into an issue attempting to use rules_ruby with the psych Gem that I believe is due to rb_bundle_fetch for some reason not executing certain gem installation steps.
The psych gem for this example, should result in a JAR file being produced: https://github.com/ruby/psych/blob/master/psych.gemspec#L71
.gem/jruby/3.1.0/gems/psych-3.3.3-java/lib/org/yaml/snakeyaml/1.31/snakeyaml-1.31.jar
However an rb_bundle_fetch WORKSPACE rule does not result in this jar being produced, while a normal bundle install execution does result in this file being produced.
I've reproduced this behavior in a public repo. But TLDR is that this does not include the expected JAR files:
WORKSPACE:
rb_bundle_fetch(
name = "bundle",
gemfile = "//:Gemfile",
gemfile_lock = "//:Gemfile.lock",
srcs = [
"//:.ruby-version"
]
)
BUILD.bazel:
load("@rules_ruby//ruby:defs.bzl", "rb_library")
rb_library(
name = "repro",
deps = [
"@bundle"
]
)
Run this to see:
bazel build --enable_workspace //:repro
# Missing snakeyaml-1.31.jar in bazel outfiles
find "$(bazel info output_path)/k8-fastbuild/bin/external" -type f -name snakeyaml-1.31.jar
Running bundle install works though!
bazel run --enable_workspace @ruby//:bundle -- install --path "${BUNDLE_PATH}"
# Returns:
# ./rules_ruby_bug/.gem/jruby/3.1.0/gems/psych-3.3.3-java/lib/org/yaml/snakeyaml/1.31/snakeyaml-1.31.jar
find "${BUNDLE_PATH}" -type f -name snakeyaml-1.31.jar
You will see extra logs during the installation that you will not see using rb_bundle_fetch:
using maven for the first time results in maven
downloading all its default plugin and can take time.
as those plugins get cached on disk and further execution
of maven is much faster then the first time.
org.yaml:snakeyaml:1.31:compile
Other information, I am using jruby-9.4.12.0 and bundler 2.4.22