Commit 1f8b6da9 authored by Nicolas "Pixel" Noble's avatar Nicolas "Pixel" Noble

Few tweaks to the rakefile to permit native gems compilation with the proto files generation.

parent cbb6b285
PATH PATH
remote: . remote: .
specs: specs:
google-protobuf (3.0.0.alpha.5.0) google-protobuf (3.0.0.alpha.5.0.5)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
......
...@@ -5,35 +5,6 @@ require "rake/testtask" ...@@ -5,35 +5,6 @@ require "rake/testtask"
spec = Gem::Specification.load("google-protobuf.gemspec") spec = Gem::Specification.load("google-protobuf.gemspec")
if RUBY_PLATFORM == "java"
if `which mvn` == ''
raise ArgumentError, "maven needs to be installed"
end
task :clean do
system("mvn clean")
end
task :compile do
system("mvn package")
end
else
Rake::ExtensionTask.new("protobuf_c", spec) do |ext|
ext.ext_dir = "ext/google/protobuf_c"
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
well_known_protos = %w[ well_known_protos = %w[
google/protobuf/any.proto google/protobuf/any.proto
google/protobuf/api.proto google/protobuf/api.proto
...@@ -55,13 +26,46 @@ proto2_protos = %w[ ...@@ -55,13 +26,46 @@ proto2_protos = %w[
genproto_output = [] genproto_output = []
well_known_protos.each do |proto_file| unless ENV['IN_DOCKER'] == 'true'
well_known_protos.each do |proto_file|
input_file = "../src/" + proto_file input_file = "../src/" + proto_file
output_file = "lib/" + proto_file.sub(/\.proto$/, ".rb") output_file = "lib/" + proto_file.sub(/\.proto$/, ".rb")
genproto_output << output_file genproto_output << output_file
file output_file => input_file do |file_task| file output_file => input_file do |file_task|
sh "../src/protoc -I../src --ruby_out=lib #{input_file}" sh "../src/protoc -I../src --ruby_out=lib #{input_file}"
end end
end
end
if RUBY_PLATFORM == "java"
if `which mvn` == ''
raise ArgumentError, "maven needs to be installed"
end
task :clean do
system("mvn clean")
end
task :compile do
system("mvn package")
end
else
Rake::ExtensionTask.new("protobuf_c", spec) do |ext|
ext.ext_dir = "ext/google/protobuf_c"
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 && IN_DOCKER=true rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.5:2.0.0"
end
task 'gem:native' => [:genproto, 'gem:windows']
end end
......
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "google-protobuf" s.name = "google-protobuf"
s.version = "3.0.0.alpha.5.0" s.version = "3.0.0.alpha.5.0.5"
s.licenses = ["BSD"] s.licenses = ["BSD"]
s.summary = "Protocol Buffers" s.summary = "Protocol Buffers"
s.description = "Protocol Buffers are Google's data interchange format." s.description = "Protocol Buffers are Google's data interchange format."
......
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