diff options
author | Josh Haberman <jhaberman@gmail.com> | 2016-03-03 14:08:54 -0800 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2016-03-03 14:08:54 -0800 |
commit | 513875da7770f4190fe7b1938638ded96c396c48 (patch) | |
tree | d00b29b56f9e5ff6a85351eb72db6b11a406a528 /ruby/Rakefile | |
parent | 78105897a8f01c7be9cf8502b6c58d47eb1ccdd7 (diff) | |
download | protobuf-513875da7770f4190fe7b1938638ded96c396c48.tar.gz protobuf-513875da7770f4190fe7b1938638ded96c396c48.tar.bz2 protobuf-513875da7770f4190fe7b1938638ded96c396c48.zip |
Generate well-known types in Ruby extension and prune unneeded proto2 dependencies.
Diffstat (limited to 'ruby/Rakefile')
-rw-r--r-- | ruby/Rakefile | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/ruby/Rakefile b/ruby/Rakefile index 81c3119e..8eb7a2df 100644 --- a/ruby/Rakefile +++ b/ruby/Rakefile @@ -34,6 +34,49 @@ else end end +well_known_protos = %w[ + google/protobuf/any.proto + google/protobuf/api.proto + google/protobuf/duration.proto + google/protobuf/empty.proto + google/protobuf/field_mask.proto + google/protobuf/source_context.proto + google/protobuf/struct.proto + google/protobuf/timestamp.proto + google/protobuf/type.proto + google/protobuf/wrappers.proto +] + +# These are omitted for now because we don't support proto2. +proto2_protos = %w[ + google/protobuf/descriptor.proto + google/protobuf/compiler/plugin.proto +] + +genproto_output = [] + +well_known_protos.each do |proto_file| + input_file = "../src/" + proto_file + output_file = "lib/" + proto_file.sub(/\.proto$/, ".rb") + genproto_output << output_file + file output_file => input_file do |file_task| + sh "../src/protoc -I../src --ruby_out=lib #{input_file}" + end +end + + +# Proto for tests. +genproto_output << "tests/generated_code.rb" +file "tests/generated_code.rb" => "tests/generated_code.proto" do |file_task| + sh "../src/protoc --ruby_out=. tests/generated_code.proto" +end + +task :genproto => genproto_output + +task :clean do + sh "rm -f #{genproto_output.join(' ')}" +end + Gem::PackageTask.new(spec) do |pkg| end @@ -41,7 +84,7 @@ Rake::TestTask.new(:test => :build) do |t| t.test_files = FileList["tests/*.rb"] end -task :build => [:clean, :compile] +task :build => [:clean, :compile, :genproto] task :default => [:build] # vim:sw=2:et |