mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-05-19 12:22:27 +08:00
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:
@@ -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.
|
||||
|
||||
@@ -165,7 +165,14 @@ module Motion; module Project;
|
||||
App.fail "Expected `:manifest' key/value pair when `:resources' is given" if res and !manifest
|
||||
App.fail "Expected `:resources' key/value pair when `:manifest' is given" if manifest and !res
|
||||
App.fail "Unused arguments: `#{opt}'" unless opt.empty?
|
||||
@vendored_projects << { :jar => jar, :resources => res, :manifest => manifest }
|
||||
|
||||
package = nil
|
||||
if manifest
|
||||
line = `/usr/bin/xmllint --xpath '/manifest/@package' \"#{manifest}\"`.strip
|
||||
App.fail "Given manifest `#{manifest}' does not have a `package' attribute in the top-level element" if $?.to_i != 0
|
||||
package = line.match(/package=\"(.+)\"$/)[1]
|
||||
end
|
||||
@vendored_projects << { :jar => jar, :resources => res, :manifest => manifest, :package => package }
|
||||
end
|
||||
|
||||
def vendored_bs_files
|
||||
|
||||
Reference in New Issue
Block a user