buildr 1.4.7.pre2 → 1.4.7

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 (54) hide show
  1. data/CHANGELOG +24 -2
  2. data/Rakefile +4 -1
  3. data/addon/buildr/{checkstyle.rake → checkstyle.rb} +0 -0
  4. data/addon/buildr/{findbugs.rake → findbugs.rb} +0 -0
  5. data/addon/buildr/gwt.rake +82 -0
  6. data/addon/buildr/{javancss.rake → javancss.rb} +0 -0
  7. data/addon/buildr/jdepend.rb.orig +178 -0
  8. data/addon/buildr/nailgun.rb +2 -2
  9. data/addon/buildr/{pmd.rake → pmd.rb} +3 -1
  10. data/addon/buildr/sonar.rb +142 -0
  11. data/buildr.gemspec +21 -17
  12. data/doc/installing.textile.orig +282 -0
  13. data/doc/more_stuff.textile +31 -0
  14. data/doc/more_stuff.textile.orig +1004 -0
  15. data/etc/KEYS +44 -0
  16. data/lib/buildr.rb +3 -3
  17. data/lib/buildr/core/doc.rb +9 -3
  18. data/lib/buildr/core/generate.rb +2 -2
  19. data/lib/buildr/core/run.rb +1 -1
  20. data/lib/buildr/core/shell.rb +1 -1
  21. data/lib/buildr/core/test.rb +1 -1
  22. data/lib/buildr/core/util.rb +2 -2
  23. data/lib/buildr/ide/eclipse.rb +4 -4
  24. data/lib/buildr/ide/idea.rb +184 -1
  25. data/lib/buildr/java/ant.rb +2 -3
  26. data/lib/buildr/java/bdd.rb +4 -4
  27. data/lib/buildr/java/pom.rb +5 -4
  28. data/lib/buildr/java/rjb.rb +1 -1
  29. data/lib/buildr/java/test_result.rb +4 -0
  30. data/lib/buildr/packaging/version_requirement.rb +1 -1
  31. data/lib/buildr/packaging/zip.rb +1 -1
  32. data/lib/buildr/run.rb +3 -2
  33. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
  34. data/lib/buildr/version.rb +1 -1
  35. data/rakelib/doc.rake +5 -5
  36. data/rakelib/package.rake +3 -3
  37. data/rakelib/rspec.rake +22 -4
  38. data/rakelib/stage.rake +16 -12
  39. data/spec/core/application_spec.rb +1 -1
  40. data/spec/core/cc_spec.rb +12 -4
  41. data/spec/core/doc_spec.rb +1 -1
  42. data/spec/core/run_spec.rb +17 -4
  43. data/spec/core/test_spec.rb +5 -3
  44. data/spec/ide/idea_spec.rb +2 -2
  45. data/spec/java/cobertura_spec.rb +4 -0
  46. data/spec/java/emma_spec.rb +4 -1
  47. data/spec/java/java_spec.rb +1 -1
  48. data/spec/java/pom_spec.rb +125 -0
  49. data/spec/packaging/archive_spec.rb +1 -1
  50. data/spec/packaging/artifact_spec.rb +1 -1
  51. data/spec/sandbox.rb +4 -0
  52. data/spec/spec_helpers.rb +6 -1
  53. data/spec/version_requirement_spec.rb +2 -0
  54. metadata +390 -239
data/CHANGELOG CHANGED
@@ -1,4 +1,26 @@
1
- 1.4.7 (Pending)
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)
2
24
  * Added: Add a Findbugs extension.
3
25
  * Added: Add a Checkstyle extension.
4
26
  * Added: Add a JavaNCSS extension.
@@ -43,7 +65,7 @@
43
65
  * Change: Move to Bundler to manage the project dependencies
44
66
  * Change: BUILDR-548 Remove support for JTestR as it is no longer maintained (Antoine Toulme)
45
67
  * Change: BUILDR-614 Buildr development - Using rvm, bundler and OSX installs the wrong rjb (Russell Teabeault)
46
- * Change: Upgrade to RJB 1.3.7
68
+ * Change: Upgrade to RJB 1.4.0
47
69
  * Fixed: ArtifactNamespace fails when using artifacts with classfier.
48
70
  * Fixed: Buildr.artifacts() should handle any object with :to_spec method
49
71
  (i.e., any object that ActsAsArtifact)
data/Rakefile CHANGED
@@ -13,6 +13,9 @@
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/]
@@ -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
 
