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
@@ -0,0 +1,196 @@
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>css_lint:html</code> and <code>css_lint:xml</code> tasks.
18
+ # Require explicitly using <code>require "buildr/css_lint"</code>.
19
+ module CssLint
20
+ class << self
21
+
22
+ def css_lint(output_file, source_paths, options = {})
23
+ args = []
24
+ args << 'csslint'
25
+ args << "--format=#{options[:format]}" if options[:format]
26
+ args << '--quiet'
27
+ [:errors, :warnings, :ignore].each do |severity|
28
+ if options[severity] && !options[severity].empty?
29
+ args << "--#{severity}=#{options[severity].join(',')}"
30
+ end
31
+ end
32
+ if options[:excludes] && !options[:excludes].empty?
33
+ args << "--exclude-list=#{options[:excludes].join(',')}"
34
+ end
35
+
36
+ source_paths.each do |source_path|
37
+ args << source_path.to_s
38
+ end
39
+
40
+ command = args.join(' ')
41
+ mkdir_p File.dirname(output_file)
42
+ File.open(output_file, 'wb') do |f|
43
+ f.write `#{command}`
44
+ end
45
+ if 0 != $?.exitstatus
46
+ error = IO.read(output_file)
47
+ rm_f output_file
48
+ raise "Problem running csslint: #{command}\n#{error}"
49
+ end
50
+ end
51
+ end
52
+
53
+ class Config
54
+ def enabled?
55
+ !self.source_paths.empty?
56
+ end
57
+
58
+ def html_enabled?
59
+ File.exist?(self.style_file)
60
+ end
61
+
62
+ attr_writer :config_directory
63
+
64
+ def config_directory
65
+ @config_directory || project._(:source, :main, :etc, :scss_lint)
66
+ end
67
+
68
+ attr_writer :report_dir
69
+
70
+ def report_dir
71
+ @report_dir || project._(:reports, :css_lint)
72
+ end
73
+
74
+ attr_writer :excludes
75
+
76
+ def excludes
77
+ @excludes ||= []
78
+ end
79
+
80
+ attr_writer :errors
81
+
82
+ def errors
83
+ @errors ||= []
84
+ end
85
+
86
+ attr_writer :warnings
87
+
88
+ def warnings
89
+ @warnings ||= []
90
+ end
91
+
92
+ attr_writer :ignore
93
+
94
+ def ignore
95
+ @ignore ||= []
96
+ end
97
+
98
+ attr_writer :format
99
+
100
+ def format
101
+ @format || 'csslint-xml'
102
+ end
103
+
104
+ attr_writer :xml_output_file
105
+
106
+ def xml_output_file
107
+ @xml_output_file || "#{self.report_dir}/css_lint.xml"
108
+ end
109
+
110
+ attr_writer :html_output_file
111
+
112
+ def html_output_file
113
+ @html_output_file || "#{self.report_dir}/css_lint.html"
114
+ end
115
+
116
+ attr_writer :style_file
117
+
118
+ def style_file
119
+ unless @style_file
120
+ project_xsl = "#{self.config_directory}/css_lint-report.xsl"
121
+ if File.exist?(project_xsl)
122
+ @style_file = project_xsl
123
+ else
124
+ @style_file = "#{File.dirname(__FILE__)}/css_lint-report.xsl"
125
+ end
126
+ end
127
+ @style_file
128
+ end
129
+
130
+ def source_paths
131
+ unless @source_paths
132
+ @source_paths = []
133
+ dir = self.project._(:source, :main, :webapp, :css)
134
+ @source_paths << dir if File.directory?(dir)
135
+ end
136
+ @source_paths
137
+ end
138
+
139
+ protected
140
+
141
+ def initialize(project)
142
+ @project = project
143
+ end
144
+
145
+ attr_reader :project
146
+
147
+ end
148
+
149
+ module ProjectExtension
150
+ include Extension
151
+
152
+ def css_lint
153
+ @css_lint ||= Buildr::CssLint::Config.new(project)
154
+ end
155
+
156
+ after_define do |project|
157
+ if project.css_lint.enabled?
158
+ desc 'Generate css-lint xml report.'
159
+ project.task('css_lint:xml') do
160
+ source_paths = project.css_lint.source_paths.flatten.compact
161
+ source_paths.each do |path|
162
+ path.respond_to?(:invoke) ? path.invoke : project.file(path).invoke
163
+ end
164
+
165
+ puts 'CssLint: Analyzing CSS...'
166
+ Buildr::CssLint.css_lint(project.css_lint.xml_output_file,
167
+ source_paths,
168
+ :format => project.css_lint.format,
169
+ :excludes => project.css_lint.excludes,
170
+ :ignore => project.css_lint.ignore,
171
+ :warnings => project.css_lint.warnings,
172
+ :errors => project.css_lint.errors)
173
+ end
174
+
175
+ if project.css_lint.html_enabled?
176
+ xml_task = project.task('css_lint:xml')
177
+ desc 'Generate css_lint html report.'
178
+ project.task('css_lint:html' => xml_task) do
179
+ puts "CssLint: Generating report"
180
+ mkdir_p File.dirname(project.css_lint.html_output_file)
181
+ Buildr.ant 'css_lint' do |ant|
182
+ ant.xslt :in => project.css_lint.xml_output_file,
183
+ :out => project.css_lint.html_output_file,
184
+ :style => project.css_lint.style_file
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end
190
+ end
191
+ end
192
+ end
193
+
194
+ class Buildr::Project
195
+ include Buildr::CssLint::ProjectExtension
196
+ end
@@ -0,0 +1,282 @@
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
+ class CustomPom
18
+ Developer = Struct.new(:id, :name, :email, :roles)
19
+
20
+ # Specify the name of the project
21
+ attr_writer :name
22
+
23
+ # Retrieve the name of the project, defaulting to the project description or the name if not specified
24
+ def name
25
+ @name || @buildr_project.comment || @buildr_project.name
26
+ end
27
+
28
+ # Specify a project description
29
+ attr_writer :description
30
+
31
+ # Retrieve the project description, defaulting to the name if not specified
32
+ def description
33
+ @description || name
34
+ end
35
+
36
+ # Property for the projects url
37
+ attr_accessor :url
38
+
39
+ # Return the map of licenses for project
40
+ def licenses
41
+ @licenses ||= {}
42
+ end
43
+
44
+ # Add Apache2 to the list of licenses
45
+ def add_apache_v2_license
46
+ self.licenses['The Apache Software License, Version 2.0'] = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
47
+ end
48
+
49
+ def add_bsd_2_license
50
+ self.licenses['The BSD 2-Clause License'] = 'http://opensource.org/licenses/BSD-2-Clause'
51
+ end
52
+
53
+ def add_bsd_3_license
54
+ self.licenses['The BSD 3-Clause License'] = 'http://opensource.org/licenses/BSD-3-Clause'
55
+ end
56
+
57
+ def add_cddl_v1_license
58
+ self.licenses['Common Development and Distribution License (CDDL-1.0)'] = 'http://opensource.org/licenses/CDDL-1.0'
59
+ end
60
+
61
+ def add_epl_v1_license
62
+ self.licenses['Eclipse Public License - v 1.0'] = 'http://www.eclipse.org/legal/epl-v10.html'
63
+ end
64
+
65
+ def add_gpl_v1_license
66
+ self.licenses['GNU General Public License (GPL) version 1.0'] = 'http://www.gnu.org/licenses/gpl-1.0.html'
67
+ end
68
+
69
+ def add_gpl_v2_license
70
+ self.licenses['GNU General Public License (GPL) version 2.0'] = 'http://www.gnu.org/licenses/gpl-2.0.html'
71
+ end
72
+
73
+ def add_gpl_v3_license
74
+ self.licenses['GNU General Public License (GPL) version 3.0'] = 'http://www.gnu.org/licenses/gpl-3.0.html'
75
+ end
76
+
77
+ def add_lgpl_v2_license
78
+ self.licenses['GNU General Lesser Public License (LGPL) version 2.1'] = 'http://www.gnu.org/licenses/lgpl-2.1.html'
79
+ end
80
+
81
+ def add_lgpl_v3_license
82
+ self.licenses['GNU General Lesser Public License (LGPL) version 3.0'] = 'http://www.gnu.org/licenses/lgpl-3.0.html'
83
+ end
84
+
85
+ def add_mit_license
86
+ self.licenses['The MIT License'] = 'http://opensource.org/licenses/MIT'
87
+ end
88
+
89
+ attr_accessor :scm_url
90
+ attr_accessor :scm_connection
91
+ attr_accessor :scm_developer_connection
92
+
93
+ attr_accessor :issues_url
94
+ attr_accessor :issues_system
95
+
96
+ # Add a project like add_github_project('realityforge/gwt-appcache')
97
+ def add_github_project(project_spec)
98
+ git_url = "git@github.com:#{project_spec}.git"
99
+ self.scm_connection = self.scm_developer_connection = "scm:git:#{git_url}"
100
+ self.scm_url = git_url
101
+ web_url = "https://github.com/#{project_spec}"
102
+ self.url = web_url
103
+ self.issues_url = "#{web_url}/issues"
104
+ self.issues_system = 'GitHub Issues'
105
+ end
106
+
107
+ def developers
108
+ @developers ||= []
109
+ end
110
+
111
+ def add_developer(id, name = nil, email = nil, roles = nil)
112
+ self.developers << Developer.new(id, name, email, roles)
113
+ end
114
+
115
+ def provided_dependencies
116
+ @provided_dependencies ||= []
117
+ end
118
+
119
+ def provided_dependencies=(provided_dependencies)
120
+ @provided_dependencies = provided_dependencies
121
+ end
122
+
123
+ def runtime_dependencies
124
+ @runtime_dependencies ||= []
125
+ end
126
+
127
+ def runtime_dependencies=(runtime_dependencies)
128
+ @runtime_dependencies = runtime_dependencies
129
+ end
130
+
131
+ def optional_dependencies
132
+ @optional_dependencies ||= []
133
+ end
134
+
135
+ def optional_dependencies=(optional_dependencies)
136
+ @optional_dependencies = optional_dependencies
137
+ end
138
+
139
+ protected
140
+
141
+ def associate_project(buildr_project)
142
+ @buildr_project = buildr_project
143
+ end
144
+
145
+ def self.pom_xml(project, package)
146
+ Proc.new do
147
+ xml = Builder::XmlMarkup.new(:indent => 2)
148
+ xml.instruct!
149
+ xml.project('xmlns' => 'http://maven.apache.org/POM/4.0.0',
150
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
151
+ 'xsi:schemaLocation' => 'http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd') do
152
+ xml.modelVersion '4.0.0'
153
+ xml.parent do
154
+ xml.groupId 'org.sonatype.oss'
155
+ xml.artifactId 'oss-parent'
156
+ xml.version '7'
157
+ end
158
+ xml.groupId project.group
159
+ xml.artifactId project.id
160
+ xml.version project.version
161
+ xml.packaging package.type.to_s
162
+ xml.classifier package.classifier if package.classifier
163
+
164
+ xml.name project.pom.name if project.pom.name
165
+ xml.description project.pom.description if project.pom.description
166
+ xml.url project.pom.url if project.pom.url
167
+
168
+ xml.licenses do
169
+ project.pom.licenses.each_pair do |name, url|
170
+ xml.license do
171
+ xml.name name
172
+ xml.url url
173
+ xml.distribution 'repo'
174
+ end
175
+ end
176
+ end
177
+
178
+ if project.pom.scm_url || project.pom.scm_connection || project.pom.scm_developer_connection
179
+ xml.scm do
180
+ xml.connection project.pom.scm_connection if project.pom.scm_connection
181
+ xml.developerConnection project.pom.scm_developer_connection if project.pom.scm_developer_connection
182
+ xml.url project.pom.scm_url if project.pom.scm_url
183
+ end
184
+ end
185
+
186
+ if project.pom.issues_url
187
+ xml.issueManagement do
188
+ xml.url project.pom.issues_url
189
+ xml.system project.pom.issues_system if project.pom.issues_system
190
+ end
191
+ end
192
+
193
+ xml.developers do
194
+ project.pom.developers.each do |developer|
195
+ xml.developer do
196
+ xml.id developer.id
197
+ xml.name developer.name if developer.name
198
+ xml.email developer.email if developer.email
199
+ if developer.roles
200
+ xml.roles do
201
+ developer.roles.each do |role|
202
+ xml.role role
203
+ end
204
+ end
205
+ end
206
+ end
207
+ end
208
+ end
209
+
210
+ xml.dependencies do
211
+ provided_deps = Buildr.artifacts(project.pom.provided_dependencies).collect { |d| d.to_s }
212
+ runtime_deps = Buildr.artifacts(project.pom.runtime_dependencies).collect { |d| d.to_s }
213
+ optional_deps = Buildr.artifacts(project.pom.optional_dependencies).collect { |d| d.to_s }
214
+ deps =
215
+ Buildr.artifacts(project.compile.dependencies).
216
+ select { |d| d.is_a?(Artifact) }.
217
+ collect do |d|
218
+ f = d.to_s
219
+ scope = provided_deps.include?(f) ? 'provided' :
220
+ runtime_deps.include?(f) ? 'runtime' :
221
+ 'compile'
222
+ d.to_hash.merge(:scope => scope, :optional => optional_deps.include?(f))
223
+ end + Buildr.artifacts(project.test.compile.dependencies).
224
+ select { |d| d.is_a?(Artifact) && !project.compile.dependencies.include?(d) }.collect { |d| d.to_hash.merge(:scope => 'test') }
225
+ deps.each do |dependency|
226
+ xml.dependency do
227
+ xml.groupId dependency[:group]
228
+ xml.artifactId dependency[:id]
229
+ xml.version dependency[:version]
230
+ xml.scope dependency[:scope] unless dependency[:scope] == 'compile'
231
+ xml.optional true if dependency[:optional]
232
+ end
233
+ end
234
+ end
235
+ end
236
+ end
237
+ end
238
+ end
239
+ end
240
+
241
+ module Buildr
242
+ class Project #:nodoc:
243
+ def pom
244
+ unless @pom
245
+ @pom = parent ? parent.pom.dup : Buildr::CustomPom.new
246
+ @pom.send :associate_project, self
247
+ end
248
+ @pom
249
+ end
250
+ end
251
+ end
252
+
253
+ module Buildr
254
+ module Package
255
+ alias :old_package :package
256
+
257
+ def package(*args)
258
+ package = old_package(*args)
259
+ class << package
260
+ def pom
261
+ unless @pom || classifier
262
+ pom_filename = Util.replace_extension(name, 'pom')
263
+ spec = {:group => group, :id => id, :version => version, :type => :pom}
264
+ @pom = Buildr.artifact(spec, pom_filename)
265
+ buildr_project = Buildr.project(self.scope.join(':'))
266
+ @pom.content Buildr::CustomPom.pom_xml(buildr_project, self)
267
+ end
268
+ @pom
269
+ end
270
+ end
271
+ package.instance_variable_set('@pom', nil)
272
+ package.enhance([package.pom.to_s]) if package.type.to_s == 'jar' && !package.classifier
273
+ package
274
+ end
275
+ end
276
+
277
+ module ActsAsArtifact
278
+ def pom_xml
279
+ self.pom.content
280
+ end
281
+ end
282
+ end