aboutsummaryrefslogtreecommitdiff
path: root/ruby/Rakefile
diff options
context:
space:
mode:
authorJisi Liu <jisi.liu@gmail.com>2016-03-30 11:43:44 -0700
committerJisi Liu <jisi.liu@gmail.com>2016-03-30 11:43:44 -0700
commit0de06f54bc8253ba39eee9e8cc4c5de487a48835 (patch)
treee66dec08e23df554f5c29a1dbb4592388815e4ec /ruby/Rakefile
parent3b3c8abb9635eb3ea078a821a99c9ef29d66dff7 (diff)
parenta25e9964b126a79e8a99bced2207ddca22d6a1a9 (diff)
downloadprotobuf-0de06f54bc8253ba39eee9e8cc4c5de487a48835.tar.gz
protobuf-0de06f54bc8253ba39eee9e8cc4c5de487a48835.tar.bz2
protobuf-0de06f54bc8253ba39eee9e8cc4c5de487a48835.zip
Merge branch 'master' of github.com:google/protobuf
Diffstat (limited to 'ruby/Rakefile')
-rw-r--r--ruby/Rakefile45
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