@@ -0,0 +1,82 @@
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 GWT
18
+
19
+ class << self
20
+ # The specs for requirements
21
+ def dependencies
22
+ ['com.google.gwt:gwt-dev:jar:2.4.0']
23
+ end
24
+
25
+ def gwtc_main(modules, source_artifacts, output_dir, options = {})
26
+ cp = Buildr.artifacts(self.dependencies).each(&:invoke).map(&:to_s) + Buildr.artifacts(source_artifacts).each(&:invoke).map(&:to_s)
27
+ style = options[:style] || "OBFUSCATED," # "PRETTY", "DETAILED"
28
+ log_level = options[:log_level] # ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL
29
+ workers = options[:workers] || 2
30
+
31
+ args = []
32
+ if log_level
33
+ args << "-logLevel"
34
+ args << log_level
35
+ end
36
+ args << "-strict"
37
+ args << "-style"
38
+ args << style
39
+ args << "-localWorkers"
40
+ args << workers
41
+ args << "-war"
42
+ args << output_dir
43
+ if options[:compile_report_dir]
44
+ args << "-compileReport"
45
+ args << "-extra"
46
+ args << options[:compile_report_dir]
47
+ end
48
+
49
+ if options[:draft_compile]
50
+ args << "-draftCompile"
51
+ end
52
+
53
+ args += modules
54
+
55
+ Java::Commands.java 'com.google.gwt.dev.Compiler', *(args + [{:classpath => cp, :properties => options[:properties], :java_args => options[:java_args]}])
56
+ end
57
+ end
58
+
59
+ module ProjectExtension
60
+ include Extension
61
+
62
+ def gwt(module_names, options = {})
63
+ output_key = options[:output_key] || project.id
64
+ output_dir = project._(:target, :generated, :gwt, output_key)
65
+ artifacts = (project.compile.sources + project.resources.sources).collect do |a|
66
+ a.is_a?(String) ? file(a) : a
67
+ end
68
+ dependencies = artifacts(options[:dependencies]) || project.compile.dependencies
69
+ task = file(output_dir) do
70
+ Buildr::GWT.gwtc_main(module_names, dependencies + artifacts, output_dir, options.dup)
71
+ end
72
+ task.enhance(dependencies)
73
+ task.enhance([project.compile])
74
+ task
75
+ end
76
+ end
77
+ end
78
+ end
79
+
80
+ class Buildr::Project
81
+ include Buildr::GWT::ProjectExtension
82
+ end
@@ -0,0 +1,178 @@
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
+ # Addes the <code>projectname:jdepend:swing</code>, <code>projectname:jdepend:text</code> and
18
+ # <code>projectname:jdepend:xml</code> tasks.
19
+ #
20
+ # Require explicitly using <code>require "buildr/jdepend"</code>.
21
+ module JDepend
22
+
23
+ class << self
24
+
25
+ # The specs for requirements
26
+ def dependencies
27
+ [
28
+ 'jdepend:jdepend:jar:2.9.1'
29
+ ]
30
+ end
31
+
32
+ def jdepend(output_file, target_paths, options = {})
33
+ dependencies = (options[:dependencies] || []) + self.dependencies
34
+ cp = Buildr.artifacts(dependencies).each(&:invoke).map(&:to_s)
35
+
36
+ args = []
37
+ if output_file
38
+ args << "-file"
39
+ args << output_file
40
+ end
41
+ target_paths.each do |target_path|
42
+ file(target_path).invoke
43
+ <<<<<<< HEAD
44
+ args << target_path
45
+ =======
46
+ args << target_path.to_s
47
+ >>>>>>> 28deb000947f13d5df722228ed2bc24fdcb303d3
48
+ end
49
+
50
+ # If no output file then we must be trying to run the swing app
51
+ command = output_file ? 'jdepend.xmlui.JDepend' : 'jdepend.swingui.JDepend'
52
+
53
+ begin
54
+ Java::Commands.java command, *(args + [{:classpath => cp, :properties => options[:properties], :java_args => options[:java_args]}])
55
+ rescue => e
56
+ raise e if options[:fail_on_error]
57
+ end
58
+ end
59
+ end
60
+
61
+ class Config
62
+ def enabled?
63
+ !!@enabled
64
+ end
65
+
66
+ attr_writer :enabled
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, :jdepend)
76
+ end
77
+
78
+ attr_writer :report_dir
79
+
80
+ def report_dir
81
+ @report_dir || project._(:reports, :jdepend)
82
+ end
83
+
84
+ attr_writer :fail_on_error
85
+
86
+ def fail_on_error?
87
+ @fail_on_error.nil? ? false : @fail_on_error
88
+ end
89
+
90
+ attr_writer :xml_output_file
91
+
92
+ def xml_output_file
93
+ @xml_output_file || "#{self.report_dir}/jdepend.xml"
94
+ end
95
+
96
+ attr_writer :html_output_file
97
+
98
+ def html_output_file
99
+ @html_output_file || "#{self.report_dir}/jdepend.html"
100
+ end
101
+
102
+ attr_writer :style_file
103
+
104
+ def style_file
105
+ @style_file || "#{self.config_directory}/jdepend.xsl"
106
+ end
107
+
108
+ def target_paths
109
+ @target_paths ||= [self.project.compile.target, self.project.test.compile.target]
110
+ end
111
+
112
+ def to_options
113
+ {
114
+ :fail_on_error => project.jdepend.fail_on_error?,
115
+ # Set user home so that jdepend.properties will be loaded from there if present
116
+ :properties => { 'user.home' => project.jdepend.config_directory }
117
+ }
118
+ end
119
+
120
+ protected
121
+
122
+ def initialize(project)
123
+ @project = project
124
+ end
125
+
126
+ attr_reader :project
127
+
128
+ end
129
+
130
+ module ProjectExtension
131
+ include Extension
132
+
133
+ def jdepend
134
+ @jdepend ||= Buildr::JDepend::Config.new(project)
135
+ end
136
+
137
+ after_define do |project|
138
+ if project.jdepend.enabled?
139
+ desc "Generate JDepend xml report."
140
+ project.task("jdepend:xml") do
141
+ puts "JDepend: Analyzing source code..."
142
+ mkdir_p File.dirname(project.jdepend.xml_output_file)
143
+ Buildr::JDepend.jdepend(project.jdepend.xml_output_file,
144
+ project.jdepend.target_paths.flatten.compact,
145
+ project.jdepend.to_options)
146
+ end
147
+
148
+ desc "Run JDepend with Swing UI."
149
+ project.task("jdepend:swing") do
150
+ puts "JDepend: Analyzing source code..."
151
+ Buildr::JDepend.jdepend(nil,
152
+ project.jdepend.target_paths.flatten.compact,
153
+ project.jdepend.to_options)
154
+ end
155
+
156
+ if project.jdepend.html_enabled?
157
+ xml_task = project.task("jdepend:xml")
158
+ desc "Generate JDepend html report."
159
+ project.task("jdepend:html" => xml_task) do
160
+ puts "JDepend: Generating report"
161
+ mkdir_p File.dirname(project.jdepend.html_output_file)
162
+ Buildr.ant "jdepend" do |ant|
163
+ ant.xslt :in => project.jdepend.xml_output_file,
164
+ :out => project.jdepend.html_output_file,
165
+ :style => project.jdepend.style_file
166
+ end
167
+ end
168
+
169
+ end
170
+ end
171
+ end
172
+ end
173
+ end
174
+ end
175
+
176
+ class Buildr::Project
177
+ include Buildr::JDepend::ProjectExtension
178
+ end
@@ -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'] || Config::CONFIG['prefix']
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' + Config::CONFIG['EXEEXT']) => dist_dir.target) do |task|
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}"
@@ -54,13 +54,15 @@ module Buildr
54
54
  def cpd(format, output_file_prefix, source_paths, options = {})
55
55
  dependencies = (options[:dependencies] || []) + self.dependencies
56
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'
57
59
 
58
60
  puts "PMD-CPD: Analyzing source code..."
59
61
  mkdir_p File.dirname(output_file_prefix)
60
62
 
61
63
  Buildr.ant("cpd-report") do |ant|
62
64
  ant.taskdef :name=> 'cpd', :classpath => cp.join(';'), :classname => 'net.sourceforge.pmd.cpd.CPDTask'
63
- ant.cpd :format => format, :minimumTokenCount => 100, :outputFile => "#{output_file_prefix}.#{format}" do
65
+ ant.cpd :format => format, :minimumTokenCount => minimum_token_count, :encoding => encoding, :outputFile => "#{output_file_prefix}.#{format}" do
64
66
  source_paths.each do |src|
65
67
  ant.fileset :dir=> src, :includes=>'**/*.java'
66
68
  end
@@ -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