mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-03-29 00:48:07 +08:00
38 lines
1.1 KiB
Ruby
38 lines
1.1 KiB
Ruby
# -*- coding: utf-8 -*-
|
|
$:.unshift("../../lib")
|
|
require 'motion/project/template/android'
|
|
|
|
Motion::Project::App.setup do |app|
|
|
# Use `rake config' to see complete project settings.
|
|
app.name = 'TestAndroid'
|
|
app.api_version = 'L'
|
|
|
|
# Build the vendor jar if needed.
|
|
testjava_jar = 'vendor/testjava.jar'
|
|
if !File.exist?(testjava_jar) \
|
|
or Dir.glob('vendor/java/**/*.java').any? { |x| File.mtime(x) > File.mtime(testjava_jar) }
|
|
FileUtils.rm_rf('vendor/classes')
|
|
FileUtils.mkdir('vendor/classes')
|
|
Dir.chdir('vendor/java') do
|
|
Dir.glob('**/*.java').each do |java|
|
|
sh "/usr/bin/javac -d ../classes \"#{java}\""
|
|
end
|
|
end
|
|
Dir.chdir('vendor/classes') do
|
|
sh "/usr/bin/jar cvf ../testjava.jar ."
|
|
end
|
|
end
|
|
app.vendor_project :jar => testjava_jar
|
|
|
|
# Make sure the main file is compiled and executed first.
|
|
ary = app.files
|
|
ary.delete('./app/main.rb')
|
|
if files = ENV['files']
|
|
files = files.split(',')
|
|
ary.delete_if do |path|
|
|
!files.any? { |x| path.include?(x) }
|
|
end
|
|
end
|
|
ary.unshift('./app/main.rb')
|
|
end
|