Class: Buildr::AS3::Alchemy::Compiler::AlcGcc
- Inherits:
-
Compiler::Base
- Object
- Compiler::Base
- Buildr::AS3::Alchemy::Compiler::AlcGcc
- Includes:
- Compiler::CompilerUtils
- Defined in:
- lib/buildr/as3/alchemy.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #compile(sources, target, dependencies) ⇒ Object
-
#initialize(project, options) ⇒ AlcGcc
constructor
A new instance of AlcGcc.
Methods included from Compiler::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) ⇒ AlcGcc
Returns a new instance of AlcGcc.
139 140 141 142 |
# File 'lib/buildr/as3/alchemy.rb', line 139 def initialize(project, ) super @project = project end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
137 138 139 |
# File 'lib/buildr/as3/alchemy.rb', line 137 def project @project end |
Instance Method Details
#compile(sources, target, dependencies) ⇒ Object
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/buildr/as3/alchemy.rb', line 146 def compile(sources, target, dependencies) alchemy_tk = [:alchemy].invoke flex_sdk = alchemy_tk.flex_sdk output = Buildr::AS3::Compiler::CompilerUtils::get_output(project, target, :swc, ) # gcc stringecho.c -O3 -Wall -swc -o stringecho.swc cmd_args = [] cmd_args << "gcc" cmd_args << File.basename([:main]) cmd_args << "-O3 -Wall -swc" cmd_args << "-o #{File.basename output}" reserved = [:flexsdk, :main, :alchemy] .to_hash.reject { |key, value| reserved.include?(key) }. each do |key, value| cmd_args << "-#{key}=#{value}" end unless Buildr.application..dryrun ENV["ALCHEMY_HOME"]= alchemy_tk.home ENV["ALCHEMY_VER"] = "0.4a" ENV["PATH"] = "#{alchemy_tk.bin}#{File::PATH_SEPARATOR}#{ENV["PATH"]}" ENV["ASC"]="#{alchemy_tk.home}/bin/asc.jar" ENV["ADL"]=alchemy_tk.flex_sdk.adl ENV["SWFBRIDGE"]=alchemy_tk.swfbridge ENV["PATH"] = "#{alchemy_tk.achacks}#{File::PATH_SEPARATOR}#{ENV["PATH"]}" ENV["PATH"] = "#{ENV["PATH"]}:#{flex_sdk.bin}" project_dir = Dir.getwd Dir.chdir File.dirname [:main] system(cmd_args.join(" ")) File.copy(File.basename(output), output) File.delete File.basename(output) Dir.chdir project_dir end end |