Protocol Buffers - Google's data interchange format (grpc依赖) https://developers.google.com/protocol-buffers/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
2.0 KiB

Gem::Specification.new do |s|
s.name = "google-protobuf"
s.version = "4.30.0"
git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag
s.licenses = ["BSD-3-Clause"]
s.summary = "Protocol Buffers"
s.description = "Protocol Buffers are Google's data interchange format."
s.homepage = "https://developers.google.com/protocol-buffers"
s.authors = ["Protobuf Authors"]
s.email = "protobuf@googlegroups.com"
s.metadata = { "source_code_uri" => "https://github.com/protocolbuffers/protobuf/tree/#{git_tag}/ruby" }
s.require_paths = ["lib"]
s.files = Dir.glob('lib/**/*.{rb,rake}')
if RUBY_PLATFORM == "java"
s.platform = "java"
s.files += ["lib/google/protobuf_java.jar"] +
Dir.glob('ext/**/*').reject do |file|
File.basename(file) =~ /^((convert|defs|map|repeated_field)\.[ch]|
BUILD\.bazel|extconf\.rb|wrap_memcpy\.c)$/x
end
s.extensions = ["ext/google/protobuf_c/Rakefile"]
s.add_dependency "ffi", "~>1"
s.add_dependency "ffi-compiler", "~>1"
else
s.files += Dir.glob('ext/**/*').reject do |file|
File.basename(file) =~ /^(BUILD\.bazel)$/
end
s.extensions = %w[
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'
# TODO: evaluate removing Rakefile and moving logic to extconf.rb, so that we
# can remove this runtime dependency on rake. See the discussion here for
# more details:
# https://github.com/protocolbuffers/protobuf/pull/15203
Add rake runtime dependency for ruby (#15203) We have a rake based extension `ext/google/protobuf_c/Rakefile` (added since 3.25.0), which depends on `rake`. However, when gem is installed by `bundle` command, `rake` is not guaranteed to be activated by `bundle` (e.g. when `BUNDLE_PATH` is not default and rake is not already installed in `BUNDLE_PATH`). Therefore, we have to explicit declare a runtime dependency on `rake` for the extension, or otherwise the installation will fail with `can't find gem rake (>= 0.a) with executable rake (Gem::GemNotFoundException)`. Here is a reproduction: ``` root@4d9cb6ba41b1:/build# cat Gemfile source 'https://rubygems.org' gem 'google-protobuf' root@4d9cb6ba41b1:/build# bundle config --local path vendor/bundle root@4d9cb6ba41b1:/build# bundle Fetching gem metadata from https://rubygems.org/........... Resolving dependencies... Installing google-protobuf 3.25.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /build/vendor/bundle/ruby/3.3.0/gems/google-protobuf-3.25.1/ext/google/protobuf_c rake RUBYARCHDIR\=/build/vendor/bundle/ruby/3.3.0/extensions/aarch64-linux/3.3.0/google-protobuf-3.25.1 RUBYLIBDIR\=/build/vendor/bundle/ruby/3.3.0/extensions/aarch64-linux/3.3.0/google-protobuf-3.25.1 /usr/local/lib/ruby/3.3.0/rubygems.rb:259:in `find_spec_for_exe': can't find gem rake (>= 0.a) with executable rake (Gem::GemNotFoundException) from /usr/local/lib/ruby/3.3.0/rubygems.rb:278:in `activate_bin_path' from /usr/local/bin/rake:25:in `<main>' rake failed, exit code 1 Gem files will remain installed in /build/vendor/bundle/ruby/3.3.0/gems/google-protobuf-3.25.1 for inspection. Results logged to /build/vendor/bundle/ruby/3.3.0/extensions/aarch64-linux/3.3.0/google-protobuf-3.25.1/gem_make.out /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:125:in `run' /usr/local/lib/ruby/3.3.0/rubygems/ext/rake_builder.rb:30:in `build' /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:193:in `build_extension' /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:227:in `block in build_extensions' /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `each' /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `build_extensions' /usr/local/lib/ruby/3.3.0/rubygems/installer.rb:852:in `build_extensions' /usr/local/lib/ruby/3.3.0/bundler/rubygems_gem_installer.rb:76:in `build_extensions' /usr/local/lib/ruby/3.3.0/bundler/rubygems_gem_installer.rb:28:in `install' /usr/local/lib/ruby/3.3.0/bundler/source/rubygems.rb:205:in `install' /usr/local/lib/ruby/3.3.0/bundler/installer/gem_installer.rb:54:in `install' /usr/local/lib/ruby/3.3.0/bundler/installer/gem_installer.rb:16:in `install_from_spec' /usr/local/lib/ruby/3.3.0/bundler/installer/parallel_installer.rb:132:in `do_install' /usr/local/lib/ruby/3.3.0/bundler/installer/parallel_installer.rb:123:in `block in worker_pool' /usr/local/lib/ruby/3.3.0/bundler/worker.rb:62:in `apply_func' /usr/local/lib/ruby/3.3.0/bundler/worker.rb:57:in `block in process_queue' <internal:kernel>:187:in `loop' /usr/local/lib/ruby/3.3.0/bundler/worker.rb:54:in `process_queue' /usr/local/lib/ruby/3.3.0/bundler/worker.rb:90:in `block (2 levels) in create_threads' An error occurred while installing google-protobuf (3.25.1), and Bundler cannot continue. In Gemfile: google-protobuf ``` Closes #15203 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15203 from ntkme:ruby-rake-dependency 1318863022c4b0c9a22f267630a3e0138cf311e6 PiperOrigin-RevId: 600916613
10 months ago
s.add_dependency "rake", ">= 13"
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 "test-unit", '~> 3.0', '>= 3.0.9'
# bigdecimal must be used as a non-built in gem as of ruby-3.4
s.add_development_dependency "bigdecimal"
end