Skip to content

Commit

Permalink
Merge pull request #6 from driv3r/improve-build-for-mac
Browse files Browse the repository at this point in the history
Improve build for mac
  • Loading branch information
Leszek Zalewski authored Jan 14, 2021
2 parents 94ab462 + ceba320 commit 3f8bf8c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.3.2]
### Changed
- Support broader range of MacOS systems with prebuild binaries
- Cleanup default prebuild binaries after gem installation to reduce used disc space

## [0.3.1]
### Changed
- Package pre-build binaries together
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Currently during heavy development.

## Installation

> **NOTE**: Compilation requires openssl-dev / openssl-devel package
Add this line to your application's Gemfile:

```ruby
Expand Down
6 changes: 4 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ task build: ["thermite:build"] do
next
end

puts "Make #{thermite.config.ruby_extension_path} a #{Gem::Platform.local} default implementation"
platform = "#{Gem::Platform.local.cpu}-#{Gem::Platform.local.os}"

puts "Make #{thermite.config.ruby_extension_path} a #{platform} default implementation"
FileUtils.cp(thermite.config.ruby_extension_path,
"#{thermite.config.ruby_extension_path}.#{Gem::Platform.local}.default")
"#{thermite.config.ruby_extension_path}.#{platform}.default")
end

task default: %i[build thermite:test spec rubocop]
15 changes: 12 additions & 3 deletions ext/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ thermite = Thermite::Tasks.new(cargo_project_path: project_dir,
ruby_project_path: project_dir,
optional_rust_extension: true)

namespace :thermite do
namespace :thermite do # rubocop:disable Metrics/BlockLength
desc "Clean up default binaries"
task :clean_binnaries do
puts "Cleaning up"
Dir["#{thermite.config.ruby_extension_path}.*.default"].each do |file|
FileUtils.rm(file)
end
end

desc "Try to build extension if cargo is available or setup default lib"
task :build_or_default do
default_ext_path = "#{thermite.config.ruby_extension_path}.#{Gem::Platform.local}.default"
platform = "#{Gem::Platform.local.cpu}-#{Gem::Platform.local.os}"
default_ext_path = "#{thermite.config.ruby_extension_path}.#{platform}.default"

if thermite.cargo
profile = ENV.fetch("CARGO_PROFILE", "release")
Expand Down Expand Up @@ -39,4 +48,4 @@ namespace :thermite do
end
end

task default: %w[thermite:build_or_default thermite:cargo_clean]
task default: %w[thermite:build_or_default thermite:cargo_clean thermite:clean_binnaries]
2 changes: 1 addition & 1 deletion lib/rusty_json_schema/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module RustyJSONSchema

VERSION = "0.3.1"
VERSION = "0.3.2"

end

0 comments on commit 3f8bf8c

Please sign in to comment.