buildr 1.4.23 → 1.4.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24cea5e75140b45ce8d2e1585d18ea4c3c3f91fd
4
- data.tar.gz: e29059e7bc254d207146cb02a7ff5deddc07d605
3
+ metadata.gz: cf20984ae2dd15bd6458177ddf5269371c4d98f0
4
+ data.tar.gz: 4ff180d97b201efecd5fc628bccb64fb424b46aa
5
5
  SHA512:
6
- metadata.gz: 7b9f79e5d063b52e113d111888a8e974e463aa7f1c068aa73adcc55f3993719c31892f00203c22c2d613911f2c058b9bf84ffbabb1a4d36286f8a1f508417ba1
7
- data.tar.gz: c4be41e2dc2eee68b841797a539857bfc12ec4151f78c1e867e684dcf31ac7deb3d0fa40099159474064c666251fa4bf476cb5e63b560b88645f630901de338d
6
+ metadata.gz: c90ff97b512210d6c052a75c494ec48f75262f7fd115949a6fe7623e2c727bdb092126419f1e20e23d6a294208a12c514bc9544e6f683bdb352b62e4d7b1e133
7
+ data.tar.gz: 6d78972103b067e2c75975a450c4b844bab23102303a2aa7f0d5cf4c756f20d1da87674e504a618e2d2e15a55edcdf8b22b38316b86387bdf6b519ae62859d3e
data/CHANGELOG CHANGED
@@ -1,3 +1,33 @@
1
+ 1.4.24 (2016-03-19)
2
+ * Added: Support the :no_invoke parameter being passed to Buildr.project() and
3
+ Buildr.projects() to avoid attempting to call invoke when retrieving the projects.
4
+ * Added: Add `exclude_paths` setting to pmd addon to allow paths to be explicitly excluded.
5
+ * Fixed: Update jDepend addon to ensure target directories are invoked prior to attempting
6
+ to analyze directories.
7
+ * Added: Add jdepend.additional_project_names configuration to jDepend addon to
8
+ ease merging in the source paths from multiple projects into one jDepend task.
9
+ * Added: Add findbugs.additional_project_names configuration to Findbugs addon to
10
+ ease merging in the source paths from multiple projects into one Findbugs task.
11
+ * Added: Add checkstyle.additional_project_names configuration to Checkstyle addon to
12
+ ease merging in the source paths from multiple projects into one Checkstyle task.
13
+ * Added: Add pmd.additional_project_names configuration to PMD addon to ease merging in
14
+ the source paths from multiple projects into one PMD task.
15
+ * Fixed: In the PMD addon, check that the source directory exists before adding to
16
+ sources directories to include.
17
+ * Fixed: BUILDR-709 - Fix "Exception in jacoco.rb [TypeError : can't convert Array into
18
+ String]". Submitted By Ross Mahony.
19
+ * Added: Define the 'activate_jruby_facet' addon that activates the jruby facet in
20
+ generated IDEA project modules.
21
+ * Change: Update the Intellij IDEA plugin to support marking directories as generated.
22
+ * Change: Update the Intellij IDEA plugin to correctly identify project paths as resource
23
+ directories.
24
+ * Change: Update the default GWT version used in the GWT addon to the latest release 2.7.0.
25
+ * Fixed: Fix GWT addon to explicitly add gwt-dev artifact to gwt compile path now that
26
+ the bug that allowed unintended sharing has been fixed.
27
+ * Fixed: Fix bug in IDEA module generation that resulted in dependencies in IDEA module
28
+ using shared references to compile dependencies.
29
+ * Change: Update the checkstyle addon to use checkstyle 6.12.1.
30
+
1
31
  1.4.23 (2015-06-12)
2
32
  * Change: BUILDR-706 - Update the checkstyle addon use checkstyle 6.6. Submitted
3
33
  by Dieter Vrancken.
