Class: Buildr::AS3::Compiler::Compc

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CompilerUtils

#append_args, #get_last_modified, get_output, #is_output_outdated?, #move_dependency_dirs_to_source, #needed?, #older, #reserved_options, #timestamp_from_file

Constructor Details

#initialize(project, options) ⇒ Compc

Returns a new instance of Compc.



203
204
205
206
# File 'lib/buildr/as3/compiler.rb', line 203

def initialize(project, options)
  super
  @project = project
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



201
202
203
# File 'lib/buildr/as3/compiler.rb', line 201

def project
  @project
end

Instance Method Details

#compile(sources, target, dependencies) ⇒ Object



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/buildr/as3/compiler.rb', line 210

def compile(sources, target, dependencies)
  flex_sdk = options[:flexsdk].invoke
  output = CompilerUtils::get_output(project, target, :swc, options)
  move_dependency_dirs_to_source( sources, dependencies)
  cmd_args = []
  cmd_args << "-jar" << flex_sdk.compc_jar
  cmd_args << "-output" << output
  cmd_args << "+flexlib" << "#{flex_sdk.home}/frameworks"
  cmd_args << "-load-config" << flex_sdk.flex_config
  sources.each {|source| cmd_args << "-include-sources+=#{source}"}
  cmd_args << "-library-path+=#{dependencies.join(",")}" unless dependencies.empty?
  options[:debug] = Buildr.options.debug.to_s
  options.to_hash.reject { |key, value| reserved_options.include?(key) }.
      each do |key, value|
    cmd_args << "-#{key}=#{value}"
  end
  flex_sdk.default_options.each do |key, value|
    cmd_args << "-#{key}=#{value}"
  end

  unless Buildr.application.options.dryrun
    Java::Commands.java cmd_args
  end
end