rake-compiler 0.7.9 → 0.8.0

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.
@@ -1,3 +1,18 @@
1
+ === 0.8.0 / 2012-01-08
2
+
3
+ * Enhancements:
4
+ * Invocation from command line now support extra options similar to RubyGems.
5
+ Closes #4 from Pull #47 [jonforums]
6
+
7
+ $ rake compile -- --with-opt-dir=/opt/local
8
+
9
+ * Bugfixes:
10
+ * Only emit cross-compilation warnings for C when `cross` is invoked.
11
+ Closes #16 from Pull #48 [mvz]
12
+ * Only emit warnings when invoking cross-compilation tasks for JRuby.
13
+ Pull #45 [jfirebaugh]
14
+ * Use x86 MinGW cross-compiler. Pull #49 [larskanis]
15
+
1
16
  === 0.7.9 / 2011-06-08
2
17
 
3
18
  * Enhancements:
data/Isolate CHANGED
@@ -1,7 +1,6 @@
1
- gem 'rake'
2
- gem 'rspec', '~> 2.6.0'
3
- gem 'cucumber', '~> 0.10.6'
1
+ gem "rake"
4
2
 
5
- unless RUBY_PLATFORM =~ /java/
6
- gem 'rcov', '~> 0.9.9'
3
+ env :development do
4
+ gem "rspec", "~> 2.8.0"
5
+ gem "cucumber", "~> 1.1.4"
7
6
  end
data/Rakefile CHANGED
@@ -12,9 +12,9 @@
12
12
  #
13
13
 
14
14
  begin
15
- require 'isolate/now'
15
+ require "isolate/now"
16
16
  rescue LoadError => e
17
- fail "This project uses Isolate to manage development dependencies. Please `gem install isolate` first and try again."
17
+ abort "This project requires Isolate to work. Please `gem install isolate` and try again."
18
18
  end
19
19
 
20
20
  # load rakefile extensions (tasks)
@@ -13,6 +13,14 @@ Feature: Compile C code into Ruby extensions.
13
13
  And binary extension 'extension_one' do exist in 'lib'
14
14
  And 'tmp' folder is created
15
15
 
16
+ Scenario: compile an extension with extra options
17
+ Given a safe project directory
18
+ And a extension named 'extension_one'
19
+ And 'tmp' folder is deleted
20
+ When rake task 'compile -- --with-opt-dir=/opt/local' is invoked
21
+ Then rake task 'compile -- --with-opt-dir=/opt/local' succeeded
22
+ And output of rake task 'compile -- --with-opt-dir=/opt/local' contains /with-opt-dir/
23
+
16
24
  Scenario: not recompile unmodified extension
17
25
  Given a safe project directory
18
26
  And a extension named 'extension_one'
@@ -16,7 +16,7 @@ Feature: Cross-compile C extensions
16
16
  Given that all my source files are in place
17
17
  And I'm running a POSIX operating system
18
18
  And I've installed cross compile toolchain
19
- When rake task 'cross compile RUBY_CC_VERSION=1.8.6:1.9.1' is invoked
20
- Then rake task 'cross compile RUBY_CC_VERSION=1.8.6:1.9.1' succeeded
19
+ When rake task 'cross compile RUBY_CC_VERSION=1.8.7:1.9.2' is invoked
20
+ Then rake task 'cross compile RUBY_CC_VERSION=1.8.7:1.9.2' succeeded
21
21
  And binaries for platform 'i386-mingw32' version '1.8' get copied
22
22
  And binaries for platform 'i386-mingw32' version '1.9' get copied
@@ -24,31 +24,31 @@ Given /^a extension '(.*)' with forced platform '(.*)'$/ do |extension_name, for
24
24
  end
25
25
 
26
26
  Given /^that all my source files are in place$/ do
27
- Given "a safe project directory"
28
- Given "a extension cross-compilable 'extension_one'"
27
+ step "a safe project directory"
28
+ step "a extension cross-compilable 'extension_one'"
29
29
  end
30
30
 
31
31
  Given /^that all my Java source files are in place$/ do
32
- Given "a safe project directory"
33
- Given "a extension Java-compilable 'extension_one'"
32
+ step "a safe project directory"
33
+ step "a extension Java-compilable 'extension_one'"
34
34
  end
35
35
 
36
36
  Given /^that my gem source is all in place$/ do
