buildr 1.4.6-x86-mswin32 → 1.4.7-x86-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. data/CHANGELOG +81 -0
  2. data/Rakefile +5 -2
  3. data/addon/buildr/antlr.rb +0 -4
  4. data/addon/buildr/bnd.rb +3 -1
  5. data/addon/buildr/checkstyle.rb +201 -0
  6. data/addon/buildr/cobertura.rb +0 -1
  7. data/addon/buildr/drb.rb +0 -2
  8. data/addon/buildr/emma.rb +0 -1
  9. data/addon/buildr/findbugs.rb +227 -0
  10. data/addon/buildr/gwt.rake +82 -0
  11. data/addon/buildr/hibernate.rb +0 -4
  12. data/addon/buildr/javacc.rb +0 -4
  13. data/addon/buildr/javancss.rb +155 -0
  14. data/addon/buildr/jdepend.rb +138 -24
  15. data/addon/buildr/jdepend.rb.orig +178 -0
  16. data/addon/buildr/jetty.rb +0 -5
  17. data/addon/buildr/jibx.rb +85 -86
  18. data/addon/buildr/nailgun.rb +2 -2
  19. data/addon/buildr/openjpa.rb +0 -4
  20. data/addon/buildr/pmd.rb +166 -0
  21. data/addon/buildr/protobuf.rb +0 -1
  22. data/addon/buildr/sonar.rb +142 -0
  23. data/addon/buildr/xmlbeans.rb +0 -5
  24. data/buildr.gemspec +36 -21
  25. data/doc/_layouts/default.html +1 -0
  26. data/doc/contributing.textile +11 -2
  27. data/doc/download.textile +17 -5
  28. data/doc/index.textile +21 -46
  29. data/doc/installing.textile +18 -8
  30. data/doc/installing.textile.orig +282 -0
  31. data/doc/languages.textile +0 -38
  32. data/doc/more_stuff.textile +199 -12
  33. data/doc/more_stuff.textile.orig +1004 -0
  34. data/doc/packaging.textile +10 -0
  35. data/doc/settings_profiles.textile +2 -2
  36. data/etc/KEYS +44 -0
  37. data/lib/buildr.rb +67 -4
  38. data/lib/buildr/clojure.rb +0 -2
  39. data/lib/buildr/core/application.rb +23 -32
  40. data/lib/buildr/core/build.rb +0 -7
  41. data/lib/buildr/core/cc.rb +0 -5
  42. data/lib/buildr/core/checks.rb +0 -4
  43. data/lib/buildr/core/common.rb +0 -5
  44. data/lib/buildr/core/compile.rb +5 -10
  45. data/lib/buildr/core/doc.rb +9 -3
  46. data/lib/buildr/core/environment.rb +0 -1
  47. data/lib/buildr/core/filter.rb +0 -5
  48. data/lib/buildr/core/generate.rb +2 -6
  49. data/lib/buildr/core/help.rb +1 -6
  50. data/lib/buildr/core/linux.rb +0 -1
  51. data/lib/buildr/core/osx.rb +0 -1
  52. data/lib/buildr/core/project.rb +0 -4
  53. data/lib/buildr/core/run.rb +1 -5
  54. data/lib/buildr/core/shell.rb +1 -6
  55. data/lib/buildr/core/test.rb +1 -7
  56. data/lib/buildr/core/transports.rb +4 -6
  57. data/lib/buildr/core/util.rb +2 -65
  58. data/lib/buildr/groovy/doc.rb +0 -3
  59. data/lib/buildr/groovy/shell.rb +0 -2
  60. data/lib/buildr/ide/eclipse.rb +4 -13
  61. data/lib/buildr/ide/eclipse/java.rb +0 -4
  62. data/lib/buildr/ide/eclipse/plugin.rb +0 -4
  63. data/lib/buildr/ide/eclipse/scala.rb +0 -4
  64. data/lib/buildr/ide/idea.rb +284 -52
  65. data/lib/buildr/java/ant.rb +2 -6
  66. data/lib/buildr/java/bdd.rb +5 -123
  67. data/lib/buildr/java/cobertura.rb +16 -10
  68. data/lib/buildr/java/commands.rb +33 -7
  69. data/lib/buildr/java/compiler.rb +0 -7
  70. data/lib/buildr/java/deprecated.rb +0 -4
  71. data/lib/buildr/java/doc.rb +0 -2
  72. data/lib/buildr/java/emma.rb +0 -4
  73. data/lib/buildr/java/jruby.rb +0 -2
  74. data/lib/buildr/java/packaging.rb +0 -4
  75. data/lib/buildr/java/pom.rb +24 -16
  76. data/lib/buildr/java/rjb.rb +1 -1
  77. data/lib/buildr/java/test_result.rb +1 -2
  78. data/lib/buildr/java/tests.rb +68 -6
  79. data/lib/buildr/packaging/archive.rb +0 -1
  80. data/lib/buildr/packaging/artifact.rb +19 -16
  81. data/lib/buildr/packaging/artifact_namespace.rb +51 -24
  82. data/lib/buildr/packaging/artifact_search.rb +1 -2
  83. data/lib/buildr/packaging/gems.rb +1 -13
  84. data/lib/buildr/packaging/package.rb +0 -6
  85. data/lib/buildr/packaging/tar.rb +2 -4
  86. data/lib/buildr/packaging/version_requirement.rb +1 -1
  87. data/lib/buildr/packaging/zip.rb +1 -2
  88. data/lib/buildr/packaging/ziptask.rb +0 -4
  89. data/lib/buildr/run.rb +3 -3
  90. data/lib/buildr/scala/bdd.rb +129 -11
  91. data/lib/buildr/scala/compiler.rb +53 -6
  92. data/lib/buildr/scala/doc.rb +6 -4
  93. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
  94. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.java +38 -0
  95. data/lib/buildr/scala/shell.rb +0 -4
  96. data/lib/buildr/scala/tests.rb +15 -6
  97. data/lib/buildr/shell.rb +0 -1
  98. data/lib/buildr/version.rb +1 -1
  99. data/rakelib/all-in-one.rake +20 -11
  100. data/rakelib/checks.rake +0 -31
  101. data/rakelib/doc.rake +86 -100
  102. data/rakelib/package.rake +3 -3
  103. data/rakelib/release.rake +1 -1
  104. data/rakelib/rspec.rake +23 -7
  105. data/rakelib/stage.rake +18 -21
  106. data/spec/addon/bnd_spec.rb +2 -2
  107. data/spec/addon/jaxb_xjc_spec.rb +5 -0
  108. data/spec/core/application_spec.rb +11 -64
  109. data/spec/core/cc_spec.rb +12 -5
  110. data/spec/core/compile_spec.rb +11 -0
  111. data/spec/core/doc_spec.rb +1 -1
  112. data/spec/core/run_spec.rb +17 -4
  113. data/spec/core/test_spec.rb +5 -3
  114. data/spec/ide/idea_spec.rb +60 -0
  115. data/spec/java/bdd_spec.rb +8 -218
  116. data/spec/java/cobertura_spec.rb +4 -0
  117. data/spec/java/compiler_spec.rb +11 -8
  118. data/spec/java/emma_spec.rb +4 -1
  119. data/spec/java/java_spec.rb +1 -1
  120. data/spec/java/pom_spec.rb +125 -0
  121. data/spec/java/tests_spec.rb +185 -0
  122. data/spec/packaging/archive_spec.rb +1 -1
  123. data/spec/packaging/artifact_namespace_spec.rb +15 -0
  124. data/spec/packaging/artifact_spec.rb +26 -1
  125. data/spec/sandbox.rb +7 -1
  126. data/spec/scala/bdd_spec.rb +111 -8
  127. data/spec/scala/tests_spec.rb +5 -1
  128. data/spec/spec_helpers.rb +9 -4
  129. data/spec/version_requirement_spec.rb +2 -0
  130. metadata +570 -505
  131. data/lib/buildr/core.rb +0 -34
  132. data/lib/buildr/ide.rb +0 -19
  133. data/lib/buildr/java.rb +0 -25
  134. data/lib/buildr/java/jtestr_result.rb +0 -331
  135. data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
  136. data/lib/buildr/packaging.rb +0 -25
  137. data/rakelib/setup.rake +0 -68
