-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRakefile
84 lines (73 loc) · 2.31 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
require "bundler/gem_tasks"
require "jruby-parser"
require "ant"
require "pathname"
#require "rsense-core"
ant_import
def parser_path
jrp_path = ""
$LOAD_PATH.each do |p|
if p =~ /jruby-parser/
jrp_path = p
end
end
jrp_path = Pathname.new(jrp_path).join("jruby-parser.jar")
end
ant.path :id => "build.class.path" do
fileset :file => "build_lib/*.jar"
fileset :file => "lib/jars/*.jar"
fileset :file => "#{parser_path.to_s}"
fileset :file => "lib/rsense.jar"
pathelement :path => "${classpath}"
end
desc "Build RSense Jar"
task :build_jar => [:antlr, :set_version] do
ant.javac(:fork => "true", :debug =>"true", :source => "1.6",:target => "1.6", :deprecation => "true", :srcdir => "src", :bootclasspath => "${java6.boot.classpath}",:destdir => "build", :classpathref => "build.class.path") do
compilerarg :value => "-Xlint:all"
end
ant.jar(:jarfile => "lib/rsense.jar", :basedir => "build") do
fileset :dir => "src/resources"
manifest do
attribute :name => "Main-Class", :value => "org.cx4a.rsense.Main"
end
end
end
desc "Update Rsense\'s Version in Java Properties File"
task :set_version do
prop_file = Pathname.new("./src/resources/org/cx4a/rsense/rsense.properties").expand_path
version = Rsense::Core::VERSION
File.open(prop_file, "w") do |f|
f.puts "rsense.version = #{version}"
end
end
desc "Run Rsense\'s set of tests"
task :rtests => [:build_jar] do
ant.java(fork: "true", classpathref: "build.class.path", classname: "org.cx4a.rsense.Main") do
arg(value: "script")
arg(file: "test/script/all.rsense")
arg(value: "--log-level=error")
arg(value: "--test-color")
end
end
desc "Test, Bump, Build"
task :prepare_jar => [:set_version, :build_jar, :rtests] do
puts "Jar Prepared!"
end
desc "Build from scratch"
task :build_scratch => [:prepare_jar, :build] do
puts "Built gem from scratch."
end
desc "Install locally from scratch"
task :install_scratch => [:build_scratch, :install] do
puts "Installed from scratch."
end
desc "Commit rsense.jar"
task :commit_jar do
sh "git add src/resources/org/cx4a/rsense/rsense.properties"
sh "git add lib/rsense.jar"
sh "git commit -m 'Rebuilds rsense.jar'"
end
desc "Cut a release from scratch."
task :release_scratch => [:build_scratch, :commit_jar,:release] do
puts "Release published from scratch."
end