|  | @@ -5,6 +5,40 @@ require "rake/testtask"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  spec = Gem::Specification.load("google-protobuf.gemspec")
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +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 = []
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +# We won't have access to .. from within docker, but the proto files
 | 
	
		
			
				|  |  | +# will be there, thanks to the :genproto rule dependency for gem:native.
 | 
	
		
			
				|  |  | +unless ENV['IN_DOCKER'] == 'true'
 | 
	
		
			
				|  |  | +  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
 | 
	
		
			
				|  |  | +end
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  if RUBY_PLATFORM == "java"
 | 
	
		
			
				|  |  |    if `which mvn` == ''
 | 
	
		
			
				|  |  |      raise ArgumentError, "maven needs to be installed"
 | 
	
	
		
			
				|  | @@ -30,37 +64,15 @@ else
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    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"
 | 
	
		
			
				|  |  | +    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
 | 
	
		
			
				|  |  | -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}"
 | 
	
		
			
				|  |  | +  if RUBY_PLATFORM =~ /darwin/
 | 
	
		
			
				|  |  | +    task 'gem:native' do
 | 
	
		
			
				|  |  | +      system "rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.5:2.0.0"
 | 
	
		
			
				|  |  | +    end
 | 
	
		
			
				|  |  | +  else
 | 
	
		
			
				|  |  | +    task 'gem:native' => [:genproto, 'gem:windows']
 | 
	
		
			
				|  |  |    end
 | 
	
		
			
				|  |  |  end
 | 
	
		
			
				|  |  |  
 |