37
- Given "a safe project directory"
38
- Given "a gem named 'gem_abc'"
39
- Given "a extension cross-compilable 'extension_one'"
37
+ step "a safe project directory"
38
+ step "a gem named 'gem_abc'"
39
+ step "a extension cross-compilable 'extension_one'"
40
40
  end
41
41
 
42
42
  Given /^that my JRuby gem source is all in place$/ do
43
- Given "a safe project directory"
44
- Given "a gem named 'gem_abc'"
45
- Given "a extension Java-compilable 'extension_one'"
43
+ step "a safe project directory"
44
+ step "a gem named 'gem_abc'"
45
+ step "a extension Java-compilable 'extension_one'"
46
46
  end
47
47
 
48
48
  Given /^that my gem source is all in place to target two platforms$/ do
49
- Given "a safe project directory"
50
- Given "a gem named 'gem_abc'"
51
- Given "a extension 'extension_one' multi cross-compilable"
49
+ step "a safe project directory"
50
+ step "a gem named 'gem_abc'"
51
+ step "a extension 'extension_one' multi cross-compilable"
52
52
  end
53
53
 
54
54
  Given /^not changed any file since$/ do
@@ -24,6 +24,7 @@ module Rake
24
24
  attr_accessor :platform
25
25
  attr_accessor :config_options
26
26
  attr_accessor :source_pattern
27
+ attr_accessor :extra_options
27
28
 
28
29
  def platform
29
30
  @platform ||= RUBY_PLATFORM
@@ -42,6 +43,7 @@ module Rake
42
43
  @ext_dir = "ext/#{@name}"
43
44
  @lib_dir = 'lib'
44
45
  @config_options = []
46
+ @extra_options = ARGV.select { |i| i =~ /\A--?/ }
45
47
  end
46
48
 
47
49
  def define
@@ -39,7 +39,7 @@ module Rake
39
39
  paths = ENV['PATH'].split(File::PATH_SEPARATOR)
40
40
 
41
41
  # the pattern to look into (captures *nix and windows executables)
42
- pattern = "*mingw*gcc{,.*}"
42
+ pattern = "i?86*mingw*gcc{,.*}"
43
43
 
44
44
  @mingw_gcc_executable = paths.find do |path|
45
45
  # cleanup paths before globbing
@@ -38,10 +38,6 @@ module Rake
38
38
 
39
39
  def binary(platform = nil)
40
40
  if platform == "java"
41
- warn_once <<-EOF
42
- Compiling a native C extension on JRuby. This is discouraged and a
43
- Java extension should be preferred.
44
- EOF
45
41
  "#{name}.#{RbConfig::MAKEFILE_CONFIG['DLEXT']}"
46
42
  else
47
43
  super
@@ -106,6 +102,12 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
106
102
  # binary in temporary folder depends on makefile and source files
107
103
  # tmp/extension_name/extension_name.{so,bundle}
108
104
  file "#{tmp_path}/#{binary(platf)}" => ["#{tmp_path}/Makefile"] + source_files do
105
+ jruby_compile_msg = <<-EOF
106
+ Compiling a native C extension on JRuby. This is discouraged and a
107
+ Java extension should be preferred.
108
+ EOF
109
+ warn_once(jruby_compile_msg) if defined?(JRUBY_VERSION)
110
+
109
111
  chdir tmp_path do
110
112
  sh make
111
113
  end
@@ -140,10 +142,14 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
140
142
  # add options to command
141
143
  cmd.push(*options)
142
144
 
145
+ # add any extra command line options
146
+ unless extra_options.empty?
147
+ cmd.push(*extra_options)
148
+ end
149
+
143
150
  chdir tmp_path do
144
151
  # FIXME: Rake is broken for multiple arguments system() calls.
145
152
  # Add current directory to the search path of Ruby
146
- # Also, include additional parameters supplied.
147
153
  sh cmd.join(' ')
148
154
  end
149
155
  end
@@ -272,7 +278,7 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
272
278
 
273
279
  # warn the user about the need of configuration to use cross compilation.
274
280
  unless File.exist?(config_path)
275
- warn "rake-compiler must be configured first to enable cross-compilation"
281
+ define_dummy_cross_platform_tasks
276
282
  return
277
283
  end
278
284
 
@@ -349,6 +355,15 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
349
355
  end
350
356
  end
351
357
 
358
+ def define_dummy_cross_platform_tasks
359
+ task 'cross' do
360
+ Rake::Task['compile'].clear
361
+ task 'compile' do
362
+ raise "rake-compiler must be configured first to enable cross-compilation"
363
+ end
364
+ end
365
+ end
366
+
352
367
  def extconf
