Class: Rake::ExtensionTask
- Inherits:
-
BaseExtensionTask
- Object
- TaskLib
- BaseExtensionTask
- Rake::ExtensionTask
- Defined in:
- lib/rake/extensiontask.rb
Instance Attribute Summary collapse
-
#config_includes ⇒ Object
Returns the value of attribute config_includes.
-
#config_script ⇒ Object
Returns the value of attribute config_script.
-
#cross_compile ⇒ Object
Returns the value of attribute cross_compile.
- #cross_config_options(for_platform = nil) ⇒ Object
- #cross_platform ⇒ Object
-
#no_native ⇒ Object
Returns the value of attribute no_native.
Attributes inherited from BaseExtensionTask
#config_options, #ext_dir, #extra_options, #gem_spec, #lib_dir, #name, #platform, #source_pattern, #tmp_dir
Instance Method Summary collapse
- #binary(platform = nil) ⇒ Object
- #cross_compiling(&block) ⇒ Object
- #define ⇒ Object
- #init(name = nil, gem_spec = nil) ⇒ Object
Methods inherited from BaseExtensionTask
Constructor Details
This class inherits a constructor from Rake::BaseExtensionTask
Instance Attribute Details
#config_includes ⇒ Object
Returns the value of attribute config_includes.
16 17 18 |
# File 'lib/rake/extensiontask.rb', line 16 def config_includes @config_includes end |
#config_script ⇒ Object
Returns the value of attribute config_script.
11 12 13 |
# File 'lib/rake/extensiontask.rb', line 11 def config_script @config_script end |
#cross_compile ⇒ Object
Returns the value of attribute cross_compile.
12 13 14 |
# File 'lib/rake/extensiontask.rb', line 12 def cross_compile @cross_compile end |
#cross_config_options(for_platform = nil) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/rake/extensiontask.rb', line 69 def (for_platform=nil) return @cross_config_options unless for_platform # apply options for this platform, only @cross_config_options.map do |option| if option.kind_of?(Hash) option[for_platform] || [] else option end end.flatten end |
#cross_platform ⇒ Object
33 34 35 |
# File 'lib/rake/extensiontask.rb', line 33 def cross_platform @cross_platform ||= 'i386-mingw32' end |
#no_native ⇒ Object
Returns the value of attribute no_native.
15 16 17 |
# File 'lib/rake/extensiontask.rb', line 15 def no_native @no_native end |
Instance Method Details
#binary(platform = nil) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/rake/extensiontask.rb', line 41 def binary(platform = nil) if platform == "java" "#{name}.#{RbConfig::MAKEFILE_CONFIG['DLEXT']}" else super end end |
#cross_compiling(&block) ⇒ Object
37 38 39 |
# File 'lib/rake/extensiontask.rb', line 37 def cross_compiling(&block) @cross_compiling = block if block_given? end |
#define ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/rake/extensiontask.rb', line 49 def define super unless compiled_files.empty? warn "WARNING: rake-compiler found compiled files in '#{@ext_dir}' directory. Please remove them." end # only gems with 'ruby' platforms are allowed to define native tasks define_native_tasks if !@no_native && (@gem_spec && @gem_spec.platform == 'ruby') # only define cross platform functionality when enabled return unless @cross_compile if cross_platform.is_a?(Array) then cross_platform.each { |platf| define_cross_platform_tasks(platf) } else define_cross_platform_tasks(cross_platform) end end |
#init(name = nil, gem_spec = nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rake/extensiontask.rb', line 18 def init(name = nil, gem_spec = nil) super @config_script = 'extconf.rb' @source_pattern = "*.{c,cc,cpp}" @compiled_pattern = "*.{o,obj,so,bundle,dSYM}" @cross_compile = false @cross_config_options = [] @cross_compiling = nil @no_native = (ENV["RAKE_EXTENSION_TASK_NO_NATIVE"] == "true") @config_includes = [] # Default to an empty list of ruby versions for each platform @ruby_versions_per_platform = Hash.new { |h, k| h[k] = [] } @make = nil end |