Class: Buildr::FindBugs::FindBugsTask
- Inherits:
-
Rake::Task
- Object
- Rake::Task
- Buildr::FindBugs::FindBugsTask
- Defined in:
- lib/buildr-findBugs.rb
Instance Attribute Summary collapse
- #auxAnalyzePath ⇒ Object
- #auxClasspath ⇒ Object
- #jvmargs ⇒ Object
-
#project ⇒ Object
readonly
Returns the value of attribute project.
- #report ⇒ Object
- #sourcePath ⇒ Object
Instance Method Summary collapse
-
#initialize(*args) ⇒ FindBugsTask
constructor
:nodoc:.
-
#with(options) ⇒ Object
:call-seq: with(options) => self.
Constructor Details
#initialize(*args) ⇒ FindBugsTask
:nodoc:
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 |
# File 'lib/buildr-findBugs.rb', line 13 def initialize(*args) #:nodoc: super enhance do raise "Cannot run Findbugs, FINDBUGS_HOME undefined" unless defined? ENV['FINDBUGS_HOME'] mkpath File.dirname(report) #otherwise Findbugs can't create the file Buildr.ant('findBugs') do |ant| refid = "#{project.name}-auxClasspath" artifacts = [Buildr::artifact("com.google.code.findbugs:findbugs-ant:jar:1.3.9")] artifacts.each {|lib| lib.invoke} # We use a huge classpath. ant.path :id => refid do [[auxClasspath] + artifacts].flatten.each do |elt| ant.pathelement :location => elt end end ant.taskdef :name=>'findBugs', :classname=>'edu.umd.cs.findbugs.anttask.FindBugsTask', :classpathref => refid ant.findBugs :output => "xml", :outputFile => report, :home => ENV['FINDBUGS_HOME'], :jvmargs => jvmargs do ant.sourcePath(:path => sourcePath) ant.auxAnalyzePath :path => auxAnalyzePath ant.auxClasspath :refid => refid end end end end |
Instance Attribute Details
#auxAnalyzePath ⇒ Object
51 52 53 |
# File 'lib/buildr-findBugs.rb', line 51 def auxAnalyzePath @auxAnalyzePath || project.compile.target end |
#auxClasspath ⇒ Object
55 56 57 |
# File 'lib/buildr-findBugs.rb', line 55 def auxClasspath @auxClasspath || [project.compile.dependencies] end |
#jvmargs ⇒ Object
59 60 61 |
# File 'lib/buildr-findBugs.rb', line 59 def jvmargs @jvmargs || "-Xmx512m" end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
9 10 11 |
# File 'lib/buildr-findBugs.rb', line 9 def project @project end |
#report ⇒ Object
43 44 45 |
# File 'lib/buildr-findBugs.rb', line 43 def report @report || project.path_to(:reports, "findbugs.xml") end |
#sourcePath ⇒ Object
47 48 49 |
# File 'lib/buildr-findBugs.rb', line 47 def sourcePath @sourcePath || project.compile.sources.select { |source| File.directory?(source.to_s) }.join(File::PATH_SEPARATOR) end |
Instance Method Details
#with(options) ⇒ Object
:call-seq:
with() => self
Passes options to the task and returns self.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/buildr-findBugs.rb', line 69 def with() .each do |key, value| begin send "#{key}=", value rescue NoMethodError raise ArgumentError, "#{self.class.name} does not support the option #{key}" end end self end |