Switch rules_ruby to the supported version from bazel-contrib (#19808)

Closes #19808

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/19808 from protocolbuffers:rules_ruby 2b8365967d
PiperOrigin-RevId: 734270719
This commit is contained in:
Jason Lunn 2025-03-06 13:38:51 -08:00 committed by Copybara-Service
parent 3c50c0da0e
commit 4e6cf01430
17 changed files with 221 additions and 156 deletions

View file

@ -0,0 +1,37 @@
Subject: [PATCH] Disable bundle install
---
Index: ruby/private/bundle_fetch.bzl
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ruby/private/bundle_fetch.bzl b/ruby/private/bundle_fetch.bzl
--- a/ruby/private/bundle_fetch.bzl (revision 075937d3f2e22d4657f5c4693e7405d8952ab209)
+++ b/ruby/private/bundle_fetch.bzl (date 1740971614385)
@@ -168,16 +168,16 @@
)
# Fetch Bundler and define an `rb_gem_install()` target for it.
- _download_gem(repository_ctx, gemfile_lock.bundler, cache_path, gemfile_lock.bundler.sha256)
- gem_full_names.append(":%s" % gemfile_lock.bundler.full_name)
- gem_install_fragments.append(
- _GEM_INSTALL_BUILD_FRAGMENT.format(
- name = gemfile_lock.bundler.full_name,
- gem = gemfile_lock.bundler.filename,
- cache_path = cache_path,
- ruby = ruby_toolchain_attr,
- ),
- )
+# _download_gem(repository_ctx, gemfile_lock.bundler, cache_path, gemfile_lock.bundler.sha256)
+# gem_full_names.append(":%s" % gemfile_lock.bundler.full_name)
+# gem_install_fragments.append(
+# _GEM_INSTALL_BUILD_FRAGMENT.format(
+# name = gemfile_lock.bundler.full_name,
+# gem = gemfile_lock.bundler.filename,
+# cache_path = cache_path,
+# ruby = ruby_toolchain_attr,
+# ),
+# )
# Create `bin` package with shims for gem executables.
# This allows targets to depend on `@bundle//bin:rake`

View file