data/CHANGELOG CHANGED
@@ -1,3 +1,84 @@
1
+ 1.4.7 (2012-05-29)
2
+ * Added: BUILDR-618 pom properties feature does not support hierarchy (kafka liu)
3
+ * Added: Add a Sonar extension.
4
+ * Change: BUILDR-638 Update to rake 0.9.2.2 (Russell Teabeault)
5
+ * Added: BUILDR-316 Add a GWT extension
6
+ * Change: BUILDR-624 Update rspec version to 2.9.0 (Russell Teabeault)
7
+ * Change: BUILDR-632 Update net-ssh version to 2.3.0 (Russell Teabeault)
8
+ * Change: BUILDR-632 Update net-sftp version to 2.0.5 (Russell Teabeault)
9
+ * Fixed: BUILDR-635 JRE container entry to be declared before user sources and dependencies (Dani Perez)
10
+ * Change: BUILDR-639 Stop requiring pygmentize to run "rake -T" (Russell Teabeault)
11
+ * Added: Enhance the IDEA extension to support the addition of several explicit facets such as
12
+ ejb, jruby, jpa, web and gwt.
13
+ * Added: Add several utility methods to IDEA extension for defining artifacts and configurations.
14
+ Add some explicit methods to support a gwt configuration and a "Exploded War" artifact.
15
+ * Change: Upgraded to Apache Ant 1.8.3
16
+ * Change: Default maven2 repository is now repo1.maven.org/maven2.
17
+ * Change: Make minimumTokenCount and encoding configurable for the PMD/CPD action
18
+ and default encoding to UTF-8 for compatibility with external tools (i.e. Jenkins)
19
+ * Change: BUILDR-615 VersionRequirement.version? now returns true for
20
+ versions following pattern "r9999", e.g. "r09"
21
+ * Change: BUILDR-630 Run task should not add test dependencies (Russell Teabeault)
22
+ * Change: BUILDR-629 JavaRunner should include target/resources in classpath (Russell Teabeault)
23
+ * Fixed: BUILDR-617 pom exclusion does not work (Kafka Liu)
24
+ * Added: Add a Findbugs extension.
25
+ * Added: Add a Checkstyle extension.
26
+ * Added: Add a JavaNCSS extension.
27
+ * Added: Add a PMD extension.
28
+ * Added: MultiTest framework that allows combining multiple test frameworks
29
+ for a single project.
30
+ * Added: Scala Specs2 framework support.
31
+ * Added: Buildr.transitive() now accepts hash with :scopes, :optional and
32
+ :scopes_transitive parameters
33
+ * Added: Improved scala file change detection
34
+ (to avoid recompiling unnecessarily)
35
+ * Added: ScalaTest now automatically loads the Mockito library
36
+ * Added: Enhance the Intellij IDEA extension to support the addition of "artifacts"
37
+ and "configurations" to the generated project file.
38
+ * Added: BUILDR-598 TestNG support for :groups and :excludegroups (Christopher Coco)
39
+ * Added: BUILDR-616 Buildr development - If using rvm a default .rvmrc file would be helpful (Russell Teabeault)
40
+ * Change: Scala Specs upgraded to 1.6.9 if using Scala 2.9.1
41
+ * Change: Scala 2.9.1 is now default
42
+ * Change: Make it possible to parameterize the JDepend extension and control the
43
+ projects that are included in the analysis and to enable support for
44
+ loading a per project jdepend.properties.
45
+ * Change: Parameterize the the directory where the top level cobertura tasks will generate
46
+ reports. Specify using Buildr::Cobertura.report_dir = '....'
47
+ * Change: Stop pretty printing the Intellij IDEA project files to avoid IDEA breaking
48
+ in the presence of non-normalized whitespace content.
49
+ * Change: Change the Intellij IDEA extension to always rebuild the project files.
50
+ * Change: Upgrade to require atoulme-Antwrap 0.7.2
51
+ * Change: Changed the default output directory for Intellij IDEA extension to be
52
+ _(:target, :main, :idea, :classes) from _(:target, :main, :java) and the
53
+ default test output directory to be _(:target, :test, :idea, :classes)
54
+ from _(:target, :test, :java)
55
+ * Change: Upgrade to highline 1.6.2
56
+ * Change: Upgrade to jekyll 0.11.0, jekylltask 1.1.0, RedCloth 4.2.7, rdoc 3.8 for
57
+ generating documentation
58
+ * Change: Upgrade to require rubygems > 1.8.6
59
+ * Change: BUILDR-603 Remove install/uninstall actions from :gem packaging type
60
+ * Change: BUILDR-602 Fail the build when gem dependencies are missing rather than
61
+ attempting to install the dependencies
62
+ * Change: BUILDR-601 Remove Buildr::Util::Gems
63
+ * Change: BUILDR-600 Centralize the common ad internal requires into one location.
64
+ * Change: Upgrade to JRuby 1.6.2
65
+ * Change: Move to Bundler to manage the project dependencies
66
+ * Change: BUILDR-548 Remove support for JTestR as it is no longer maintained (Antoine Toulme)
67
+ * Change: BUILDR-614 Buildr development - Using rvm, bundler and OSX installs the wrong rjb (Russell Teabeault)
68
+ * Change: Upgrade to RJB 1.4.0
69
+ * Fixed: ArtifactNamespace fails when using artifacts with classfier.
70
+ * Fixed: Buildr.artifacts() should handle any object with :to_spec method
71
+ (i.e., any object that ActsAsArtifact)
72
+ * Fixed: Handle HTTP Unauthorized (501) result code when downloading artifacts.
73
+ * Fixed: BUILDR-611 Buildr should not unnecessarily recompile Java files
74
+ explicitly added to compile.from
75
+ * Fixed: scaladoc generation with scala 2.9.x
76
+ * Fixed: Bnd Plugin: Add each artifact individually as a prerequisite to
77
+ bundle / package task when passed to classpath_element method
78
+ * Fixed: BUILDR-439 "The command line is too long" when running TestNG tests (Tammo Van Lessen)
79
+ * Fixed: BUILDR-595 Add option to specifiy location of ca cert
80
+ * Fixed: BUILDR-596 Update installation notes to talk about the all-in-one bundle
81
+
1
82
  1.4.6 (2011-06-21)
