Class: Buildr::AS3::Compiler::FlexCompilerBase

Inherits:
Compiler::Base
  • Object
show all
Defined in:
lib/buildr/as3/compiler/base.rb

Overview

:nodoc:

Direct Known Subclasses

Compc, Mxmlc

Constant Summary

COMPILE_OPTIONS =
[:warnings, :debug, :other, :flexsdk, :apparat]

Instance Method Summary (collapse)

Constructor Details

- (FlexCompilerBase) initialize(project, options)

:nodoc:



32
33
34
35
36
# File 'lib/buildr/as3/compiler/base.rb', line 32

def initialize(project, options) #:nodoc:
  super
  options[:debug] = Buildr.options.debug if options[:debug].nil?
  options[:warnings] ||= true
end

Instance Method Details

- (Object) compile(sources, target, dependencies)

:nodoc:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/buildr/as3/compiler/base.rb', line 38

def compile(sources, target, dependencies) #:nodoc:
  check_options options, COMPILE_OPTIONS
  flex_sdk = options[:flexsdk].invoke
  output = @project.get_as3_output( target, options )
  cmd_args = []
  cmd_args << "-jar" << @compiler_jar
  cmd_args << "+flexlib" << "#{flex_sdk.home}/frameworks"
  cmd_args << "-output" << output
  cmd_args << "+configname=air" if @air
  cmd_args << @main unless @main.nil?
  cmd_args << "-define+=CONFIG::debug,#{options[:debug]}"
  cmd_args << "-define+=CONFIG::environment,\"#{Buildr.environment}\""
  cmd_args << "-load-config" << flex_sdk.flex_config
  cmd_args += generate_source_args sources
  cmd_args += generate_dependency_args dependencies
  cmd_args += flex_compiler_args
  unless Buildr.application.options.dryrun
    trace(cmd_args.join(' '))
    Java::Commands.java cmd_args
  end
end

- (Boolean) needed?(sources, target, dependencies)



60
61
62
63
64
# File 'lib/buildr/as3/compiler/base.rb', line 60

def needed?(sources, target, dependencies)
  return true unless File.exist?(@project.get_as3_output(target, options))
  Dir.glob(FileList[sources,dependencies].to_a.collect{ |file| file += "**/*" } ).
      map{|file| File.stat(file).mtime}.max > File.stat(@project.get_as3_output(target, options)).mtime
end