This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix extern static warning See rust-lang/rust#35112
- Loading branch information
1 parent
4c45ec5
commit 9a67ce7
Showing
20 changed files
with
441 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
target | ||
Cargo.lock | ||
.vscode | ||
*.o | ||
*.a | ||
*.so | ||
*.dylib | ||
*.bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target | ||
*.bundle | ||
*.gem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "duration" | ||
version = "0.1.0" | ||
authors = ["Godfrey Chan <[email protected]>"] | ||
|
||
[lib] | ||
|
||
crate-type = ["staticlib"] | ||
|
||
[dependencies] | ||
|
||
libc = "*" | ||
|
||
[dependencies.libcruby-sys] | ||
|
||
path = "../../crates/libcruby-sys" | ||
|
||
[dependencies.helix] | ||
|
||
path = "../.." | ||
|
||
[profile.release] | ||
|
||
lto = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source 'https://rubygems.org' | ||
|
||
gemspec | ||
|
||
gem 'helix_runtime', path: '../../ruby' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
PATH | ||
remote: ../../ruby | ||
specs: | ||
helix_runtime (0.5.0) | ||
|
||
PATH | ||
remote: . | ||
specs: | ||
duration (0.1.0) | ||
helix_runtime | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
minitest (5.8.3) | ||
rake (10.5.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
bundler (~> 1.11) | ||
duration! | ||
helix_runtime! | ||
minitest (~> 5.0) | ||
rake (~> 10.0) | ||
|
||
BUNDLED WITH | ||
1.12.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'rake/clean' | ||
require 'rake/testtask' | ||
require 'bundler/setup' | ||
require 'bundler/gem_tasks' | ||
|
||
directory 'target' | ||
directory 'lib/duration' | ||
|
||
task :cargo_build do | ||
sh "cargo build --release" | ||
end | ||
CLEAN.include('target') | ||
|
||
file "lib/duration/native.bundle" => ['lib/duration', :cargo_build] do | ||
sh "gcc -Wl,-force_load,target/release/libduration.a --shared -Wl,-undefined,dynamic_lookup -o lib/duration/native.bundle" | ||
end | ||
CLOBBER.include('lib/duration/native.bundle') | ||
|
||
task :irb => "lib/duration/native.bundle" do | ||
exec "irb -Ilib -rduration" | ||
end | ||
|
||
task :benchmark => "lib/duration/native.bundle" do | ||
exec "ruby -Ilib benchmark.rb" | ||
end | ||
|
||
Rake::TestTask.new(:test) do |t| | ||
t.libs << "test" | ||
t.libs << "lib" | ||
t.test_files = FileList['test/**/*_test.rb'] | ||
end | ||
|
||
task :test => "lib/duration/native.bundle" | ||
task :default => :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# coding: utf-8 | ||
lib = File.expand_path('../lib', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require 'duration/version' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "duration" | ||
spec.version = Duration::VERSION | ||
spec.authors = ["Godfrey Chan"] | ||
spec.email = ["[email protected]"] | ||
|
||
spec.summary = "Rust ActiveSupport::Duration" | ||
spec.license = "MIT" | ||
|
||
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or | ||
# delete this section to allow pushing this gem to any host. | ||
if spec.respond_to?(:metadata) | ||
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" | ||
else | ||
raise "RubyGems 2.0 or newer is required to protect against public gem pushes." | ||
end | ||
|
||
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } | ||
spec.bindir = "exe" | ||
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } | ||
spec.require_paths = ["lib"] | ||
|
||
spec.add_runtime_dependency "helix_runtime" | ||
spec.add_development_dependency "bundler", "~> 1.11" | ||
spec.add_development_dependency "rake", "~> 10.0" | ||
spec.add_development_dependency "minitest", "~> 5.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require "helix_runtime" | ||
require "duration/native" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Duration | ||
VERSION = "0.1.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#[macro_use] | ||
extern crate helix; | ||
|
||
declare_types! { | ||
class Duration { | ||
struct { | ||
inner: u32 | ||
} | ||
|
||
def initialize() -> Duration { | ||
Duration { inner: 0 } | ||
} | ||
|
||
def inspect(self) -> String { | ||
format!("{}", self.inner) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'test_helper' | ||
|
||
class DurationTest < Minitest::Test | ||
def test_blank | ||
assert_equal 'zomg', Duration.new.inspect | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) | ||
require 'duration' | ||
|
||
require 'minitest/autorun' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.