@@ -0,0 +1,33 @@
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
+ module ActivateJrubyFacet
18
+ module ProjectExtension
19
+ include Extension
20
+
21
+ # A custom extension that just enables the jruby facet in IDEA projects for all projects
22
+ # that generate idea projects files. This is useful as buildr/rake scripts and other automation
23
+ # can be identified as ruby projects.
24
+ after_define do |project|
25
+ project.iml.add_jruby_facet if project.iml?
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ class Buildr::Project
32
+ include Buildr::ActivateJrubyFacet::ProjectExtension
33
+ end
@@ -22,22 +22,21 @@ module Buildr
22
22
 
23
23
  # The specs for requirements
24
24
  def dependencies
25
- [
26
- 'com.puppycrawl.tools:checkstyle:jar:6.6',
27
- 'antlr:antlr:jar:2.7.7',
28
- 'org.antlr:antlr4-runtime:jar:4.5',
29
- 'com.google.guava:guava:jar:18.0',
30
- 'org.apache.commons:commons-lang3:jar:3.4',
31
- 'org.abego.treelayout:org.abego.treelayout.core:jar:1.0.1',
32
- 'commons-cli:commons-cli:jar:1.2',
33
- 'commons-beanutils:commons-beanutils-core:jar:1.8.3',
34
- 'commons-logging:commons-logging:jar:1.1.1'
35
- ]
25
+ %w(
26
+ com.puppycrawl.tools:checkstyle:jar:6.12.1
27
+ org.antlr:antlr4-runtime:jar:4.5.1-1
28
+ antlr:antlr:jar:2.7.7
29
+ com.google.guava:guava:jar:18.0 org.apache.commons:commons-lang3:jar:3.4
30
+ org.abego.treelayout:org.abego.treelayout.core:jar:1.0.1
31
+ commons-cli:commons-cli:jar:1.3
32
+ commons-beanutils:commons-beanutils-core:jar:1.8.3
33
+ commons-logging:commons-logging:jar:1.1.1
34
+ )
36
35
  end
37
36
 
38
37
  def checkstyle(configuration_file, format, output_file, source_paths, options = {})
39
38
  dependencies = self.dependencies + (options[:dependencies] || [])
40
- cp = Buildr.artifacts(dependencies).each { |a| a.invoke() if a.respond_to?(:invoke) }.map(&:to_s)
39
+ cp = Buildr.artifacts(dependencies).each { |a| a.invoke if a.respond_to?(:invoke) }.map(&:to_s)
41
40
 
42
41
  args = []
43
42
  if options[:properties_file]
@@ -50,11 +49,11 @@ module Buildr
50
49
  args << format
51
50
  args << '-o'
52
51
  args << output_file
53
- args += source_paths
52
+ args += source_paths.select { |p| File.exist?(p) }
54
53
 
55
54
  begin
56
55
  Java::Commands.java 'com.puppycrawl.tools.checkstyle.Main', *(args + [{:classpath => cp, :properties => options[:properties], :java_args => options[:java_args]}])
57
- rescue => e
56
+ rescue Exception => e
58
57
  raise e if options[:fail_on_error]
59
58
  end
60
59
  end
@@ -177,6 +176,35 @@ module Buildr
177
176
  @extra_dependencies ||= [self.project.compile.dependencies, self.project.test.compile.dependencies].flatten
178
177
  end
179
178
 
179
+ # An array of additional projects to scan for main and test sources
180
+ attr_writer :additional_project_names
181
+
182
+ def additional_project_names
183
+ @additional_project_names ||= []
184
+ end
185
+
186
+ def complete_source_paths
187
+ paths = self.source_paths.dup
188
+
189
+ self.additional_project_names.each do |project_name|
190
+ p = self.project.project(project_name)
191
+ paths << [p.compile.sources, p.test.compile.sources].flatten.compact
192
+ end
193
+
194
+ paths.flatten.compact
195
+ end
196
+
197
+ def complete_extra_dependencies
198
+ deps = self.extra_dependencies.dup
199
+
200
+ self.additional_project_names.each do |project_name|
201
+ p = self.project.project(project_name)
202
+ deps << [p.compile.dependencies, p.test.compile.dependencies].flatten.compact
203
+ end
204
+
205
+ deps.flatten.compact
206
+ end
207
+
180
208
  protected
