Sha256: 2c5ae153cc239128e199b3b5bfca757b4b3d543acff1406a21e5b2ef0e865e3f

Contents?: true

Size: 1.57 KB

Versions: 22

Compression:

Stored size: 1.57 KB

Contents

require "rake/extensiontask"
require "rake_compiler_dock"
require "minitest/test_task"

CLEAN.add("lib/**/*.{o,so,bundle}", "pkg")

cross_platforms = %w[
  aarch64-linux
  arm-linux
  arm64-darwin
  x64-mingw-ucrt
  x64-mingw32
  x86-linux
  x86-mingw32
  x86_64-darwin
  x86_64-linux
].freeze

ENV["RUBY_CC_VERSION"] = %w[3.3.0 3.2.0 3.1.0 3.0.0 2.7.0 2.6.0].join(":")

gemspec = Gem::Specification.load("argon2id.gemspec")

Gem::PackageTask.new(gemspec).define

namespace :java do
  java_gemspec = gemspec.dup
  java_gemspec.files.reject! { |path| File.fnmatch?("ext/*", path) }
  java_gemspec.extensions.clear
  java_gemspec.platform = Gem::Platform.new("java")
  java_gemspec.required_ruby_version = ">= 3.1.0"

  Gem::PackageTask.new(java_gemspec).define
end

Rake::ExtensionTask.new("argon2id", gemspec) do |e|
  e.lib_dir = "lib/argon2id"
  e.cross_compile = true
  e.cross_platform = cross_platforms
end

Minitest::TestTask.create

begin
  require "ruby_memcheck"

  namespace :test do
    RubyMemcheck::TestTask.new(valgrind: :compile)
  end
rescue LoadError
  # Only define the test:valgrind task if ruby_memcheck is installed
end

namespace :gem do
  cross_platforms.each do |platform|
    desc "Compile and build native gem for #{platform}"
    task platform do
      RakeCompilerDock.sh <<~SCRIPT, platform: platform, verbose: true
        gem install bundler --no-document &&
        bundle &&
        bundle exec rake native:#{platform} pkg/#{gemspec.full_name}-#{Gem::Platform.new(platform)}.gem PATH="/usr/local/bin:$PATH"
      SCRIPT
    end
  end
end

task default: [:compile, :test]

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
argon2id-0.7.0 Rakefile
argon2id-0.7.0-x86_64-linux Rakefile
argon2id-0.7.0-x86_64-darwin Rakefile
argon2id-0.7.0-x86-mingw32 Rakefile
argon2id-0.7.0-x86-linux Rakefile
argon2id-0.7.0-x64-mingw32 Rakefile
argon2id-0.7.0-x64-mingw-ucrt Rakefile
argon2id-0.7.0-java Rakefile
argon2id-0.7.0-arm64-darwin Rakefile
argon2id-0.7.0-arm-linux Rakefile
argon2id-0.7.0-aarch64-linux Rakefile
argon2id-0.6.0 Rakefile
argon2id-0.6.0-x86_64-linux Rakefile
argon2id-0.6.0-x86_64-darwin Rakefile
argon2id-0.6.0-x86-mingw32 Rakefile
argon2id-0.6.0-x86-linux Rakefile
argon2id-0.6.0-x64-mingw32 Rakefile
argon2id-0.6.0-x64-mingw-ucrt Rakefile
argon2id-0.6.0-java Rakefile
argon2id-0.6.0-arm64-darwin Rakefile