buildr 1.3.5-x86-mswin32 → 1.4.0-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +153 -8
- data/README.rdoc +1 -1
- data/addon/buildr/antlr.rb +5 -5
- data/addon/buildr/drb.rb +18 -18
- data/addon/buildr/hibernate.rb +18 -14
- data/addon/buildr/javacc.rb +4 -4
- data/addon/buildr/jetty.rb +5 -5
- data/addon/buildr/nailgun.rb +23 -23
- data/addon/buildr/openjpa.rb +1 -1
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/protobuf.rb +75 -0
- data/addon/buildr/xmlbeans.rb +5 -5
- data/buildr.buildfile +2 -2
- data/buildr.gemspec +8 -7
- data/doc/_layouts/default.html +2 -2
- data/doc/artifacts.textile +4 -4
- data/doc/building.textile +35 -3
- data/doc/contributing.textile +5 -0
- data/doc/download.textile +16 -5
- data/doc/extending.textile +38 -12
- data/doc/installing.textile +6 -5
- data/doc/languages.textile +182 -42
- data/doc/more_stuff.textile +2 -2
- data/doc/packaging.textile +14 -15
- data/doc/projects.textile +7 -2
- data/doc/quick_start.textile +4 -4
- data/doc/scripts/buildr-git.rb +63 -63
- data/doc/scripts/gitflow.rb +21 -21
- data/doc/settings_profiles.textile +9 -2
- data/doc/testing.textile +16 -5
- data/etc/KEYS +38 -0
- data/lib/buildr.rb +1 -1
- data/lib/buildr/core.rb +1 -0
- data/lib/buildr/core/application.rb +33 -27
- data/lib/buildr/core/build.rb +41 -28
- data/lib/buildr/core/cc.rb +172 -0
- data/lib/buildr/core/checks.rb +1 -1
- data/lib/buildr/core/common.rb +7 -6
- data/lib/buildr/core/compile.rb +7 -8
- data/lib/buildr/core/doc.rb +263 -0
- data/lib/buildr/core/environment.rb +6 -6
- data/lib/buildr/core/filter.rb +77 -35
- data/lib/buildr/core/generate.rb +7 -7
- data/lib/buildr/core/help.rb +1 -1
- data/lib/buildr/core/osx.rb +6 -6
- data/lib/buildr/core/progressbar.rb +4 -4
- data/lib/buildr/core/project.rb +144 -36
- data/lib/buildr/core/shell.rb +34 -34
- data/lib/buildr/core/test.rb +89 -20
- data/lib/buildr/core/transports.rb +8 -7
- data/lib/buildr/core/util.rb +77 -23
- data/lib/buildr/groovy/bdd.rb +5 -5
- data/lib/buildr/groovy/compiler.rb +19 -15
- data/lib/buildr/groovy/shell.rb +6 -6
- data/lib/buildr/ide/eclipse.rb +148 -75
- data/lib/buildr/ide/eclipse/java.rb +3 -3
- data/lib/buildr/ide/eclipse/plugin.rb +8 -5
- data/lib/buildr/ide/eclipse/scala.rb +4 -2
- data/lib/buildr/ide/idea.rb +2 -2
- data/lib/buildr/ide/idea7x.rb +23 -4
- data/lib/buildr/java.rb +1 -0
- data/lib/buildr/java/ant.rb +4 -4
- data/lib/buildr/java/bdd.rb +51 -54
- data/lib/buildr/java/cobertura.rb +57 -35
- data/lib/buildr/java/commands.rb +14 -5
- data/lib/buildr/java/compiler.rb +3 -217
- data/lib/buildr/java/deprecated.rb +4 -4
- data/lib/buildr/java/doc.rb +70 -0
- data/lib/buildr/java/emma.rb +22 -22
- data/lib/buildr/java/jruby.rb +4 -4
- data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
- data/lib/buildr/java/packaging.rb +30 -29
- data/lib/buildr/java/pom.rb +4 -4
- data/lib/buildr/java/rjb.rb +6 -6
- data/lib/buildr/java/test_result.rb +61 -85
- data/lib/buildr/java/tests.rb +44 -27
- data/lib/buildr/java/version_requirement.rb +8 -8
- data/lib/buildr/packaging/archive.rb +55 -22
- data/lib/buildr/packaging/artifact.rb +75 -36
- data/lib/buildr/packaging/artifact_namespace.rb +90 -78
- data/lib/buildr/packaging/artifact_search.rb +5 -5
- data/lib/buildr/packaging/gems.rb +11 -7
- data/lib/buildr/packaging/package.rb +10 -7
- data/lib/buildr/packaging/tar.rb +14 -14
- data/lib/buildr/packaging/version_requirement.rb +30 -10
- data/lib/buildr/packaging/ziptask.rb +51 -13
- data/lib/buildr/scala.rb +1 -0
- data/lib/buildr/scala/bdd.rb +25 -20
- data/lib/buildr/scala/compiler.rb +87 -40
- data/lib/buildr/scala/doc.rb +106 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +14 -9
- data/lib/buildr/scala/tests.rb +33 -26
- data/lib/buildr/shell.rb +33 -33
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +1 -1
- data/rakelib/doc.rake +7 -0
- data/rakelib/package.rake +1 -1
- data/rakelib/release.rake +9 -6
- data/rakelib/rspec.rake +26 -7
- data/rakelib/setup.rake +15 -3
- data/rakelib/stage.rake +18 -11
- data/spec/addon/drb_spec.rb +25 -25
- data/spec/core/application_spec.rb +111 -21
- data/spec/core/build_spec.rb +16 -15
- data/spec/core/cc_spec.rb +174 -0
- data/spec/core/checks_spec.rb +34 -34
- data/spec/core/common_spec.rb +51 -5
- data/spec/core/compile_spec.rb +89 -14
- data/spec/core/extension_spec.rb +127 -19
- data/spec/core/generate_spec.rb +2 -2
- data/spec/core/project_spec.rb +10 -10
- data/spec/core/test_spec.rb +144 -35
- data/spec/core/transport_spec.rb +8 -8
- data/spec/core/util_spec.rb +63 -5
- data/spec/groovy/bdd_spec.rb +5 -5
- data/spec/groovy/compiler_spec.rb +29 -18
- data/spec/ide/eclipse_spec.rb +185 -9
- data/spec/ide/idea7x_spec.rb +22 -10
- data/spec/java/ant_spec.rb +9 -5
- data/spec/java/bdd_spec.rb +29 -37
- data/spec/java/cobertura_spec.rb +12 -12
- data/spec/java/commands_spec.rb +34 -0
- data/spec/java/compiler_spec.rb +53 -53
- data/spec/java/emma_spec.rb +11 -11
- data/spec/java/java_spec.rb +10 -10
- data/spec/java/packaging_spec.rb +67 -20
- data/spec/java/test_coverage_helper.rb +18 -18
- data/spec/java/tests_spec.rb +13 -9
- data/spec/packaging/archive_spec.rb +187 -20
- data/spec/packaging/artifact_namespace_spec.rb +172 -83
- data/spec/packaging/artifact_spec.rb +83 -18
- data/spec/packaging/packaging_spec.rb +41 -14
- data/spec/sandbox.rb +23 -12
- data/spec/scala/bdd_spec.rb +13 -8
- data/spec/scala/compiler_spec.rb +18 -13
- data/spec/scala/scala.rb +3 -3
- data/spec/scala/tests_spec.rb +46 -24
- data/spec/spec_helpers.rb +28 -10
- data/spec/version_requirement_spec.rb +25 -11
- metadata +149 -133
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
- data/rakelib/stage.rake~ +0 -213
@@ -30,7 +30,10 @@ module Buildr
|
|
30
30
|
eclipse = project.eclipse
|
31
31
|
|
32
32
|
# smart defaults
|
33
|
-
if eclipse.natures.empty? && (
|
33
|
+
if eclipse.natures.empty? && (
|
34
|
+
(File.exists? project.path_to("plugin.xml")) ||
|
35
|
+
(File.exists? project.path_to("OSGI-INF")) ||
|
36
|
+
(File.exists?(project.path_to("META-INF/MANIFEST.MF")) && File.read(project.path_to("META-INF/MANIFEST.MF")).match(/^Bundle-SymbolicName:/)))
|
34
37
|
eclipse.natures = [NATURE, Buildr::Eclipse::Java::NATURE]
|
35
38
|
eclipse.classpath_containers = [CONTAINER, Buildr::Eclipse::Java::CONTAINER] if eclipse.classpath_containers.empty?
|
36
39
|
eclipse.builders = BUILDERS + [Buildr::Eclipse::Java::BUILDER] if eclipse.builders.empty?
|
@@ -49,12 +52,12 @@ module Buildr
|
|
49
52
|
index = eclipse.classpath_containers.index(Buildr::Eclipse::Java::CONTAINER) || -1
|
50
53
|
eclipse.classpath_containers = eclipse.classpath_containers.insert(index, CONTAINER)
|
51
54
|
end
|
52
|
-
unless (eclipse.builders.include?(
|
55
|
+
unless (eclipse.builders.include?(BUILDERS[0]) && eclipse.builders.include?(BUILDERS[1]))
|
53
56
|
# plugin builder must be before java builder
|
54
57
|
index = eclipse.classpath_containers.index(Buildr::Eclipse::Java::BUILDER) || -1
|
55
|
-
eclipse.builders = eclipse.builders.insert(index,
|
56
|
-
index = eclipse.classpath_containers.index(
|
57
|
-
eclipse.builders = eclipse.builders.insert(index,
|
58
|
+
eclipse.builders = eclipse.builders.insert(index, BUILDERS[1]) unless eclipse.builders.include? BUILDERS[1]
|
59
|
+
index = eclipse.classpath_containers.index(BUILDERS[1]) || -1
|
60
|
+
eclipse.builders = eclipse.builders.insert(index, BUILDERS[0]) unless eclipse.builders.include? BUILDERS[0]
|
58
61
|
end
|
59
62
|
end
|
60
63
|
end
|
@@ -26,14 +26,15 @@ module Buildr
|
|
26
26
|
CONTAINER = 'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER'
|
27
27
|
BUILDER = 'ch.epfl.lamp.sdt.core.scalabuilder'
|
28
28
|
|
29
|
-
after_define
|
29
|
+
after_define :eclipse => :eclipse_scala
|
30
|
+
after_define :eclipse_scala do |project|
|
30
31
|
eclipse = project.eclipse
|
31
|
-
|
32
32
|
# smart defaults
|
33
33
|
if eclipse.natures.empty? && (project.compile.language == :scala || project.test.compile.language == :scala)
|
34
34
|
eclipse.natures = [NATURE, Buildr::Eclipse::Java::NATURE]
|
35
35
|
eclipse.classpath_containers = [CONTAINER, Buildr::Eclipse::Java::CONTAINER] if eclipse.classpath_containers.empty?
|
36
36
|
eclipse.builders = BUILDER if eclipse.builders.empty?
|
37
|
+
eclipse.exclude_libs += Buildr::Scala::Scalac.dependencies
|
37
38
|
end
|
38
39
|
|
39
40
|
# :scala nature explicitly set
|
@@ -54,6 +55,7 @@ module Buildr
|
|
54
55
|
eclipse.builders -= [Buildr::Eclipse::Java::BUILDER]
|
55
56
|
eclipse.builders += [BUILDER]
|
56
57
|
end
|
58
|
+
eclipse.exclude_libs += Buildr::Scala::Scalac.dependencies
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
data/lib/buildr/ide/idea.rb
CHANGED
@@ -30,11 +30,11 @@ module Buildr
|
|
30
30
|
Project.local_task "idea"=>"artifacts"
|
31
31
|
end
|
32
32
|
|
33
|
-
before_define do |project|
|
33
|
+
before_define(:idea) do |project|
|
34
34
|
project.recursive_task("idea")
|
35
35
|
end
|
36
36
|
|
37
|
-
after_define do |project|
|
37
|
+
after_define(:idea => :package) do |project|
|
38
38
|
idea = project.task("idea")
|
39
39
|
# We need paths relative to the top project's base directory.
|
40
40
|
root_path = lambda { |p| f = lambda { |p| p.parent ? f[p.parent] : p.base_dir }; f[p] }[project]
|
data/lib/buildr/ide/idea7x.rb
CHANGED
@@ -37,13 +37,17 @@ module Buildr
|
|
37
37
|
# Global task "idea" generates artifacts for all projects.
|
38
38
|
desc "Generate Idea 7.x artifacts for all projects"
|
39
39
|
Project.local_task "idea7x"=>"artifacts"
|
40
|
+
|
41
|
+
desc "Delete the generated Idea 7.x artifacts for all projects"
|
42
|
+
Project.local_task "idea7x:clean"
|
40
43
|
end
|
41
44
|
|
42
|
-
before_define do |project|
|
45
|
+
before_define(:idea7x) do |project|
|
43
46
|
project.recursive_task("idea7x")
|
47
|
+
project.recursive_task("idea7x:clean")
|
44
48
|
end
|
45
49
|
|
46
|
-
after_define do |project|
|
50
|
+
after_define(:idea7x => :package) do |project|
|
47
51
|
idea7x = project.task("idea7x")
|
48
52
|
|
49
53
|
# We need paths relative to the top project's base directory.
|
@@ -90,7 +94,7 @@ module Buildr
|
|
90
94
|
ext_libs = m2_libs.map { |path| "jar://#{path.to_s.sub(m2repo, "$M2_REPO$")}!/" }
|
91
95
|
ext_libs << "#{MODULE_DIR_URL}/#{relative[project.test.resources.target.to_s]}" if project.test.resources.target
|
92
96
|
ext_libs << "#{MODULE_DIR_URL}/#{relative[project.resources.target.to_s]}" if project.resources.target
|
93
|
-
|
97
|
+
|
94
98
|
Buildr::Idea7x.generate_module_libs(xml, ext_libs)
|
95
99
|
xml.orderEntryProperties
|
96
100
|
end
|
@@ -99,11 +103,18 @@ module Buildr
|
|
99
103
|
end
|
100
104
|
end
|
101
105
|
|
106
|
+
# Add task to remove generated module
|
107
|
+
project.task("idea7x:clean") do
|
108
|
+
if File.exist?(task_name)
|
109
|
+
info "Removing #{task_name}"
|
110
|
+
rm_rf task_name
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
102
114
|
# Root project aggregates all the subprojects.
|
103
115
|
if project.parent == nil
|
104
116
|
Buildr::Idea7x.generate_ipr(project, idea7x, Buildr.application.buildfile)
|
105
117
|
end
|
106
|
-
|
107
118
|
end # after_define
|
108
119
|
|
109
120
|
class << self
|
@@ -200,6 +211,14 @@ module Buildr
|
|
200
211
|
template_xml.write file
|
201
212
|
end
|
202
213
|
end
|
214
|
+
|
215
|
+
# Add task to remove generated project file
|
216
|
+
project.task("idea7x:clean") do
|
217
|
+
if File.exist?(task_name)
|
218
|
+
info "Removing #{task_name}"
|
219
|
+
rm_rf task_name
|
220
|
+
end
|
221
|
+
end
|
203
222
|
end
|
204
223
|
|
205
224
|
end
|
data/lib/buildr/java.rb
CHANGED
data/lib/buildr/java/ant.rb
CHANGED
@@ -25,8 +25,8 @@ module Buildr
|
|
25
25
|
module Ant
|
26
26
|
|
27
27
|
# Which version of Ant we're using by default.
|
28
|
-
VERSION = '1.
|
29
|
-
|
28
|
+
VERSION = '1.8.0'
|
29
|
+
|
30
30
|
class << self
|
31
31
|
# Current version of Ant being used.
|
32
32
|
def version
|
@@ -40,14 +40,14 @@ module Buildr
|
|
40
40
|
@dependencies ||= ["org.apache.ant:ant:jar:#{version}", "org.apache.ant:ant-launcher:jar:#{version}",
|
41
41
|
"org.apache.ant:ant-trax:jar:#{version}"]
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
private
|
45
45
|
def const_missing(const)
|
46
46
|
return super unless const == :REQUIRES # TODO: remove in 1.5
|
47
47
|
Buildr.application.deprecated "Please use Ant.dependencies/.version instead of Ant::REQUIRES/VERSION"
|
48
48
|
dependencies
|
49
49
|
end
|
50
|
-
end
|
50
|
+
end
|
51
51
|
|
52
52
|
|
53
53
|
Java.classpath << lambda { Ant.dependencies }
|
data/lib/buildr/java/bdd.rb
CHANGED
@@ -31,7 +31,7 @@ module Buildr
|
|
31
31
|
def initialize(task, options)
|
32
32
|
self.bdd_dir = self.class.bdd_dir
|
33
33
|
project = task.project
|
34
|
-
project.task('test:compile').tap do |comp|
|
34
|
+
project.task('test:compile').tap do |comp|
|
35
35
|
comp.send :associate_with, project, bdd_dir
|
36
36
|
self.lang = comp.language || self.class.lang
|
37
37
|
end
|
@@ -42,13 +42,13 @@ module Buildr
|
|
42
42
|
end
|
43
43
|
super
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
end
|
47
47
|
|
48
48
|
module TestFramework::JRubyBased
|
49
49
|
extend self
|
50
50
|
|
51
|
-
VERSION = '1.
|
51
|
+
VERSION = '1.5.1'
|
52
52
|
|
53
53
|
class << self
|
54
54
|
def version
|
@@ -58,9 +58,12 @@ module Buildr
|
|
58
58
|
def jruby_artifact
|
59
59
|
"org.jruby:jruby-complete:jar:#{version}"
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def dependencies
|
63
|
-
|
63
|
+
unless @dependencies
|
64
|
+
@dependencies = [jruby_artifact]
|
65
|
+
end
|
66
|
+
@dependencies
|
64
67
|
end
|
65
68
|
|
66
69
|
def included(mod)
|
@@ -71,18 +74,20 @@ module Buildr
|
|
71
74
|
|
72
75
|
module ClassMethods
|
73
76
|
def dependencies
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
+
unless @dependencies
|
78
|
+
super
|
79
|
+
unless RUBY_PLATFORM[/java/] && TestFramework::JRubyBased.jruby_installed?
|
80
|
+
@dependencies |= TestFramework::JRubyBased.dependencies
|
81
|
+
end
|
77
82
|
end
|
78
|
-
|
83
|
+
@dependencies
|
79
84
|
end
|
80
85
|
end
|
81
86
|
|
82
87
|
def run(tests, dependencies)
|
83
88
|
maybe_install_jruby
|
84
89
|
dependencies |= [task.compile.target.to_s]
|
85
|
-
|
90
|
+
|
86
91
|
spec_dir = task.project.path_to(:source, :spec, :ruby)
|
87
92
|
report_dir = task.report_to.to_s
|
88
93
|
rm_rf report_dir
|
@@ -91,7 +96,7 @@ module Buildr
|
|
91
96
|
|
92
97
|
runner = runner_config
|
93
98
|
runner.content = runner_content(binding)
|
94
|
-
|
99
|
+
|
95
100
|
Buildr.write(runner.file, runner.content)
|
96
101
|
rm_f runner.result
|
97
102
|
|
@@ -104,7 +109,7 @@ module Buildr
|
|
104
109
|
cmd_options.update(:classpath => dependencies, :project => task.project)
|
105
110
|
jruby runner.file, tests, cmd_options
|
106
111
|
end
|
107
|
-
|
112
|
+
|
108
113
|
result = YAML.load(File.read(runner.result))
|
109
114
|
if Exception === result
|
110
115
|
raise [result.message, result.backtrace].flatten.join("\n")
|
@@ -113,14 +118,14 @@ module Buildr
|
|
113
118
|
end
|
114
119
|
|
115
120
|
def jruby_home
|
116
|
-
@jruby_home ||= RUBY_PLATFORM =~ /java/ ? Config::CONFIG['prefix'] :
|
121
|
+
@jruby_home ||= RUBY_PLATFORM =~ /java/ ? Config::CONFIG['prefix'] :
|
117
122
|
( ENV['JRUBY_HOME'] || File.expand_path('~/.jruby') )
|
118
123
|
end
|
119
124
|
|
120
125
|
def jruby_installed?
|
121
126
|
!Dir.glob(File.join(jruby_home, 'lib', 'jruby*.jar')).empty?
|
122
127
|
end
|
123
|
-
|
128
|
+
|
124
129
|
protected
|
125
130
|
def maybe_install_jruby
|
126
131
|
unless jruby_installed?
|
@@ -129,15 +134,7 @@ module Buildr
|
|
129
134
|
say msg
|
130
135
|
say ''
|
131
136
|
say "You need to install JRuby version #{jruby_artifact.version} using your system package manager."
|
132
|
-
|
133
|
-
say ''
|
134
|
-
say " java -jar #{jruby_artifact} -S extract '#{jruby_home}'"
|
135
|
-
say ''
|
136
|
-
if agree('Do you want me to execute it for you? [y/N]', false)
|
137
|
-
jruby_artifact.invoke
|
138
|
-
Java::Commands.java('-jar', jruby_artifact.to_s, '-S', 'extract', jruby_home)
|
139
|
-
end
|
140
|
-
|
137
|
+
|
141
138
|
fail msg unless jruby_installed?
|
142
139
|
end
|
143
140
|
end
|
@@ -164,7 +161,7 @@ module Buildr
|
|
164
161
|
yield config if block_given?
|
165
162
|
Java.org.jruby.Ruby.newInstance config
|
166
163
|
end
|
167
|
-
|
164
|
+
|
168
165
|
def jruby_gem
|
169
166
|
%{
|
170
167
|
require 'jruby'
|
@@ -201,14 +198,10 @@ module Buildr
|
|
201
198
|
runner.gems ||= {}
|
202
199
|
runner.rspec ||= ['--format', 'progress', '--format', "html:#{runner.html_report}"]
|
203
200
|
runner.format.each { |format| runner.rspec << '--format' << format } if runner.format
|
204
|
-
runner.rspec.push '--format', "
|
201
|
+
runner.rspec.push '--format', "Buildr::TestFramework::TestResult::YamlFormatter:#{runner.result}"
|
205
202
|
runner
|
206
203
|
end
|
207
|
-
|
208
|
-
def runner_formatter
|
209
|
-
"Buildr::TestFramework::TestResult::YamlFormatter"
|
210
|
-
end
|
211
|
-
|
204
|
+
|
212
205
|
end
|
213
206
|
|
214
207
|
# <a href="http://rspec.info">RSpec</a> is the defacto BDD framework for ruby.
|
@@ -222,7 +215,7 @@ module Buildr
|
|
222
215
|
# * :requires -- A list of ruby files to require before running the specs
|
223
216
|
# Mainly used if an rspec format needs to require some file.
|
224
217
|
# * :format -- A list of valid Rspec --format option values. (defaults to 'progress')
|
225
|
-
# * :output -- File path to output dump. @false@ to
|
218
|
+
# * :output -- File path to output dump. @false@ to suppress output
|
226
219
|
# * :fork -- Create a new JavaVM to run the tests on
|
227
220
|
# * :properties -- Hash of properties passed to the test suite.
|
228
221
|
# * :java_args -- Arguments passed to the JVM.
|
@@ -231,7 +224,7 @@ module Buildr
|
|
231
224
|
@bdd_dir = :spec
|
232
225
|
|
233
226
|
include TestFramework::JRubyBased
|
234
|
-
|
227
|
+
|
235
228
|
TESTS_PATTERN = [ /_spec.rb$/ ]
|
236
229
|
OPTIONS = [:properties, :java_args]
|
237
230
|
|
@@ -240,7 +233,7 @@ module Buildr
|
|
240
233
|
end
|
241
234
|
|
242
235
|
def tests(dependencies) #:nodoc:
|
243
|
-
Dir[task.project.path_to(:source, bdd_dir, lang, '**/*_spec.rb')].select do |name|
|
236
|
+
Dir[task.project.path_to(:source, bdd_dir, lang, '**/*_spec.rb')].select do |name|
|
244
237
|
selector = ENV['SPEC']
|
245
238
|
selector.nil? || Regexp.new(selector) === name
|
246
239
|
end
|
@@ -271,7 +264,7 @@ module Buildr
|
|
271
264
|
argv.push *<%= tests.inspect %>
|
272
265
|
parser.order!(argv)
|
273
266
|
$rspec_options = parser.options
|
274
|
-
|
267
|
+
|
275
268
|
Buildr::TestFramework::TestResult::Error.guard('<%= runner.result %>') do
|
276
269
|
::Spec::Runner::CommandLine.run($rspec_options)
|
277
270
|
end
|
@@ -300,12 +293,12 @@ module Buildr
|
|
300
293
|
# * :java_args -- Arguments passed to the JVM.
|
301
294
|
class JtestR < TestFramework::JavaBDD
|
302
295
|
@lang = :ruby
|
303
|
-
@bdd_dir = :spec
|
296
|
+
@bdd_dir = :spec
|
304
297
|
|
305
298
|
include TestFramework::JRubyBased
|
306
299
|
|
307
|
-
VERSION = '0.
|
308
|
-
|
300
|
+
VERSION = '0.5'
|
301
|
+
|
309
302
|
# pattern for rspec stories
|
310
303
|
STORY_PATTERN = /_(steps|story)\.rb$/
|
311
304
|
# pattern for test_unit files
|
@@ -322,10 +315,14 @@ module Buildr
|
|
322
315
|
end
|
323
316
|
|
324
317
|
def dependencies
|
325
|
-
@dependencies
|
326
|
-
|
318
|
+
unless @dependencies
|
319
|
+
super
|
320
|
+
@dependencies |= ["org.jtestr:jtestr:jar:#{version}"] +
|
321
|
+
JUnit.dependencies + TestNG.dependencies
|
322
|
+
end
|
323
|
+
@dependencies
|
327
324
|
end
|
328
|
-
|
325
|
+
|
329
326
|
def applies_to?(project) #:nodoc:
|
330
327
|
File.exist?(project.path_to(:source, bdd_dir, lang, 'jtestr_config.rb')) ||
|
331
328
|
Dir[project.path_to(:source, bdd_dir, lang, '**/*.rb')].any? { |f| TESTS_PATTERN.any? { |r| r === f } } ||
|
@@ -372,7 +369,7 @@ module Buildr
|
|
372
369
|
|
373
370
|
def runner_config
|
374
371
|
runner = super
|
375
|
-
# JtestR 0.3.1 comes with rspec 1.1.4 (and any other jtestr dependency) included,
|
372
|
+
# JtestR 0.3.1 comes with rspec 1.1.4 (and any other jtestr dependency) included,
|
376
373
|
# so the rspec version used depends on the jtestr jar.
|
377
374
|
runner.requires.unshift 'jtestr'
|
378
375
|
runner
|
@@ -382,20 +379,16 @@ module Buildr
|
|
382
379
|
runner_erb = File.join(File.dirname(__FILE__), 'jtestr_runner.rb.erb')
|
383
380
|
Filter::Mapper.new(:erb, binding).transform(File.read(runner_erb), runner_erb)
|
384
381
|
end
|
385
|
-
|
386
|
-
def runner_formatter
|
387
|
-
'Buildr::TestFramework::TestResult::JtestRYamlFormatter'
|
388
|
-
end
|
389
|
-
|
382
|
+
|
390
383
|
end
|
391
384
|
|
392
|
-
|
385
|
+
|
393
386
|
# JBehave is a Java BDD framework. To use in your project:
|
394
387
|
# test.using :jbehave
|
395
|
-
#
|
388
|
+
#
|
396
389
|
# This framework will search in your project for:
|
397
390
|
# src/spec/java/**/*Behaviour.java
|
398
|
-
#
|
391
|
+
#
|
399
392
|
# JMock libraries are included on runtime.
|
400
393
|
#
|
401
394
|
# Support the following options:
|
@@ -407,15 +400,19 @@ module Buildr
|
|
407
400
|
|
408
401
|
VERSION = '1.0.1'
|
409
402
|
TESTS_PATTERN = [ /Behaviou?r$/ ] #:nodoc:
|
410
|
-
|
403
|
+
|
411
404
|
class << self
|
412
405
|
def version
|
413
406
|
Buildr.settings.build['jbehave'] || VERSION
|
414
407
|
end
|
415
408
|
|
416
409
|
def dependencies
|
417
|
-
@dependencies
|
418
|
-
|
410
|
+
unless @dependencies
|
411
|
+
super
|
412
|
+
@dependencies |= ["org.jbehave:jbehave:jar:#{version}", 'cglib:cglib-full:jar:2.0.2'] +
|
413
|
+
JMock.dependencies + JUnit.dependencies
|
414
|
+
end
|
415
|
+
@dependencies
|
419
416
|
end
|
420
417
|
|
421
418
|
def applies_to?(project) #:nodoc:
|
@@ -436,7 +433,7 @@ module Buildr
|
|
436
433
|
filter_classes(dependencies, :class_names => TESTS_PATTERN,
|
437
434
|
:interfaces => %w{ org.jbehave.core.behaviour.Behaviours })
|
438
435
|
end
|
439
|
-
|
436
|
+
|
440
437
|
def run(tests, dependencies) #:nodoc:
|
441
438
|
cmd_args = ['org.jbehave.core.BehaviourRunner']
|
442
439
|
cmd_options = { :properties=>options[:properties], :java_args=>options[:java_args], :classpath=>dependencies }
|
@@ -449,7 +446,7 @@ module Buildr
|
|
449
446
|
end
|
450
447
|
end
|
451
448
|
end
|
452
|
-
|
449
|
+
|
453
450
|
end
|
454
451
|
|
455
452
|
end
|
@@ -22,16 +22,16 @@ module Buildr
|
|
22
22
|
# Provides the <code>cobertura:html</code>, <code>cobertura:xml</code> and <code>cobertura:check</code> tasks.
|
23
23
|
# Require explicitly using <code>require "buildr/cobertura"</code>.
|
24
24
|
#
|
25
|
-
# You can generate cobertura reports for a single project
|
25
|
+
# You can generate cobertura reports for a single project
|
26
26
|
# using the project name as prefix:
|
27
27
|
#
|
28
28
|
# project_name:cobertura:html
|
29
29
|
#
|
30
|
-
# You can also specify which classes to include/exclude from instrumentation by
|
31
|
-
# passing a class name regexp to the <code>cobertura.include</code> or
|
32
|
-
# <code>cobertura.exclude</code> methods.
|
33
|
-
#
|
34
|
-
# define 'someModule' do
|
30
|
+
# You can also specify which classes to include/exclude from instrumentation by
|
31
|
+
# passing a class name regexp to the <code>cobertura.include</code> or
|
32
|
+
# <code>cobertura.exclude</code> methods.
|
33
|
+
#
|
34
|
+
# define 'someModule' do
|
35
35
|
# cobertura.include 'some.package.*'
|
36
36
|
# cobertura.include /some.(foo|bar).*/
|
37
37
|
# cobertura.exclude 'some.foo.util.SimpleUtil'
|
@@ -40,17 +40,29 @@ module Buildr
|
|
40
40
|
#
|
41
41
|
module Cobertura
|
42
42
|
|
43
|
-
VERSION = '1.9'
|
43
|
+
VERSION = '1.9.4.1'
|
44
44
|
|
45
45
|
class << self
|
46
|
-
|
47
46
|
def version
|
48
47
|
Buildr.settings.build['cobertura'] || VERSION
|
49
48
|
end
|
49
|
+
end
|
50
|
+
|
51
|
+
REQUIRES = ArtifactNamespace.for(self).tap do |ns|
|
52
|
+
ns.cobertura! "net.sourceforge.cobertura:cobertura:jar:#{version}", '>=1.9'
|
53
|
+
ns.log4j! 'log4j:log4j:jar:1.2.9', ">=1.2.9"
|
54
|
+
ns.asm! 'asm:asm:jar:2.2.1', '>=2.2.1'
|
55
|
+
ns.asm_tree! 'asm:asm-tree:jar:2.2.1', '>=2.2.1'
|
56
|
+
ns.oro! 'oro:oro:jar:2.0.8', '>=2.0.8'
|
57
|
+
end
|
50
58
|
|
59
|
+
class << self
|
51
60
|
def dependencies
|
52
|
-
|
53
|
-
|
61
|
+
if (VersionRequirement.create('>=1.9.1').satisfied_by?(REQUIRES.cobertura.version))
|
62
|
+
[:asm, :asm_tree].each { |s| REQUIRES[s] = '3.0' unless REQUIRES[s].selected? }
|
63
|
+
end
|
64
|
+
|
65
|
+
REQUIRES.artifacts
|
54
66
|
end
|
55
67
|
|
56
68
|
def report_to(file = nil)
|
@@ -62,18 +74,18 @@ module Buildr
|
|
62
74
|
end
|
63
75
|
|
64
76
|
end
|
65
|
-
|
77
|
+
|
66
78
|
class CoberturaConfig # :nodoc:
|
67
|
-
|
79
|
+
|
68
80
|
def initialize(project)
|
69
81
|
@project = project
|
70
82
|
end
|
71
|
-
|
83
|
+
|
72
84
|
attr_reader :project
|
73
85
|
private :project
|
74
|
-
|
86
|
+
|
75
87
|
attr_writer :data_file, :instrumented_dir, :report_dir
|
76
|
-
|
88
|
+
|
77
89
|
def data_file
|
78
90
|
@data_file ||= project.path_to(:reports, 'cobertura.ser')
|
79
91
|
end
|
@@ -97,7 +109,7 @@ module Buildr
|
|
97
109
|
includes.push(*classPatterns.map { |p| String === p ? Regexp.new(p) : p })
|
98
110
|
self
|
99
111
|
end
|
100
|
-
|
112
|
+
|
101
113
|
def includes
|
102
114
|
@includeClasses ||= []
|
103
115
|
end
|
@@ -114,15 +126,23 @@ module Buildr
|
|
114
126
|
@excludeClasses ||= []
|
115
127
|
end
|
116
128
|
|
129
|
+
def ignore(*regexps)
|
130
|
+
ignores.push(*regexps)
|
131
|
+
end
|
132
|
+
|
133
|
+
def ignores
|
134
|
+
@ignores ||= []
|
135
|
+
end
|
136
|
+
|
117
137
|
def sources
|
118
138
|
project.compile.sources
|
119
139
|
end
|
120
|
-
|
140
|
+
|
121
141
|
def check
|
122
142
|
@check ||= CoberturaCheck.new
|
123
143
|
end
|
124
144
|
end
|
125
|
-
|
145
|
+
|
126
146
|
class CoberturaCheck
|
127
147
|
attr_writer :branch_rate, :line_rate, :total_branch_rate, :total_line_rate, :package_line_rate, :package_branch_rate
|
128
148
|
attr_reader :branch_rate, :line_rate, :total_branch_rate, :total_line_rate, :package_line_rate, :package_branch_rate
|
@@ -137,7 +157,7 @@ module Buildr
|
|
137
157
|
|
138
158
|
after_define do |project|
|
139
159
|
cobertura = project.cobertura
|
140
|
-
|
160
|
+
|
141
161
|
namespace 'cobertura' do
|
142
162
|
unless project.compile.target.nil?
|
143
163
|
# Instrumented bytecode goes in a different directory. This task creates before running the test
|
@@ -151,10 +171,10 @@ module Buildr
|
|
151
171
|
:classpath=>Buildr.artifacts(Cobertura.dependencies).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
|
152
172
|
ant.send "cobertura-instrument", :todir=>task.to_s, :datafile=>cobertura.data_file do
|
153
173
|
includes, excludes = cobertura.includes, cobertura.excludes
|
154
|
-
|
174
|
+
|
155
175
|
classes_dir = project.compile.target.to_s
|
156
|
-
if includes.empty? && excludes.empty?
|
157
|
-
ant.fileset :dir => classes_dir do
|
176
|
+
if includes.empty? && excludes.empty?
|
177
|
+
ant.fileset :dir => classes_dir do
|
158
178
|
ant.include :name => "**/*.class"
|
159
179
|
end
|
160
180
|
else
|
@@ -166,29 +186,31 @@ module Buildr
|
|
166
186
|
end
|
167
187
|
end
|
168
188
|
end
|
189
|
+
|
190
|
+
cobertura.ignores.each { |r| ant.ignore :regex => r }
|
169
191
|
end
|
170
192
|
end
|
171
193
|
end
|
172
194
|
touch task.to_s
|
173
195
|
end
|
174
|
-
|
196
|
+
|
175
197
|
task 'instrument' => instrumented
|
176
|
-
|
198
|
+
|
177
199
|
# We now have two target directories with bytecode. It would make sense to remove compile.target
|
178
200
|
# and add instrumented instead, but apparently Cobertura only creates some of the classes, so
|
179
201
|
# we need both directories and instrumented must come first.
|
180
202
|
project.test.dependencies.unshift cobertura.instrumented_dir
|
181
203
|
project.test.with Cobertura.dependencies
|
182
204
|
project.test.options[:properties]["net.sourceforge.cobertura.datafile"] = cobertura.data_file
|
183
|
-
|
205
|
+
|
184
206
|
unless project.compile.sources.empty?
|
185
207
|
[:xml, :html].each do |format|
|
186
|
-
task format => ['instrument', 'test'] do
|
208
|
+
task format => ['instrument', 'test'] do
|
187
209
|
info "Creating test coverage reports in #{cobertura.report_to(format)}"
|
188
210
|
Buildr.ant "cobertura" do |ant|
|
189
211
|
ant.taskdef :resource=>"tasks.properties",
|
190
212
|
:classpath=>Buildr.artifacts(Cobertura.dependencies).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
|
191
|
-
ant.send "cobertura-report", :format=>format,
|
213
|
+
ant.send "cobertura-report", :format=>format,
|
192
214
|
:destdir=>cobertura.report_to(format), :datafile=>cobertura.data_file do
|
193
215
|
cobertura.sources.flatten.each do |src|
|
194
216
|
ant.fileset(:dir=>src.to_s) if File.exist?(src.to_s)
|
@@ -202,9 +224,9 @@ module Buildr
|
|
202
224
|
task :check => [:instrument, :test] do
|
203
225
|
Buildr.ant "cobertura" do |ant|
|
204
226
|
ant.taskdef :classpath=>Cobertura.requires.join(File::PATH_SEPARATOR), :resource=>"tasks.properties"
|
205
|
-
|
227
|
+
|
206
228
|
params = { :datafile => Cobertura.data_file }
|
207
|
-
|
229
|
+
|
208
230
|
# oh so ugly...
|
209
231
|
params[:branchrate] = cobertura.check.branch_rate if cobertura.check.branch_rate
|
210
232
|
params[:linerate] = cobertura.check.line_rate if cobertura.check.line_rate
|
@@ -212,21 +234,21 @@ module Buildr
|
|
212
234
|
params[:totallinerate] = cobertura.check.total_line_rate if cobertura.check.total_line_rate
|
213
235
|
params[:packagebranchrate] = cobertura.check.package_branch_rate if cobertura.check.package_branch_rate
|
214
236
|
params[:packagelinerate] = cobertura.check.package_line_rate if cobertura.check.package_line_rate
|
215
|
-
|
237
|
+
|
216
238
|
ant.send("cobertura-check", params) do
|
217
239
|
end
|
218
240
|
end
|
219
241
|
end
|
220
|
-
|
242
|
+
|
221
243
|
end
|
222
244
|
end
|
223
245
|
|
224
246
|
project.clean do
|
225
247
|
rm_rf [cobertura.report_to, cobertura.data_file, cobertura.instrumented_dir]
|
226
248
|
end
|
227
|
-
|
249
|
+
|
228
250
|
end
|
229
|
-
|
251
|
+
|
230
252
|
end
|
231
253
|
|
232
254
|
class Buildr::Project
|
@@ -243,7 +265,7 @@ module Buildr
|
|
243
265
|
task(instrument_task).invoke if Rake::Task.task_defined?(instrument_task)
|
244
266
|
end
|
245
267
|
end
|
246
|
-
|
268
|
+
|
247
269
|
[:xml, :html].each do |format|
|
248
270
|
report_target = report_to(format)
|
249
271
|
desc "Run the test cases and produce code coverage reports in #{report_target}"
|
@@ -260,7 +282,7 @@ module Buildr
|
|
260
282
|
end
|
261
283
|
end
|
262
284
|
end
|
263
|
-
|
285
|
+
|
264
286
|
task "clean" do
|
265
287
|
rm_rf [report_to, data_file]
|
266
288
|
end
|