Class: Rake::ExtensionTask

Inherits:
BaseExtensionTask show all
Defined in:
lib/rake/extensiontask.rb

Instance Attribute Summary collapse

Attributes inherited from BaseExtensionTask

#config_options, #ext_dir, #extra_options, #gem_spec, #lib_dir, #name, #platform, #source_pattern, #tmp_dir

Instance Method Summary collapse

Methods inherited from BaseExtensionTask

#initialize

Constructor Details

This class inherits a constructor from Rake::BaseExtensionTask

Instance Attribute Details

#config_includesObject

Returns the value of attribute config_includes.



17
18
19
# File 'lib/rake/extensiontask.rb', line 17

def config_includes
  @config_includes
end

#config_scriptObject

Returns the value of attribute config_script.



12
13
14
# File 'lib/rake/extensiontask.rb', line 12

def config_script
  @config_script
end

#cross_compileObject

Returns the value of attribute cross_compile.



13
14
15
# File 'lib/rake/extensiontask.rb', line 13

def cross_compile
  @cross_compile
end

#cross_config_optionsObject

Returns the value of attribute cross_config_options.



15
16
17
# File 'lib/rake/extensiontask.rb', line 15

def cross_config_options
  @cross_config_options
end

#cross_platformObject

Returns the value of attribute cross_platform.



14
15
16
# File 'lib/rake/extensiontask.rb', line 14

def cross_platform
  @cross_platform
end

#no_nativeObject

Returns the value of attribute no_native.



16
17
18
# File 'lib/rake/extensiontask.rb', line 16

def no_native
  @no_native
end

Instance Method Details

#binary(platform = nil) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/rake/extensiontask.rb', line 39

def binary(platform = nil)
  if platform == "java"
    "#{name}.#{RbConfig::MAKEFILE_CONFIG['DLEXT']}"
  else
    super
  end
end

#cross_compiling(&block) ⇒ Object



35
36
37
# File 'lib/rake/extensiontask.rb', line 35

def cross_compiling(&block)
  @cross_compiling = block if block_given?
end

#defineObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/rake/extensiontask.rb', line 47

def define
  if (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby')
    warn_once <<-EOF
WARNING: You're attempting to (cross-)compile C extensions from a platform
(#{RUBY_ENGINE}) that does not support native extensions or mkmf.rb.
Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
    EOF
    return
  end

  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



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rake/extensiontask.rb', line 19

def init(name = nil, gem_spec = nil)
  super
  @config_script = 'extconf.rb'
  @source_pattern = "*.c"
  @compiled_pattern = "*.{o,obj,so,bundle,dSYM}"
  @cross_compile = false
  @cross_config_options = []
  @cross_compiling = nil
  @no_native = false
  @config_includes = []
end