@ -40,9 +40,48 @@ bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_python", version = "1.0.0")
bazel_dep(name = "rules_rust", version = "0.51.0")
bazel_dep(name = "rules_ruby", version = "0.17.3", dev_dependency=True)
# Workaround for https://github.com/bazel-contrib/rules_ruby/issues/216
# Patch rules_ruby to disable automatic attempt to install bundler. When fixed,
# delete Disable_bundle_install.patch and single_version_override() below.
single_version_override(
module_name = "rules_ruby",
patch_strip = 1,
patches = [
"@com_google_protobuf//:Disable_bundle_install.patch",
],
version = "0.17.3",
)
bazel_dep(name = "rules_shell", version = "0.2.0")
bazel_dep(name = "platforms", version = "0.0.10")
# Ruby toolchains
ruby = use_extension("@rules_ruby//ruby:extensions.bzl", "ruby", dev_dependency=True)
ruby.toolchain(
name = "ruby",
version = "system",
)
use_repo(ruby, "ruby")
ruby.bundle_fetch(
name = "protobuf_bundle",
gem_checksums = {
"bigdecimal-3.1.9": "2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc",
"bigdecimal-3.1.9-java": "dd9b8f7c870664cd9538a1325ce385ba57a6627969177258c4f0e661a7be4456",
"ffi-1.17.1": "26f6b0dbd1101e6ffc09d3ca640b2a21840cc52731ad8a7ded9fb89e5fb0fc39",
"ffi-1.17.1-java": "2546e11f9592e2b9b6de49eb96d2a378da47b0bb8469d5cbc9881a55c0d55da7",
"ffi-compiler-1.3.2": "a94f3d81d12caf5c5d4ecf13980a70d0aeaa72268f3b9cc13358bcc6509184a0",
"power_assert-2.0.5": "63b511b85bb8ea57336d25156864498644f5bbf028699ceda27949e0125bc323",
"rake-13.2.1": "46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d",
"rake-compiler-1.1.9": "51b5c95a1ff25cabaaf92e674a2bed847ab53d66302fc8843830df46ab1f51f5",
"rake-compiler-dock-1.2.1": "3cc968d7ffc923c0e775b28d79a3389efb3d2b16ef52ed0298fbc97d347e5878",
"test-unit-3.6.7": "c342bb9f7334ea84a361b43c20b063f405c0bf3c7dbe3ff38f61a91661d29221"
},
gemfile = "//ruby:Gemfile",
gemfile_lock = "//ruby:Gemfile.lock",
)
use_repo(ruby, "protobuf_bundle", "ruby_toolchains")
register_toolchains("@ruby_toolchains//:all", dev_dependency=True)
# Proto toolchains
register_toolchains("//bazel/private/toolchains:all")
@ -130,7 +169,7 @@ maven.install(
use_repo(maven, "maven")
# Development dependencies
bazel_dep(name = "googletest", version = "1.14.0", dev_dependency = True)
bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True)
bazel_dep(name = "rules_buf", version = "0.3.0", dev_dependency = True)
bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True)
bazel_dep(
@ -145,4 +184,4 @@ cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_exten
use_repo(cc_configure, "local_config_cc")
# rules_proto are needed for @com_google_protobuf_v25.0 used in //compatibility/... tests
bazel_dep(name = "rules_proto", version = "4.0.0", dev_dependency = True)
bazel_dep(name = "rules_proto", version = "7.0.2", dev_dependency = True)

View file

@ -136,39 +136,45 @@ load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
kt_register_toolchains()
# Workaround for https://github.com/bazel-contrib/rules_ruby/issues/216
# Patch rules_ruby to disable automatic attempt to install bundler. When fixed,
# delete Disable_bundle_install.patch and remove the patch related attributes
http_archive(
name = "rules_ruby",
integrity = "sha256-Lh/xxR6WsKJnS92sYkpJDBtdS6DNrCbi0kuUxBffG6E=",
strip_prefix = "rules_ruby-588d9dd40487277e2560ece09fe310d7c0ecb4a6",
urls = [
"https://github.com/protocolbuffers/rules_ruby/archive/588d9dd40487277e2560ece09fe310d7c0ecb4a6.zip",
patch_args = ["-p1"],
patches = [
"@com_google_protobuf//:Disable_bundle_install.patch",
],
sha256 = "005da20827bee6b33d8ece7dc9973da293d7f8bb2ca07beaac43c31acaadbd31",
strip_prefix = "rules_ruby-0.17.3",
url = "https://github.com/bazel-contrib/rules_ruby/releases/download/v0.17.3/rules_ruby-v0.17.3.tar.gz",
)
load("@rules_ruby//ruby:defs.bzl", "ruby_runtime")
load("@rules_ruby//ruby:deps.bzl", "rb_register_toolchains", "rb_bundle_fetch")
ruby_runtime("system_ruby")
rb_register_toolchains(
version = "system",
)
register_toolchains("@system_ruby//:toolchain")
# Uncomment pairs of ruby_runtime() + register_toolchain() calls below to enable
# local JRuby testing. Do not submit the changes (due to impact on test duration
# for non JRuby builds due to downloading JRuby SDKs).
#ruby_runtime("jruby-9.2")
#
#register_toolchains("@jruby-9.2//:toolchain")
#
#ruby_runtime("jruby-9.3")
#
#register_toolchains("@jruby-9.3//:toolchain")
load("@system_ruby//:bundle.bzl", "ruby_bundle")
ruby_bundle(
rb_bundle_fetch(
name = "protobuf_bundle",
srcs = ["//ruby:google-protobuf.gemspec"],
bundler_version = "2.4.22",
srcs = [
"//ruby:google-protobuf.gemspec",
],
gem_checksums = {
"bigdecimal-3.1.9": "2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc",
"bigdecimal-3.1.9-java": "dd9b8f7c870664cd9538a1325ce385ba57a6627969177258c4f0e661a7be4456",
"ffi-1.17.1": "26f6b0dbd1101e6ffc09d3ca640b2a21840cc52731ad8a7ded9fb89e5fb0fc39",
"ffi-1.17.1-java": "2546e11f9592e2b9b6de49eb96d2a378da47b0bb8469d5cbc9881a55c0d55da7",
"ffi-compiler-1.3.2": "a94f3d81d12caf5c5d4ecf13980a70d0aeaa72268f3b9cc13358bcc6509184a0",
"power_assert-2.0.5": "63b511b85bb8ea57336d25156864498644f5bbf028699ceda27949e0125bc323",
"rake-13.2.1": "46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d",
"rake-compiler-1.1.9": "51b5c95a1ff25cabaaf92e674a2bed847ab53d66302fc8843830df46ab1f51f5",
"rake-compiler-dock-1.2.1": "3cc968d7ffc923c0e775b28d79a3389efb3d2b16ef52ed0298fbc97d347e5878",
"test-unit-3.6.7": "c342bb9f7334ea84a361b43c20b063f405c0bf3c7dbe3ff38f61a91661d29221"
},
gemfile = "//ruby:Gemfile",
gemfile_lock = "//ruby:Gemfile.lock",
)
http_archive(
@ -276,9 +282,9 @@ crate_repositories()
# For testing runtime against old gencode from a previous major version.
http_archive(
name = "com_google_protobuf_v25.0",
integrity = "sha256-e+7ZxRHWMs/3wirACU3Xcg5VAVMDnV2n4Fm8zrSIR0o=",
strip_prefix = "protobuf-25.0",
url = "https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz",
integrity = "sha256-aYl601ZjGPYtu0Nc2Nsl58qiPgSXqT9e20mQM5FcxXk=",
strip_prefix = "protobuf-d8756a62c8ae40686b75fee9ad9c876ac892d043",
url = "https://github.com/protocolbuffers/protobuf/archive/d8756a62c8ae40686b75fee9ad9c876ac892d043.tar.gz",
)
# Needed as a dependency of @com_google_protobuf_v25.0

View file

@ -4,32 +4,6 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# TODO: either replace rules_ruby with a maintained version on BCR
# or use bzlmod extensions to depend on this specific repo
http_archive(
name = "rules_ruby",
urls = [
"https://github.com/protocolbuffers/rules_ruby/archive/588d9dd40487277e2560ece09fe310d7c0ecb4a6.zip"
],
strip_prefix = "rules_ruby-588d9dd40487277e2560ece09fe310d7c0ecb4a6",
integrity = "sha256-Lh/xxR6WsKJnS92sYkpJDBtdS6DNrCbi0kuUxBffG6E=",
)
load("@rules_ruby//ruby:defs.bzl", "ruby_runtime")
ruby_runtime("system_ruby")
register_toolchains("@system_ruby//:toolchain")
load("@system_ruby//:bundle.bzl", "ruby_bundle")
ruby_bundle(
name = "protobuf_bundle",
srcs = ["//ruby:google-protobuf.gemspec"],
bundler_version = "2.4.22",
gemfile = "//ruby:Gemfile",
)
# For testing UPB.
http_archive(
name = "lua",
@ -63,9 +37,9 @@ http_archive(
# For testing runtime against old gencode from a previous major version.
http_archive(
name = "com_google_protobuf_v25.0",
integrity = "sha256-e+7ZxRHWMs/3wirACU3Xcg5VAVMDnV2n4Fm8zrSIR0o=",
strip_prefix = "protobuf-25.0",
url = "https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz",
integrity = "sha256-aYl601ZjGPYtu0Nc2Nsl58qiPgSXqT9e20mQM5FcxXk=",
strip_prefix = "protobuf-d8756a62c8ae40686b75fee9ad9c876ac892d043",
url = "https://github.com/protocolbuffers/protobuf/archive/d8756a62c8ae40686b75fee9ad9c876ac892d043.tar.gz",
)
# Needed as a dependency of @com_google_protobuf_v25.0

View file

@ -63,6 +63,9 @@ class ExtensionFunctions(object):
def install(self, *args, **kwargs):
pass
def bundle_fetch(self, *args, **kwargs):
pass
class ModuleFileFunctions(object):
"""A fake MODULE file that we can exec() to get the functions we need."""
@ -84,12 +87,15 @@ class ModuleFileFunctions(object):
}
)
def register_toolchains(self, *args):
def register_toolchains(self, *args, **kwargs):
pass
def use_repo(self, *args, **kwargs):
pass
def single_version_override(self, *args, **kwargs):
pass
def use_extension(self, *args, **kwargs):
return ExtensionFunctions()

View file

@ -16,7 +16,7 @@ load(
"strip_prefix",
)
load("@rules_python//python:defs.bzl", "py_binary")
load("@rules_ruby//ruby:defs.bzl", "ruby_binary")
load("@rules_ruby//ruby:defs.bzl", "rb_binary")
load("//:protobuf.bzl", "internal_csharp_proto_library", "internal_objc_proto_library", "internal_php_proto_library", "internal_py_proto_library", "internal_ruby_proto_library")
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
@ -425,10 +425,11 @@ cc_binary(
deps = [":conformance_objc_lib"],
)
ruby_binary(
rb_binary(
name = "conformance_ruby",
testonly = True,
srcs = ["conformance_ruby.rb"],
main = "conformance_ruby.rb",
visibility = ["//ruby:__subpackages__"],
deps = [
":conformance_ruby_proto",

View file

@ -1,5 +1,3 @@
#!/usr/bin/env ruby
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
#
@ -7,6 +5,13 @@
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
# TODO - When rules_ruby supports prefix stripping, use it to obviate the need
# for manual load path manipulation
# https://github.com/bazel-contrib/rules_ruby/issues/219
$LOAD_PATH.unshift ENV['PWD']
$LOAD_PATH.unshift File.join(ENV['PWD'], 'ruby', 'lib')
$LOAD_PATH.unshift File.join(ENV['PWD'], 'ruby')
require 'conformance/conformance_pb'
require 'conformance/test_protos/test_messages_edition2023_pb'
require 'google/protobuf'

View file

@ -496,7 +496,7 @@ def internal_objc_proto_library(
def internal_ruby_proto_library(
name,
ruby_library,
rb_library,
srcs = [],
deps = [],
includes = ["."],
@ -513,7 +513,7 @@ def internal_ruby_proto_library(
Args:
name: the name of the ruby_proto_library.
ruby_library: the ruby library rules to use.
rb_library: the ruby library rules to use.
srcs: the .proto files to compile.
deps: a list of dependency labels; must be a internal_ruby_proto_library.
includes: a string indicating the include path of the .proto files.
@ -522,7 +522,7 @@ def internal_ruby_proto_library(
testonly: common rule attribute (see:
https://bazel.build/reference/be/common-definitions#common-attributes)
visibility: the visibility of the generated files.
**kwargs: other keyword arguments that are passed to ruby_library.
**kwargs: other keyword arguments that are passed to rb_library.
"""
@ -543,13 +543,12 @@ def internal_ruby_proto_library(
deps = []
if default_runtime:
deps.append(default_runtime)
ruby_library(
rb_library(
name = name,
srcs = [name + "_genproto"],
deps = deps,
testonly = testonly,
visibility = visibility,
includes = includes,
**kwargs
)

View file

@ -5,7 +5,7 @@
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_ruby//ruby:defs.bzl", "ruby_library")
load("@rules_ruby//ruby:defs.bzl", "rb_library")
load("//:protobuf_version.bzl", "PROTOBUF_RUBY_VERSION")
load("//conformance:defs.bzl", "conformance_test")
load("//python:internal.bzl", "internal_copy_files")
@ -42,7 +42,7 @@ selects.config_setting_group(
name = "jruby_ffi",
match_all = [
":ffi_enabled",
"@rules_ruby//ruby/runtime:config_jruby",
"@ruby//engine:jruby",
],
)
@ -50,7 +50,7 @@ selects.config_setting_group(
name = "jruby_native",
match_all = [
":ffi_disabled",
"@rules_ruby//ruby/runtime:config_jruby",
"@ruby//engine:jruby",
],
)
@ -58,7 +58,7 @@ selects.config_setting_group(
name = "ruby_ffi",
match_all = [
":ffi_enabled",
"@rules_ruby//ruby/runtime:config_ruby",
"@ruby//engine:ruby",
],
)
@ -66,7 +66,7 @@ selects.config_setting_group(
name = "ruby_native",
match_all = [
":ffi_disabled",
"@rules_ruby//ruby/runtime:config_ruby",
"@ruby//engine:ruby",
],
)
@ -100,7 +100,6 @@ internal_ruby_proto_library(
name = "well_known_ruby_protos",
srcs = [":copied_wkt_proto_files"],
default_runtime = "",
includes = ["."],
visibility = [
"//conformance:__pkg__",
"//ruby:__subpackages__",
@ -121,7 +120,6 @@ internal_ruby_proto_library(
name = "conformance_test_ruby_proto",
testonly = 1,
srcs = [":copied_conformance_test_files"],
includes = ["."],
visibility = [
"//conformance:__pkg__",
"//ruby:__subpackages__",
@ -143,12 +141,11 @@ internal_ruby_proto_library(
name = "conformance_editions_test_ruby_proto",
testonly = 1,
srcs = [":copied_conformance_editions_test_files"],
includes = ["."],
visibility = ["//conformance:__pkg__"],
deps = [":well_known_ruby_protos"],
)
ruby_library(
rb_library(
name = "protobuf",
visibility = [
"//visibility:public",
@ -193,7 +190,7 @@ genrule(
""",
tags = ["manual"],
target_compatible_with = select({
"@rules_ruby//ruby/runtime:config_jruby": [],
"@ruby//engine:jruby": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
)
@ -230,7 +227,7 @@ genrule(
""",
tags = ["manual"],
target_compatible_with = select({
"@rules_ruby//ruby/runtime:config_ruby": [],
"@ruby//engine:jruby": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
)
@ -238,7 +235,7 @@ genrule(
filegroup(
name = "release",
srcs = select({
"@rules_ruby//ruby/runtime:config_jruby": [":jruby_release"],
"@ruby//engine:jruby": [":jruby_release"],
"//conditions:default": [":ruby_release"],
}),
tags = ["manual"],

View file

@ -1,3 +1,24 @@
source 'https://rubygems.org'
gemspec
gem "bigdecimal"
# FFI is required for JRuby platforms, but optional elsewhere
if defined? $JRUBY_VERSION
gem "ffi", "~>1", platforms: %i[jruby]
gem "ffi-compiler", "~>1", platforms: %i[jruby]
else
group :development do
gem "ffi", "~>1"
gem "ffi-compiler", "~>1"
end
end
group :test do
gem "test-unit", '~> 3.0', '>= 3.0.9'
end
group :development do
gem "rake", ">= 13"
gem "rake-compiler", "~> 1.1.0"
gem "rake-compiler-dock", "= 1.2.1"
end

View file

@ -1,16 +1,8 @@
PATH
remote: .
specs:
google-protobuf (4.30.0-java)
ffi (~> 1)
ffi-compiler (~> 1)
rake (>= 13)
GEM
remote: https://rubygems.org/
specs:
bigdecimal (3.1.8)
bigdecimal (3.1.8-java)
bigdecimal (3.1.9)
bigdecimal (3.1.9-java)
ffi (1.17.1)
ffi (1.17.1-java)
ffi-compiler (1.3.2)
@ -20,6 +12,7 @@ GEM
rake (13.2.1)
rake-compiler (1.1.9)
rake
rake-compiler-dock (1.2.1)
test-unit (3.6.7)
power_assert
@ -29,6 +22,8 @@ PLATFORMS
arm64-darwin
arm64-linux
java
ruby
universal-java-23
x64-mingw-ucrt
x64-mingw32
x86-linux
@ -40,9 +35,10 @@ DEPENDENCIES
bigdecimal
ffi (~> 1)
ffi-compiler (~> 1)
google-protobuf!
rake (>= 13)
rake-compiler (~> 1.1.0)
rake-compiler-dock (= 1.2.1)
test-unit (~> 3.0, >= 3.0.9)
BUNDLED WITH
2.4.10
2.5.23

View file

@ -1,6 +1,6 @@
"""Wrapper around internal_ruby_proto_library to supply our rules_ruby"""
load("@rules_ruby//ruby:defs.bzl", "ruby_library")
load("@rules_ruby//ruby:defs.bzl", "rb_library")
load("//:protobuf.bzl", _internal_ruby_proto_library = "internal_ruby_proto_library")
def internal_ruby_proto_library(
@ -14,11 +14,11 @@ def internal_ruby_proto_library(
Args:
name: the name of the ruby_proto_library.
**kwargs: other keyword arguments that are passed to ruby_library.
**kwargs: other keyword arguments that are passed to rb_library.
"""
_internal_ruby_proto_library(
name,
ruby_library,
rb_library,
**kwargs
)

View file

@ -49,12 +49,12 @@ cc_library(
],
linkstatic = True,
target_compatible_with = select({
"@rules_ruby//ruby/runtime:config_jruby": ["@platforms//:incompatible"],
"@ruby//engine:jruby": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
deps = [
"//third_party/utf8_range",
"@rules_ruby//ruby/runtime:headers",
"@ruby//:headers",
],
alwayslink = True,
)

View file

@ -29,7 +29,6 @@ Gem::Specification.new do |s|
ext/google/protobuf_c/extconf.rb
ext/google/protobuf_c/Rakefile
]
s.add_development_dependency "rake-compiler-dock", "= 1.2.1"
end
s.required_ruby_version = '>= 3.0'
# bigdecimal must be used as a non-built in gem as of ruby-3.4
@ -42,5 +41,6 @@ Gem::Specification.new do |s|
s.add_development_dependency "ffi", "~>1"
s.add_development_dependency "ffi-compiler", "~>1"
s.add_development_dependency "rake-compiler", "~> 1.1.0"
s.add_development_dependency "rake-compiler-dock", "= 1.2.1"
s.add_development_dependency "test-unit", '~> 3.0', '>= 3.0.9'
end

View file

@ -1,6 +1,6 @@
load("@rules_java//java:java_binary.bzl", "java_binary")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_ruby//ruby:defs.bzl", "ruby_library")
load("@rules_ruby//ruby:defs.bzl", "rb_library")
config_setting(
name = "requires_bundle",
@ -45,7 +45,6 @@ genrule(
java_binary(
name = "protobuf_java_bin",
create_executable = False,
deploy_env = ["@rules_ruby//ruby/runtime:jruby_binary"],
runtime_deps = [
"//ruby/src/main/java:protobuf_java",
],
@ -61,14 +60,14 @@ genrule(
visibility = ["//ruby:__subpackages__"],
)
ruby_library(
rb_library(
name = "protobuf_lib",
srcs = glob([
"**/*.rb",
]),
data = select({
# Platform native implementations
"@rules_ruby//ruby/runtime:config_jruby": ["protobuf_java.jar"],
"@ruby//engine:jruby": ["protobuf_java.jar"],
"@platforms//os:osx": ["protobuf_c.bundle"],
"//conditions:default": ["protobuf_c.so"],
}) + select({
@ -77,21 +76,11 @@ ruby_library(
"//ruby:linux_ffi_enabled": ["libprotobuf_c_ffi.so"],
"//conditions:default": [],
}),
includes = [
"ruby",
"ruby/lib",
],
visibility = ["//ruby:__pkg__"],
deps = [
"//ruby:well_known_ruby_protos",
"@protobuf_bundle//:bigdecimal",
] + select({
"//ruby:ffi_enabled": [
"@protobuf_bundle//:ffi",
"@protobuf_bundle//:ffi-compiler",
"@protobuf_bundle",
],
"//conditions:default": [],
}),
)
pkg_files(

View file

@ -9,14 +9,14 @@ java_library(
"google/ProtobufJavaService.java",
],
target_compatible_with = select({
"@rules_ruby//ruby/runtime:config_jruby": [],
"@ruby//engine:jruby": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
visibility = ["//ruby:__subpackages__"],
deps = [
"//java/core",
"//java/util",
"@rules_ruby//ruby/runtime:jars",
"@ruby//:jars",
],
)

View file

@ -1,8 +1,8 @@
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_ruby//ruby:defs.bzl", "ruby_library", "ruby_test")
load("@rules_ruby//ruby:defs.bzl", "rb_library", "rb_test")
load("//ruby:defs.bzl", "internal_ruby_proto_library")
ruby_library(
rb_library(
name = "common_tests",
srcs = ["common_tests.rb"],
)
@ -10,175 +10,170 @@ ruby_library(
internal_ruby_proto_library(
name = "test_ruby_protos",
srcs = glob(["*.proto"]),
includes = [
".",
"ruby/tests",
"src",
],
visibility = [
"//ruby:__subpackages__",
],
deps = ["//ruby:well_known_ruby_protos"],
)
ruby_test(
rb_test(
name = "implementation",
srcs = ["implementation.rb"],
deps = [
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "basic",
srcs = ["basic.rb"],
deps = [
":common_tests",
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "basic_proto2",
srcs = ["basic_proto2.rb"],
deps = [
":common_tests",
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "encode_decode_test",
srcs = ["encode_decode_test.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "gc_test",
srcs = ["gc_test.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "generated_code_test",
srcs = ["generated_code_test.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "multi_level_nesting_test",
srcs = ["multi_level_nesting_test.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "object_cache_test",
srcs = ["object_cache_test.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "repeated_field_test",
srcs = ["repeated_field_test.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "ruby_version",
srcs = ["ruby_version.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "stress",
srcs = ["stress.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "type_errors",
srcs = ["type_errors.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "utf8",
srcs = ["utf8.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "well_known_types_test",
srcs = ["well_known_types_test.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "service_test",
srcs = ["service_test.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)
ruby_test(
rb_test(
name = "memory_test",
srcs = ["memory_test.rb"],
deps = [
":test_ruby_protos",
"//ruby:protobuf",
"@protobuf_bundle//:test-unit",
"@protobuf_bundle",
],
)