181
209
 
182
210
  def initialize(project)
@@ -203,10 +231,10 @@ module Buildr
203
231
  Buildr::Checkstyle.checkstyle(project.checkstyle.configuration_file,
204
232
  project.checkstyle.format,
205
233
  project.checkstyle.xml_output_file,
206
- project.checkstyle.source_paths.flatten.compact,
234
+ project.checkstyle.complete_source_paths,
207
235
  :properties => project.checkstyle.properties,
208
236
  :fail_on_error => project.checkstyle.fail_on_error?,
209
- :dependencies => project.checkstyle.extra_dependencies)
237
+ :dependencies => project.checkstyle.complete_extra_dependencies)
210
238
  end
211
239
 
212
240
  if project.checkstyle.html_enabled?
@@ -154,6 +154,46 @@ module Buildr
154
154
  @extra_dependencies ||= [self.project.compile.dependencies, self.project.test.compile.dependencies].flatten.compact
155
155
  end
156
156
 
157
+ # An array of additional projects to scan for main and test sources
158
+ attr_writer :additional_project_names
159
+
160
+ def additional_project_names
161
+ @additional_project_names ||= []
162
+ end
163
+
164
+ def complete_source_paths
165
+ paths = self.source_paths.dup
166
+
167
+ self.additional_project_names.each do |project_name|
168
+ p = self.project.project(project_name)
169
+ paths << [p.compile.sources, p.test.compile.sources].flatten.compact
170
+ end
171
+
172
+ paths.flatten.compact
173
+ end
174
+
175
+ def complete_analyze_paths
176
+ paths = self.analyze_paths.dup
177
+
178
+ self.additional_project_names.each do |project_name|
179
+ paths << self.project.project(project_name).compile.target
180
+ end
181
+
182
+ paths.flatten.compact
183
+ end
184
+
185
+ def complete_extra_dependencies
186
+ deps = self.extra_dependencies.dup
187
+
188
+ self.additional_project_names.each do |project_name|
189
+ p = self.project.project(project_name)
190
+ deps << [p.compile.dependencies, p.test.compile.dependencies].flatten.compact
191
+ end
192
+
193
+ deps.flatten.compact
194
+ end
195
+
196
+
157
197
  protected
158
198
 
159
199
  def initialize(project)
@@ -179,15 +219,15 @@ module Buildr
179
219
  {
180
220
  :properties => project.findbugs.properties,
181
221
  :fail_on_error => project.findbugs.fail_on_error?,
182
- :extra_dependencies => project.findbugs.extra_dependencies
222
+ :extra_dependencies => project.findbugs.complete_extra_dependencies
183
223
  }
184
224
  options[:exclude_filter] = project.findbugs.filter_file if File.exist?(project.findbugs.filter_file)
185
225
  options[:output] = 'xml:withMessages'
186
226
  options[:report_level] = project.findbugs.report_level
187
227
 
188
228
  Buildr::Findbugs.findbugs(project.findbugs.xml_output_file,
189
- project.findbugs.source_paths.flatten.compact,
190
- project.findbugs.analyze_paths.flatten.compact,
229
+ project.findbugs.complete_source_paths,
230
+ project.findbugs.complete_analyze_paths,
191
231
  options)
192
232
  end
193
233
 
@@ -198,15 +238,15 @@ module Buildr
198
238
  {
199
239
  :properties => project.findbugs.properties,
200
240
  :fail_on_error => project.findbugs.fail_on_error?,
201
- :extra_dependencies => project.findbugs.extra_dependencies
241
+ :extra_dependencies => project.findbugs.complete_extra_dependencies
202
242
  }
203
243
  options[:exclude_filter] = project.findbugs.filter_file if File.exist?(project.findbugs.filter_file)
204
244
  options[:output] = 'html'
205
245
  options[:report_level] = project.findbugs.report_level
206
246
 
