Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 49 lines (34 sloc) 1.47 KB
repositories.remote << 'http://www.sparkjava.com/nexus/content/repositories/spark/'
repositories.remote << 'http://repo1.maven.org/maven2'
SPARK = transitive('spark:spark:jar:0.9.9.3-SNAPSHOT')
define 'microjava' do
project.version = '0.1'
define 'web' do
compile.with SPARK
package :jar
deps = compile.dependencies
task :package do |t|
assembly_dir = "web/target/assembly"
FileUtils.mkdir_p "#{assembly_dir}/lib"
FileUtils.mkdir_p "#{assembly_dir}/main"
FileUtils.copy "web/target/microjava-web-#{project.version}.jar", "#{assembly_dir}/main"
artifacts = Buildr.artifacts(deps).map(&:to_s)
artifacts.each do |artifact|
FileUtils.copy artifact, "#{assembly_dir}/lib"
end
Unzip.new(assembly_dir => "lib/one-jar-boot-0.97.jar").extract
FileUtils.rm_rf "#{assembly_dir}/src"
File.open("#{assembly_dir}/boot-manifest.mf", 'a') do |f|
f.write("One-Jar-Main-Class: com.thoughtworks.microjava.web.AppServer\n")
end
Buildr.ant('create jar') do |x|
x.echo(:message => "Packaging uberjar")
x.jar(:basedir => assembly_dir,
:destfile => "web/target/microjava-web-#{project.version}.jar",
:manifest => "#{assembly_dir}/boot-manifest.mf",
:whenmanifestonly => "fail",
:includes => "**")
end
end
end
end