2020-03-12 12:49:22 +09:00
|
|
|
# -*- ruby -*-
|
|
|
|
|
#
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
|
# distributed with this work for additional information
|
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
|
# to you 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
|
|
|
|
|
#
|
|
|
|
|
# http://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 "pkg-config"
|
|
|
|
|
|
|
|
|
|
base_dir = File.join(__dir__)
|
|
|
|
|
|
|
|
|
|
packages = []
|
|
|
|
|
Dir.glob("#{base_dir}/*/*.gemspec") do |gemspec|
|
|
|
|
|
package = File.basename(File.dirname(gemspec))
|
2025-12-01 10:41:51 +09:00
|
|
|
if package == "red-arrow-format"
|
2025-12-11 07:02:09 +09:00
|
|
|
next if RUBY_VERSION < "3.2.0"
|
2025-12-01 10:41:51 +09:00
|
|
|
else
|
|
|
|
|
glib_package_name = package.gsub(/\Ared-/, "") + "-glib"
|
|
|
|
|
next unless PKGConfig.exist?(glib_package_name)
|
|
|
|
|
end
|
2020-03-12 12:49:22 +09:00
|
|
|
packages << package
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
packages.each do |package|
|
2021-11-06 16:45:22 +09:00
|
|
|
namespace package do
|
2026-03-21 17:59:16 +09:00
|
|
|
package_dir = File.join(base_dir, package)
|
|
|
|
|
|
2021-11-06 16:45:22 +09:00
|
|
|
desc "Run test for #{package}"
|
|
|
|
|
task :test do
|
2026-03-21 17:59:16 +09:00
|
|
|
cd(package_dir) do
|
2021-11-06 16:45:22 +09:00
|
|
|
if ENV["USE_BUNDLER"]
|
|
|
|
|
sh("bundle", "exec", "rake", "test")
|
|
|
|
|
else
|
|
|
|
|
ruby("-S", "rake", "test")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2026-03-21 17:59:16 +09:00
|
|
|
desc "Run benchmark for #{package}"
|
|
|
|
|
task :benchmark do
|
|
|
|
|
cd(package_dir) do
|
|
|
|
|
if File.directory?("benchmark")
|
|
|
|
|
if ENV["USE_BUNDLER"]
|
|
|
|
|
sh("bundle", "exec", "rake", "benchmark")
|
|
|
|
|
else
|
|
|
|
|
ruby("-S", "rake", "benchmark")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-11-06 16:45:22 +09:00
|
|
|
desc "Install #{package}"
|
|
|
|
|
task :install do
|
2026-03-21 17:59:16 +09:00
|
|
|
cd(package_dir) do
|
2021-11-06 16:45:22 +09:00
|
|
|
if ENV["USE_BUNDLER"]
|
|
|
|
|
sh("bundle", "exec", "rake", "install")
|
|
|
|
|
else
|
|
|
|
|
ruby("-S", "rake", "install")
|
|
|
|
|
end
|
2020-12-21 09:58:05 +09:00
|
|
|
end
|
2020-03-12 12:49:22 +09:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
sorted_packages = packages.sort_by do |package|
|
|
|
|
|
if package == "red-arrow"
|
|
|
|
|
"000-#{package}"
|
|
|
|
|
else
|
|
|
|
|
package
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc "Run test for all packages"
|
2021-11-06 16:45:22 +09:00
|
|
|
task test: sorted_packages.collect {|package| "#{package}:test"}
|
|
|
|
|
|
2026-03-21 17:59:16 +09:00
|
|
|
desc "Run benchmark for all packages"
|
|
|
|
|
task benchmark: sorted_packages.collect {|package| "#{package}:benchmark"}
|
|
|
|
|
|
2021-11-06 16:45:22 +09:00
|
|
|
desc "Install all packages"
|
|
|
|
|
task install: sorted_packages.collect {|package| "#{package}:install"}
|
2020-03-12 12:49:22 +09:00
|
|
|
|
2021-11-06 16:45:22 +09:00
|
|
|
task default: :test
|