106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/buildr/as3/toolkits/alchemy.rb', line 106
def compile(sources, target, dependencies)
alchemy_tk = options[:alchemy].invoke
flex_sdk = alchemy_tk.flex_sdk
output = @project.get_as3_output
cmd_args = []
cmd_args << "gcc"
cmd_args << File.basename(options[:main])
cmd_args << "-O3 -Wall -swc"
cmd_args << "-o #{File.basename output}"
reserved = [:flexsdk, :main, :alchemy]
options.to_hash.reject { |key, value| reserved.include?(key) }.
each do |key, value|
cmd_args << "-#{key}=#{value}"
end
unless Buildr.application.options.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 options[:main]
system(cmd_args.join(" "))
File.copy(File.basename(output), output)
File.delete File.basename(output)
Dir.chdir project_dir
end
end
|