buildr 1.4.6-java → 1.4.7-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +81 -0
- data/Rakefile +5 -2
- data/addon/buildr/antlr.rb +0 -4
- data/addon/buildr/bnd.rb +3 -1
- data/addon/buildr/checkstyle.rb +201 -0
- data/addon/buildr/cobertura.rb +0 -1
- data/addon/buildr/drb.rb +0 -2
- data/addon/buildr/emma.rb +0 -1
- data/addon/buildr/findbugs.rb +227 -0
- data/addon/buildr/gwt.rake +82 -0
- data/addon/buildr/hibernate.rb +0 -4
- data/addon/buildr/javacc.rb +0 -4
- data/addon/buildr/javancss.rb +155 -0
- data/addon/buildr/jdepend.rb +138 -24
- data/addon/buildr/jdepend.rb.orig +178 -0
- data/addon/buildr/jetty.rb +0 -5
- data/addon/buildr/jibx.rb +85 -86
- data/addon/buildr/nailgun.rb +2 -2
- data/addon/buildr/openjpa.rb +0 -4
- data/addon/buildr/pmd.rb +166 -0
- data/addon/buildr/protobuf.rb +0 -1
- data/addon/buildr/sonar.rb +142 -0
- data/addon/buildr/xmlbeans.rb +0 -5
- data/buildr.gemspec +36 -21
- data/doc/_layouts/default.html +1 -0
- data/doc/contributing.textile +11 -2
- data/doc/download.textile +17 -5
- data/doc/index.textile +21 -46
- data/doc/installing.textile +18 -8
- data/doc/installing.textile.orig +282 -0
- data/doc/languages.textile +0 -38
- data/doc/more_stuff.textile +199 -12
- data/doc/more_stuff.textile.orig +1004 -0
- data/doc/packaging.textile +10 -0
- data/doc/settings_profiles.textile +2 -2
- data/etc/KEYS +44 -0
- data/lib/buildr.rb +67 -4
- data/lib/buildr/clojure.rb +0 -2
- data/lib/buildr/core/application.rb +23 -32
- data/lib/buildr/core/build.rb +0 -7
- data/lib/buildr/core/cc.rb +0 -5
- data/lib/buildr/core/checks.rb +0 -4
- data/lib/buildr/core/common.rb +0 -5
- data/lib/buildr/core/compile.rb +5 -10
- data/lib/buildr/core/doc.rb +9 -3
- data/lib/buildr/core/environment.rb +0 -1
- data/lib/buildr/core/filter.rb +0 -5
- data/lib/buildr/core/generate.rb +2 -6
- data/lib/buildr/core/help.rb +1 -6
- data/lib/buildr/core/linux.rb +0 -1
- data/lib/buildr/core/osx.rb +0 -1
- data/lib/buildr/core/project.rb +0 -4
- data/lib/buildr/core/run.rb +1 -5
- data/lib/buildr/core/shell.rb +1 -6
- data/lib/buildr/core/test.rb +1 -7
- data/lib/buildr/core/transports.rb +4 -6
- data/lib/buildr/core/util.rb +2 -65
- data/lib/buildr/groovy/doc.rb +0 -3
- data/lib/buildr/groovy/shell.rb +0 -2
- data/lib/buildr/ide/eclipse.rb +4 -13
- data/lib/buildr/ide/eclipse/java.rb +0 -4
- data/lib/buildr/ide/eclipse/plugin.rb +0 -4
- data/lib/buildr/ide/eclipse/scala.rb +0 -4
- data/lib/buildr/ide/idea.rb +284 -52
- data/lib/buildr/java/ant.rb +2 -6
- data/lib/buildr/java/bdd.rb +5 -123
- data/lib/buildr/java/cobertura.rb +16 -10
- data/lib/buildr/java/commands.rb +33 -7
- data/lib/buildr/java/compiler.rb +0 -7
- data/lib/buildr/java/deprecated.rb +0 -4
- data/lib/buildr/java/doc.rb +0 -2
- data/lib/buildr/java/emma.rb +0 -4
- data/lib/buildr/java/jruby.rb +0 -2
- data/lib/buildr/java/packaging.rb +0 -4
- data/lib/buildr/java/pom.rb +24 -16
- data/lib/buildr/java/rjb.rb +1 -1
- data/lib/buildr/java/test_result.rb +1 -2
- data/lib/buildr/java/tests.rb +68 -6
- data/lib/buildr/packaging/archive.rb +0 -1
- data/lib/buildr/packaging/artifact.rb +19 -16
- data/lib/buildr/packaging/artifact_namespace.rb +51 -24
- data/lib/buildr/packaging/artifact_search.rb +1 -2
- data/lib/buildr/packaging/gems.rb +1 -13
- data/lib/buildr/packaging/package.rb +0 -6
- data/lib/buildr/packaging/tar.rb +2 -4
- data/lib/buildr/packaging/version_requirement.rb +1 -1
- data/lib/buildr/packaging/zip.rb +1 -2
- data/lib/buildr/packaging/ziptask.rb +0 -4
- data/lib/buildr/run.rb +3 -3
- data/lib/buildr/scala/bdd.rb +129 -11
- data/lib/buildr/scala/compiler.rb +53 -6
- data/lib/buildr/scala/doc.rb +6 -4
- data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/Specs2Runner.java +38 -0
- data/lib/buildr/scala/shell.rb +0 -4
- data/lib/buildr/scala/tests.rb +15 -6
- data/lib/buildr/shell.rb +0 -1
- data/lib/buildr/version.rb +1 -1
- data/rakelib/all-in-one.rake +20 -11
- data/rakelib/checks.rake +0 -31
- data/rakelib/doc.rake +86 -100
- data/rakelib/package.rake +3 -3
- data/rakelib/release.rake +1 -1
- data/rakelib/rspec.rake +23 -7
- data/rakelib/stage.rake +18 -21
- data/spec/addon/bnd_spec.rb +2 -2
- data/spec/addon/jaxb_xjc_spec.rb +5 -0
- data/spec/core/application_spec.rb +11 -64
- data/spec/core/cc_spec.rb +12 -5
- data/spec/core/compile_spec.rb +11 -0
- data/spec/core/doc_spec.rb +1 -1
- data/spec/core/run_spec.rb +17 -4
- data/spec/core/test_spec.rb +5 -3
- data/spec/ide/idea_spec.rb +60 -0
- data/spec/java/bdd_spec.rb +8 -218
- data/spec/java/cobertura_spec.rb +4 -0
- data/spec/java/compiler_spec.rb +11 -8
- data/spec/java/emma_spec.rb +4 -1
- data/spec/java/java_spec.rb +1 -1
- data/spec/java/pom_spec.rb +125 -0
- data/spec/java/tests_spec.rb +185 -0
- data/spec/packaging/archive_spec.rb +1 -1
- data/spec/packaging/artifact_namespace_spec.rb +15 -0
- data/spec/packaging/artifact_spec.rb +26 -1
- data/spec/sandbox.rb +7 -1
- data/spec/scala/bdd_spec.rb +111 -8
- data/spec/scala/tests_spec.rb +5 -1
- data/spec/spec_helpers.rb +9 -4
- data/spec/version_requirement_spec.rb +2 -0
- metadata +499 -467
- data/lib/buildr/core.rb +0 -34
- data/lib/buildr/ide.rb +0 -19
- data/lib/buildr/java.rb +0 -25
- data/lib/buildr/java/jtestr_result.rb +0 -331
- data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
- data/lib/buildr/packaging.rb +0 -25
- data/rakelib/setup.rake +0 -68
data/addon/buildr/jetty.rb
CHANGED
@@ -13,15 +13,10 @@
|
|
13
13
|
# License for the specific language governing permissions and limitations under
|
14
14
|
# the License.
|
15
15
|
|
16
|
-
|
17
16
|
require 'uri'
|
18
17
|
require 'net/http'
|
19
|
-
require 'buildr/core/project'
|
20
|
-
require 'buildr/java'
|
21
|
-
require 'buildr/packaging'
|
22
18
|
require 'thread'
|
23
19
|
|
24
|
-
|
25
20
|
module Buildr
|
26
21
|
|
27
22
|
# Provides a collection of tasks and methods for using Jetty, specifically as a server
|
data/addon/buildr/jibx.rb
CHANGED
@@ -1,86 +1,85 @@
|
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
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
|
+
require 'java/java'
|
17
|
+
|
18
|
+
module Buildr
|
19
|
+
|
20
|
+
# Provides JiBX bytecode enhancement. Require explicitly using <code>require 'buildr/jibx'</code>.
|
21
|
+
module JiBX
|
22
|
+
|
23
|
+
JIBX_VERSION = '1.1.5'
|
24
|
+
BCEL_VERSION = '5.2'
|
25
|
+
STAX_VERSION = '1.0-2'
|
26
|
+
XPP3_VERSION = '1.1.4c'
|
27
|
+
|
28
|
+
REQUIRES = ["org.jibx:jibx-bind:jar:#{JIBX_VERSION}",
|
29
|
+
"org.jibx:jibx-run:jar:#{JIBX_VERSION}",
|
30
|
+
"org.apache.bcel:bcel:jar:#{BCEL_VERSION}",
|
31
|
+
"javax.xml.stream:stax-api:jar:#{STAX_VERSION}",
|
32
|
+
"xpp3:xpp3:jar:#{XPP3_VERSION}"]
|
33
|
+
|
34
|
+
Java.classpath << REQUIRES
|
35
|
+
|
36
|
+
class << self
|
37
|
+
|
38
|
+
def bind(options)
|
39
|
+
rake_check_options options, :classpath, :output, :binding, :target, :verbose, :load
|
40
|
+
artifacts = Buildr.artifacts(options[:classpath]).each { |a| a.invoke }.map(&:to_s) + [options[:output].to_s]
|
41
|
+
binding = file(options[:binding]).tap { |task| task.invoke }.to_s
|
42
|
+
|
43
|
+
Buildr.ant 'jibx' do |ant|
|
44
|
+
ant.taskdef :name=>'bind',
|
45
|
+
:classname=>'org.jibx.binding.ant.CompileTask',
|
46
|
+
:classpath => requires.join(File::PATH_SEPARATOR)
|
47
|
+
ant.bind :verbose => options[:verbose].to_s, :load => options[:load].to_s, :binding=>options[:binding].to_s do
|
48
|
+
ant.classpath :path => artifacts.join(File::PATH_SEPARATOR)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def requires()
|
56
|
+
@requires ||= Buildr.artifacts(REQUIRES).each { |artifact| artifact.invoke }.map(&:to_s)
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
def jibx_bind(options = nil)
|
62
|
+
|
63
|
+
# FIXME - add support for :bindingfileset and :classpathset
|
64
|
+
# Note: either :binding or :bindingfileset should be set, and either
|
65
|
+
# :classpath or :classpathset should be set, and options passed to
|
66
|
+
# ant.bind should be adjusted accordingly. At present, only :binding
|
67
|
+
# and :classpath are supported (which should be fine for most!)
|
68
|
+
jibx_options = {:output => compile.target,
|
69
|
+
:classpath => compile.classpath,
|
70
|
+
:binding => path_to(:source, :main, :resources, 'META-INF/binding.xml'),
|
71
|
+
:target => compile.target,
|
72
|
+
:load => false,
|
73
|
+
:verbose => false
|
74
|
+
}
|
75
|
+
|
76
|
+
JiBX.bind jibx_options.merge(options || {})
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
class Project
|
82
|
+
include JiBX
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
data/addon/buildr/nailgun.rb
CHANGED
@@ -49,7 +49,7 @@ module Buildr
|
|
49
49
|
|
50
50
|
# Returns the path to JRUBY_HOME.
|
51
51
|
def jruby_home
|
52
|
-
ENV['JRUBY_HOME'] ||
|
52
|
+
ENV['JRUBY_HOME'] || RbConfig::CONFIG['prefix']
|
53
53
|
end
|
54
54
|
|
55
55
|
# Returns the path to NAILGUN_HOME.
|
@@ -164,7 +164,7 @@ module Buildr
|
|
164
164
|
attr_reader :artifact
|
165
165
|
@artifact = Buildr.artifact(ARTIFACT_SPEC).from(nailgun_jar)
|
166
166
|
|
167
|
-
compiled_bin = file(tmp_path(NAME, NAME, 'ng' +
|
167
|
+
compiled_bin = file(tmp_path(NAME, NAME, 'ng' + RbConfig::CONFIG['EXEEXT']) => dist_dir.target) do |task|
|
168
168
|
unless task.to_s.pathmap('%x') == '.exe'
|
169
169
|
Dir.chdir(task.to_s.pathmap('%d')) do
|
170
170
|
info "Compiling #{task.to_s}"
|
data/addon/buildr/openjpa.rb
CHANGED
@@ -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
|
|
22
18
|
# Provides OpenJPA bytecode enhancement and Mapping tool task. Require explicitly using <code>require "buildr/openjpa"</code>.
|
data/addon/buildr/pmd.rb
ADDED
@@ -0,0 +1,166 @@
|
|
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>pmd:rule:xml</code>, <code>pmd:rule:html</code>, <code>pmd:cpd:xml</code>
|
18
|
+
# and <code>pmd:cpd:html</code> tasks.
|
19
|
+
#
|
20
|
+
# Require explicitly using <code>require "buildr/pmd"</code>.
|
21
|
+
module Pmd
|
22
|
+
|
23
|
+
class << self
|
24
|
+
|
25
|
+
# The specs for requirements
|
26
|
+
def dependencies
|
27
|
+
[
|
28
|
+
'pmd:pmd:jar:4.2.6',
|
29
|
+
'jaxen:jaxen:jar:1.1.1',
|
30
|
+
'asm:asm:jar:3.2'
|
31
|
+
]
|
32
|
+
end
|
33
|
+
|
34
|
+
def pmd(rule_set_files, format, output_file_prefix, source_paths, options = {})
|
35
|
+
dependencies = (options[:dependencies] || []) + self.dependencies
|
36
|
+
cp = Buildr.artifacts(dependencies).each(&:invoke).map(&:to_s)
|
37
|
+
(options[:rule_set_paths] || []).each {|p| cp << p}
|
38
|
+
|
39
|
+
puts "PMD: Analyzing source code..."
|
40
|
+
mkdir_p File.dirname(output_file_prefix)
|
41
|
+
|
42
|
+
Buildr.ant("pmd-report") do |ant|
|
43
|
+
ant.taskdef :name=> 'pmd', :classpath => cp.join(';'), :classname => 'net.sourceforge.pmd.ant.PMDTask'
|
44
|
+
ant.pmd :shortFilenames => true, :rulesetfiles => rule_set_files.join(',') do
|
45
|
+
ant.formatter :type => format, :toFile => "#{output_file_prefix}.#{format}"
|
46
|
+
source_paths.each do |src|
|
47
|
+
ant.fileset :dir=> src, :includes=>'**/*.java'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def cpd(format, output_file_prefix, source_paths, options = {})
|
55
|
+
dependencies = (options[:dependencies] || []) + self.dependencies
|
56
|
+
cp = Buildr.artifacts(dependencies).each(&:invoke).map(&:to_s)
|
57
|
+
minimum_token_count = options[:minimum_token_count] || 100
|
58
|
+
encoding = options[:encoding] || 'UTF-8'
|
59
|
+
|
60
|
+
puts "PMD-CPD: Analyzing source code..."
|
61
|
+
mkdir_p File.dirname(output_file_prefix)
|
62
|
+
|
63
|
+
Buildr.ant("cpd-report") do |ant|
|
64
|
+
ant.taskdef :name=> 'cpd', :classpath => cp.join(';'), :classname => 'net.sourceforge.pmd.cpd.CPDTask'
|
65
|
+
ant.cpd :format => format, :minimumTokenCount => minimum_token_count, :encoding => encoding, :outputFile => "#{output_file_prefix}.#{format}" do
|
66
|
+
source_paths.each do |src|
|
67
|
+
ant.fileset :dir=> src, :includes=>'**/*.java'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class Config
|
76
|
+
|
77
|
+
attr_writer :enabled
|
78
|
+
|
79
|
+
def enabled?
|
80
|
+
!!@enabled
|
81
|
+
end
|
82
|
+
|
83
|
+
attr_writer :rule_set_files
|
84
|
+
|
85
|
+
def rule_set_files
|
86
|
+
@rule_set_files || ['basic','imports','unusedcode']
|
87
|
+
end
|
88
|
+
|
89
|
+
attr_writer :rule_set_paths
|
90
|
+
|
91
|
+
def rule_set_paths
|
92
|
+
@rule_set_paths ||= []
|
93
|
+
end
|
94
|
+
|
95
|
+
attr_writer :report_dir
|
96
|
+
|
97
|
+
def report_dir
|
98
|
+
@report_dir || project._(:reports, :pmd)
|
99
|
+
end
|
100
|
+
|
101
|
+
attr_writer :output_file_prefix
|
102
|
+
|
103
|
+
def output_file_prefix
|
104
|
+
@output_file_prefix || "#{self.report_dir}/pmd"
|
105
|
+
end
|
106
|
+
|
107
|
+
attr_writer :cpd_output_file_prefix
|
108
|
+
|
109
|
+
def cpd_output_file_prefix
|
110
|
+
@cpd_output_file_prefix || "#{self.report_dir}/cpd"
|
111
|
+
end
|
112
|
+
|
113
|
+
def source_paths
|
114
|
+
@source_paths ||= [self.project.compile.sources, self.project.test.compile.sources]
|
115
|
+
end
|
116
|
+
|
117
|
+
def flat_source_paths
|
118
|
+
source_paths.flatten.compact
|
119
|
+
end
|
120
|
+
|
121
|
+
protected
|
122
|
+
|
123
|
+
def initialize(project)
|
124
|
+
@project = project
|
125
|
+
end
|
126
|
+
|
127
|
+
attr_reader :project
|
128
|
+
end
|
129
|
+
|
130
|
+
module ProjectExtension
|
131
|
+
include Extension
|
132
|
+
|
133
|
+
def pmd
|
134
|
+
@pmd ||= Buildr::Pmd::Config.new(project)
|
135
|
+
end
|
136
|
+
|
137
|
+
after_define do |project|
|
138
|
+
if project.pmd.enabled?
|
139
|
+
desc "Generate pmd xml report."
|
140
|
+
project.task("pmd:rule:xml") do
|
141
|
+
Buildr::Pmd.pmd(project.pmd.rule_set_files, 'xml', project.pmd.output_file_prefix, project.pmd.flat_source_paths, :rule_set_paths => project.pmd.rule_set_paths)
|
142
|
+
end
|
143
|
+
|
144
|
+
desc "Generate pmd html report."
|
145
|
+
project.task("pmd:rule:html") do
|
146
|
+
Buildr::Pmd.pmd(project.pmd.rule_set_files, 'html', project.pmd.output_file_prefix, project.pmd.flat_source_paths, :rule_set_paths => project.pmd.rule_set_paths)
|
147
|
+
end
|
148
|
+
|
149
|
+
desc "Generate pmd cpd xml report."
|
150
|
+
project.task("pmd:cpd:xml") do
|
151
|
+
Buildr::Pmd.cpd('xml', project.pmd.cpd_output_file_prefix, project.pmd.flat_source_paths)
|
152
|
+
end
|
153
|
+
|
154
|
+
desc "Generate pmd cpd text report."
|
155
|
+
project.task("pmd:cpd:text") do
|
156
|
+
Buildr::Pmd.cpd('text', project.pmd.cpd_output_file_prefix, project.pmd.flat_source_paths)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
class Buildr::Project
|
165
|
+
include Buildr::Pmd::ProjectExtension
|
166
|
+
end
|
data/addon/buildr/protobuf.rb
CHANGED
@@ -0,0 +1,142 @@
|
|
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 Sonar
|
18
|
+
|
19
|
+
class << self
|
20
|
+
|
21
|
+
# The specs for requirements
|
22
|
+
def dependencies
|
23
|
+
[
|
24
|
+
'org.codehaus.sonar-plugins:sonar-ant-task:jar:1.3'
|
25
|
+
]
|
26
|
+
end
|
27
|
+
|
28
|
+
def sonar(jdbc_url, jdbc_driver_class_name, jdbc_username, jdbc_password, host_url, project_name, key, sources, binaries, libraries)
|
29
|
+
|
30
|
+
# Build the artifacts for FindBugs to analyse
|
31
|
+
Buildr.artifacts(binaries).each(&:invoke)
|
32
|
+
|
33
|
+
cp = Buildr.artifacts(self.dependencies).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
|
34
|
+
|
35
|
+
args = {
|
36
|
+
:key => key,
|
37
|
+
:version => '1',
|
38
|
+
'xmlns:sonar' => 'antlib:org.sonar.ant'
|
39
|
+
}
|
40
|
+
|
41
|
+
Buildr.ant('sonar') do |ant|
|
42
|
+
ant.taskdef :name => 'sonar', :classname => 'org.sonar.ant.SonarTask', :classpath => cp
|
43
|
+
|
44
|
+
ant.property :name => 'sonar.projectName', :value => project_name
|
45
|
+
|
46
|
+
ant.property :name => 'sonar.jdbc.url', :value => jdbc_url
|
47
|
+
ant.property :name => 'sonar.jdbc.driverClassName', :value => jdbc_driver_class_name
|
48
|
+
ant.property :name => 'sonar.jdbc.username', :value => jdbc_username
|
49
|
+
ant.property :name => 'sonar.jdbc.password', :value => jdbc_password
|
50
|
+
ant.property :name => 'sonar.host.url', :value => host_url
|
51
|
+
|
52
|
+
ant.property :name => 'sonar.checkstyle.generateXml', :value => 'true'
|
53
|
+
|
54
|
+
ant.property :name => 'sonar.sources', :value => sources.join(',')
|
55
|
+
ant.property :name => 'sonar.binaries', :value => binaries.join(',')
|
56
|
+
ant.property :name => 'sonar.libraries', :value => libraries.join(',')
|
57
|
+
|
58
|
+
ant.sonar args
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class Config
|
65
|
+
|
66
|
+
attr_accessor :enabled
|
67
|
+
attr_accessor :jdbc_url
|
68
|
+
attr_accessor :jdbc_driver_class_name
|
69
|
+
attr_accessor :jdbc_username
|
70
|
+
attr_accessor :jdbc_password
|
71
|
+
attr_accessor :host_url
|
72
|
+
attr_accessor :key
|
73
|
+
attr_accessor :project_name
|
74
|
+
|
75
|
+
attr_writer :sources
|
76
|
+
def sources
|
77
|
+
@sources ||= []
|
78
|
+
end
|
79
|
+
|
80
|
+
attr_writer :binaries
|
81
|
+
def binaries
|
82
|
+
@binaries ||= []
|
83
|
+
end
|
84
|
+
|
85
|
+
attr_writer :libraries
|
86
|
+
def libraries
|
87
|
+
@libraries ||= []
|
88
|
+
end
|
89
|
+
|
90
|
+
def enabled?
|
91
|
+
!!@enabled
|
92
|
+
end
|
93
|
+
|
94
|
+
protected
|
95
|
+
|
96
|
+
def initialize(project)
|
97
|
+
@project = project
|
98
|
+
end
|
99
|
+
|
100
|
+
attr_reader :project
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
module ProjectExtension
|
105
|
+
include Extension
|
106
|
+
|
107
|
+
def sonar
|
108
|
+
@sonar ||= Buildr::Sonar::Config.new(project)
|
109
|
+
end
|
110
|
+
|
111
|
+
after_define do |project|
|
112
|
+
if project.sonar.enabled?
|
113
|
+
desc 'Execute Sonar code analysis'
|
114
|
+
project.task('sonar') do
|
115
|
+
puts 'Sonar: Analyzing source code...'
|
116
|
+
|
117
|
+
sources = project.sonar.sources.flatten.compact
|
118
|
+
binaries = project.sonar.binaries.flatten.compact
|
119
|
+
libraries = project.sonar.libraries.flatten.compact
|
120
|
+
|
121
|
+
Buildr::Sonar.sonar(
|
122
|
+
project.sonar.jdbc_url,
|
123
|
+
project.sonar.jdbc_driver_class_name,
|
124
|
+
project.sonar.jdbc_username,
|
125
|
+
project.sonar.jdbc_password,
|
126
|
+
project.sonar.host_url,
|
127
|
+
project.sonar.project_name,
|
128
|
+
project.sonar.key,
|
129
|
+
sources,
|
130
|
+
binaries,
|
131
|
+
libraries
|
132
|
+
)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
class Buildr::Project
|
141
|
+
include Buildr::Sonar::ProjectExtension
|
142
|
+
end
|