# Protobuf Ruby runtime # # See also code generation logic under /src/google/protobuf/compiler/ruby. load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_ruby//ruby:defs.bzl", "ruby_library") load("//:protobuf.bzl", "internal_ruby_proto_library") load("//conformance:defs.bzl", "conformance_test") load("//:protobuf_version.bzl", "PROTOBUF_RUBY_VERSION") ################################################################################ # Ruby Runtime ################################################################################ ruby_library( name = "protobuf", deps = ["//ruby/lib/google:protobuf_lib"], visibility = [ "//visibility:public", ], ) sh_binary( name = "jruby_release", data = [ "//ruby/lib/google:copy_jar", "//ruby/lib/google:dist_files", "//:well_known_ruby_protos", "google-protobuf.gemspec", ], srcs = [ "build_jruby_release.sh", ], deps = ["@bazel_tools//tools/bash/runfiles"], target_compatible_with = select({ "@rules_ruby//ruby/runtime:config_jruby": [], "//conditions:default": ["@platforms//:incompatible"], }), ) sh_binary( name = "release", data = [ "@utf8_range//:utf8_range_srcs", "@utf8_range//:LICENSE", "//:well_known_ruby_protos", "//ruby/ext/google/protobuf_c:dist_files", "//ruby/lib/google:dist_files", "google-protobuf.gemspec", ], srcs = [ "build_release.sh", ], deps = ["@bazel_tools//tools/bash/runfiles"], target_compatible_with = select({ "@rules_ruby//ruby/runtime:config_ruby": [], "//conditions:default": ["@platforms//:incompatible"], }), ) ################################################################################ # Tests ################################################################################ # Define this here so the descriptor paths match what we get in Rake tests. internal_ruby_proto_library( name = "test_ruby_protos", srcs = ["//ruby/tests:test_protos"], deps = ["//:well_known_ruby_protos"], includes = [".", "src", "ruby/tests"], visibility = [ "//ruby:__subpackages__", ], ) conformance_test( name = "conformance_test", failure_list = "//conformance:failure_list_ruby.txt", testee = "//conformance:conformance_ruby", text_format_failure_list = "//conformance:text_format_failure_list_ruby.txt", target_compatible_with = select({ "@rules_ruby//ruby/runtime:config_ruby": [], "//conditions:default": ["@platforms//:incompatible"], }), ) conformance_test( name = "conformance_test_jruby", failure_list = "//conformance:failure_list_jruby.txt", testee = "//conformance:conformance_ruby", text_format_failure_list = "//conformance:text_format_failure_list_jruby.txt", target_compatible_with = select({ "@rules_ruby//ruby/runtime:config_jruby": [], "//conditions:default": ["@platforms//:incompatible"], }), ) ################################################################################ # Distribution files ################################################################################ pkg_files( name = "dist_files", srcs = [ "//ruby/ext/google/protobuf_c:dist_files", "//ruby/lib/google:dist_files", "//ruby/src/main/java:dist_files", "//ruby/tests:dist_files", ".gitignore", "BUILD.bazel", "Gemfile", "Rakefile", "README.md", ], strip_prefix = strip_prefix.from_root(""), visibility = ["//pkg:__pkg__"], )