# frozen_string_literal: true # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'bundler/gem_tasks' desc "Compile the necessary protobuf files." task :compile_protos do Rake::Task[:clean_protos].invoke FileUtils.mkdir 'lib' protos = [ "../googleapis/google/api/*.proto", "../googleapis/google/logging/type/*.proto", "../googleapis/google/longrunning/*.proto", "../googleapis/google/rpc/*.proto", "../googleapis/google/type/*.proto", ] command = [] command << "grpc_tools_ruby_protoc" command << "--ruby_out=lib" command << "-I ../googleapis" command += protos full_command = command.join " " puts full_command system full_command end desc "Remove the compiled protos." task :clean_protos do FileUtils.rm_rf "lib" end desc "Run the CI build" task :ci do puts "\nCompiling Protos\n" Rake::Task[:compile_protos].invoke end Rake::Task[:build].enhance [:compile_protos] Rake::Task[:clean].enhance [:clean_protos] task default: :ci