353
368
  "#{@ext_dir}/#{@config_script}"
354
369
  end
@@ -67,15 +67,6 @@ module Rake
67
67
  install "#{tmp_path}/#{binary(platf)}", "#{lib_path}/#{binary(platf)}"
68
68
  end
69
69
 
70
- not_jruby_compile_msg = <<-EOF
71
- WARNING: You're cross-compiling a binary extension for JRuby, but are using
72
- another interpreter. If your Java classpath or extension dir settings are not
73
- correctly detected, then either check the appropriate environment variables or
74
- execute the Rake compilation task using the JRuby interpreter.
75
- (e.g. `jruby -S rake compile:java`)
76
- EOF
77
- warn_once(not_jruby_compile_msg) unless defined?(JRUBY_VERSION)
78
-
79
70
  file "#{tmp_path}/#{binary(platf)}" => "#{tmp_path}/.build" do
80
71
 
81
72
  class_files = FileList["#{tmp_path}/**/*.class"].
@@ -92,6 +83,15 @@ execute the Rake compilation task using the JRuby interpreter.
92
83
  end
93
84
 
94
85
  file "#{tmp_path}/.build" => [tmp_path] + source_files do
86
+ not_jruby_compile_msg = <<-EOF
87
+ WARNING: You're cross-compiling a binary extension for JRuby, but are using
88
+ another interpreter. If your Java classpath or extension dir settings are not
89
+ correctly detected, then either check the appropriate environment variables or
90
+ execute the Rake compilation task using the JRuby interpreter.
91
+ (e.g. `jruby -S rake compile:java`)
92
+ EOF
93
+ warn_once(not_jruby_compile_msg) unless defined?(JRUBY_VERSION)
94
+
95
95
  classpath_arg = java_classpath_arg(@classpath)
96
96
  debug_arg = @debug ? '-g' : ''
97
97
 
@@ -283,16 +283,29 @@ describe Rake::ExtensionTask do
283
283
  File.stub!(:open).and_yield(mock_fake_rb)
284
284
  end
285
285
 
286
- it 'should warn if no rake-compiler configuration exist' do
287
- File.should_receive(:exist?).with(@config_file).and_return(false)
286
+ context 'if no rake-compiler configuration exists' do
287
+ before :each do
288
+ File.should_receive(:exist?).with(@config_file).and_return(false)
288
289
 
289
- out, err = capture_output do
290
- Rake::ExtensionTask.new('extension_one') do |ext|
291
- ext.cross_compile = true
290
+ _, @err = capture_output do
291
+ Rake::ExtensionTask.new('extension_one') do |ext|
292
+ ext.cross_compile = true
293
+ end
292
294
  end
293
295
  end
294
296
 
295
- err.should match(/rake-compiler must be configured first to enable cross-compilation/)
297
+ it 'should not generate a warning' do
298
+ @err.should eq("")
299
+ end
300
+
301
+ it 'should create a dummy nested cross-compile target that raises an error' do
302
+ Rake::Task.should have_defined("cross")
303
+ Rake::Task["cross"].invoke
304
+ lambda {
305
+ Rake::Task["compile"].invoke
306
+ }.should raise_error(RuntimeError,
307
+ /rake-compiler must be configured first to enable cross-compilation/)
308
+ end
296
309
  end
297
310
 
298
311
  it 'should parse the config file using YAML' do
@@ -3,7 +3,7 @@ require 'rubygems/package_task'
3
3
  GEM_SPEC = Gem::Specification.new do |s|
4
4
  # basic information
5
5
  s.name = "rake-compiler"
6
- s.version = "0.7.9"
6
+ s.version = "0.8.0"
7
7
  s.platform = Gem::Platform::RUBY
8
8
 
9
9
  # description and details
@@ -18,9 +18,8 @@ GEM_SPEC = Gem::Specification.new do |s|
18
18
  s.add_dependency 'rake'
19
19
 
20
20
  # development dependencies
21
- s.add_development_dependency 'rspec', '~> 2.6.0'
22
- s.add_development_dependency 'cucumber', '~> 0.10.6'
23
- #s.add_development_dependency 'rcov', '~> 0.9.9'
21
+ s.add_development_dependency 'rspec', '~> 2.8.0'
22
+ s.add_development_dependency 'cucumber', '~> 1.1.4'
24
23
 
25
24
  # components, files and paths
