Commit bc215089 authored by Joshua Haberman's avatar Joshua Haberman

Merge pull request #1214 from haberman/binarygem

Added support for binary gems.
parents 0906f5d1 6efe3aaf
PATH PATH
remote: . remote: .
specs: specs:
google-protobuf (3.0.0.alpha.4.0) google-protobuf (3.0.0.alpha.5.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
...@@ -10,6 +10,7 @@ GEM ...@@ -10,6 +10,7 @@ GEM
rake (10.4.2) rake (10.4.2)
rake-compiler (0.9.5) rake-compiler (0.9.5)
rake rake
rake-compiler-dock (0.5.1)
rubygems-tasks (0.2.4) rubygems-tasks (0.2.4)
test-unit (3.0.9) test-unit (3.0.9)
power_assert power_assert
...@@ -21,8 +22,9 @@ PLATFORMS ...@@ -21,8 +22,9 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
google-protobuf! google-protobuf!
rake-compiler rake-compiler
rake-compiler-dock
rubygems-tasks rubygems-tasks
test-unit test-unit
BUNDLED WITH BUNDLED WITH
1.10.6 1.11.2
...@@ -20,6 +20,17 @@ else ...@@ -20,6 +20,17 @@ else
Rake::ExtensionTask.new("protobuf_c", spec) do |ext| Rake::ExtensionTask.new("protobuf_c", spec) do |ext|
ext.ext_dir = "ext/google/protobuf_c" ext.ext_dir = "ext/google/protobuf_c"
ext.lib_dir = "lib/google" ext.lib_dir = "lib/google"
ext.cross_compile = true
ext.cross_platform = [
'x86-mingw32', 'x64-mingw32',
'x86_64-linux', 'x86-linux',
'universal-darwin'
]
end
task 'gem:windows' do
require 'rake_compiler_dock'
RakeCompilerDock.sh "bundle && rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.6"
end end
end end
......
...@@ -8,12 +8,13 @@ Gem::Specification.new do |s| ...@@ -8,12 +8,13 @@ Gem::Specification.new do |s|
s.authors = ["Protobuf Authors"] s.authors = ["Protobuf Authors"]
s.email = "protobuf@googlegroups.com" s.email = "protobuf@googlegroups.com"
s.require_paths = ["lib"] s.require_paths = ["lib"]
s.files = `git ls-files -z`.split("\x0").find_all{|f| f =~ /lib\/.+\.rb/} s.files = Dir.glob('lib/**/*.rb')
unless RUBY_PLATFORM == "java" if RUBY_PLATFORM == "java"
s.files += `git ls-files "*.c" "*.h" extconf.rb Makefile`.split
s.extensions= ["ext/google/protobuf_c/extconf.rb"]
else
s.files += ["lib/google/protobuf_java.jar"] s.files += ["lib/google/protobuf_java.jar"]
else
s.files += Dir.glob('ext/**/*')
s.extensions= ["ext/google/protobuf_c/extconf.rb"]
s.add_development_dependency "rake-compiler-dock"
end end
s.test_files = ["tests/basic.rb", s.test_files = ["tests/basic.rb",
"tests/stress.rb", "tests/stress.rb",
......
...@@ -44,7 +44,11 @@ if RUBY_PLATFORM == "java" ...@@ -44,7 +44,11 @@ if RUBY_PLATFORM == "java"
require 'json' require 'json'
require 'google/protobuf_java' require 'google/protobuf_java'
else else
require 'google/protobuf_c' begin
require "google/#{RUBY_VERSION.sub(/\.\d$/, '')}/protobuf_c"
rescue LoadError
require 'google/protobuf_c'
end
end end
require 'google/protobuf/repeated_field' require 'google/protobuf/repeated_field'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment