Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git] / Rakefile
blob88e1460cf3d57d74d4a7206c236c92b5136cc72f
1 task :default => [:build]
3 Object.const_set(:BASE_DIR, Dir.pwd)
5 File.open("default.build.properties") do |props|
6   props.each_line do |line|
7     # skip comments
8     next if line =~ /^\W*#/
9     
10     # build const name
11     name, value = line.split("=")
12     name.gsub!(".", "_").upcase!
13     Object.const_set(name.to_sym, value)
14     
15     # substitute embedded props
16     value.chop!.gsub!(/\$\{([^}]+)\}/) do |embed|
17       Object.const_get($1.gsub!(".", "_").upcase!)
18     end
19   end
20 end
22 def ant(*args)
23   system "ant -logger org.apache.tools.ant.NoBannerLogger #{args.join(' ')}"
24 end
26 desc "Build JRuby"
27 task :build do
28   ant "jar"
29 end
30 task :jar => :build
32 desc "Alias for test:short"
33 task :test => "test:short"
35 desc "Alias for spec:ci"
36 task :spec => "spec:ci"
38 namespace :test do
39   desc "Compile test code"
40   task :compile do
41     ant "compile-test"
42     system "jar cf build/jruby-test-classes.jar -C build/classes/test ."
43   end
45   desc "Run the basic set of tests"
46   task :short do
47     ant "test"
48   end
49   
50   desc "Run the complete set of tests (will take a while)"
51   task :all do
52     ant "test-all"
53   end
55   desc "Run tracing tests (do not forget to pass --debug)"
56   task :tracing do
57     require 'rake/testtask'
58     Rake::TestTask.new('test:tracing') do |t|
59       t.pattern = 'test/tracing/test_*.rb'
60       t.verbose = true
61     end
62   end
63 end
65 file "build/jruby-test-classes.jar" do
66   Rake::Task['test:compile'].invoke
67 end
69 namespace :spec do
70   desc "Run the rubyspecs expected to pass (version-frozen)"
71   task :ci do
72     ant "spec"
73   end
74   
75   desc "Run all the specs including failures (version-frozen)"
76   task :all do
77     ant "spec-all"
78   end
80   require 'spec/rake/spectask'
81   desc "Runs Java Integration Specs"
82   Spec::Rake::SpecTask.new("ji" => "build/jruby-test-classes.jar") do |t|
83     t.spec_opts ||= []
84     t.spec_opts << "--options" << "spec/java_integration/spec.opts"
85     t.spec_files = FileList['spec/java_integration/**/*_spec.rb']
86   end
88   desc "Runs Compiler Specs"
89   Spec::Rake::SpecTask.new("compiler" => "build/jruby-test-classes.jar") do |t|
90     t.spec_files = FileList['spec/compiler/**/*_spec.rb']
91   end
92 end
94 desc "Clean all built output"
95 task :clean do
96   delete_files = FileList.new do |fl|
97     fl.
98       include("#{BUILD_DIR}/**").
99       exclude("#{BUILD_DIR}/rubyspec").
100       include(DIST_DIR).
101       include(API_DOCS_DIR)
102   end
103   
104   delete_files.each {|files| rm_rf files, :verbose => true}
107 desc "Generate sources, compile and add to jar file"
108 task :gen do
109   mkdir_p 'src_gen'
110   system 'apt -nocompile -cp lib/jruby.jar:build_lib/asm-3.0.jar:build_lib/asm-util-3.0.jar -factory org.jruby.anno.AnnotationBinder src/org/jruby/*.java'
111   system 'javac -cp lib/jruby.jar src_gen/*.java'
112   system 'jar -uf lib/jruby.jar -C src_gen .'