Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (51 sloc) 1.38 KB
# add support for Ruby Gems:
#export RUBYOPT=rubygems
# or
#require 'rubygems'
#https://gist.github.com/54177
require 'anttrap'
require 'rbconfig'
# the name of the Ant project.
# adding a timestamp may be helpful to you
AntTrap.antproject="RakeFile #{Time.new}"
# Generate a file named build.xml
AntTrap.antfile="build.xml"
# path to the rake binary
# the default is rake, but you can use what you like here
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ then
AntTrap.rake = 'rake.bat'
end
# additional arguments to pass to rake
AntTrap.rakeargs = ["-v"]
JAVA_HOME=ENV['JAVA_HOME']
JAVAC = "#{JAVA_HOME}//bin//javac"
JAR = "#{JAVA_HOME}//bin//jar"
task :default => [:Compile]
sources = FileList['src/**/*.java']
classes = sources.ext('class')
jars = FileList['lib/**/*.jar']
desc "Compiles all Java sources files in the project"
task :Compile => sources do
# see the javac command line docs regarding @ syntax for javac
File.open("javac.classes","w+") do |f|
sources.each {|t| f.puts "#{t}" }
end
File.open("javac.options","w+") do |f|
f.puts "-d rakeout"
f.puts "-g"
f.puts '-sourcepath src'
end
cp = jars.join(";")
command =<<EOF
#{JAVAC} -J-Xms256m -J-Xmx256m -classpath #{cp} @javac.options @javac.classes
EOF
sh command
end
desc "Deploy source to server"
task :Deploy => classes do
puts "Deploying!!!"
end
desc "Clean"
task :Clean do
puts "Clean"
end
Something went wrong with that request. Please try again.