Sha256: 2359fe697899033c9c8a90aa305ed54e699d16d57b9c8d13559d11898784c625

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

require "bundler/gem_tasks"
begin
require "rake/extensiontask"
require "rake_compiler_dock"
require "shellwords"

spec = Bundler::GemHelper.gemspec

cross_platforms = ["x86-mingw32", "x64-mingw32"]
Rake::ExtensionTask.new("numo/narray", spec) do |ext|
  ext.cross_compile = true
  ext.cross_platform = cross_platforms
end

pkg_dir = "pkg"
windows_gem_paths = cross_platforms.collect do |platform|
  File.join(pkg_dir, "#{spec.full_name}-#{platform}.gem")
end

namespace :build do
  directory pkg_dir

  desc "Build gems for Windows into the pkg directory"
  task :windows => pkg_dir do
    build_dir = "tmp/windows"
    rm_rf build_dir
    mkdir_p build_dir

    commands = [
      ["git", "clone", "file://#{Dir.pwd}/.git", build_dir],
      ["cd", build_dir],
      ["bundle"],
      ["rake", "cross", "native", "gem"],
    ]
    raw_commands = commands.collect do |command|
      Shellwords.join(command)
    end
    raw_command_line = raw_commands.join(" && ")

    RakeCompilerDock.sh(raw_command_line)

    cp(Dir.glob("#{build_dir}/#{pkg_dir}/*.gem"),
       "#{pkg_dir}/")
  end
end

namespace :release do
  task :windows => "build:windows" do
    windows_gem_paths.each do |path|
      ruby("-S", "gem", "push", path)
    end
  end
end

rescue LoadError
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numo-narray-0.9.0.4 Rakefile
numo-narray-0.9.0.3-x86-mingw32 Rakefile
numo-narray-0.9.0.3-x64-mingw32 Rakefile