2
83
  * Added: BUILDR-592 Allow Users to Specify SSH Options for Deployment (Marc-André Laverdière)
3
84
  * Fixed: BUILDR-591 Sort modules in iml files generated by idea task to ensure
data/Rakefile CHANGED
@@ -13,10 +13,13 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
+ # To work-around a bug with gemcutter: http://stackoverflow.com/questions/4932881/gemcutter-rake-build-now-throws-undefined-method-write-for-syckemitter
17
+ require 'psych' if RUBY_VERSION >= '1.9.2' && !RUBY_PLATFORM[/java/]
18
+
16
19
  # We need JAVA_HOME for most things (setup, spec, etc).
17
20
  unless ENV['JAVA_HOME']
18
21
  if RUBY_PLATFORM[/java/]
19
- ENV['JAVA_HOME'] = java.lang.System.getProperty('java.home')
22
+ ENV['JAVA_HOME'] = Java.java.lang.System.getProperty('java.home')
20
23
  elsif RUBY_PLATFORM[/darwin/]
21
24
  ENV['JAVA_HOME'] = '/System/Library/Frameworks/JavaVM.framework/Home'
22
25
  else
@@ -36,7 +39,7 @@ end
36
39
 
37
40
  # Tell us if we need sudo for various commands.
38
41
  def sudo_needed?
