rake-compiler 1.1.9 → 1.2.1
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.md +20 -0
- data/README.md +1 -1
- data/lib/rake/baseextensiontask.rb +2 -6
- data/lib/rake/compiler_config.rb +38 -0
- data/lib/rake/extensiontask.rb +5 -6
- data/spec/lib/rake/compiler_config_spec.rb +54 -0
- data/spec/lib/rake/extensiontask_spec.rb +39 -21
- metadata +7 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 530d28062d0a6bc7601e7aec15adba736048594ad4e0026dff17594f4462a2ca
|
|
4
|
+
data.tar.gz: 94dea28437dd1dedaef5a48f7eb13672102bc11d43a371e755d593126cac20b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c4066120b1718f19299eacfee717a8efd7ca381078124e38107b372f3925791b9016aa6048bd773c6aebf6875e94937cb5eff38365e759c665102e6f55e8b1f
|
|
7
|
+
data.tar.gz: 804376554f6efa4c5b4e62b28b2d18cbffb0273c0de6e0bbc3fb7674dc4669a1bab83e121c3dd2bb1f5c1a1cffc89b5977ca96410c7599b589affbe075c0abd9
|
data/History.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
### 1.2.1 / 2022-12-16
|
|
2
|
+
|
|
3
|
+
* Enhancements:
|
|
4
|
+
* GH-209: Added support for RubyGems 3.3.21 or later.
|
|
5
|
+
[Patch by Mike Dalessio]
|
|
6
|
+
|
|
7
|
+
* Fixes:
|
|
8
|
+
* GH-208: Fixed a typo in documentation.
|
|
9
|
+
[Patch by Garen Torikian]
|
|
10
|
+
|
|
11
|
+
* Thanks:
|
|
12
|
+
* Garen Torikian
|
|
13
|
+
* Mike Dalessio
|
|
14
|
+
|
|
15
|
+
### 1.2.0 / 2022-04-15
|
|
16
|
+
|
|
17
|
+
* Enhancements:
|
|
18
|
+
* Defer requiring `yaml`.
|
|
19
|
+
[ruby/stringio#21](https://github.com/ruby/stringio/issues/21)
|
|
20
|
+
|
|
1
21
|
### 1.1.9 / 2022-01-22
|
|
2
22
|
|
|
3
23
|
* Enhancements:
|
data/README.md
CHANGED
|
@@ -241,7 +241,7 @@ several settings for `Rake::ExtensionTask`:
|
|
|
241
241
|
| no_native | ExtensionTask (CRuby) | [Optional] Set to true to prevent non-CRuby platforms from defining native tasks. Default: `false`. |
|
|
242
242
|
| config_includes | ExtensionTask (CRuby) | [Optional] Specify an Array of paths to include as `-I...:...` includes during compilation. Default: `['.']`. |
|
|
243
243
|
| classpath | JavaExtensionTask | [Optional] Specify additional classpath paths as an Array. Default: _Uses the current CLASSPATH._ |
|
|
244
|
-
| debug | JavaExtensionTask | [Optional] Whether to set the debug flag during
|
|
244
|
+
| debug | JavaExtensionTask | [Optional] Whether to set the debug flag during compilation. Default: `false`. |
|
|
245
245
|
| source_version | JavaExtensionTask | [Optional] The JRE version that your source code requires to compile. Default: `1.6`. |
|
|
246
246
|
| target_version | JavaExtensionTask | [Optional] The oldest JRE version you want to support. Default: `1.6`. |
|
|
247
247
|
| encoding | JavaExtensionTask | [Optional] Specify an -encoding option to provide to the compiler. Default: `nil`. |
|
|
@@ -3,14 +3,10 @@ require 'rake/clean'
|
|
|
3
3
|
require 'rake/tasklib'
|
|
4
4
|
require 'rbconfig'
|
|
5
5
|
|
|
6
|
-
begin
|
|
7
|
-
require 'psych'
|
|
8
|
-
rescue LoadError
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
require 'yaml'
|
|
12
6
|
require 'pathname'
|
|
13
7
|
|
|
8
|
+
require_relative "compiler_config"
|
|
9
|
+
|
|
14
10
|
module Rake
|
|
15
11
|
class BaseExtensionTask < TaskLib
|
|
16
12
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Rake
|
|
2
|
+
class CompilerConfig
|
|
3
|
+
def initialize(config_path)
|
|
4
|
+
require "yaml"
|
|
5
|
+
@config = YAML.load_file(config_path)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def find(ruby_version, gem_platform)
|
|
9
|
+
gem_platform = Gem::Platform.new(gem_platform)
|
|
10
|
+
|
|
11
|
+
@config.each do |config_name, config_location|
|
|
12
|
+
# There are two variations we might find in the rake-compiler config.yml
|
|
13
|
+
#
|
|
14
|
+
# 1. config_name: rbconfig-x86_64-linux-3.0.0
|
|
15
|
+
# runtime_platform_name: x86_64-linux
|
|
16
|
+
# runtime_version: 3.0.0
|
|
17
|
+
#
|
|
18
|
+
# 2. config_name: rbconfig-x86_64-linux-gnu-3.0.0
|
|
19
|
+
# runtime_platform_name: x86_64-linux-gnu
|
|
20
|
+
# runtime_version: 3.0.0
|
|
21
|
+
#
|
|
22
|
+
# With rubygems < 3.3.21, both variations will be present (two entries pointing at the same
|
|
23
|
+
# installation).
|
|
24
|
+
#
|
|
25
|
+
# With rubygems >= 3.3.21, only the second variation will be present.
|
|
26
|
+
runtime_platform_name = config_name.split("-")[1..-2].join("-")
|
|
27
|
+
runtime_version = config_name.split("-").last
|
|
28
|
+
runtime_platform = Gem::Platform.new(runtime_platform_name)
|
|
29
|
+
|
|
30
|
+
if (ruby_version == runtime_version) && (gem_platform =~ runtime_platform)
|
|
31
|
+
return config_location
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
nil
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data/lib/rake/extensiontask.rb
CHANGED
|
@@ -393,7 +393,11 @@ Java extension should be preferred.
|
|
|
393
393
|
return
|
|
394
394
|
end
|
|
395
395
|
|
|
396
|
-
|
|
396
|
+
rbconfig_file = Rake::CompilerConfig.new(config_path).find(ruby_ver, for_platform)
|
|
397
|
+
unless rbconfig_file
|
|
398
|
+
warn "no configuration section for specified version of Ruby (rbconfig-#{for_platform}-#{ruby_ver})"
|
|
399
|
+
return
|
|
400
|
+
end
|
|
397
401
|
|
|
398
402
|
# tmp_path
|
|
399
403
|
tmp_path = "#{@tmp_dir}/#{for_platform}/#{@name}/#{ruby_ver}"
|
|
@@ -404,11 +408,6 @@ Java extension should be preferred.
|
|
|
404
408
|
# lib_binary_path
|
|
405
409
|
lib_binary_path = "#{lib_path}/#{File.basename(binary(for_platform))}"
|
|
406
410
|
|
|
407
|
-
unless rbconfig_file = config_file["rbconfig-#{for_platform}-#{ruby_ver}"] then
|
|
408
|
-
warn "no configuration section for specified version of Ruby (rbconfig-#{for_platform}-#{ruby_ver})"
|
|
409
|
-
return
|
|
410
|
-
end
|
|
411
|
-
|
|
412
411
|
# mkmf
|
|
413
412
|
mkmf_file = File.expand_path(File.join(File.dirname(rbconfig_file), '..', 'mkmf.rb'))
|
|
414
413
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
+
|
|
3
|
+
require 'rake/extensiontask'
|
|
4
|
+
require 'rbconfig'
|
|
5
|
+
require 'tempfile'
|
|
6
|
+
|
|
7
|
+
describe Rake::CompilerConfig do
|
|
8
|
+
def config_file(contents)
|
|
9
|
+
Tempfile.new.tap do |tf|
|
|
10
|
+
tf.write(contents)
|
|
11
|
+
tf.close
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "returns the matching config for exact platform match" do
|
|
16
|
+
cc = Rake::CompilerConfig.new(config_file(<<~CONFIG))
|
|
17
|
+
---
|
|
18
|
+
rbconfig-x86_64-linux-3.0.0: "/path/to/aaa/rbconfig.rb"
|
|
19
|
+
rbconfig-x86_64-darwin-3.1.0: "/path/to/bbb/rbconfig.rb"
|
|
20
|
+
rbconfig-x86_64-linux-3.1.0: "/path/to/ccc/rbconfig.rb"
|
|
21
|
+
CONFIG
|
|
22
|
+
|
|
23
|
+
expect(cc.find("3.0.0", "x86_64-linux")).to eq("/path/to/aaa/rbconfig.rb")
|
|
24
|
+
expect(cc.find("3.1.0", "x86_64-darwin")).to eq("/path/to/bbb/rbconfig.rb")
|
|
25
|
+
expect(cc.find("3.1.0", "x86_64-linux")).to eq("/path/to/ccc/rbconfig.rb")
|
|
26
|
+
|
|
27
|
+
expect(cc.find("2.7.0", "x86_64-linux")).to be_nil
|
|
28
|
+
expect(cc.find("3.1.0", "arm64-linux")).to be_nil
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "returns the matching config for inexact platform match" do
|
|
32
|
+
cc = Rake::CompilerConfig.new(config_file(<<~CONFIG))
|
|
33
|
+
---
|
|
34
|
+
rbconfig-x86_64-linux-gnu-3.0.0: "/path/to/aaa/rbconfig.rb"
|
|
35
|
+
rbconfig-x86_64-linux-musl-3.1.0: "/path/to/bbb/rbconfig.rb"
|
|
36
|
+
CONFIG
|
|
37
|
+
|
|
38
|
+
expect(cc.find("3.0.0", "x86_64-linux")).to eq("/path/to/aaa/rbconfig.rb")
|
|
39
|
+
expect(cc.find("3.1.0", "x86_64-linux")).to eq("/path/to/bbb/rbconfig.rb")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "does not match the other way around" do
|
|
43
|
+
if Gem::Version.new(Gem::VERSION) < Gem::Version.new("3.3.21")
|
|
44
|
+
skip "rubygems 3.3.21+ only"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
cc = Rake::CompilerConfig.new(config_file(<<~CONFIG))
|
|
48
|
+
---
|
|
49
|
+
rbconfig-x86_64-linux-3.1.0: "/path/to/bbb/rbconfig.rb"
|
|
50
|
+
CONFIG
|
|
51
|
+
|
|
52
|
+
expect(cc.find("3.1.0", "x86_64-linux-musl")).to be_nil
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -2,6 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
|
2
2
|
|
|
3
3
|
require 'rake/extensiontask'
|
|
4
4
|
require 'rbconfig'
|
|
5
|
+
require 'yaml'
|
|
5
6
|
|
|
6
7
|
describe Rake::ExtensionTask do
|
|
7
8
|
context '#new' do
|
|
@@ -380,9 +381,10 @@ describe Rake::ExtensionTask do
|
|
|
380
381
|
end
|
|
381
382
|
|
|
382
383
|
it 'should warn if no section of config file defines running version of ruby' do
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
384
|
+
allow_any_instance_of(Rake::CompilerConfig).to(
|
|
385
|
+
receive(:find).with(@ruby_ver, @platform).and_return(nil)
|
|
386
|
+
)
|
|
387
|
+
|
|
386
388
|
out, err = capture_output do
|
|
387
389
|
Rake::ExtensionTask.new('extension_one') do |ext|
|
|
388
390
|
ext.cross_compile = true
|
|
@@ -402,9 +404,9 @@ describe Rake::ExtensionTask do
|
|
|
402
404
|
end
|
|
403
405
|
|
|
404
406
|
it 'should generate additional rake tasks if files are added when cross compiling' do
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
407
|
+
allow_any_instance_of(Rake::CompilerConfig).to(
|
|
408
|
+
receive(:find).and_return("/rubies/1.9.1/rbconfig.rb")
|
|
409
|
+
)
|
|
408
410
|
|
|
409
411
|
# Use a real spec instead of a mock because define_native_tasks dups and
|
|
410
412
|
# calls methods on Gem::Specification, which is more than mock can do.
|
|
@@ -432,9 +434,11 @@ describe Rake::ExtensionTask do
|
|
|
432
434
|
end
|
|
433
435
|
|
|
434
436
|
it 'should allow usage of RUBY_CC_VERSION to indicate a different version of ruby' do
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
437
|
+
allow_any_instance_of(Rake::CompilerConfig).to(
|
|
438
|
+
receive(:find)
|
|
439
|
+
.with("1.9.1", "i386-mingw32")
|
|
440
|
+
.and_return("/rubies/1.9.1/rbconfig.rb")
|
|
441
|
+
)
|
|
438
442
|
|
|
439
443
|
ENV['RUBY_CC_VERSION'] = '1.9.1'
|
|
440
444
|
Rake::ExtensionTask.new('extension_one') do |ext|
|
|
@@ -443,10 +447,16 @@ describe Rake::ExtensionTask do
|
|
|
443
447
|
end
|
|
444
448
|
|
|
445
449
|
it 'should allow multiple versions be supplied to RUBY_CC_VERSION' do
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
+
allow_any_instance_of(Rake::CompilerConfig).to(
|
|
451
|
+
receive(:find)
|
|
452
|
+
.with("1.8.6", "i386-mingw32")
|
|
453
|
+
.and_return("/rubies/1.8.6/rbconfig.rb")
|
|
454
|
+
)
|
|
455
|
+
allow_any_instance_of(Rake::CompilerConfig).to(
|
|
456
|
+
receive(:find)
|
|
457
|
+
.with("1.9.1", "i386-mingw32")
|
|
458
|
+
.and_return("/rubies/1.9.1/rbconfig.rb")
|
|
459
|
+
)
|
|
450
460
|
|
|
451
461
|
ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.1'
|
|
452
462
|
Rake::ExtensionTask.new('extension_one') do |ext|
|
|
@@ -458,18 +468,19 @@ describe Rake::ExtensionTask do
|
|
|
458
468
|
platforms = ["x86-mingw32", "x64-mingw32"]
|
|
459
469
|
ruby_cc_versions = ["1.8.6", "2.1.10", "2.2.6", "2.3.3", "2.10.1", "2.11.0"]
|
|
460
470
|
ENV["RUBY_CC_VERSION"] = ruby_cc_versions.join(":")
|
|
461
|
-
|
|
471
|
+
|
|
462
472
|
ruby_cc_versions.each do |ruby_cc_version|
|
|
463
473
|
platforms.each do |platform|
|
|
464
474
|
unless platform == "x64-mingw32" && ruby_cc_version == "2.11.0"
|
|
465
475
|
rbconf = "/rubies/#{ruby_cc_version}/rbconfig.rb"
|
|
466
476
|
end
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
477
|
+
allow_any_instance_of(Rake::CompilerConfig).to(
|
|
478
|
+
receive(:find)
|
|
479
|
+
.with(ruby_cc_version, platform)
|
|
480
|
+
.and_return(rbconf)
|
|
481
|
+
)
|
|
470
482
|
end
|
|
471
483
|
end
|
|
472
|
-
allow(YAML).to receive(:load_file).and_return(config)
|
|
473
484
|
|
|
474
485
|
allow(Gem).to receive_message_chain(:configuration, :verbose=).and_return(true)
|
|
475
486
|
|
|
@@ -514,9 +525,16 @@ describe Rake::ExtensionTask do
|
|
|
514
525
|
|
|
515
526
|
context "(cross compile for multiple versions)" do
|
|
516
527
|
before :each do
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
528
|
+
allow_any_instance_of(Rake::CompilerConfig).to(
|
|
529
|
+
receive(:find)
|
|
530
|
+
.with("1.8.6", "universal-unknown")
|
|
531
|
+
.and_return("/rubies/1.8.6/rbconfig.rb")
|
|
532
|
+
)
|
|
533
|
+
allow_any_instance_of(Rake::CompilerConfig).to(
|
|
534
|
+
receive(:find)
|
|
535
|
+
.with("1.9.1", "universal-unknown")
|
|
536
|
+
.and_return("/rubies/1.9.1/rbconfig.rb")
|
|
537
|
+
)
|
|
520
538
|
|
|
521
539
|
ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.1'
|
|
522
540
|
@ext = Rake::ExtensionTask.new('extension_one') do |ext|
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rake-compiler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kouhei Sutou
|
|
8
8
|
- Luis Lavena
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2022-
|
|
12
|
+
date: 2022-12-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rake
|
|
@@ -108,9 +108,11 @@ files:
|
|
|
108
108
|
- features/support/generator_helpers.rb
|
|
109
109
|
- features/support/platform_extension_helpers.rb
|
|
110
110
|
- lib/rake/baseextensiontask.rb
|
|
111
|
+
- lib/rake/compiler_config.rb
|
|
111
112
|
- lib/rake/extensioncompiler.rb
|
|
112
113
|
- lib/rake/extensiontask.rb
|
|
113
114
|
- lib/rake/javaextensiontask.rb
|
|
115
|
+
- spec/lib/rake/compiler_config_spec.rb
|
|
114
116
|
- spec/lib/rake/extensiontask_spec.rb
|
|
115
117
|
- spec/lib/rake/javaextensiontask_spec.rb
|
|
116
118
|
- spec/spec.opts
|
|
@@ -126,7 +128,7 @@ homepage: https://github.com/rake-compiler/rake-compiler
|
|
|
126
128
|
licenses:
|
|
127
129
|
- MIT
|
|
128
130
|
metadata: {}
|
|
129
|
-
post_install_message:
|
|
131
|
+
post_install_message:
|
|
130
132
|
rdoc_options:
|
|
131
133
|
- "--main"
|
|
132
134
|
- README.md
|
|
@@ -146,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
146
148
|
version: 1.8.23
|
|
147
149
|
requirements: []
|
|
148
150
|
rubygems_version: 3.4.0.dev
|
|
149
|
-
signing_key:
|
|
151
|
+
signing_key:
|
|
150
152
|
specification_version: 4
|
|
151
153
|
summary: Rake-based Ruby Extension (C, Java) task generator.
|
|
152
154
|
test_files: []
|