buildr-findBugs 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@
16
16
 
17
17
  Gem::Specification.new do |spec|
18
18
  spec.name = 'buildr-findBugs'
19
- spec.version = '0.1.0'
19
+ spec.version = '0.1.1'
20
20
  spec.author = 'Antoine Toulme'
21
21
  spec.email = "atoulme@intalio.com"
22
22
  spec.homepage = "http://www.github.com/intalio/buildr-findBugs"
@@ -3,68 +3,79 @@
3
3
  module Buildr
4
4
  module FindBugs
5
5
  include Extension
6
+ VERSION = "1.3.9"
7
+
8
+ class << self
9
+ def version
10
+ Buildr.settings.build['findbugs'] || VERSION
11
+ end
12
+ end
13
+
14
+ REQUIRES = ["com.google.code.findbugs:findbugs-ant:jar:#{version}"]
15
+
16
+ class << self
17
+ def requires
18
+ @requires ||= Buildr.transitive(REQUIRES).each(& :invoke).map(& :to_s)
19
+ end
20
+ end
6
21
 
7
22
  class FindBugsTask < Rake::Task
8
23
 
9
24
  attr_reader :project
10
-
11
- attr_writer :sourcePath, :auxAnalyzePath, :auxClasspath, :jvmargs, :report
12
25
 
13
- def initialize(*args) #:nodoc:
26
+ attr_writer :sourcePath, :auxAnalyzePath, :auxClasspath, :jvmargs, :report, :excludeFilter
27
+
28
+ def initialize(* args) #:nodoc:
14
29
  super
15
- enhance do
16
- raise "Cannot run Findbugs, FINDBUGS_HOME undefined" unless defined? ENV['FINDBUGS_HOME']
30
+ enhance([:compile]) do
17
31
  mkpath File.dirname(report) #otherwise Findbugs can't create the file
18
-
32
+
19
33
  Buildr.ant('findBugs') do |ant|
20
- refid = "#{project.name}-auxClasspath"
21
- artifacts = [Buildr::artifact("com.google.code.findbugs:findbugs-ant:jar:1.3.9")]
22
- artifacts.each {|lib| lib.invoke}
23
- # We use a huge classpath.
24
- ant.path :id => refid do
25
- [[auxClasspath] + artifacts].flatten.each do |elt|
26
- ant.pathelement :location => elt
27
- end
28
- end
29
-
34
+ antClasspath = FindBugs.requires.join(File::PATH_SEPARATOR)
35
+ excludeFilterFile = File.expand_path(excludeFilter)
36
+
30
37
  ant.taskdef :name=>'findBugs',
31
- :classname=>'edu.umd.cs.findbugs.anttask.FindBugsTask', :classpathref => refid
32
- ant.findBugs :output => "xml", :outputFile => report, :home => ENV['FINDBUGS_HOME'], :jvmargs => jvmargs do
33
- ant.sourcePath(:path => sourcePath)
38
+ :classname=>'edu.umd.cs.findbugs.anttask.FindBugsTask',
39
+ :classpath => antClasspath
40
+ ant.findBugs :output => "xml", :outputFile => report, :classpath => antClasspath, :pluginList => '', :jvmargs => jvmargs, :excludeFilter => excludeFilterFile do
41
+ ant.sourcePath :path => sourcePath
34
42
  ant.auxAnalyzePath :path => auxAnalyzePath
35
- ant.auxClasspath :refid => refid
43
+ ant.auxClasspath { |aux| auxClasspath.each { |dep| aux.pathelement :location => dep } } unless auxClasspath.empty?
36
44
  end
37
45
 
38
46
  end
39
47
 
40
48
  end
41
49
  end
42
-
50
+
43
51
  def report
44
52
  @report || project.path_to(:reports, "findbugs.xml")
45
53
  end
46
-
54
+
47
55
  def sourcePath
48
56
  @sourcePath || project.compile.sources.select { |source| File.directory?(source.to_s) }.join(File::PATH_SEPARATOR)
49
57
  end
50
-
58
+
51
59
  def auxAnalyzePath
52
60
  @auxAnalyzePath || project.compile.target
53
61
  end
54
-
62
+
55
63
  def auxClasspath
56
- @auxClasspath || [project.compile.dependencies]
64
+ @auxClasspath || project.compile.dependencies
57
65
  end
58
-
66
+
59
67
  def jvmargs
60
68
  @jvmargs || "-Xmx512m"
61
69
  end
62
-
70
+
71
+ def excludeFilter
72
+ @excludeFilter || project.path_to("exclude_filter.xml")
73
+ end
63
74
 
64
75
  # :call-seq:
65
76
  # with(options) => self
66
77
  #
67
- # Passes options to the task and returns self.
78
+ # Passes options to the task and returns self.
68
79
  #
69
80
  def with(options)
70
81
  options.each do |key, value|
@@ -76,14 +87,14 @@ module Buildr
76
87
  end
77
88
  self
78
89
  end
79
-
80
- private
90
+
91
+ private
81
92
 
82
93
  def associate_with(project)
83
94
  @project = project
84
- end
85
-
86
-
95
+ end
96
+
97
+
87
98
  end
88
99
 
89
100
  first_time do
@@ -97,18 +108,19 @@ module Buildr
97
108
  project.recursive_task('findBugs')
98
109
  end
99
110
 
100
- after_define do |project|
111
+ after_define do |project|
101
112
  project.clean do
102
113
  rm_rf project.path_to(:reports, "findbugs.xml")
103
114
  end
104
115
  end
105
116
 
106
- def findBugs(*deps, &block)
107
- task('findBugs').enhance deps, &block
117
+ def findBugs(* deps, & block)
118
+ task('findBugs').enhance deps, & block
108
119
  end
109
120
  end
110
121
  end
111
122
 
112
123
  class Buildr::Project
113
124
  include Buildr::FindBugs
114
- end
125
+ end
126
+
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildr-findBugs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
5
11
  platform: ruby
6
12
  authors:
7
13
  - Antoine Toulme
@@ -9,19 +15,25 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-01-23 00:00:00 -08:00
18
+ date: 2010-08-09 00:00:00 +02:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: buildr
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 1
32
+ - 4
33
+ - 0
23
34
  version: 1.4.0
24
- version:
35
+ type: :runtime
36
+ version_requirements: *id001
25
37
  description: |
26
38
  Adds a task to help run FindBugs over your code.
27
39
 
@@ -50,21 +62,27 @@ rdoc_options: []
50
62
  require_paths:
51
63
  - lib
52
64
  required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
53
66
  requirements:
54
67
  - - ">="
55
68
  - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
56
72
  version: "0"
57
- version:
58
73
  required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
59
75
  requirements:
60
76
  - - ">="
61
77
  - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
62
81
  version: "0"
63
- version:
64
82
  requirements: []
65
83
 
66
84
  rubyforge_project:
67
- rubygems_version: 1.3.5
85
+ rubygems_version: 1.3.7
68
86
  signing_key:
69
87
  specification_version: 3
70
88
  summary: A plugin for adding FindBugs support to Buildr.