-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
53 lines (46 loc) · 1.64 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'ant'
directory "pkg/classes"
MAIN_SRC_DIR = 'ext/main'
TEST_SRC_DIR = 'ext/test'
TEST_REPORT_DIR = "pkg/report"
CLASSES_DIR = "pkg/classes"
task :setup do
ant.path :id => 'classpath' do
fileset :dir => "./bin"
pathelement :location => File.join(RbConfig::CONFIG["libdir"],"jruby.jar")
end
end
desc "Clean up build artifacts"
task :clean do
rm_rf "pkg/classes"
rm_rf "bin/oj.jar"
end
desc "Compile the extension"
task :compile => "pkg/classes" do |t|
ant.javac :srcdir => "ext", :destdir => t.prerequisites.first,
:source => "1.7", :target => "1.7", :debug => true,
:classpath => "${java.class.path}:${sun.boot.class.path}:./bin/junit-4.12.jar:./lib/oj.jar:./bin/ant-junit4.jar:./bin/hamcrest-all-1.3.jar"
end
desc "Build the jar"
task :jar => :compile do
ant.jar :basedir => "pkg/classes", :destfile => "bin/oj.jar", :includes => "**/*.class"
end
task :run_tests => [:jar,:setup] do
ant.mkdir :dir => TEST_REPORT_DIR
ant.junit :fork => "yes", :forkmode => "perTest", :printsummary => "yes",
:haltonfailure => "no", :failureproperty => "tests.failed" do
classpath :refid => 'classpath'
formatter :type => "xml"
batchtest :todir => TEST_REPORT_DIR do
fileset :dir => TEST_SRC_DIR, :includes => '**/Test*.java'
end
end
if ant.project.getProperty("tests.failed")
ant.junitreport :todir => TEST_REPORT_DIR do
fileset :dir => TEST_REPORT_DIR, :includes => "TEST-*.xml"
report :todir => "#{TEST_REPORT_DIR}/html"
end
ant.fail :message => "One or more tests failed. Please check the test report for more info."
end
puts
end