Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix source gem compilation #8471

Merged
merged 2 commits into from Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 17 additions & 11 deletions ruby/Rakefile
Expand Up @@ -24,6 +24,12 @@ proto2_protos = %w[
google/protobuf/compiler/plugin.proto
]

if system('../src/protoc --version')
protoc_command = '../src/protoc'
else
protoc_command = 'protoc'
end

genproto_output = []

# We won't have access to .. from within docker, but the proto files
Expand All @@ -34,7 +40,7 @@ unless ENV['IN_DOCKER'] == 'true'
output_file = "lib/" + proto_file.sub(/\.proto$/, "_pb.rb")
genproto_output << output_file
file output_file => input_file do |file_task|
sh "../src/protoc -I../src --ruby_out=lib #{input_file}"
sh "#{protoc_command} -I../src --ruby_out=lib #{input_file}"
end
end
end
Expand Down Expand Up @@ -108,43 +114,43 @@ genproto_output << "tests/multi_level_nesting_test.rb"
genproto_output << "tests/wrappers.rb"

file "tests/generated_code.rb" => "tests/generated_code.proto" do |file_task|
sh "../src/protoc --ruby_out=. tests/generated_code.proto"
sh "#{protoc_command} --ruby_out=. tests/generated_code.proto"
end

file "tests/generated_code_proto2.rb" => "tests/generated_code_proto2.proto" do |file_task|
sh "../src/protoc --ruby_out=. tests/generated_code_proto2.proto"
sh "#{protoc_command} --ruby_out=. tests/generated_code_proto2.proto"
end

file "tests/test_import.rb" => "tests/test_import.proto" do |file_task|
sh "../src/protoc --ruby_out=. tests/test_import.proto"
sh "#{protoc_command} --ruby_out=. tests/test_import.proto"
end

file "tests/test_import_proto2.rb" => "tests/test_import_proto2.proto" do |file_task|
sh "../src/protoc --ruby_out=. tests/test_import_proto2.proto"
sh "#{protoc_command} --ruby_out=. tests/test_import_proto2.proto"
end

file "tests/test_ruby_package.rb" => "tests/test_ruby_package.proto" do |file_task|
sh "../src/protoc --ruby_out=. tests/test_ruby_package.proto"
sh "#{protoc_command} --ruby_out=. tests/test_ruby_package.proto"
end

file "tests/test_ruby_package_proto2.rb" => "tests/test_ruby_package_proto2.proto" do |file_task|
sh "../src/protoc --ruby_out=. tests/test_ruby_package_proto2.proto"
sh "#{protoc_command} --ruby_out=. tests/test_ruby_package_proto2.proto"
end

file "tests/basic_test.rb" => "tests/basic_test.proto" do |file_task|
sh "../src/protoc --experimental_allow_proto3_optional -I../src -I. --ruby_out=. tests/basic_test.proto"
sh "#{protoc_command} --experimental_allow_proto3_optional -I../src -I. --ruby_out=. tests/basic_test.proto"
end

file "tests/basic_test_proto2.rb" => "tests/basic_test_proto2.proto" do |file_task|
sh "../src/protoc -I../src -I. --ruby_out=. tests/basic_test_proto2.proto"
sh "#{protoc_command} -I../src -I. --ruby_out=. tests/basic_test_proto2.proto"
end

file "tests/multi_level_nesting_test.rb" => "tests/multi_level_nesting_test.proto" do |file_task|
sh "../src/protoc -I../src -I. --ruby_out=. tests/multi_level_nesting_test.proto"
sh "#{protoc_command} -I../src -I. --ruby_out=. tests/multi_level_nesting_test.proto"
end

file "tests/wrappers.rb" => "../src/google/protobuf/wrappers.proto" do |file_task|
sh "../src/protoc -I../src -I. --ruby_out=tests ../src/google/protobuf/wrappers.proto"
sh "#{protoc_command} -I../src -I. --ruby_out=tests ../src/google/protobuf/wrappers.proto"
end

task :genproto => genproto_output
Expand Down
1 change: 1 addition & 0 deletions ruby/ext/google/protobuf_c/extconf.rb
Expand Up @@ -17,4 +17,5 @@
$objs = ["protobuf.o", "convert.o", "defs.o", "message.o",
"repeated_field.o", "map.o", "ruby-upb.o", "wrap_memcpy.o"]

find_header('third_party/wyhash/wyhash.h', '../../../..')
create_makefile("google/protobuf_c")