lib/java/test.rb in buildr-1.2.0 vs lib/java/test.rb in buildr-1.2.1
- old
+ new
@@ -584,11 +584,11 @@
Java::TestTask.define_task("test")
project.test.instance_eval { instance_variable_set :@project, project }
#project.recursive_task("test")
# Similar to the regular resources task but using different paths.
resources = Java::ResourcesTask.define_task("test:resources")
- project.path_to("src/test/resources").tap { |dir| resources.filter.from dir if File.exist?(dir) }
+ project.path_to("src/test/resources").tap { |dir| resources.from dir if File.exist?(dir) }
# Similar to the regular compile task but using different paths.
compile = Java::CompileTask.define_task("test:compile"=>[project.compile, task("test:prepare"), project.test.resources])
project.path_to("src/test/java").tap { |dir| compile.from dir if File.exist?(dir) }
compile.into project.path_to(:target, "test-classes")
resources.filter.into compile.target
@@ -618,29 +618,40 @@
# after the build, including when running build related tasks like install, deploy and release.
#
# Set to false to not run any test cases. Set to :all to run all test cases, ignoring failures.
#
# This option is set from the environment variable "test", so you can also do:
- # buildr # With tests
- # buildr test=no # Without tests
- # buildr test=all # Ignore failures
- attr_accessor :test
- def test() #:nodoc:
- if @test.nil?
- case value = ENV["TEST"] || ENV["test"]
- when /^(no|off|false|skip)$/i
- @test = false
- when /^all$/i
- @test = :all
- when /^(yes|on|true)$/i, nil
- @test = true
- else
- warn "Expecting the environment variable test to be 'no' or 'all', not sure what to do with #{value}, so I'm just going to run all the test cases and stop at failure."
- @test = true
- end
+ # Returns the test option (environment variable TEST). Possible values are:
+ # * :false -- Do not run any test cases (also accepts "no" and "skip").
+ # * :true -- Run all test cases, stop on failure (default if not set).
+ # * :all -- Run all test cases, ignore failures.
+ def test()
+ case value = ENV["TEST"] || ENV["test"]
+ when /^(no|off|false|skip)$/i
+ false
+ when /^all$/i
+ :all
+ when /^(yes|on|true)$/i, nil
+ true
+ else
+ warn "Expecting the environment variable test to be 'no' or 'all', not sure what to do with #{value}, so I'm just going to run all the test cases and stop at failure."
+ true
end
- @test
+ end
+
+ # Sets the test option (environment variable TEST). Possible values are true, false or :all.
+ #
+ # You can also set this from the environment variable, e.g.:
+ #
+ # buildr # With tests
+ # buildr test=no # Without tests
+ # buildr test=all # Ignore failures
+ # set TEST=no
+ # buildr # Without tests
+ def test=(flag)
+ ENV["test"] = nil
+ ENV["TEST"] = flag.to_s
end
end