rake-compiler 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.txt +6 -0
- data/lib/rake/extensiontask.rb +19 -0
- data/spec/lib/rake/extensiontask_spec.rb +40 -0
- data/tasks/gem.rake +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f72eedd0e2aa8b6e09dff6eaf2a4b5d64b3b47d
|
4
|
+
data.tar.gz: ccdcaf324ce4011c959c278cd04a3552d4ca2156
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2c14d6ef462ae69a1b80b7239da013fe9d3c7e80af0582df6bb09f1f1d0327acda0edbccab15881a158cc17a8b3c3baf8ca9988f56e5c370f85279ecda482de
|
7
|
+
data.tar.gz: 7a72083b3c95e41af61f5552ce39fbca484db1383e171b45d87577a72084be67999911b550747a59d04f5211ba9f3bdac4c06deb357a7800dfcc6ebb66ddc6ef
|
data/History.txt
CHANGED
data/lib/rake/extensiontask.rb
CHANGED
@@ -25,6 +25,7 @@ module Rake
|
|
25
25
|
@cross_compiling = nil
|
26
26
|
@no_native = false
|
27
27
|
@config_includes = []
|
28
|
+
@ruby_versions_per_platform = Hash.new([])
|
28
29
|
end
|
29
30
|
|
30
31
|
def cross_platform
|
@@ -253,6 +254,13 @@ Java extension should be preferred.
|
|
253
254
|
# adjust to specified platform
|
254
255
|
spec.platform = Gem::Platform.new(platf)
|
255
256
|
|
257
|
+
# set ruby version constraints
|
258
|
+
cross_rubies = @ruby_versions_per_platform[platf]
|
259
|
+
spec.required_ruby_version = [
|
260
|
+
">= #{version_ary2str( cross_rubies.min[0,2] )}",
|
261
|
+
"< #{version_ary2str( cross_rubies.max[0,2].succ )}"
|
262
|
+
]
|
263
|
+
|
256
264
|
# clear the extensions defined in the specs
|
257
265
|
spec.extensions.clear
|
258
266
|
|
@@ -346,6 +354,9 @@ Java extension should be preferred.
|
|
346
354
|
@lib_dir = "#{@lib_dir}/#{$1}"
|
347
355
|
end
|
348
356
|
|
357
|
+
# Update cross compiled platform/version combinations
|
358
|
+
@ruby_versions_per_platform[for_platform] << version_str2ary(version)
|
359
|
+
|
349
360
|
define_cross_platform_tasks_with_version(for_platform, version)
|
350
361
|
|
351
362
|
# restore lib_dir
|
@@ -497,6 +508,14 @@ Java extension should be preferred.
|
|
497
508
|
[*@cross_platform].map { |p| "native:#{p}" }
|
498
509
|
end
|
499
510
|
|
511
|
+
def version_str2ary(version_string)
|
512
|
+
version_string[/\A[^-]+/].split(".").map(&:to_i).pack("C*")
|
513
|
+
end
|
514
|
+
|
515
|
+
def version_ary2str(version_ary)
|
516
|
+
version_ary.unpack("C*").join(".")
|
517
|
+
end
|
518
|
+
|
500
519
|
def fake_rb(platform, version)
|
501
520
|
<<-FAKE_RB
|
502
521
|
# Pre-load resolver library before faking, in order to avoid error
|
@@ -454,6 +454,46 @@ describe Rake::ExtensionTask do
|
|
454
454
|
end
|
455
455
|
end
|
456
456
|
|
457
|
+
it "should set required_ruby_version from RUBY_CC_VERSION" do
|
458
|
+
platforms = ["x86-mingw32", "x64-mingw32"]
|
459
|
+
ruby_cc_versions = ["2.1.10", "2.2.6", "2.3.3"]
|
460
|
+
ENV["RUBY_CC_VERSION"] = ruby_cc_versions.join(":")
|
461
|
+
config = mock(Hash)
|
462
|
+
ruby_cc_versions.each do |ruby_cc_version|
|
463
|
+
platforms.each do |platform|
|
464
|
+
config.stub!(:[]).
|
465
|
+
with("rbconfig-#{platform}-#{ruby_cc_version}").
|
466
|
+
and_return("/rubies/#{ruby_cc_version}/rbconfig.rb")
|
467
|
+
end
|
468
|
+
end
|
469
|
+
YAML.stub!(:load_file).and_return(config)
|
470
|
+
|
471
|
+
Gem.stub_chain(:configuration, :verbose=).and_return(true)
|
472
|
+
|
473
|
+
spec = Gem::Specification.new do |s|
|
474
|
+
s.name = 'my_gem'
|
475
|
+
s.platform = Gem::Platform::RUBY
|
476
|
+
end
|
477
|
+
|
478
|
+
cross_specs = []
|
479
|
+
Rake::ExtensionTask.new("extension_one", spec) do |ext|
|
480
|
+
ext.cross_platform = platforms
|
481
|
+
ext.cross_compile = true
|
482
|
+
ext.cross_compiling do |cross_spec|
|
483
|
+
cross_specs << cross_spec
|
484
|
+
end
|
485
|
+
end
|
486
|
+
platforms.each do |platform|
|
487
|
+
Rake::Task["native:my_gem:#{platform}"].execute
|
488
|
+
end
|
489
|
+
|
490
|
+
expected_required_ruby_versions = [
|
491
|
+
Gem::Requirement.new([">= 2.1", "< 2.4"]),
|
492
|
+
Gem::Requirement.new([">= 2.1", "< 2.4"]),
|
493
|
+
]
|
494
|
+
cross_specs.collect(&:required_ruby_version).should == expected_required_ruby_versions
|
495
|
+
end
|
496
|
+
|
457
497
|
after :each do
|
458
498
|
ENV.delete('RUBY_CC_VERSION')
|
459
499
|
end
|
data/tasks/gem.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: 1.8.23
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project: rake-compiler
|
137
|
-
rubygems_version: 2.5.
|
137
|
+
rubygems_version: 2.5.2
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Rake-based Ruby Extension (C, Java) task generator.
|