Add ruby release targets
Add bazel targets to create ruby release artifacts.
Should be run with:
bazel run ruby:release
bazel run ruby:jruby_release
bazel run ruby:release --define=ruby_platform=c bazel run ruby:jruby_release --define=ruby_platform=java
These defines aren't necessary anymore, and don't actually do anything. The new pattern is to use target_compatible_with (e.g. https://github.com/protocolbuffers/protobuf/blob/ade256e153ea7bfff85987a7f1bf2e9c9632cb10/ruby/BUILD.bazel#L54) and just allow the toolchain resolution to pick the appropriate target
bazel run ruby:release --define=ruby_platform=c bazel run ruby:jruby_release --define=ruby_platform=java
These defines aren't necessary anymore, and don't actually do anything. The new pattern is to use
target_compatible_with(e.g.https://github.com/protocolbuffers/protobuf/blob/ade256e153ea7bfff85987a7f1bf2e9c9632cb10/ruby/BUILD.bazel#L54
) and just allow the toolchain resolution to pick the appropriate target
I implemented that but now when I test I get:
Dependency chain:
//ruby:jruby_release (06aa77) <-- target platform (@local_config_platform//:host) didn't satisfy constraint @platforms//:incompatible
How can I use this and test locally?
Our current configuration is to use the system ruby version. So if you're using c-ruby and you run a bazel target only compatible with jruby, you'll see those constraint errors. You'll need to switch to jruby with rvm before running the target.
Alternatively, I came up with a strategy that I liked for this kind of thing. If you have cruby and jruby targets that build the same "kind" of thing, you can add a third target with a conditional dependency on both. I did this with the protobuf runtime, where //lib/google/protobuf:protobuf_lib will always compile, but sometimes refer to the jruby jar and sometimes to the cruby library.
bazel run ruby:release --define=ruby_platform=c bazel run ruby:jruby_release --define=ruby_platform=java
These defines aren't necessary anymore, and don't actually do anything. The new pattern is to use
target_compatible_with(e.g.https://github.com/protocolbuffers/protobuf/blob/ade256e153ea7bfff85987a7f1bf2e9c9632cb10/ruby/BUILD.bazel#L54
) and just allow the toolchain resolution to pick the appropriate target
Used this and deleted comments about using the other flags.