39
- Config::CONFIG['host_os'] !~ /windows|cygwin|bccwin|cygwin|djgpp|mingw|mswin|wince/i && !ENV['GEM_HOME']
42
+ RbConfig::CONFIG['host_os'] !~ /windows|cygwin|bccwin|cygwin|djgpp|mingw|mswin|wince/i && !ENV['GEM_HOME']
40
43
  end
41
44
 
42
45
 
@@ -13,10 +13,6 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
-
17
- require 'buildr/java'
18
-
19
-
20
16
  module Buildr
21
17
  # Provides ANTLR grammar generation tasks. Require explicitly using <code>require "buildr/antlr"</code>.
22
18
  module ANTLR
data/addon/buildr/bnd.rb CHANGED
@@ -46,7 +46,9 @@ module Buildr
46
46
 
47
47
  def classpath_element(dependencies)
48
48
  artifacts = Buildr.artifacts([dependencies])
49
- self.prerequisites << artifacts
49
+ artifacts.each do |artifact|
50
+ self.prerequisites << artifact
51
+ end
50
52
  artifacts.each do |dependency|
51
53
  self.classpath << dependency.to_s
52
54
  end
@@ -0,0 +1,201 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ module Buildr
17
+ # Provides the <code>checkstyle:html</code> and <code>checkstyle:xml</code> tasks.
18
+ # Require explicitly using <code>require "buildr/checkstyle"</code>.
19
+ module Checkstyle
20
+
21
+ class << self
22
+
23
+ # The specs for requirements
24
+ def dependencies
25
+ [
26
+ 'com.puppycrawl.tools:checkstyle:jar:5.4',
27
+ 'commons-cli:commons-cli:jar:1.2',
28
+ 'antlr:antlr:jar:2.7.7',
29
+ 'com.google.collections:google-collections:jar:1.0',
30
+ 'commons-beanutils:commons-beanutils-core:jar:1.8.3',
31
+ 'commons-logging:commons-logging:jar:1.1.1'
32
+ ]
33
+ end
34
+
35
+ def checkstyle(configuration_file, format, output_file, source_paths, options = {})
36
+ dependencies = (options[:dependencies] || []) + self.dependencies
37
+ cp = Buildr.artifacts(dependencies).each(&:invoke).map(&:to_s)
38
+
39
+ args = []
40
+ if options[:properties_file]
41
+ args << "-p"
42
+ args << options[:properties_file]
43
+ end
44
+ args << "-c"
45
+ args << configuration_file
46
+ args << "-f"
47
+ args << format
48
+ args << "-o"
49
+ args << output_file
50
+ source_paths.each do |source_path|
51
+ args << "-r"
52
+ args << source_path
53
+ end
54
+
55
+ begin
56
+ Java::Commands.java 'com.puppycrawl.tools.checkstyle.Main', *(args + [{:classpath => cp, :properties => options[:properties], :java_args => options[:java_args]}])
57
+ rescue => e
58
+ raise e if options[:fail_on_error]
59
+ end
60
+ end
61
+ end
62
+
63
+ class Config
64
+ def enabled?
65
+ File.exist?(self.configuration_file)
66
+ end
67
+
68
+ def html_enabled?
69
+ File.exist?(self.style_file)
70
+ end
71
+
72
+ attr_writer :config_directory
73
+
74
+ def config_directory
75
+ @config_directory || project._(:source, :main, :etc, :checkstyle)
76
+ end
77
+
78
+ attr_writer :report_dir
79
+
80
+ def report_dir
81
+ @report_dir || project._(:reports, :checkstyle)
82
+ end
83
+
84
+ attr_writer :configuration_file
85
+
86
+ def configuration_file
87
+ @configuration_file || "#{self.config_directory}/checks.xml"
88
+ end
89
+
90
+ attr_writer :fail_on_error
91
+
92
+ def fail_on_error?
93
+ @fail_on_error.nil? ? false : @fail_on_error
94
+ end
95
+
96
+ attr_writer :format
97
+
98
+ def format
99
+ @format || 'xml'
100
+ end
101
+
102
+ attr_writer :xml_output_file
103
+
104
+ def xml_output_file
105
+ @xml_output_file || "#{self.report_dir}/checkstyle.xml"
106
+ end
107
+
108
+ attr_writer :html_output_file
109
+
110
+ def html_output_file
111
+ @html_output_file || "#{self.report_dir}/checkstyle.html"
112
+ end
113
+
114
+ attr_writer :style_file
115
+
116
+ def style_file
117
+ @style_file || "#{self.config_directory}/checkstyle-report.xsl"
118
+ end
119
+
120
+ attr_writer :suppressions_file
121
+
122
+ def suppressions_file
123
+ @suppressions_file || "#{self.config_directory}/suppressions.xml"
124
+ end
125
+
126
+ attr_writer :import_control_file
127
+
128
+ def import_control_file
129
+ @import_control_file || "#{self.config_directory}/import-control.xml"
130
+ end
131
+
132
+ def properties
133
+ properties = {:basedir => self.project.base_dir}
134
+ properties['checkstyle.suppressions.file'] = self.suppressions_file if File.exist?(self.suppressions_file)
135
+ properties['checkstyle.import-control.file'] = self.import_control_file if File.exist?(self.import_control_file)
136
+ properties
137
+ end
138
+
139
+ def source_paths
140
+ @source_paths ||= [self.project.compile.sources, self.project.test.compile.sources]
141
+ end
142
+
143
+ def extra_dependencies
144
+ @extra_dependencies ||= [self.project.compile.dependencies, self.project.test.compile.dependencies]
145
+ end
146
+
147
+ protected
148
+
149
+ def initialize(project)
150
+ @project = project
151
+ end
152
+
153
+ attr_reader :project
154
+
155
+ end
156
+
157
+ module ProjectExtension
158
+ include Extension
159
+
160
+ def checkstyle
161
+ @checkstyle ||= Buildr::Checkstyle::Config.new(project)
162
+ end
163
+
164
+ after_define do |project|
165
+ if project.checkstyle.enabled?
166
+ desc "Generate checkstyle xml report."
167
+ project.task("checkstyle:xml") do
168
+ puts "Checkstyle: Analyzing source code..."
169
+ mkdir_p File.dirname(project.checkstyle.xml_output_file)
170
+ Buildr::Checkstyle.checkstyle(project.checkstyle.configuration_file,
171
+ project.checkstyle.format,
172
+ project.checkstyle.xml_output_file,
173
+ project.checkstyle.source_paths.flatten.compact,
174
+ :properties => project.checkstyle.properties,
175
+ :fail_on_error => project.checkstyle.fail_on_error?,
176
+ :dependencies => project.checkstyle.extra_dependencies)
177
+ end
178
+
179
+ if project.checkstyle.html_enabled?
180
+ xml_task = project.task("checkstyle:xml")
181
+ desc "Generate checkstyle html report."
182
+ project.task("checkstyle:html" => xml_task) do
183
+ puts "Checkstyle: Generating report"
184
+ mkdir_p File.dirname(project.checkstyle.html_output_file)
185
+ Buildr.ant "checkstyle" do |ant|
186
+ ant.xslt :in => project.checkstyle.xml_output_file,
187
+ :out => project.checkstyle.html_output_file,
188
+ :style => project.checkstyle.style_file
189
+ end
190
+ end
191
+
192
+ end
193
+ end
194
+ end
195
+ end
196
+ end
197
+ end
198
+
199
+ class Buildr::Project
200
+ include Buildr::Checkstyle::ProjectExtension
201
+ end
@@ -13,7 +13,6 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
-
17
16
  if Buildr::VERSION < '1.5'
