]> git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/ruby/red-arrow/Rakefile
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / ruby / red-arrow / Rakefile
1 # -*- ruby -*-
2 #
3 # Licensed to the Apache Software Foundation (ASF) under one
4 # or more contributor license agreements. See the NOTICE file
5 # distributed with this work for additional information
6 # regarding copyright ownership. The ASF licenses this file
7 # to you under the Apache License, Version 2.0 (the
8 # "License"); you may not use this file except in compliance
9 # with the License. You may obtain a copy of the License at
10 #
11 # http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing,
14 # software distributed under the License is distributed on an
15 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 # KIND, either express or implied. See the License for the
17 # specific language governing permissions and limitations
18 # under the License.
19
20 require "bundler/gem_helper"
21 require "rake/clean"
22 require "yard"
23
24 base_dir = File.join(__dir__)
25
26 helper = Bundler::GemHelper.new(base_dir)
27 helper.install
28 spec = helper.gemspec
29
30 release_task = Rake::Task["release"]
31 release_task.prerequisites.replace(["build", "release:rubygem_push"])
32
33 def run_extconf(build_dir, extension_dir, *arguments)
34 cd(build_dir) do
35 ruby(File.join(extension_dir, "extconf.rb"),
36 *arguments)
37 end
38 end
39
40 spec.extensions.each do |extension|
41 extension_dir = File.join(base_dir, File.dirname(extension))
42 build_dir = ENV["BUILD_DIR"]
43 if build_dir
44 build_dir = File.join(build_dir, "red-arrow")
45 directory build_dir
46 else
47 build_dir = extension_dir
48 end
49 CLOBBER << File.join(build_dir, "Makefile")
50 CLOBBER << File.join(build_dir, "mkmf.log")
51
52 makefile = File.join(build_dir, "Makefile")
53 file makefile => build_dir do
54 run_extconf(build_dir, extension_dir)
55 end
56
57 desc "Configure"
58 task :configure => build_dir do
59 run_extconf(build_dir, extension_dir)
60 end
61
62 desc "Compile"
63 task :compile => makefile do
64 cd(build_dir) do
65 sh("make")
66 end
67 end
68
69 task :clean do
70 cd(build_dir) do
71 sh("make", "clean") if File.exist?("Makefile")
72 end
73 end
74 end
75
76 desc "Run tests"
77 task :test do
78 cd(base_dir) do
79 ruby("test/run-test.rb")
80 end
81 end
82
83 task default: :test
84
85 desc "Run benchmarks"
86 task :benchmark do
87 benchmarks = if ENV["BENCHMARKS"]
88 ENV["BENCHMARKS"].split
89 else
90 FileList["benchmark/{,*/**/}*.yml"]
91 end
92 cd(base_dir) do
93 benchmarks.each do |benchmark|
94 sh("benchmark-driver", benchmark)
95 end
96 end
97 end
98
99 YARD::Rake::YardocTask.new do |task|
100 end