207
247
  Buildr::Findbugs.findbugs(project.findbugs.html_output_file,
208
- project.findbugs.source_paths.flatten.compact,
209
- project.findbugs.analyze_paths.flatten.compact,
248
+ project.findbugs.complete_source_paths,
249
+ project.findbugs.complete_analyze_paths,
210
250
  options)
211
251
  end
212
252
  end
@@ -23,7 +23,7 @@ module Buildr
23
23
  end
24
24
 
25
25
  def version
26
- @version || Buildr.settings.build['gwt'] || '2.5.1'
26
+ @version || Buildr.settings.build['gwt'] || '2.7.0'
27
27
  end
28
28
 
29
29
  # The specs for requirements
@@ -127,22 +127,23 @@ module Buildr
127
127
 
128
128
  version = gwt_detect_version(dependencies) || Buildr::GWT.version
129
129
 
130
- if project.iml?
131
- existing_deps = project.compile.dependencies.collect do |d|
132
- a = artifact(d)
133
- a.invoke if a.is_a?(Buildr::Artifact)
134
- a.to_s
135
- end
136
- Buildr::GWT.dependencies(version).each do |d|
137
- a = artifact(d)
138
- a.invoke if a.respond_to?(:invoke)
139
- project.iml.main_dependencies << a.to_s unless existing_deps.include?(a.to_s)
140
- end
130
+ additional_gwt_deps = []
131
+ existing_deps = project.compile.dependencies.collect do |d|
132
+ a = artifact(d)
133
+ a.invoke if a.is_a?(Buildr::Artifact)
134
+ a.to_s
135
+ end
136
+ Buildr::GWT.dependencies(version).each do |d|
137
+ a = artifact(d)
138
+ a.invoke if a.respond_to?(:invoke)
139
+ project.iml.main_dependencies << a.to_s unless !project.iml? || existing_deps.include?(a.to_s)
140
+ project.compile.dependencies << a.to_s unless existing_deps.include?(a.to_s)
141
+ additional_gwt_deps << a
141
142
  end
142
143
 
143
144
  task = project.file(output_dir) do
144
145
  Buildr::GWT.gwtc_main(module_names,
145
- (dependencies + artifacts).flatten.compact,
146
+ (dependencies + artifacts + additional_gwt_deps).flatten.compact,
146
147
  output_dir,
147
148
  unit_cache_dir,
148
149
  {:version => version}.merge(options))
@@ -138,7 +138,8 @@ module Buildr
138
138
  options << "excludes=#{project.jacoco.excludes.join(':')}" unless project.jacoco.excludes.empty?
139
139
 
140
140
  agent_config = "-javaagent:#{agent_jar}=#{options.join(',')}"
141
- project.test.options[:java_args] = (project.test.options[:java_args] || []) + [agent_config]
141
+ existing = project.test.options[:java_args] || []
142
+ project.test.options[:java_args] = (existing.is_a?(Array)? existing : [existing]) + [agent_config]
142
143
  end
143
144
  namespace 'jacoco' do
144
145
  if project.jacoco.generate_xml?
@@ -18,7 +18,7 @@ module Buildr
18
18
  class << self
19
19
 
20
20
  def jaxb_version
21
- "2.2.1"
21
+ '2.2.1'
22
22
  end
23
23
 
24
24
  # The specs for requirements
@@ -32,7 +32,7 @@ module Buildr
32
32
 
33
33
  # Repositories containing the requirements
34
34
  def remote_repository
35
- "http://download.java.net/maven/2"
35
+ 'http://download.java.net/maven/2'
36
36
  end
37
37
 
38
38
  def xjc(*args)
@@ -50,15 +50,15 @@ module Buildr
50
50
  target_dir = File.expand_path(options[:directory] || _(:target, :generated, :jaxb, 'main/java'))
51
51
  timestamp_file = File.expand_path("#{target_dir}/jaxb-#{options[:id] || 1}.cache")
52
52
 
