introduce app.vendor_project which receives a hash (mandatory, :jar key/value, optional, :resources key/value), fix build system to include 3rd-party resources directories into the apk

This commit is contained in:
Laurent Sansonetti
2014-05-18 19:08:28 +02:00
parent 1e235c909e
commit e67a6e4123
2 changed files with 16 additions and 4 deletions

View File

@@ -292,8 +292,8 @@ EOS
or App.config.resources_dirs.any? { |x| File.mtime(x) > File.mtime(archive) }
App.info 'Create', archive
assets_flags = App.config.assets_dirs.map { |x| '-A "' + x + '"' }.join(' ')
resources_flags = App.config.resources_dirs.map { |x| '-S "' + x + '"' }.join(' ')
sh "\"#{App.config.build_tools_dir}/aapt\" package -f -M \"#{android_manifest}\" #{assets_flags} #{resources_flags} -I \"#{android_jar}\" -F \"#{archive}\""
resources_flags = (App.config.resources_dirs + App.config.vendored_resources).map { |x| '-S "' + x + '"' }.join(' ')
sh "\"#{App.config.build_tools_dir}/aapt\" package -f -M \"#{android_manifest}\" #{assets_flags} #{resources_flags} -I \"#{android_jar}\" -F \"#{archive}\" --auto-add-overlay"
Dir.chdir(App.config.build_dir) do
[File.basename(dex_classes), libpayload_subpath, gdbserver_subpath].each do |file|
line = "\"#{App.config.build_tools_dir}/aapt\" add -f \"../#{archive}\" \"#{file}\""

View File

@@ -38,6 +38,8 @@ module Motion; module Project;
@sub_activities = []
@arch = 'armv5te'
@assets_dirs = [File.join(project_dir, 'assets')]
@vendored_jars = []
@vendored_resources = []
@manifest_metadata = {}
end
@@ -154,8 +156,18 @@ module Motion; module Project;
File.join(App.config.motiondir, 'bin', name)
end
def vendored_jars
@vendored_jars = Dir.glob('vendor/*.jar')
attr_reader :vendored_jars, :vendored_resources
def vendor_project(opt)
jar = opt.delete(:jar)
unless jar
App.fail "Expected `:jar' key/value pair in `#{opt}'"
end
@vendored_jars << jar
res = opt.delete(:resources)
if res
@vendored_resources << res
end
end
def vendored_bs_files