I've gotten a rake task that works on this which I'll share here.
(Thanks again to Alan Pinstein for showing me how to dynamically
generate rake tasks within other tasks. Cool trick.)
Luke, I had to add include_resource_bundles to mxmlc to make this work
- you currently only have it in compc.
The task first deletes the locale swfs from all 3 directories ( bin-
debug, html-template, bin-release + /locale), compiles to the first
one, then copies to the other 2.
The one last piece would be a way to use sprouts to run copylocale
conditionally when the locale doesn't exist.
I'm posting this to get feedback - both on the copylocale step and
also on making this better, incorporating it into sprouts more
seamlessly, etc.
##############################
# bundle exec rake compile_locale['partnerX_en_US']
# prereq: run copylocale one time with your custom locale. (Haven't
automated this yet.)
# e.g. ~/Library/Sprouts/1.1/cache/flex4/4.1.0.16076A/bin/copylocale
en_US partnerX_en_US
desc 'Compile a locale swf by specifying its base name. resource
bundle folder should live at resource_bundles/basename. REQUIRES
RUNNING THE COPYLOCALE UTILITY ONCE FIRST.'
task :compile_locale, :locale_name do |t, args|
# The new locale swf will be placed in the following locations
dirs = [ "bin-debug", "html-template", "bin-release" ].map { |p|
"#{p}/locale" }
targets = dirs.map { |p| "#{p}/#{args[:locale_name]}.swf" }
targets.each { |file|
if File.exists?(file)
puts "remove #{file}..."
puts `rm #{file}` # do rm -i to be prompted prior to delete
end
}
target = targets.shift
puts `mkdir -p #{dirs.shift}`
mxmlc target do |t|
t.source_path << "resource_bundles/#{args[:locale_name]}"
t.locale = args[:locale_name]
t.include_resource_bundles << "ui"
t.allow_source_path_overlap = true
t.target_player = TARGET_PLAYER
end
Rake::Task[target].execute
targets.each { |file|
dir = dirs.shift
puts `mkdir -p #{dir}; cp #{target} #{file}` unless File.exists?
(file)
}
end