53
- project.iml.main_source_directories << target_dir if project.iml?
53
+ project.iml.main_generated_source_directories << target_dir if project.iml?
54
54
 
55
55
  file(target_dir => timestamp_file)
56
56
 
57
57
  file(timestamp_file => files.flatten) do |task|
58
58
  rm_rf target_dir unless options[:keep_content]
59
59
  mkdir_p target_dir
60
- args << "-d" << target_dir
61
- args << "-p" << options[:package] if options[:package]
60
+ args << '-d' << target_dir
61
+ args << '-p' << options[:package] if options[:package]
62
62
  args += files.collect{|f| f.to_s}
63
63
  JaxbXjc.xjc args
64
64
  touch timestamp_file
@@ -35,12 +35,12 @@ module Buildr
35
35
 
36
36
  args = []
37
37
  if output_file
38
- args << "-file"
38
+ args << '-file'
39
39
  args << output_file
40
40
  end
41
41
  target_paths.each do |target_path|
42
42
  file(target_path).invoke
43
- args << target_path.to_s
43
+ args << target_path.to_s if ::File.exist?(target_path.to_s)
44
44
  end
45
45
 
46
46
  # If no output file then we must be trying to run the swing app
@@ -121,6 +121,28 @@ module Buildr
121
121
  }
122
122
  end
123
123
 
124
+ # An array of additional projects to scan for target_paths
125
+ attr_writer :additional_project_names
126
+
127
+ def additional_project_names
128
+ @additional_project_names ||= []
129
+ end
130
+
131
+ def complete_target_paths
132
+ deps = self.target_paths.dup
133
+
134
+ self.additional_project_names.each do |project_name|
135
+ p = self.project.project(project_name)
136
+ deps << [p.compile.target, p.test.compile.target].flatten.compact
137
+ end
138
+
139
+ deps = deps.flatten.compact
140
+ deps.each do |d|
141
+ d.invoke if d.respond_to?(:invoke)
142
+ end
143
+ deps
144
+ end
145
+
124
146
  protected
125
147
 
126
148
  def initialize(project)
@@ -140,30 +162,30 @@ module Buildr
140
162
 
141
163
  after_define do |project|
142
164
  if project.jdepend.enabled?
143
- desc "Generate JDepend xml report."
144
- project.task("jdepend:xml") do
145
- puts "JDepend: Analyzing source code..."
165
+ desc 'Generate JDepend xml report.'
166
+ project.task('jdepend:xml') do
167
+ puts 'JDepend: Analyzing source code...'
146
168
  mkdir_p File.dirname(project.jdepend.xml_output_file)
147
169
  Buildr::JDepend.jdepend(project.jdepend.xml_output_file,
148
- project.jdepend.target_paths.flatten.compact,
170
+ project.jdepend.complete_target_paths,
149
171
  project.jdepend.to_options)
150
172
  end
151
173
 
152
- desc "Run JDepend with Swing UI."
153
- project.task("jdepend:swing") do
154
- puts "JDepend: Analyzing source code..."
174
+ desc 'Run JDepend with Swing UI.'
175
+ project.task('jdepend:swing') do
176
+ puts 'JDepend: Analyzing source code...'
155
177
  Buildr::JDepend.jdepend(nil,
156
- project.jdepend.target_paths.flatten.compact,
178
+ project.jdepend.complete_target_paths,
157
179
  project.jdepend.to_options)
158
180
  end
159
181
 
160
182
  if project.jdepend.html_enabled?
161
- xml_task = project.task("jdepend:xml")
162
- desc "Generate JDepend html report."
183
+ xml_task = project.task('jdepend:xml')
184
+ desc 'Generate JDepend html report.'
163
185
  project.task("jdepend:html" => xml_task) do
164
- puts "JDepend: Generating report"
186
+ puts 'JDepend: Generating report'
165
187
  mkdir_p File.dirname(project.jdepend.html_output_file)
166
- Buildr.ant "jdepend" do |ant|
188
+ Buildr.ant 'jdepend' do |ant|
167
189
  ant.xslt :in => project.jdepend.xml_output_file,
