rake-compiler 1.1.7 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02cad822f10b4321127ce0c91ecb9ce1b7465897be75cb63864598f67a0862f9
4
- data.tar.gz: e892ced800adc8b779b7a248f726590d2a9967c6efb95817778af4b51f650d4a
3
+ metadata.gz: 168f62a83a0e87ed5dd8ddc21151082d826a18af8baa3319be221704fd559e1b
4
+ data.tar.gz: 62247a212ea5dce5803ef33d4490d3a6a982e5bf78716a5da0339e1c980b467a
5
5
  SHA512:
6
- metadata.gz: b773ca5038495c9301561f7f093dd292a90c8987d71964234359e742e159e3dcceba66762a12c161a79b60c0d8eb55b2fc1d65dfb186a64b8905ea75148090f5
7
- data.tar.gz: 281a93c3f8e00a01ede2150bff92f8898406fef693192d1a83710eb7e40c07e53229f91aeee8c661489a4901e81c702e8d55f667858f59ddeb47f8f93da75ab3
6
+ metadata.gz: 5857be6b32518649261bb405df56b6986083e019f38621801323aea374544a9771c30bca2f7cc539c7fc8cd4f0cc44b8861f93bab4877ff4bfc45aecbb6e5d44
7
+ data.tar.gz: 61c4b8db10ff10e4b8ec45a7688241689981bc3c70f2a2b7eb2eebf877e9ca623844f70e70858daf899812a7ef8deb7c13c77b9fc0570d3bdcff7d367b445e07
data/History.md CHANGED
@@ -1,3 +1,22 @@
1
+ ### 1.2.0 / 2022-04-15
2
+
3
+ * Enhancements:
4
+ * Defer requiring `yaml`.
5
+ [ruby/stringio#21](https://github.com/ruby/stringio/issues/21)
6
+
7
+ ### 1.1.9 / 2022-01-22
8
+
9
+ * Enhancements:
10
+ * Add support for `--release` option to build JRuby extension.
11
+ [#200](https://github.com/rake-compiler/rake-compiler/issues/200) [Reported by Pavel Rosický]
12
+ [#201](https://github.com/rake-compiler/rake-compiler/issues/201) [Patch by Satoshi Tagomori]
13
+
14
+ ### 1.1.8 / 2022-01-18
15
+
16
+ * Fixes:
17
+ * Fix wrong `required_ruby_version` when some `RUBY_CC_VERSION`s are missing.
18
+ [#198](https://github.com/rake-compiler/rake-compiler/issues/198) [Patch by Lars Kanis]
19
+
1
20
  ### 1.1.7 / 2022-01-04
2
21
 
3
22
  * Fixes:
@@ -3,12 +3,6 @@ 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
 
14
8
  module Rake
@@ -377,9 +377,6 @@ Java extension should be preferred.
377
377
  @lib_dir = "#{@lib_dir}/#{$1}"
378
378
  end
379
379
 
380
- # Update cross compiled platform/version combinations
381
- @ruby_versions_per_platform[for_platform] << version
382
-
383
380
  define_cross_platform_tasks_with_version(for_platform, version)
384
381
 
385
382
  # restore lib_dir
@@ -396,6 +393,7 @@ Java extension should be preferred.
396
393
  return
397
394
  end
398
395
 
396
+ require "yaml"
399
397
  config_file = YAML.load_file(config_path)
400
398
 
401
399
  # tmp_path
@@ -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
@@ -106,8 +110,7 @@ execute the Rake compilation task using the JRuby interpreter.
106
110
 
107
111
  javac_command_line = [
108
112
  "javac",
109
- "-target", @target_version,
110
- "-source", @source_version,
113
+ *java_target_args,
111
114
  java_lint_arg,
112
115
  "-d", tmp_path,
113
116
  ]
@@ -208,6 +211,14 @@ execute the Rake compilation task using the JRuby interpreter.
208
211
  end
209
212
  end
210
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
+
211
222
  #
212
223
  # Discover Java Extension Directories and build an extdirs arguments
213
224
  #
@@ -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
@@ -456,14 +457,17 @@ describe Rake::ExtensionTask do
456
457
 
457
458
  it "should set required_ruby_version from RUBY_CC_VERSION, set platform, clear extensions but keep metadata" do
458
459
  platforms = ["x86-mingw32", "x64-mingw32"]
459
- ruby_cc_versions = ["1.8.6", "2.1.10", "2.2.6", "2.3.3", "2.10.1"]
460
+ ruby_cc_versions = ["1.8.6", "2.1.10", "2.2.6", "2.3.3", "2.10.1", "2.11.0"]
460
461
  ENV["RUBY_CC_VERSION"] = ruby_cc_versions.join(":")
461
462
  config = Hash.new
462
463
  ruby_cc_versions.each do |ruby_cc_version|
463
464
  platforms.each do |platform|
465
+ unless platform == "x64-mingw32" && ruby_cc_version == "2.11.0"
466
+ rbconf = "/rubies/#{ruby_cc_version}/rbconfig.rb"
467
+ end
464
468
  allow(config).to receive(:[]).
465
469
  with("rbconfig-#{platform}-#{ruby_cc_version}").
466
- and_return("/rubies/#{ruby_cc_version}/rbconfig.rb")
470
+ and_return(rbconf)
467
471
  end
468
472
  end
469
473
  allow(YAML).to receive(:load_file).and_return(config)
@@ -490,7 +494,7 @@ describe Rake::ExtensionTask do
490
494
  end
491
495
 
492
496
  expected_required_ruby_versions = [
493
- Gem::Requirement.new([">= 1.8", "< 2.11.dev"]),
497
+ Gem::Requirement.new([">= 1.8", "< 2.12.dev"]),
494
498
  Gem::Requirement.new([">= 1.8", "< 2.11.dev"]),
495
499
  ]
496
500
  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.7
4
+ version: 1.2.0
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: 2022-01-03 00:00:00.000000000 Z
12
+ date: 2022-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake