buildr 1.4.16 → 1.4.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG +20 -0
  3. data/addon/buildr/bnd.rb +158 -158
  4. data/addon/buildr/checkstyle-report.xsl +87 -0
  5. data/addon/buildr/checkstyle.rb +213 -205
  6. data/addon/buildr/css_lint-report.xsl +83 -0
  7. data/addon/buildr/css_lint.rake +196 -0
  8. data/addon/buildr/custom_pom.rb +282 -0
  9. data/addon/buildr/drb.rb +0 -1
  10. data/addon/buildr/git_auto_version.rb +34 -34
  11. data/addon/buildr/gwt.rb +171 -171
  12. data/addon/buildr/hibernate.rb +8 -8
  13. data/addon/buildr/javancss.rb +155 -155
  14. data/addon/buildr/jaxb_xjc.rb +74 -74
  15. data/addon/buildr/jibx.rb +0 -1
  16. data/addon/buildr/org/apache/buildr/BuildrNail.java +2 -2
  17. data/addon/buildr/org/apache/buildr/JettyWrapper.java +3 -3
  18. data/addon/buildr/package_as_nsis.rb +2 -2
  19. data/addon/buildr/pmd.rb +166 -166
  20. data/addon/buildr/scss_lint-report.xsl +79 -0
  21. data/addon/buildr/scss_lint.rb +199 -0
  22. data/addon/buildr/wsgen.rb +4 -0
  23. data/doc/building.textile +3 -3
  24. data/doc/css/default.css +3 -3
  25. data/doc/css/print.css +1 -1
  26. data/doc/download.textile +18 -7
  27. data/doc/index.textile +8 -1
  28. data/doc/installing.textile +3 -3
  29. data/doc/languages.textile +0 -1
  30. data/doc/mailing_lists.textile +0 -4
  31. data/doc/more_stuff.textile +127 -3
  32. data/doc/preface.textile +1 -1
  33. data/doc/projects.textile +6 -6
  34. data/doc/releasing.textile +0 -1
  35. data/lib/buildr/clojure/shell.rb +0 -1
  36. data/lib/buildr/core/build.rb +16 -16
  37. data/lib/buildr/core/filter.rb +3 -3
  38. data/lib/buildr/core/jrebel.rb +0 -1
  39. data/lib/buildr/core/linux.rb +0 -1
  40. data/lib/buildr/core/run.rb +0 -1
  41. data/lib/buildr/core/shell.rb +0 -1
  42. data/lib/buildr/groovy/doc.rb +0 -1
  43. data/lib/buildr/ide/eclipse.rb +0 -2
  44. data/lib/buildr/ide/idea.rb +44 -8
  45. data/lib/buildr/java/bdd.rb +0 -1
  46. data/lib/buildr/java/commands.rb +2 -3
  47. data/lib/buildr/java/jruby.rb +2 -2
  48. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +5 -5
  49. data/lib/buildr/java/tests.rb +0 -1
  50. data/lib/buildr/packaging/artifact_namespace.rb +0 -2
  51. data/lib/buildr/resources/icons-license.txt +14 -17
  52. data/lib/buildr/scala/bdd.rb +0 -1
  53. data/lib/buildr/scala/compiler.rb +0 -1
  54. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
  55. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.java +0 -2
  56. data/lib/buildr/version.rb +1 -1
  57. data/rakelib/metrics.rake +3 -3
  58. data/rakelib/release.rake +8 -2
  59. data/spec/addon/bnd_spec.rb +383 -383
  60. data/spec/addon/custom_pom_spec.rb +149 -0
  61. data/spec/addon/drb_spec.rb +0 -1
  62. data/spec/addon/jaxb_xjc_spec.rb +130 -130
  63. data/spec/core/application_spec.rb +0 -1
  64. data/spec/core/build_spec.rb +1 -1
  65. data/spec/core/console_spec.rb +0 -1
  66. data/spec/core/doc_spec.rb +0 -1
  67. data/spec/core/extension_spec.rb +0 -1
  68. data/spec/core/generate_from_eclipse_spec.rb +9 -9
  69. data/spec/core/run_spec.rb +2 -3
  70. data/spec/core/shell_spec.rb +0 -1
  71. data/spec/ide/idea_spec.rb +1979 -1941
  72. data/spec/java/cobertura_spec.rb +6 -6
  73. data/spec/java/commands_spec.rb +11 -11
  74. data/spec/java/compiler_spec.rb +0 -1
  75. data/spec/java/doc_spec.rb +0 -1
  76. data/spec/java/ecj_spec.rb +1 -3
  77. data/spec/java/external_spec.rb +0 -2
  78. data/spec/java/java_spec.rb +3 -3
  79. data/spec/java/run_spec.rb +0 -1
  80. data/spec/java/tests_spec.rb +15 -0
  81. data/spec/xpath_matchers.rb +121 -120
  82. metadata +10 -2
