mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-05-05 06:47:26 +08:00
support for 3rd-party android libraries: the build system will vendor all .jar files that are inside the ‘vendor’ sub-directory, and also generate .bridgesupport metadata for them
This commit is contained in:
@@ -28,7 +28,7 @@ module Motion; module Project;
|
||||
register :android
|
||||
|
||||
variable :sdk_path, :ndk_path, :avd_config, :package, :main_activity,
|
||||
:sub_activities, :api_version, :arch, :vendored_jars
|
||||
:sub_activities, :api_version, :arch
|
||||
|
||||
def initialize(project_dir, build_mode)
|
||||
super
|
||||
@@ -36,7 +36,6 @@ module Motion; module Project;
|
||||
@main_activity = 'MainActivity'
|
||||
@sub_activities = []
|
||||
@arch = 'armv5te'
|
||||
@vendored_jars = []
|
||||
end
|
||||
|
||||
def validate
|
||||
@@ -147,5 +146,26 @@ module Motion; module Project;
|
||||
raise "Invalid arch `#{arch}'"
|
||||
end
|
||||
end
|
||||
|
||||
def bin_exec(name)
|
||||
File.join(App.config.motiondir, 'bin', name)
|
||||
end
|
||||
|
||||
def vendored_jars
|
||||
@vendored_jars = Dir.glob('vendor/*.jar')
|
||||
end
|
||||
|
||||
def vendored_bs_files
|
||||
@vendored_bs_files ||= begin
|
||||
vendored_jars.map do |jar_file|
|
||||
bs_file = File.join(File.dirname(jar_file), File.basename(jar_file) + '.bridgesupport')
|
||||
if !File.exist?(bs_file) or File.mtime(jar_file) > File.mtime(bs_file)
|
||||
App.info 'Create', bs_file
|
||||
sh "#{bin_exec('android/gen_bridge_metadata')} \"#{jar_file}\" \"#{bs_file}\""
|
||||
end
|
||||
bs_file
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end; end
|
||||
|
||||
Reference in New Issue
Block a user