Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: third_party/protobuf/ruby/Rakefile

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Update to new HEAD (b7632464b4) + restore GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 require "rubygems" 1 require "rubygems"
2 require "rubygems/package_task" 2 require "rubygems/package_task"
3 require "rake/extensiontask" unless RUBY_PLATFORM == "java" 3 require "rake/extensiontask" unless RUBY_PLATFORM == "java"
4 require "rake/testtask" 4 require "rake/testtask"
5 5
6 spec = Gem::Specification.load("google-protobuf.gemspec") 6 spec = Gem::Specification.load("google-protobuf.gemspec")
7 7
8 well_known_protos = %w[ 8 well_known_protos = %w[
9 google/protobuf/any.proto 9 google/protobuf/any.proto
10 google/protobuf/api.proto 10 google/protobuf/api.proto
(...skipping 13 matching lines...) Expand all
24 google/protobuf/compiler/plugin.proto 24 google/protobuf/compiler/plugin.proto
25 ] 25 ]
26 26
27 genproto_output = [] 27 genproto_output = []
28 28
29 # We won't have access to .. from within docker, but the proto files 29 # We won't have access to .. from within docker, but the proto files
30 # will be there, thanks to the :genproto rule dependency for gem:native. 30 # will be there, thanks to the :genproto rule dependency for gem:native.
31 unless ENV['IN_DOCKER'] == 'true' 31 unless ENV['IN_DOCKER'] == 'true'
32 well_known_protos.each do |proto_file| 32 well_known_protos.each do |proto_file|
33 input_file = "../src/" + proto_file 33 input_file = "../src/" + proto_file
34 output_file = "lib/" + proto_file.sub(/\.proto$/, ".rb") 34 output_file = "lib/" + proto_file.sub(/\.proto$/, "_pb.rb")
35 genproto_output << output_file 35 genproto_output << output_file
36 file output_file => input_file do |file_task| 36 file output_file => input_file do |file_task|
37 sh "../src/protoc -I../src --ruby_out=lib #{input_file}" 37 sh "../src/protoc -I../src --ruby_out=lib #{input_file}"
38 end 38 end
39 end 39 end
40 end 40 end
41 41
42 if RUBY_PLATFORM == "java" 42 if RUBY_PLATFORM == "java"
43 if `which mvn` == '' 43 if `which mvn` == ''
44 raise ArgumentError, "maven needs to be installed" 44 raise ArgumentError, "maven needs to be installed"
(...skipping 28 matching lines...) Expand all
73 system "rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.5:2.0.0" 73 system "rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.5:2.0.0"
74 end 74 end
75 else 75 else
76 task 'gem:native' => [:genproto, 'gem:windows'] 76 task 'gem:native' => [:genproto, 'gem:windows']
77 end 77 end
78 end 78 end
79 79
80 80
81 # Proto for tests. 81 # Proto for tests.
82 genproto_output << "tests/generated_code.rb" 82 genproto_output << "tests/generated_code.rb"
83 genproto_output << "tests/test_import.rb"
83 file "tests/generated_code.rb" => "tests/generated_code.proto" do |file_task| 84 file "tests/generated_code.rb" => "tests/generated_code.proto" do |file_task|
84 sh "../src/protoc --ruby_out=. tests/generated_code.proto" 85 sh "../src/protoc --ruby_out=. tests/generated_code.proto"
85 end 86 end
86 87
88 file "tests/test_import.rb" => "tests/test_import.proto" do |file_task|
89 sh "../src/protoc --ruby_out=. tests/test_import.proto"
90 end
91
87 task :genproto => genproto_output 92 task :genproto => genproto_output
88 93
89 task :clean do 94 task :clean do
90 sh "rm -f #{genproto_output.join(' ')}" 95 sh "rm -f #{genproto_output.join(' ')}"
91 end 96 end
92 97
93 Gem::PackageTask.new(spec) do |pkg| 98 Gem::PackageTask.new(spec) do |pkg|
94 end 99 end
95 100
96 Rake::TestTask.new(:test => :build) do |t| 101 Rake::TestTask.new(:test => :build) do |t|
97 t.test_files = FileList["tests/*.rb"] 102 t.test_files = FileList["tests/*.rb"]
98 end 103 end
99 104
100 task :build => [:clean, :compile, :genproto] 105 task :build => [:clean, :compile, :genproto]
101 task :default => [:build] 106 task :default => [:build]
102 107
103 # vim:sw=2:et 108 # vim:sw=2:et
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698