@@ -1,205 +1,213 @@
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.7',
27
- 'commons-cli:commons-cli:jar:1.2',
28
- 'antlr:antlr:jar:2.7.7',
29
- 'com.google.guava:guava-jdk5:jar:16.0',
30
- 'com.google.guava:guava-bootstrap-jdk5:jar:16.0',
31
- 'com.google.collections:google-collections:jar:1.0',
32
- 'commons-beanutils:commons-beanutils-core:jar:1.8.3',
33
- 'commons-logging:commons-logging:jar:1.1.1'
34
- ]
35
- end
36
-
37
- def checkstyle(configuration_file, format, output_file, source_paths, options = {})
38
- dependencies = (options[:dependencies] || []) + self.dependencies
39
- cp = Buildr.artifacts(dependencies).each { |a| a.invoke() if a.respond_to?(:invoke) }.map(&:to_s)
40
-
41
- args = []
42
- if options[:properties_file]
43
- args << "-p"
44
- args << options[:properties_file]
45
- end
46
- args << "-c"
47
- args << configuration_file
48
- args << "-f"
49
- args << format
50
- args << "-o"
51
- args << output_file
52
- source_paths.each do |source_path|
53
- args << "-r"
54
- args << source_path
55
- end
56
-
57
- begin
58
- Java::Commands.java 'com.puppycrawl.tools.checkstyle.Main', *(args + [{:classpath => cp, :properties => options[:properties], :java_args => options[:java_args]}])
59
- rescue => e
60
- raise e if options[:fail_on_error]
61
- end
62
- end
63
- end
64
-
65
- class Config
66
- def enabled?
67
- File.exist?(self.configuration_file)
68
- end
69
-
70
- def html_enabled?
71
- File.exist?(self.style_file)
72
- end
73
-
74
- attr_writer :config_directory
75
-
76
- def config_directory
77
- @config_directory || project._(:source, :main, :etc, :checkstyle)
78
- end
79
-
80
- attr_writer :report_dir
81
-
82
- def report_dir
83
- @report_dir || project._(:reports, :checkstyle)
84
- end
85
-
86
- attr_writer :configuration_file
87
-
88
- def configuration_file
89
- @configuration_file || "#{self.config_directory}/checks.xml"
90
- end
91
-
92
- attr_writer :fail_on_error
93
-
94
- def fail_on_error?
95
- @fail_on_error.nil? ? false : @fail_on_error
96
- end
97
-
98
- attr_writer :format
99
-
100
- def format
101
- @format || 'xml'
102
- end
103
-
104
- attr_writer :xml_output_file
105
-
106
- def xml_output_file
107
- @xml_output_file || "#{self.report_dir}/checkstyle.xml"
108
- end
109
-
110
- attr_writer :html_output_file
111
-
112
- def html_output_file
113
- @html_output_file || "#{self.report_dir}/checkstyle.html"
114
- end
115
-
116
- attr_writer :style_file
117
-
118
- def style_file
119
- @style_file || "#{self.config_directory}/checkstyle-report.xsl"
120
- end
121
-
122
- attr_writer :suppressions_file
123
-
124
- def suppressions_file
125
- @suppressions_file || "#{self.config_directory}/suppressions.xml"
126
- end
127
-
128
- attr_writer :import_control_file
129
-
130
- def import_control_file
131
- @import_control_file || "#{self.config_directory}/import-control.xml"
132
- end
133
-
134
- def properties
135
- unless @properties
136
- @properties = {:basedir => self.project.base_dir}
137
- @properties['checkstyle.suppressions.file'] = self.suppressions_file if File.exist?(self.suppressions_file)
138
- @properties['checkstyle.import-control.file'] = self.import_control_file if File.exist?(self.import_control_file)
139
- end
140
- @properties
141
- end
142
-
143
- def source_paths
144
- @source_paths ||= [self.project.compile.sources, self.project.test.compile.sources]
145
- end
146
-
147
- def extra_dependencies
148
- @extra_dependencies ||= []
149
- end
150
-
151
- protected
152
-
153
- def initialize(project)
154
- @project = project
155
- end
156
-
157
- attr_reader :project
158
-
159
- end
160
-
161
- module ProjectExtension
162
- include Extension
163
-
164
- def checkstyle
165
- @checkstyle ||= Buildr::Checkstyle::Config.new(project)
166
- end
167
-
168
- after_define do |project|
169
- if project.checkstyle.enabled?
170
- desc "Generate checkstyle xml report."
171
- project.task("checkstyle:xml") do
172
- puts "Checkstyle: Analyzing source code..."
173
- mkdir_p File.dirname(project.checkstyle.xml_output_file)
174
- Buildr::Checkstyle.checkstyle(project.checkstyle.configuration_file,
175
- project.checkstyle.format,
176
- project.checkstyle.xml_output_file,
177
- project.checkstyle.source_paths.flatten.compact,
178
- :properties => project.checkstyle.properties,
179
- :fail_on_error => project.checkstyle.fail_on_error?,
180
- :dependencies => project.checkstyle.extra_dependencies)
181
- end
182
-
183
- if project.checkstyle.html_enabled?
184
- xml_task = project.task("checkstyle:xml")
185
- desc "Generate checkstyle html report."
186
- project.task("checkstyle:html" => xml_task) do
187
- puts "Checkstyle: Generating report"
188
- mkdir_p File.dirname(project.checkstyle.html_output_file)
189
- Buildr.ant "checkstyle" do |ant|
190
- ant.xslt :in => project.checkstyle.xml_output_file,
191
- :out => project.checkstyle.html_output_file,
192
- :style => project.checkstyle.style_file
193
- end
194
- end
195
-
196
- end
197
- end
198
- end
199
- end
200
- end
201
- end
202
-
203
- class Buildr::Project
204
- include Buildr::Checkstyle::ProjectExtension
205
- end
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.7',
27
+ 'commons-cli:commons-cli:jar:1.2',
28
+ 'antlr:antlr:jar:2.7.7',
29
+ 'com.google.guava:guava-jdk5:jar:16.0',
30
+ 'com.google.guava:guava-bootstrap-jdk5:jar:16.0',
31
+ 'com.google.collections:google-collections:jar:1.0',
32
+ 'commons-beanutils:commons-beanutils-core:jar:1.8.3',
33
+ 'commons-logging:commons-logging:jar:1.1.1'
34
+ ]
35
+ end
36
+
37
+ def checkstyle(configuration_file, format, output_file, source_paths, options = {})
38
+ dependencies = (options[:dependencies] || []) + self.dependencies
39
+ cp = Buildr.artifacts(dependencies).each { |a| a.invoke() if a.respond_to?(:invoke) }.map(&:to_s)
40
+
41
+ args = []
42
+ if options[:properties_file]
43
+ args << "-p"
44
+ args << options[:properties_file]
45
+ end
46
+ args << "-c"
47
+ args << configuration_file
48
+ args << "-f"
49
+ args << format
50
+ args << "-o"
51
+ args << output_file
52
+ source_paths.each do |source_path|
53
+ args << "-r"
54
+ args << source_path
55
+ end
56
+
57
+ begin
58
+ Java::Commands.java 'com.puppycrawl.tools.checkstyle.Main', *(args + [{:classpath => cp, :properties => options[:properties], :java_args => options[:java_args]}])
59
+ rescue => e
60
+ raise e if options[:fail_on_error]
61
+ end
62
+ end
63
+ end
64
+
65
+ class Config
66
+ def enabled?
67
+ File.exist?(self.configuration_file)
68
+ end
69
+
70
+ def html_enabled?
71
+ File.exist?(self.style_file)
72
+ end
73
+
74
+ attr_writer :config_directory
75
+
76
+ def config_directory
77
+ @config_directory || project._(:source, :main, :etc, :checkstyle)
78
+ end
79
+
80
+ attr_writer :report_dir
81
+
82
+ def report_dir
83
+ @report_dir || project._(:reports, :checkstyle)
84
+ end
85
+
86
+ attr_writer :configuration_file
87
+
88
+ def configuration_file
89
+ @configuration_file || "#{self.config_directory}/checks.xml"
90
+ end
91
+
92
+ attr_writer :fail_on_error
93
+
94
+ def fail_on_error?
95
+ @fail_on_error.nil? ? false : @fail_on_error
96
+ end
97
+
98
+ attr_writer :format
99
+
100
+ def format
101
+ @format || 'xml'
102
+ end
103
+
104
+ attr_writer :xml_output_file
105
+
106
+ def xml_output_file
107
+ @xml_output_file || "#{self.report_dir}/checkstyle.xml"
108
+ end
109
+
110
+ attr_writer :html_output_file
111
+
112
+ def html_output_file
113
+ @html_output_file || "#{self.report_dir}/checkstyle.html"
114
+ end
115
+
116
+ attr_writer :style_file
117
+
118
+ def style_file
119
+ unless @style_file
120
+ project_xsl = "#{self.config_directory}/checkstyle-report.xsl"
121
+ if File.exist?(project_xsl)
122
+ @style_file = project_xsl
123
+ else
124
+ @style_file = "#{File.dirname(__FILE__)}/checkstyle-report.xsl"
125
+ end
126
+ end
127
+ @style_file
128
+ end
129
+
130
+ attr_writer :suppressions_file
131
+
132
+ def suppressions_file
133
+ @suppressions_file || "#{self.config_directory}/suppressions.xml"
134
+ end
135
+
136
+ attr_writer :import_control_file
137
+
138
+ def import_control_file
139
+ @import_control_file || "#{self.config_directory}/import-control.xml"
140
+ end
141
+
142
+ def properties
143
+ unless @properties
144
+ @properties = {:basedir => self.project.base_dir}
145
+ @properties['checkstyle.suppressions.file'] = self.suppressions_file if File.exist?(self.suppressions_file)
146
+ @properties['checkstyle.import-control.file'] = self.import_control_file if File.exist?(self.import_control_file)
147
+ end
148
+ @properties
149
+ end
150
+
151
+ def source_paths
152
+ @source_paths ||= [self.project.compile.sources, self.project.test.compile.sources]
153
+ end
154
+
155
+ def extra_dependencies
156
+ @extra_dependencies ||= []
157
+ end
158
+
159
+ protected
160
+
161
+ def initialize(project)
162
+ @project = project
163
+ end
164
+
165
+ attr_reader :project
166
+
167
+ end
168
+
169
+ module ProjectExtension
170
+ include Extension
171
+
172
+ def checkstyle
173
+ @checkstyle ||= Buildr::Checkstyle::Config.new(project)
174
+ end
175
+
176
+ after_define do |project|
177
+ if project.checkstyle.enabled?
178
+ desc "Generate checkstyle xml report."
179
+ project.task("checkstyle:xml") do
180
+ puts "Checkstyle: Analyzing source code..."
181
+ mkdir_p File.dirname(project.checkstyle.xml_output_file)
182
+ Buildr::Checkstyle.checkstyle(project.checkstyle.configuration_file,
183
+ project.checkstyle.format,
184
+ project.checkstyle.xml_output_file,
185
+ project.checkstyle.source_paths.flatten.compact,
186
+ :properties => project.checkstyle.properties,
187
+ :fail_on_error => project.checkstyle.fail_on_error?,
188
+ :dependencies => project.checkstyle.extra_dependencies)
189
+ end
190
+
191
+ if project.checkstyle.html_enabled?
192
+ xml_task = project.task("checkstyle:xml")
193
+ desc "Generate checkstyle html report."
194
+ project.task("checkstyle:html" => xml_task) do
195
+ puts "Checkstyle: Generating report"
196
+ mkdir_p File.dirname(project.checkstyle.html_output_file)
197
+ Buildr.ant "checkstyle" do |ant|
198
+ ant.xslt :in => project.checkstyle.xml_output_file,
199
+ :out => project.checkstyle.html_output_file,
200
+ :style => project.checkstyle.style_file
201
+ end
202
+ end
203
+
204
+ end
205
+ end
206
+ end
207
+ end
208
+ end
209
+ end
210
+
211
+ class Buildr::Project
212
+ include Buildr::Checkstyle::ProjectExtension
213
+ end
@@ -0,0 +1,83 @@
1
+ <?xml version="1.0"?>
2
+
3
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
+
5
+ <xsl:template match="/">
6
+ <html>
7
+ <head>
8
+ <title>CssLint Violations</title>
9
+ </head>
10
+ <body bgcolor="#FFFFEF">
11
+ <p>
12
+ <b>Coding Style Check Results</b>
13
+ </p>
14
+ <table border="1" cellspacing="0" cellpadding="2">
15
+ <tr bgcolor="#CC9966">
16
+ <th colspan="2">
17
+ <b>Summary</b>
18
+ </th>
19
+ </tr>
20
+ <tr bgcolor="#F3F3E1">
21
+ <td>Files with errors</td>
22
+ <td>
23
+ <xsl:number level="any" value="count(descendant::file)"/>
24
+ </td>
25
+ </tr>
26
+ <tr bgcolor="#CCF3D0">
27
+ <td>Total errors</td>
28
+ <td>
29
+ <xsl:number level="any" value="count(descendant::issue)"/>
30
+ </td>
31
+ </tr>
32
+ </table>
33
+ <hr align="left" width="95%" size="1"/>
34
+ <p>The following are violations of the ScssLint Rules:</p>
35
+ <p/>
36
+ <xsl:apply-templates/>
37
+ </body>
38
+ </html>
39
+ </xsl:template>
40
+
41
+ <xsl:template match="file[issue]">
42
+ <table bgcolor="#AFFFFF" width="95%" border="1" cellspacing="0" cellpadding="2">
43
+ <tr>
44
+ <th>File:</th>
45
+ <td>
46
+ <xsl:value-of select="@name"/>
47
+ </td>
48
+ </tr>
49
+ </table>
50
+ <table bgcolor="#DFFFFF" width="95%" border="1" cellspacing="0" cellpadding="2">
51
+ <tr>
52
+ <th style="width: 4em; padding: 0; margin: 0;">Line</th>
53
+ <th style="width: 4em; padding: 0; margin: 0;">Column</th>
54
+ <th style="width: 7em; padding: 0; margin: 0;">Severity</th>
55
+ <th>Reason</th>
56
+ <th>Evidence</th>
57
+ </tr>
58
+ <xsl:apply-templates select="issue"/>
59
+ </table>
60
+ <p/>
61
+ </xsl:template>
62
+
63
+ <xsl:template match="issue">
64
+ <tr>
65
+ <td>
66
+ <xsl:value-of select="@line"/>
67
+ </td>
68
+ <td>
69
+ <xsl:value-of select="@char"/>
70
+ </td>
71
+ <td>
72
+ <xsl:value-of select="@severity"/>
73
+ </td>
74
+ <td>
75
+ <xsl:value-of select="@reason"/>
76
+ </td>
77
+ <td>
78
+ <xsl:value-of select="@evidence"/>
79
+ </td>
80
+ </tr>
81
+ </xsl:template>
82
+
83
+ </xsl:stylesheet>