26
25
  s.files = FileList["features/**/*.{feature,rb}", "bin/rake-compiler",
@@ -1,29 +1,9 @@
1
1
  begin
2
2
  require "rspec/core/rake_task"
3
-
4
- begin
5
- require 'rcov'
6
- rescue LoadError
7
- warn "RCov gem is required, please install it (gem install rcov)."
8
- end
9
-
10
- rescue LoadError
3
+ rescue LoadError => e
11
4
  warn "RSpec gem is required, please install it (gem install rspec)."
12
5
  end
13
6
 
14
7
  if defined?(RSpec::Core::RakeTask)
15
8
  RSpec::Core::RakeTask.new(:spec)
16
-
17
- if defined?(Rcov)
18
- CLOBBER.include('coverage')
19
-
20
- namespace :spec do
21
- desc "Run all specs in spec directory with RCov"
22
- RSpec::Core::RakeTask.new(:rcov) do |t|
23
- t.rcov = true
24
- t.rcov_opts = ["--exclude", "spec/*,features/*,gems/*"]
25
- end
26
- end
27
- end
28
9
  end
29
-
metadata CHANGED
@@ -1,81 +1,61 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rake-compiler
3
- version: !ruby/object:Gem::Version
4
- hash: 17
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 7
9
- - 9
10
- version: 0.7.9
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Luis Lavena
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-06-08 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-01-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rake
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &23233764 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: rspec
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *23233764
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &23233056 !ruby/object:Gem::Requirement
38
28
  none: false
39
- requirements:
29
+ requirements:
40
30
  - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 23
43
- segments:
44
- - 2
45
- - 6
46
- - 0
47
- version: 2.6.0
31
+ - !ruby/object:Gem::Version
32
+ version: 2.8.0
48
33
  type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: cucumber
52
34
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *23233056
36
+ - !ruby/object:Gem::Dependency
37
+ name: cucumber
38
+ requirement: &23248788 !ruby/object:Gem::Requirement
54
39
  none: false
55
- requirements:
40
+ requirements:
56
41
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 59
59
- segments:
60
- - 0
61
- - 10
62
- - 6
63
- version: 0.10.6
42
+ - !ruby/object:Gem::Version
43
+ version: 1.1.4
64
44
  type: :development
65
- version_requirements: *id003
66
- description: |-
67
- Provide a standard and simplified way to build and package
68
- Ruby extensions (C, Java) using Rake as glue.
45
+ prerelease: false
46
+ version_requirements: *23248788
47
+ description: ! 'Provide a standard and simplified way to build and package
48
+
49
+ Ruby extensions (C, Java) using Rake as glue.'
69
50
  email: luislavena@gmail.com
70
- executables:
51
+ executables:
71
52
  - rake-compiler
72
53
  extensions: []
73
-
74
- extra_rdoc_files:
54
+ extra_rdoc_files:
75
55
  - README.rdoc
76
56
  - LICENSE.txt
77
57
  - History.txt
78
- files:
58
+ files:
79
59
  - features/compile.feature
80
60
  - features/cross-compile.feature
81
61
  - features/cross-package-multi.feature
@@ -119,44 +99,32 @@ files:
119
99
  - LICENSE.txt
120
100
  - cucumber.yml
121
101
  homepage: http://github.com/luislavena/rake-compiler
122
- licenses:
102
+ licenses:
123
103
  - MIT
124
104
  post_install_message:
125
- rdoc_options:
105
+ rdoc_options:
126
106
  - --main
127
107
  - README.rdoc
128
108
  - --title
129
109
  - rake-compiler -- Documentation
130
- require_paths:
110
+ require_paths:
131
111
  - lib
132
- required_ruby_version: !ruby/object:Gem::Requirement
112
+ required_ruby_version: !ruby/object:Gem::Requirement
133
113
  none: false
134
- requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- hash: 59
138
- segments:
139
- - 1
140
- - 8
141
- - 6
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
142
117
  version: 1.8.6
143
- required_rubygems_version: !ruby/object:Gem::Requirement
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
119
  none: false
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- hash: 17
149
- segments:
150
- - 1
151
- - 3
152
- - 5
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
153
123
  version: 1.3.5
154
124
  requirements: []
155
-
156
125
  rubyforge_project: rake-compiler
157
- rubygems_version: 1.8.5
126
+ rubygems_version: 1.8.15
158
127
  signing_key:
159
128
  specification_version: 3
160
129
  summary: Rake-based Ruby Extension (C, Java) task generator.
161
130
  test_files: []
162
-