rake-compiler 1.1.5 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +24 -0
- data/lib/rake/baseextensiontask.rb +2 -2
- data/lib/rake/extensiontask.rb +27 -20
- data/lib/rake/javaextensiontask.rb +30 -11
- data/spec/lib/rake/extensiontask_spec.rb +6 -3
- data/spec/lib/rake/javaextensiontask_spec.rb +25 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dac2b65206bc383a7e2f5bca57d0ef5f6b2e0a79d94af9cfefac60f9b91577a
|
4
|
+
data.tar.gz: 4e7592c9bd0bfa0a2bdcdb8bfe0a67ccff6d0ce47d4d51b68b3c17156083c9dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc0df40a879127c77bc137af890bd8880395963ce6b133e4ac4c3b2ec207d42503dc67a04856f0d07410161ebd5bd4401dad049afdf2ce9fa8abcaeee9a61df8
|
7
|
+
data.tar.gz: bd91ba1ed6881011a69870933873cd5112a5c6af3ee4fc2977992201e403deb2ffdc31eea874f1b7f32bd3b515b06b7e474fc5bb943f1e381c99d25dfd216205
|
data/History.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
### 1.1.9 / 2022-01-22
|
2
|
+
|
3
|
+
* Enhancements:
|
4
|
+
* Add support for `--release` option to build JRuby extension.
|
5
|
+
[#200](https://github.com/rake-compiler/rake-compiler/issues/200) [Reported by Pavel Rosický]
|
6
|
+
[#201](https://github.com/rake-compiler/rake-compiler/issues/201) [Patch by Satoshi Tagomori]
|
7
|
+
|
8
|
+
### 1.1.8 / 2022-01-18
|
9
|
+
|
10
|
+
* Fixes:
|
11
|
+
* Fix wrong `required_ruby_version` when some `RUBY_CC_VERSION`s are missing.
|
12
|
+
[#198](https://github.com/rake-compiler/rake-compiler/issues/198) [Patch by Lars Kanis]
|
13
|
+
|
14
|
+
### 1.1.7 / 2022-01-04
|
15
|
+
|
16
|
+
* Fixes:
|
17
|
+
* Fix binary paths for staging and clobber.
|
18
|
+
[#197](https://github.com/rake-compiler/rake-compiler/issues/197) [Patch by konsolebox]
|
19
|
+
|
20
|
+
### 1.1.6 / 2021-12-12
|
21
|
+
|
22
|
+
* Fixes:
|
23
|
+
* Fix a regression bug that `Symbol` can't be used for `name` of `Rake::ExtensionTask.new`.
|
24
|
+
|
1
25
|
### 1.1.5 / 2021-12-12
|
2
26
|
|
3
27
|
* Fixes:
|
@@ -40,8 +40,8 @@ module Rake
|
|
40
40
|
@tmp_dir = 'tmp'
|
41
41
|
@ext_dir = "ext/#{@name}"
|
42
42
|
@lib_dir = 'lib'
|
43
|
-
if @name and File.dirname(@name) != "."
|
44
|
-
@lib_dir += "/#{File.dirname(@name)}"
|
43
|
+
if @name and File.dirname(@name.to_s) != "."
|
44
|
+
@lib_dir += "/#{File.dirname(@name.to_s)}"
|
45
45
|
end
|
46
46
|
@config_options = []
|
47
47
|
@extra_options = ARGV.select { |i| i =~ /\A--?/ }
|
data/lib/rake/extensiontask.rb
CHANGED
@@ -82,9 +82,12 @@ module Rake
|
|
82
82
|
private
|
83
83
|
# copy other gem files to staging directory
|
84
84
|
def define_staging_file_tasks(files, lib_path, stage_path, platf, ruby_ver)
|
85
|
+
# lib_binary_path
|
86
|
+
lib_binary_path = "#{lib_path}/#{File.basename(binary(platf))}"
|
87
|
+
|
85
88
|
files.each do |gem_file|
|
86
89
|
# ignore directories and the binary extension
|
87
|
-
next if File.directory?(gem_file) || gem_file ==
|
90
|
+
next if File.directory?(gem_file) || gem_file == lib_binary_path
|
88
91
|
stage_file = "#{stage_path}/#{gem_file}"
|
89
92
|
|
90
93
|
# copy each file from base to stage directory
|
@@ -105,12 +108,13 @@ module Rake
|
|
105
108
|
platf = for_platform || platform
|
106
109
|
|
107
110
|
binary_path = binary(platf)
|
111
|
+
binary_base_name = File.basename(binary_path)
|
108
112
|
|
109
113
|
# lib_path
|
110
114
|
lib_path = lib_dir
|
111
115
|
|
112
|
-
lib_binary_path
|
113
|
-
|
116
|
+
# lib_binary_path
|
117
|
+
lib_binary_path = "#{lib_path}/#{binary_base_name}"
|
114
118
|
|
115
119
|
# tmp_path
|
116
120
|
tmp_path = "#{@tmp_dir}/#{platf}/#{@name}/#{ruby_ver}"
|
@@ -119,19 +123,19 @@ module Rake
|
|
119
123
|
siteconf_path = "#{tmp_path}/.rake-compiler-siteconf.rb"
|
120
124
|
tmp_binary_path = "#{tmp_path}/#{binary_path}"
|
121
125
|
tmp_binary_dir_path = File.dirname(tmp_binary_path)
|
122
|
-
stage_binary_path = "#{stage_path}/#{
|
126
|
+
stage_binary_path = "#{stage_path}/#{lib_binary_path}"
|
123
127
|
stage_binary_dir_path = File.dirname(stage_binary_path)
|
124
128
|
|
125
129
|
# cleanup and clobbering
|
126
130
|
CLEAN.include(tmp_path)
|
127
131
|
CLEAN.include(stage_path)
|
128
|
-
CLOBBER.include(
|
132
|
+
CLOBBER.include(lib_binary_path)
|
129
133
|
CLOBBER.include("#{@tmp_dir}")
|
130
134
|
|
131
135
|
# directories we need
|
132
136
|
directory tmp_path
|
133
137
|
directory tmp_binary_dir_path
|
134
|
-
directory
|
138
|
+
directory lib_path
|
135
139
|
directory stage_binary_dir_path
|
136
140
|
|
137
141
|
directory File.dirname(siteconf_path)
|
@@ -150,7 +154,7 @@ module Rake
|
|
150
154
|
|
151
155
|
# copy binary from temporary location to final lib
|
152
156
|
# tmp/extension_name/extension_name.{so,bundle} => lib/
|
153
|
-
task "copy:#{@name}:#{platf}:#{ruby_ver}" => [
|
157
|
+
task "copy:#{@name}:#{platf}:#{ruby_ver}" => [lib_path, tmp_binary_path, "#{tmp_path}/Makefile"] do
|
154
158
|
# install in lib for native platform only
|
155
159
|
unless for_platform
|
156
160
|
sh "#{make} install target_prefix=", chdir: tmp_path
|
@@ -175,8 +179,8 @@ Java extension should be preferred.
|
|
175
179
|
|
176
180
|
chdir tmp_path do
|
177
181
|
sh make
|
178
|
-
if binary_path !=
|
179
|
-
cp
|
182
|
+
if binary_path != binary_base_name
|
183
|
+
cp binary_base_name, binary_path
|
180
184
|
end
|
181
185
|
end
|
182
186
|
end
|
@@ -237,7 +241,7 @@ Java extension should be preferred.
|
|
237
241
|
# platform matches the indicated one.
|
238
242
|
if platf == RUBY_PLATFORM then
|
239
243
|
# ensure file is always copied
|
240
|
-
file
|
244
|
+
file lib_binary_path => ["copy:#{name}:#{platf}:#{ruby_ver}"]
|
241
245
|
|
242
246
|
task "compile:#{@name}" => ["compile:#{@name}:#{platf}"]
|
243
247
|
task "compile" => ["compile:#{platf}"]
|
@@ -253,6 +257,9 @@ Java extension should be preferred.
|
|
253
257
|
# lib_path
|
254
258
|
lib_path = lib_dir
|
255
259
|
|
260
|
+
# lib_binary_path
|
261
|
+
lib_binary_path = "#{lib_path}/#{File.basename(binary(platf))}"
|
262
|
+
|
256
263
|
# Update compiled platform/version combinations
|
257
264
|
@ruby_versions_per_platform[platf] << ruby_ver
|
258
265
|
|
@@ -332,13 +339,13 @@ Java extension should be preferred.
|
|
332
339
|
end
|
333
340
|
|
334
341
|
# add binaries to the dependency chain
|
335
|
-
task "native:#{@gem_spec.name}:#{platf}" => ["#{stage_path}/#{
|
342
|
+
task "native:#{@gem_spec.name}:#{platf}" => ["#{stage_path}/#{lib_binary_path}"]
|
336
343
|
|
337
344
|
# ensure the extension get copied
|
338
|
-
unless Rake::Task.task_defined?(
|
339
|
-
file
|
345
|
+
unless Rake::Task.task_defined?(lib_binary_path) then
|
346
|
+
file lib_binary_path => ["copy:#{@name}:#{platf}:#{ruby_ver}"]
|
340
347
|
end
|
341
|
-
file "#{stage_path}/#{
|
348
|
+
file "#{stage_path}/#{lib_binary_path}" => ["copy:#{@name}:#{platf}:#{ruby_ver}"]
|
342
349
|
|
343
350
|
# Allow segmented packaging by platform (open door for 'cross compile')
|
344
351
|
task "native:#{platf}" => ["native:#{@gem_spec.name}:#{platf}"]
|
@@ -370,9 +377,6 @@ Java extension should be preferred.
|
|
370
377
|
@lib_dir = "#{@lib_dir}/#{$1}"
|
371
378
|
end
|
372
379
|
|
373
|
-
# Update cross compiled platform/version combinations
|
374
|
-
@ruby_versions_per_platform[for_platform] << version
|
375
|
-
|
376
380
|
define_cross_platform_tasks_with_version(for_platform, version)
|
377
381
|
|
378
382
|
# restore lib_dir
|
@@ -397,6 +401,9 @@ Java extension should be preferred.
|
|
397
401
|
# lib_path
|
398
402
|
lib_path = lib_dir
|
399
403
|
|
404
|
+
# lib_binary_path
|
405
|
+
lib_binary_path = "#{lib_path}/#{File.basename(binary(for_platform))}"
|
406
|
+
|
400
407
|
unless rbconfig_file = config_file["rbconfig-#{for_platform}-#{ruby_ver}"] then
|
401
408
|
warn "no configuration section for specified version of Ruby (rbconfig-#{for_platform}-#{ruby_ver})"
|
402
409
|
return
|
@@ -463,12 +470,12 @@ Java extension should be preferred.
|
|
463
470
|
|
464
471
|
# clear lib/binary dependencies and trigger cross platform ones
|
465
472
|
# check if lib/binary is defined (damn bundle versus so versus dll)
|
466
|
-
if Rake::Task.task_defined?(
|
467
|
-
Rake::Task[
|
473
|
+
if Rake::Task.task_defined?(lib_binary_path) then
|
474
|
+
Rake::Task[lib_binary_path].prerequisites.clear
|
468
475
|
end
|
469
476
|
|
470
477
|
# FIXME: targeting multiple platforms copies the file twice
|
471
|
-
file
|
478
|
+
file lib_binary_path => ["copy:#{@name}:#{for_platform}:#{ruby_ver}"]
|
472
479
|
|
473
480
|
# if everything for native task is in place
|
474
481
|
if @gem_spec && @gem_spec.platform == 'ruby' then
|
@@ -17,6 +17,9 @@ module Rake
|
|
17
17
|
# Generate class files for specific VM version
|
18
18
|
attr_accessor :target_version
|
19
19
|
|
20
|
+
# Compile for oldeer platform version
|
21
|
+
attr_accessor :release
|
22
|
+
|
20
23
|
attr_accessor :encoding
|
21
24
|
|
22
25
|
# Specify lint option
|
@@ -37,6 +40,7 @@ module Rake
|
|
37
40
|
@debug = false
|
38
41
|
@source_version = '1.7'
|
39
42
|
@target_version = '1.7'
|
43
|
+
@release = nil
|
40
44
|
@encoding = nil
|
41
45
|
@java_compiling = nil
|
42
46
|
@lint_option = nil
|
@@ -53,15 +57,20 @@ module Rake
|
|
53
57
|
# platform usage
|
54
58
|
platf = for_platform || platform
|
55
59
|
|
60
|
+
binary_path = binary(platf)
|
61
|
+
|
56
62
|
# lib_path
|
57
63
|
lib_path = lib_dir
|
58
64
|
|
65
|
+
# lib_binary_path
|
66
|
+
lib_binary_path = "#{lib_path}/#{File.basename(binary_path)}"
|
67
|
+
|
59
68
|
# tmp_path
|
60
69
|
tmp_path = "#{@tmp_dir}/#{platf}/#{@name}"
|
61
70
|
|
62
71
|
# cleanup and clobbering
|
63
72
|
CLEAN.include(tmp_path)
|
64
|
-
CLOBBER.include(
|
73
|
+
CLOBBER.include(lib_binary_path)
|
65
74
|
CLOBBER.include("#{@tmp_dir}")
|
66
75
|
|
67
76
|
# directories we need
|
@@ -70,11 +79,11 @@ module Rake
|
|
70
79
|
|
71
80
|
# copy binary from temporary location to final lib
|
72
81
|
# tmp/extension_name/extension_name.{so,bundle} => lib/
|
73
|
-
task "copy:#{@name}:#{platf}" => [lib_path, "#{tmp_path}/#{
|
74
|
-
install "#{tmp_path}/#{
|
82
|
+
task "copy:#{@name}:#{platf}" => [lib_path, "#{tmp_path}/#{binary_path}"] do
|
83
|
+
install "#{tmp_path}/#{binary_path}", lib_binary_path
|
75
84
|
end
|
76
85
|
|
77
|
-
file "#{tmp_path}/#{
|
86
|
+
file "#{tmp_path}/#{binary_path}" => "#{tmp_path}/.build" do
|
78
87
|
|
79
88
|
class_files = FileList["#{tmp_path}/**/*.class"].
|
80
89
|
gsub("#{tmp_path}/", '')
|
@@ -86,7 +95,7 @@ module Rake
|
|
86
95
|
["-C #{tmp_path}", path]
|
87
96
|
}.flatten
|
88
97
|
|
89
|
-
sh "jar cf #{tmp_path}/#{
|
98
|
+
sh "jar cf #{tmp_path}/#{binary_path} #{args.join(' ')}"
|
90
99
|
end
|
91
100
|
|
92
101
|
file "#{tmp_path}/.build" => [tmp_path] + source_files do
|
@@ -101,8 +110,7 @@ execute the Rake compilation task using the JRuby interpreter.
|
|
101
110
|
|
102
111
|
javac_command_line = [
|
103
112
|
"javac",
|
104
|
-
|
105
|
-
"-source", @source_version,
|
113
|
+
*java_target_args,
|
106
114
|
java_lint_arg,
|
107
115
|
"-d", tmp_path,
|
108
116
|
]
|
@@ -137,7 +145,7 @@ execute the Rake compilation task using the JRuby interpreter.
|
|
137
145
|
# platform matches the indicated one.
|
138
146
|
if platf == RUBY_PLATFORM then
|
139
147
|
# ensure file is always copied
|
140
|
-
file
|
148
|
+
file lib_binary_path => ["copy:#{name}:#{platf}"]
|
141
149
|
|
142
150
|
task "compile:#{@name}" => ["compile:#{@name}:#{platf}"]
|
143
151
|
task "compile" => ["compile:#{platf}"]
|
@@ -184,12 +192,15 @@ execute the Rake compilation task using the JRuby interpreter.
|
|
184
192
|
end
|
185
193
|
end
|
186
194
|
|
195
|
+
# lib_binary_path
|
196
|
+
lib_binary_path = "#{lib_path}/#{File.basename(binary(platform))}"
|
197
|
+
|
187
198
|
# add binaries to the dependency chain
|
188
|
-
task "java:#{@gem_spec.name}" => [
|
199
|
+
task "java:#{@gem_spec.name}" => [lib_binary_path]
|
189
200
|
|
190
201
|
# ensure the extension get copied
|
191
|
-
unless Rake::Task.task_defined?(
|
192
|
-
file
|
202
|
+
unless Rake::Task.task_defined?(lib_binary_path) then
|
203
|
+
file lib_binary_path => ["copy:#{name}:#{platform}"]
|
193
204
|
end
|
194
205
|
|
195
206
|
task 'java' => ["java:#{@gem_spec.name}"]
|
@@ -200,6 +211,14 @@ execute the Rake compilation task using the JRuby interpreter.
|
|
200
211
|
end
|
201
212
|
end
|
202
213
|
|
214
|
+
def java_target_args
|
215
|
+
if @release
|
216
|
+
["--release=#{@release}"]
|
217
|
+
else
|
218
|
+
["-target", @target_version, "-source", @source_version]
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
203
222
|
#
|
204
223
|
# Discover Java Extension Directories and build an extdirs arguments
|
205
224
|
#
|
@@ -456,14 +456,17 @@ describe Rake::ExtensionTask do
|
|
456
456
|
|
457
457
|
it "should set required_ruby_version from RUBY_CC_VERSION, set platform, clear extensions but keep metadata" do
|
458
458
|
platforms = ["x86-mingw32", "x64-mingw32"]
|
459
|
-
ruby_cc_versions = ["1.8.6", "2.1.10", "2.2.6", "2.3.3", "2.10.1"]
|
459
|
+
ruby_cc_versions = ["1.8.6", "2.1.10", "2.2.6", "2.3.3", "2.10.1", "2.11.0"]
|
460
460
|
ENV["RUBY_CC_VERSION"] = ruby_cc_versions.join(":")
|
461
461
|
config = Hash.new
|
462
462
|
ruby_cc_versions.each do |ruby_cc_version|
|
463
463
|
platforms.each do |platform|
|
464
|
+
unless platform == "x64-mingw32" && ruby_cc_version == "2.11.0"
|
465
|
+
rbconf = "/rubies/#{ruby_cc_version}/rbconfig.rb"
|
466
|
+
end
|
464
467
|
allow(config).to receive(:[]).
|
465
468
|
with("rbconfig-#{platform}-#{ruby_cc_version}").
|
466
|
-
and_return(
|
469
|
+
and_return(rbconf)
|
467
470
|
end
|
468
471
|
end
|
469
472
|
allow(YAML).to receive(:load_file).and_return(config)
|
@@ -490,7 +493,7 @@ describe Rake::ExtensionTask do
|
|
490
493
|
end
|
491
494
|
|
492
495
|
expected_required_ruby_versions = [
|
493
|
-
Gem::Requirement.new([">= 1.8", "< 2.
|
496
|
+
Gem::Requirement.new([">= 1.8", "< 2.12.dev"]),
|
494
497
|
Gem::Requirement.new([">= 1.8", "< 2.11.dev"]),
|
495
498
|
]
|
496
499
|
cross_specs.collect(&:required_ruby_version).should == expected_required_ruby_versions
|
@@ -175,11 +175,13 @@ describe Rake::JavaExtensionTask do
|
|
175
175
|
let(:extension) do
|
176
176
|
Rake::JavaExtensionTask.new('extension_two') do |ext|
|
177
177
|
ext.lint_option = lint_option if lint_option
|
178
|
+
ext.release = release if release
|
178
179
|
end
|
179
180
|
end
|
180
181
|
|
181
182
|
context 'without a specified lint option' do
|
182
183
|
let(:lint_option) { nil }
|
184
|
+
let(:release) { nil }
|
183
185
|
|
184
186
|
it 'should honor the lint option' do
|
185
187
|
(extension.lint_option).should be_falsey
|
@@ -189,12 +191,35 @@ describe Rake::JavaExtensionTask do
|
|
189
191
|
|
190
192
|
context "with a specified lint option of 'deprecated'" do
|
191
193
|
let(:lint_option) { 'deprecated'.freeze }
|
194
|
+
let(:release) { nil }
|
192
195
|
|
193
196
|
it 'should honor the lint option' do
|
194
197
|
(extension.lint_option).should eq lint_option
|
195
198
|
(extension.send :java_lint_arg).should eq '-Xlint:deprecated'
|
196
199
|
end
|
197
200
|
end
|
201
|
+
|
202
|
+
context "without release option" do
|
203
|
+
let(:lint_option) { nil }
|
204
|
+
let(:release) { nil }
|
205
|
+
|
206
|
+
it 'should generate -target and -source build options' do
|
207
|
+
extension.target_version = "1.8"
|
208
|
+
extension.source_version = "1.8"
|
209
|
+
(extension.send :java_target_args).should eq ["-target", "1.8", "-source", "1.8"]
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
context "with release option" do
|
214
|
+
let(:lint_option) { nil }
|
215
|
+
let(:release) { '8' }
|
216
|
+
|
217
|
+
it 'should generate --release option even with target_version/source_version' do
|
218
|
+
extension.target_version = "1.8"
|
219
|
+
extension.source_version = "1.8"
|
220
|
+
(extension.send :java_target_args).should eq ["--release=8"]
|
221
|
+
end
|
222
|
+
end
|
198
223
|
end
|
199
224
|
end
|
200
225
|
private
|
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.1.
|
4
|
+
version: 1.1.9
|
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:
|
12
|
+
date: 2022-01-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: 1.8.23
|
147
147
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
148
|
+
rubygems_version: 3.4.0.dev
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: Rake-based Ruby Extension (C, Java) task generator.
|