Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Thermite to build extension #6

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/Gemfile.lock
/pkg
/target
/target
mkmf.log
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ crate-type = ["dylib"]
wasmer-runtime = "0.4.0"
wasmer-runtime-core = "0.4.0"
rutie = "0.5.4"
lazy_static = "1.3.0"
lazy_static = "1.3.0"

[package.metadata.thermite]
github_releases = true
15 changes: 4 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
require "rbconfig"
require "bundler/gem_tasks"
require "rake/testtask"
require "thermite/tasks"

desc 'Build the Rust extension'
task :build_lib do
sh 'cargo build --release'
end

desc 'Install the bundle'
task :bundle_install do
sh 'bundle install'
end

Rake::TestTask.new(test: [:bundle_install, :build_lib]) do |t|
Rake::TestTask.new(test: ["thermite:build", "thermite:test"]) do |t|
t.libs << "tests"
t.libs << "lib"
t.test_files = FileList["tests/**/*_test.rb"]
end

Thermite::Tasks.new

task :default => :test
5 changes: 5 additions & 0 deletions ext/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require "thermite/tasks"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a Rakefile file at the root of this project. It is used by the gemspec file. I reckon we can merge the two Rakefile files.


project_dir = File.dirname(File.dirname(__FILE__))
Thermite::Tasks.new(cargo_project_path: project_dir, ruby_project_path: project_dir)
task default: %w(thermite:build)
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compile and install the Ruby extension.
build:
rake build_lib
rake thermite:build

# Run the tests.
test:
Expand Down
3 changes: 2 additions & 1 deletion wasmer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/wasmerio/ruby-ext-wasm"
spec.license = "BSD-3-Clause"

spec.extensions = %w(Rakefile)
spec.extensions = %w(ext/Rakefile)

spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(examples|tests)/}) }
Expand All @@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
spec.require_paths = %w(lib)

spec.add_dependency "rutie", "~> 0.0.3"
spec.add_runtime_dependency "thermite", "~> 0"
spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "minitest", "~> 5.0"
Expand Down