18
17
  Buildr.application.deprecated "'buildr/cobertura', use 'buildr/java/cobertura' instead"
19
18
  require 'buildr/java/cobertura'
data/addon/buildr/drb.rb CHANGED
@@ -13,11 +13,9 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
-
17
16
  require 'delegate'
18
17
  require 'drb/drb'
19
18
 
20
-
21
19
  module Buildr
22
20
 
23
21
  # This addon allows you start a DRb server hosting a buildfile, so that
data/addon/buildr/emma.rb CHANGED
@@ -13,7 +13,6 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
-
17
16
  if Buildr::VERSION < '1.5'
18
17
  Buildr.application.deprecated "'buildr/emma', use 'buildr/java/emma' instead"
19
18
  require 'buildr/java/emma'
@@ -0,0 +1,227 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ module Buildr
17
+ # Provides the <code>findbugs:html</code> and <code>findbugs:xml</code> tasks.
18
+ # Require explicitly using <code>require "buildr/findbugs"</code>.
19
+ module Findbugs
20
+
21
+ class << self
22
+
23
+ # The specs for requirements
24
+ def dependencies
25
+ [
26
+ 'com.google.code.findbugs:findbugs-ant:jar:1.3.9',
27
+ 'com.google.code.findbugs:findbugs:jar:1.3.9',
28
+ 'com.google.code.findbugs:bcel:jar:1.3.9',
29
+ 'com.google.code.findbugs:jsr305:jar:1.3.9',
30
+ 'com.google.code.findbugs:jFormatString:jar:1.3.9',
31
+ 'com.google.code.findbugs:annotations:jar:1.3.9',
32
+ 'dom4j:dom4j:jar:1.6.1',
33
+ 'jaxen:jaxen:jar:1.1.1',
34
+ 'jdom:jdom:jar:1.0',
35
+ 'xom:xom:jar:1.0',
36
+ 'com.ibm.icu:icu4j:jar:2.6.1',
37
+ 'asm:asm:jar:3.1',
38
+ 'asm:asm-analysis:jar:3.1',
39
+ 'asm:asm-tree:jar:3.1',
40
+ 'asm:asm-commons:jar:3.1',
41
+ 'asm:asm-util:jar:3.1',
42
+ 'asm:asm-xml:jar:3.1',
43
+ 'commons-lang:commons-lang:jar:2.4'
44
+ ]
45
+ end
46
+
47
+ def findbugs(output_file, source_paths, analyze_paths, options = { })
48
+ dependencies = (options[:dependencies] || []) + self.dependencies
49
+ cp = Buildr.artifacts(dependencies).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
50
+
51
+ args = {
52
+ :output => "xml:withMessages",
53
+ :outputFile => output_file,
54
+ :effort => 'max',
55
+ :pluginList => '',
56
+ :classpath => cp,
57
+ :timeout => "90000000",
58
+ :debug => "false"
59
+ }
60
+ args[:failOnError] = true if options[:fail_on_error]
61
+ args[:excludeFilter] = options[:exclude_filter] if options[:exclude_filter]
62
+ args[:jvmargs] = options[:java_args] if options[:java_args]
63
+
64
+ Buildr.ant('findBugs') do |ant|
65
+ ant.taskdef :name =>'findBugs',
66
+ :classname =>'edu.umd.cs.findbugs.anttask.FindBugsTask',
67
+ :classpath => cp
68
+ ant.findBugs args do
69
+ source_paths.each do |source_path|
70
+ ant.sourcePath :path => source_path.to_s
71
+ end
72
+ Buildr.artifacts(analyze_paths).each(&:invoke).each do |analyze_path|
73
+ ant.auxAnalyzePath :path => analyze_path.to_s
74
+ end
75
+ if options[:properties]
76
+ options[:properties].each_pair do |k, v|
77
+ ant.systemProperty :name => k, :value => v
78
+ end
79
+ end
80
+ if options[:extra_dependencies]
81
+ ant.auxClasspath do |aux|
82
+ Buildr.artifacts(options[:extra_dependencies]).each(&:invoke).each do |dep|
83
+ aux.pathelement :location => dep.to_s
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+
92
+ class Config
93
+
94
+ attr_accessor :enabled
95
+
96
+ def enabled?
97
+ !!@enabled
98
+ end
99
+
100
+ def html_enabled?
101
+ File.exist?(self.style_file)
102
+ end
103
+
104
+ attr_writer :config_directory
105
+
106
+ def config_directory
107
+ @config_directory || project._(:source, :main, :etc, :findbugs)
108
+ end
109
+
110
+ attr_writer :report_dir
111
+
112
+ def report_dir
113
+ @report_dir || project._(:reports, :findbugs)
114
+ end
115
+
116
+ attr_writer :fail_on_error
117
+
118
+ def fail_on_error?
119
+ @fail_on_error.nil? ? false : @fail_on_error
120
+ end
121
+
122
+ attr_writer :xml_output_file
123
+
124
+ def xml_output_file
125
+ @xml_output_file || "#{self.report_dir}/findbugs.xml"
126
+ end
127
+
128
+ attr_writer :html_output_file
129
+
130
+ def html_output_file
131
+ @html_output_file || "#{self.report_dir}/findbugs.html"
132
+ end
133
+
134
+ attr_writer :style_file
135
+
136
+ def style_file
137
+ @style_file || "#{self.config_directory}/findbugs-report.xsl"
138
+ end
139
+
140
+ attr_writer :filter_file
141
+
142
+ def filter_file
143
+ @filter_file || "#{self.config_directory}/filter.xml"
144
+ end
145
+
146
+ def properties
147
+ @properties ||= { }
148
+ end
149
+
150
+ attr_writer :java_args
151
+
152
+ def java_args
153
+ @java_args || "-server -Xss1m -Xmx800m -Duser.language=en -Duser.region=EN "
154
+ end
155
+
156
+ def source_paths
157
+ @source_paths ||= [self.project.compile.sources, self.project.test.compile.sources]
158
+ end
159
+
160
+ def analyze_paths
161
+ @analyze_path ||= [self.project.compile.target]
162
+ end
163
+
164
+ def extra_dependencies
165
+ @extra_dependencies ||= [self.project.compile.dependencies, self.project.test.compile.dependencies]
166
+ end
167
+
168
+ protected
169
+
170
+ def initialize(project)
171
+ @project = project
172
+ end
173
+
174
+ attr_reader :project
175
+
176
+ end
177
+
178
+ module ProjectExtension
179
+ include Extension
180
+
181
+ def findbugs
182
+ @findbugs ||= Buildr::Findbugs::Config.new(project)
183
+ end
184
+
185
+ after_define do |project|
186
+ if project.findbugs.enabled?
187
+ desc "Generate findbugs xml report."
188
+ project.task("findbugs:xml") do
189
+ puts "Findbugs: Analyzing source code..."
190
+ mkdir_p File.dirname(project.findbugs.xml_output_file)
191
+
192
+ options =
193
+ {
194
+ :properties => project.findbugs.properties,
195
+ :fail_on_error => project.findbugs.fail_on_error?,
196
+ :extra_dependencies => project.findbugs.extra_dependencies
197
+ }
198
+ options[:exclude_filter] = project.findbugs.filter_file if File.exist?(project.findbugs.filter_file)
199
+
200
+ Buildr::Findbugs.findbugs(project.findbugs.xml_output_file,
201
+ project.findbugs.source_paths.flatten.compact,
202
+ project.findbugs.analyze_paths.flatten.compact,
203
+ options)
204
+ end
205
+
206
+ if project.findbugs.html_enabled?
207
+ xml_task = project.task("findbugs:xml")
208
+ desc "Generate findbugs html report."
209
+ project.task("findbugs:html" => xml_task) do
210
+ puts "Findbugs: Generating report"
211
+ mkdir_p File.dirname(project.findbugs.html_output_file)
212
+ Buildr.ant "findbugs" do |ant|
213
+ ant.style :in => project.findbugs.xml_output_file,
214
+ :out => project.findbugs.html_output_file,
215
+ :style => project.findbugs.style_file
216
+ end
217
+ end
218
+ end
219
+ end
220
+ end
221
+ end
222
+ end
223
+ end
224
+
225
+ class Buildr::Project
226
+ include Buildr::Findbugs::ProjectExtension
227
+ end