read extra packages paths from the manifest files, rebuild the R.java files if *any* resource file is newer than them

This commit is contained in:
Laurent Sansonetti
2014-05-19 10:41:21 +02:00
parent 04d11e1c99
commit ea4a041b8f
2 changed files with 11 additions and 3 deletions

View File

@@ -241,8 +241,9 @@ EOS
all_resources = (App.config.resources_dirs + App.config.vendored_projects.map { |x| x[:resources] }.compact)
aapt_resources_flags = all_resources.map { |x| '-S "' + x + '"' }.join(' ')
r_java_mtime = Dir.glob(java_dir + '/**/R.java').map { |x| File.mtime(x) }.max
if !r_java_mtime or all_resources.any? { |x| File.mtime(x) > r_java_mtime }
sh "\"#{App.config.build_tools_dir}/aapt\" package -f -M \"#{android_manifest}\" #{aapt_resources_flags} -I \"#{android_jar}\" -m -J \"#{java_dir}\" --extra-packages com.google.android.gms --auto-add-overlay"
if !r_java_mtime or all_resources.any? { |x| Dir.glob(x + '/**/*').any? { |y| File.mtime(y) > r_java_mtime } }
extra_packages = App.config.vendored_projects.map { |x| x[:package] }.compact.map { |x| "--extra-packages #{x}" }.join(' ')
sh "\"#{App.config.build_tools_dir}/aapt\" package -f -M \"#{android_manifest}\" #{aapt_resources_flags} -I \"#{android_jar}\" -m -J \"#{java_dir}\" #{extra_packages} --auto-add-overlay"
end
# Compile java files.