168
190
  :out => project.jdepend.html_output_file,
169
191
  :style => project.jdepend.style_file
@@ -24,13 +24,7 @@ module Buildr
24
24
 
25
25
  # The specs for requirements
26
26
  def dependencies
27
- [
28
- 'net.sourceforge.pmd:pmd:jar:5.1.3',
29
- 'jaxen:jaxen:jar:1.1.1',
30
- 'commons-io:commons-io:jar:2.2',
31
- 'com.beust:jcommander:jar:1.27',
32
- 'asm:asm:jar:3.2'
33
- ]
27
+ %w(net.sourceforge.pmd:pmd:jar:5.1.3 jaxen:jaxen:jar:1.1.1 commons-io:commons-io:jar:2.2 com.beust:jcommander:jar:1.27 asm:asm:jar:3.2)
34
28
  end
35
29
 
36
30
  def pmd(rule_set_files, format, output_file_prefix, source_paths, options = {})
@@ -56,7 +50,7 @@ module Buildr
56
50
  ant.pmd :shortFilenames => true, :rulesetfiles => rule_sets.join(',') do
57
51
  ant.formatter :type => format, :toFile => "#{output_file_prefix}.#{format}"
58
52
  source_paths.each do |src|
59
- ant.fileset :dir=> src, :includes=>'**/*.java'
53
+ ant.fileset :dir=> src, :includes=>'**/*.java' if File.directory?(src)
60
54
  end
61
55
  end
62
56
 
@@ -76,7 +70,7 @@ module Buildr
76
70
  ant.taskdef :name=> 'cpd', :classpath => cp.join(';'), :classname => 'net.sourceforge.pmd.cpd.CPDTask'
77
71
  ant.cpd :format => format, :minimumTokenCount => minimum_token_count, :encoding => encoding, :outputFile => "#{output_file_prefix}.#{format}" do
78
72
  source_paths.each do |src|
79
- ant.fileset :dir=> src, :includes=>'**/*.java'
73
+ ant.fileset :dir=> src, :includes=>'**/*.java' if File.directory?(src)
80
74
  end
81
75
  end
82
76
 
@@ -95,7 +89,7 @@ module Buildr
95
89
  attr_writer :rule_set_files
96
90
 
97
91
  def rule_set_files
98
- @rule_set_files ||= (self.rule_set_artifacts.empty? ? ['rulesets/java/basic.xml', 'rulesets/java/imports.xml', 'rulesets/java/unusedcode.xml', 'rulesets/java/finalizers.xml', 'rulesets/java/braces.xml'] : [])
92
+ @rule_set_files ||= (self.rule_set_artifacts.empty? ? %w(rulesets/java/basic.xml rulesets/java/imports.xml rulesets/java/unusedcode.xml rulesets/java/finalizers.xml rulesets/java/braces.xml) : [])
99
93
  end
100
94
 
101
95
  # Support specification of rule sets that are distributed as part of a maven repository
@@ -131,8 +125,27 @@ module Buildr
131
125
  @source_paths ||= [self.project.compile.sources, self.project.test.compile.sources].flatten.compact
132
126
  end
133
127
 
128
+ # An array of paths that should be excluded no matter how they are added to pmd
129
+ def exclude_paths
130
+ @source_paths ||= []
131
+ end
132
+
133
+ # An array of additional projects to scan for main and test sources
134
+ attr_writer :additional_project_names
135
+
136
+ def additional_project_names
137
+ @additional_project_names ||= []
138
+ end
139
+
134
140
  def flat_source_paths
135
- source_paths.flatten.compact
141
+ paths = source_paths.dup
142
+
143
+ self.additional_project_names.each do |project_name|
144
+ p = self.project.project(project_name)
145
+ paths << [p.compile.sources, p.test.compile.sources].flatten.compact
146
+ end
147
+
148
+ paths.flatten.select{|p|!self.exclude_paths.include?(p)}.compact
136
149
  end
137
150
 
138
151
  protected