ittayd-buildr 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +62 -9
- data/NOTICE +1 -1
- data/README.rdoc +9 -21
- data/Rakefile +20 -39
- data/_buildr +1 -0
- data/{spec/java/ant.rb → _jbuildr} +11 -15
- metadata +30 -210
- data/DISCLAIMER +0 -7
- data/addon/buildr/antlr.rb +0 -65
- data/addon/buildr/cobertura.rb +0 -22
- data/addon/buildr/drb.rb +0 -281
- data/addon/buildr/emma.rb +0 -22
- data/addon/buildr/hibernate.rb +0 -142
- data/addon/buildr/javacc.rb +0 -85
- data/addon/buildr/jdepend.rb +0 -60
- data/addon/buildr/jetty.rb +0 -248
- data/addon/buildr/jibx.rb +0 -86
- data/addon/buildr/nailgun.rb +0 -221
- data/addon/buildr/openjpa.rb +0 -90
- 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/BuildrNail.java +0 -41
- 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/org/apache/buildr/JettyWrapper.java +0 -144
- data/addon/buildr/path.rb +0 -136
- data/addon/buildr/xmlbeans.rb +0 -93
- data/buildr.buildfile +0 -53
- data/buildr.gemspec +0 -58
- data/doc/css/default.css +0 -228
- data/doc/css/print.css +0 -100
- data/doc/css/syntax.css +0 -52
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +0 -207
- data/doc/pages/building.textile +0 -240
- data/doc/pages/contributing.textile +0 -208
- data/doc/pages/download.textile +0 -62
- data/doc/pages/extending.textile +0 -175
- data/doc/pages/getting_started.textile +0 -273
- data/doc/pages/index.textile +0 -42
- data/doc/pages/languages.textile +0 -407
- data/doc/pages/mailing_lists.textile +0 -17
- data/doc/pages/more_stuff.textile +0 -314
- data/doc/pages/packaging.textile +0 -427
- data/doc/pages/projects.textile +0 -274
- data/doc/pages/recipes.textile +0 -103
- data/doc/pages/settings_profiles.textile +0 -274
- data/doc/pages/testing.textile +0 -212
- data/doc/pages/troubleshooting.textile +0 -103
- data/doc/pages/whats_new.textile +0 -323
- data/doc/print.haml +0 -51
- data/doc/print.toc.yaml +0 -29
- data/doc/scripts/buildr-git.rb +0 -412
- data/doc/scripts/install-jruby.sh +0 -44
- data/doc/scripts/install-linux.sh +0 -64
- data/doc/scripts/install-osx.sh +0 -52
- data/doc/site.haml +0 -56
- data/doc/site.toc.yaml +0 -47
- data/etc/KEYS +0 -151
- data/etc/git-svn-authors +0 -16
- data/lib/buildr.rb +0 -33
- data/lib/buildr/core.rb +0 -29
- data/lib/buildr/core/application.rb +0 -665
- data/lib/buildr/core/build.rb +0 -311
- data/lib/buildr/core/checks.rb +0 -254
- data/lib/buildr/core/common.rb +0 -150
- data/lib/buildr/core/compile.rb +0 -590
- data/lib/buildr/core/environment.rb +0 -117
- data/lib/buildr/core/filter.rb +0 -366
- data/lib/buildr/core/generate.rb +0 -195
- data/lib/buildr/core/help.rb +0 -119
- data/lib/buildr/core/osx.rb +0 -49
- data/lib/buildr/core/progressbar.rb +0 -156
- data/lib/buildr/core/project.rb +0 -923
- data/lib/buildr/core/test.rb +0 -715
- data/lib/buildr/core/transports.rb +0 -560
- data/lib/buildr/core/util.rb +0 -294
- data/lib/buildr/groovy.rb +0 -18
- data/lib/buildr/groovy/bdd.rb +0 -106
- data/lib/buildr/groovy/compiler.rb +0 -138
- data/lib/buildr/ide.rb +0 -19
- data/lib/buildr/ide/eclipse.rb +0 -222
- data/lib/buildr/ide/idea.ipr.template +0 -300
- data/lib/buildr/ide/idea.rb +0 -190
- data/lib/buildr/ide/idea7x.ipr.template +0 -290
- data/lib/buildr/ide/idea7x.rb +0 -212
- data/lib/buildr/java.rb +0 -23
- data/lib/buildr/java/ant.rb +0 -92
- data/lib/buildr/java/bdd.rb +0 -451
- data/lib/buildr/java/cobertura.rb +0 -236
- data/lib/buildr/java/commands.rb +0 -211
- data/lib/buildr/java/compiler.rb +0 -348
- data/lib/buildr/java/deprecated.rb +0 -141
- data/lib/buildr/java/emma.rb +0 -238
- data/lib/buildr/java/jruby.rb +0 -117
- data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +0 -119
- data/lib/buildr/java/packaging.rb +0 -717
- data/lib/buildr/java/pom.rb +0 -174
- data/lib/buildr/java/rjb.rb +0 -155
- data/lib/buildr/java/test_result.rb +0 -307
- data/lib/buildr/java/tests.rb +0 -329
- data/lib/buildr/java/version_requirement.rb +0 -172
- data/lib/buildr/packaging.rb +0 -24
- data/lib/buildr/packaging/archive.rb +0 -488
- data/lib/buildr/packaging/artifact.rb +0 -759
- data/lib/buildr/packaging/artifact_namespace.rb +0 -972
- data/lib/buildr/packaging/artifact_search.rb +0 -140
- data/lib/buildr/packaging/gems.rb +0 -102
- data/lib/buildr/packaging/package.rb +0 -233
- data/lib/buildr/packaging/tar.rb +0 -186
- data/lib/buildr/packaging/version_requirement.rb +0 -172
- data/lib/buildr/packaging/zip.rb +0 -64
- data/lib/buildr/packaging/ziptask.rb +0 -313
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +0 -19
- data/lib/buildr/scala/compiler.rb +0 -109
- data/lib/buildr/scala/tests.rb +0 -203
- data/rakelib/apache.rake +0 -191
- data/rakelib/changelog.rake +0 -57
- data/rakelib/doc.rake +0 -103
- data/rakelib/package.rake +0 -76
- data/rakelib/release.rake +0 -65
- data/rakelib/rspec.rake +0 -83
- data/rakelib/rubyforge.rake +0 -56
- data/rakelib/scm.rake +0 -49
- data/rakelib/setup.rake +0 -81
- data/rakelib/stage.rake +0 -48
- data/spec/addon/drb_spec.rb +0 -328
- data/spec/core/application_spec.rb +0 -419
- data/spec/core/build_spec.rb +0 -423
- data/spec/core/checks_spec.rb +0 -519
- data/spec/core/common_spec.rb +0 -670
- data/spec/core/compile_spec.rb +0 -582
- data/spec/core/generate_spec.rb +0 -33
- data/spec/core/project_spec.rb +0 -776
- data/spec/core/test_spec.rb +0 -1098
- data/spec/core/transport_spec.rb +0 -500
- data/spec/groovy/bdd_spec.rb +0 -80
- data/spec/groovy/compiler_spec.rb +0 -239
- data/spec/ide/eclipse_spec.rb +0 -311
- data/spec/java/bdd_spec.rb +0 -358
- data/spec/java/cobertura_spec.rb +0 -77
- data/spec/java/compiler_spec.rb +0 -446
- data/spec/java/emma_spec.rb +0 -120
- data/spec/java/java_spec.rb +0 -96
- data/spec/java/packaging_spec.rb +0 -1120
- data/spec/java/test_coverage_spec.rb +0 -255
- data/spec/java/tests_spec.rb +0 -471
- data/spec/packaging/archive_spec.rb +0 -503
- data/spec/packaging/artifact_namespace_spec.rb +0 -646
- data/spec/packaging/artifact_spec.rb +0 -795
- data/spec/packaging/packaging_helper.rb +0 -63
- data/spec/packaging/packaging_spec.rb +0 -589
- data/spec/sandbox.rb +0 -139
- data/spec/scala/compiler_spec.rb +0 -228
- data/spec/scala/tests_spec.rb +0 -215
- data/spec/spec_helpers.rb +0 -327
- data/spec/version_requirement_spec.rb +0 -123
@@ -1,141 +0,0 @@
|
|
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
|
-
require 'buildr/core/project'
|
18
|
-
|
19
|
-
|
20
|
-
module Java
|
21
|
-
|
22
|
-
# *Deprecated:* In earlier versions, Java.wrapper served as a wrapper around RJB/JRuby.
|
23
|
-
# From this version forward, we apply with JRuby style for importing Java classes:
|
24
|
-
# Java.java.lang.String.new('hai!')
|
25
|
-
# You still need to call Java.load before using any Java code: it resolves, downloads
|
26
|
-
# and installs various dependencies that are required on the classpath before calling
|
27
|
-
# any Java code (e.g. Ant and its tasks).
|
28
|
-
class JavaWrapper
|
29
|
-
|
30
|
-
include Singleton
|
31
|
-
|
32
|
-
# *Deprecated:* Append to Java.classpath directly.
|
33
|
-
def classpath
|
34
|
-
Buildr.application.deprecated 'Append to Java.classpath instead.'
|
35
|
-
::Java.classpath
|
36
|
-
end
|
37
|
-
|
38
|
-
def classpath=(paths)
|
39
|
-
fail 'Deprecated: Append to Java.classpath, you cannot replace the classpath.'
|
40
|
-
end
|
41
|
-
|
42
|
-
# *Deprecated:* No longer necessary.
|
43
|
-
def setup
|
44
|
-
Buildr.application.deprecated 'See documentation for new way to access Java code.'
|
45
|
-
yield self if block_given?
|
46
|
-
end
|
47
|
-
|
48
|
-
# *Deprecated:* Use Java.load instead.
|
49
|
-
def load
|
50
|
-
Buildr.application.deprecated 'Use Java.load instead.'
|
51
|
-
::Java.load
|
52
|
-
end
|
53
|
-
|
54
|
-
alias :onload :setup
|
55
|
-
|
56
|
-
# *Deprecated:* Use Java.pkg.pkg.ClassName to import a Java class.
|
57
|
-
def import(class_name)
|
58
|
-
Buildr.application.deprecated 'Use Java.pkg.pkg.ClassName to import a Java class.'
|
59
|
-
::Java.instance_eval(class_name)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
class << self
|
65
|
-
|
66
|
-
# *Deprecated*: Use Java::Commands.java instead.
|
67
|
-
def java(*args, &block)
|
68
|
-
return send(:method_missing, :java) if args.empty?
|
69
|
-
Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
|
70
|
-
Commands.java(*args, &block)
|
71
|
-
end
|
72
|
-
|
73
|
-
# *Deprecated*: Use Java::Commands.apt instead.
|
74
|
-
def apt(*args)
|
75
|
-
Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
|
76
|
-
Commands.apt(*args)
|
77
|
-
end
|
78
|
-
|
79
|
-
# *Deprecated*: Use Java::Commands.javac instead.
|
80
|
-
def javac(*args)
|
81
|
-
Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
|
82
|
-
Commands.javac(*args)
|
83
|
-
end
|
84
|
-
|
85
|
-
# *Deprecated*: Use Java::Commands.javadoc instead.
|
86
|
-
def javadoc(*args)
|
87
|
-
Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'
|
88
|
-
Commands.javadoc(*args)
|
89
|
-
end
|
90
|
-
|
91
|
-
# *Deprecated:* Use ENV_JAVA['java.version'] instead.
|
92
|
-
def version
|
93
|
-
Buildr.application.deprecated 'Use ENV_JAVA[\'java.version\'] instead.'
|
94
|
-
Java.load
|
95
|
-
ENV_JAVA['java.version']
|
96
|
-
end
|
97
|
-
|
98
|
-
# *Deprecated:* Use ENV['JAVA_HOME'] instead
|
99
|
-
def home
|
100
|
-
Buildr.application.deprecated 'Use ENV[\'JAVA_HOME\'] instead.'
|
101
|
-
ENV['JAVA_HOME']
|
102
|
-
end
|
103
|
-
|
104
|
-
# *Deprecated:* In earlier versions, Java.wrapper served as a wrapper around RJB/JRuby.
|
105
|
-
# From this version forward, we apply with JRuby style for importing Java classes:
|
106
|
-
# Java.java.lang.String.new('hai!')
|
107
|
-
# You still need to call Java.load before using any Java code: it resolves, downloads
|
108
|
-
# and installs various dependencies that are required on the classpath before calling
|
109
|
-
# any Java code (e.g. Ant and its tasks).
|
110
|
-
def wrapper
|
111
|
-
Buildr.application.deprecated 'See documentation for new way to access Java code.'
|
112
|
-
if block_given?
|
113
|
-
Java.load
|
114
|
-
yield JavaWrapper.instance
|
115
|
-
else
|
116
|
-
JavaWrapper.instance
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
alias :rjb :wrapper
|
121
|
-
|
122
|
-
end
|
123
|
-
|
124
|
-
|
125
|
-
class Options
|
126
|
-
|
127
|
-
# *Deprecated:* Use ENV['JAVA_OPTS'] instead.
|
128
|
-
def java_args
|
129
|
-
Buildr.application.deprecated "Use ENV['JAVA_OPTS'] instead"
|
130
|
-
(ENV["JAVA_OPTS"] || ENV["JAVA_OPTIONS"]).to_s.split
|
131
|
-
end
|
132
|
-
|
133
|
-
# *Deprecated:* Use ENV['JAVA_OPTS'] instead.
|
134
|
-
def java_args=(args)
|
135
|
-
Buildr.application.deprecated "Use ENV['JAVA_OPTS'] instead"
|
136
|
-
ENV['JAVA_OPTS'] = Array(args).join(' ')
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
end
|
data/lib/buildr/java/emma.rb
DELETED
@@ -1,238 +0,0 @@
|
|
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
|
-
require 'buildr/java'
|
18
|
-
|
19
|
-
|
20
|
-
module Buildr
|
21
|
-
|
22
|
-
# Provides the <code>emma:html</code> and <code>emma:xml</code> tasks.
|
23
|
-
# Require explicitly using <code>require "buildr/emma"</code>.
|
24
|
-
#
|
25
|
-
# You can generate emma reports for a single project
|
26
|
-
# using the project name as prefix:
|
27
|
-
#
|
28
|
-
# project_name:emma:html
|
29
|
-
#
|
30
|
-
# You can also specify which classes to include/exclude from instrumentation by
|
31
|
-
# passing a class name regexp to the <code>emma.include</code> or
|
32
|
-
# <code>emma.exclude</code> methods.
|
33
|
-
#
|
34
|
-
# define 'someModule' do
|
35
|
-
# emma.include 'some.package.*'
|
36
|
-
# emma.exclude 'some.foo.util.SimpleUtil'
|
37
|
-
# end
|
38
|
-
module Emma
|
39
|
-
|
40
|
-
class << self
|
41
|
-
|
42
|
-
REQUIRES = ['emma:emma_ant:jar:2.0.5312', 'emma:emma:jar:2.0.5312'] unless const_defined?('REQUIRES')
|
43
|
-
|
44
|
-
def requires()
|
45
|
-
@requires ||= Buildr.artifacts(REQUIRES).each(&:invoke).map(&:to_s)
|
46
|
-
end
|
47
|
-
|
48
|
-
def report_to format=nil
|
49
|
-
File.expand_path('reports/emma')
|
50
|
-
end
|
51
|
-
|
52
|
-
def data_file()
|
53
|
-
File.join(report_to, 'coverage.es')
|
54
|
-
end
|
55
|
-
|
56
|
-
def ant
|
57
|
-
Buildr.ant 'emma' do |ant|
|
58
|
-
ant.taskdef :classpath=>requires.join(File::PATH_SEPARATOR), :resource=>'emma_ant.properties'
|
59
|
-
ant.emma :verbosity=>(Buildr.application.options.trace ? 'verbose' : 'warning') do
|
60
|
-
yield ant
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
class EmmaConfig # :nodoc:
|
67
|
-
|
68
|
-
def initialize(project)
|
69
|
-
@project = project
|
70
|
-
end
|
71
|
-
|
72
|
-
attr_reader :project
|
73
|
-
private :project
|
74
|
-
|
75
|
-
attr_writer :metadata_file, :coverage_file, :instrumented_dir, :report_dir
|
76
|
-
|
77
|
-
def coverage_file
|
78
|
-
@coverage_file ||= File.join(report_dir, 'coverage.ec')
|
79
|
-
end
|
80
|
-
|
81
|
-
def metadata_file
|
82
|
-
@metadata_file ||= File.join(report_dir, 'coverage.em')
|
83
|
-
end
|
84
|
-
|
85
|
-
def instrumented_dir
|
86
|
-
@instrumented_dir ||= project.path_to(:target, :instrumented, :classes)
|
87
|
-
end
|
88
|
-
|
89
|
-
def report_dir
|
90
|
-
@report_dir ||= project.path_to(:reports, :emma)
|
91
|
-
end
|
92
|
-
|
93
|
-
def report_to format
|
94
|
-
report_dir
|
95
|
-
end
|
96
|
-
|
97
|
-
# :call-seq:
|
98
|
-
# project.emma.include(*classPatterns)
|
99
|
-
#
|
100
|
-
def include(*classPatterns)
|
101
|
-
includes.push(*classPatterns)
|
102
|
-
self
|
103
|
-
end
|
104
|
-
|
105
|
-
def includes
|
106
|
-
@includeClasses ||= []
|
107
|
-
end
|
108
|
-
|
109
|
-
# :call-seq:
|
110
|
-
# project.emma.exclude(*classPatterns)
|
111
|
-
#
|
112
|
-
def exclude(*classPatterns)
|
113
|
-
excludes.push(*classPatterns)
|
114
|
-
self
|
115
|
-
end
|
116
|
-
|
117
|
-
def excludes
|
118
|
-
@excludeClasses ||= []
|
119
|
-
end
|
120
|
-
|
121
|
-
def sources
|
122
|
-
project.compile.sources
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
module EmmaExtension # :nodoc:
|
127
|
-
include Buildr::Extension
|
128
|
-
|
129
|
-
def emma
|
130
|
-
@emma_config ||= EmmaConfig.new(self)
|
131
|
-
end
|
132
|
-
|
133
|
-
after_define do |project|
|
134
|
-
emma = project.emma
|
135
|
-
|
136
|
-
namespace 'emma' do
|
137
|
-
unless project.compile.target.nil?
|
138
|
-
# Instrumented bytecode goes in a different directory. This task creates before running the test
|
139
|
-
# cases and monitors for changes in the generate bytecode.
|
140
|
-
instrumented = project.file(emma.instrumented_dir => project.compile.target) do |task|
|
141
|
-
unless project.compile.sources.empty?
|
142
|
-
info "Instrumenting classes with emma metadata file #{emma.metadata_file}"
|
143
|
-
Emma.ant do |ant|
|
144
|
-
ant.instr :instrpath=>project.compile.target.to_s, :destdir=>task.to_s, :metadatafile=>emma.metadata_file do
|
145
|
-
ant.filter :includes=>emma.includes.join(', ') unless emma.includes.empty?
|
146
|
-
ant.filter :excludes=>emma.excludes.join(', ') unless emma.excludes.empty?
|
147
|
-
end
|
148
|
-
end
|
149
|
-
touch task.to_s, :verbose=>false
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
task 'instrument' => instrumented
|
154
|
-
|
155
|
-
# We now have two target directories with bytecode.
|
156
|
-
project.test.dependencies.unshift emma.instrumented_dir
|
157
|
-
project.test.with Emma.requires
|
158
|
-
project.test.options[:properties]["emma.coverage.out.file"] = emma.coverage_file
|
159
|
-
|
160
|
-
[:xml, :html].each do |format|
|
161
|
-
task format => ['instrument', 'test'] do
|
162
|
-
missing_required_files = [emma.metadata_file, emma.coverage_file].reject { |f| File.exist?(f) }
|
163
|
-
if missing_required_files.empty?
|
164
|
-
info "Creating test coverage reports in #{emma.report_dir}"
|
165
|
-
mkdir_p emma.report_dir, :verbose=>false
|
166
|
-
Emma.ant do |ant|
|
167
|
-
ant.report do
|
168
|
-
ant.infileset :file=>emma.metadata_file
|
169
|
-
ant.infileset :file=>emma.coverage_file
|
170
|
-
ant.send format, :outfile=>File.join(emma.report_to(format),"coverage.#{format}")
|
171
|
-
ant.sourcepath do
|
172
|
-
emma.sources.flatten.each do |src|
|
173
|
-
ant.dirset(:dir=>src.to_s) if File.exist?(src.to_s)
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
else
|
179
|
-
info "No test coverage report for #{project}. Missing: #{missing_required_files.join(', ')}"
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
project.clean do
|
187
|
-
rm_rf [emma.report_dir, emma.coverage_file, emma.metadata_file, emma.instrumented_dir], :verbose=>false
|
188
|
-
end
|
189
|
-
|
190
|
-
end
|
191
|
-
|
192
|
-
end
|
193
|
-
|
194
|
-
class Buildr::Project
|
195
|
-
include EmmaExtension
|
196
|
-
end
|
197
|
-
|
198
|
-
namespace "emma" do
|
199
|
-
|
200
|
-
Project.local_task('instrument') { |name| "Instrumenting #{name}" }
|
201
|
-
|
202
|
-
[:xml, :html].each do |format|
|
203
|
-
desc "Run the test cases and produce code coverage reports in #{format}"
|
204
|
-
task format => ['instrument', 'test'] do
|
205
|
-
info "Creating test coverage reports in #{format}"
|
206
|
-
mkdir_p report_to(format), :verbose=>false
|
207
|
-
Emma.ant do |ant|
|
208
|
-
ant.merge :outfile=>data_file do
|
209
|
-
Buildr.projects.each do |project|
|
210
|
-
[project.emma.metadata_file, project.emma.coverage_file].each do |data_file|
|
211
|
-
ant.fileset :file=>data_file if File.exist?(data_file)
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
215
|
-
ant.report do
|
216
|
-
ant.infileset :file=>data_file
|
217
|
-
ant.send format, :outfile=>File.join(report_to(format), "coverage.#{format}")
|
218
|
-
ant.sourcepath do
|
219
|
-
Buildr.projects.map(&:emma).map(&:sources).flatten.map(&:to_s).each do |src|
|
220
|
-
ant.dirset :dir=>src if File.exist?(src)
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
task :clean do
|
229
|
-
rm_rf [report_to, data_file], :verbose=>false
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
task :clean do
|
234
|
-
task('emma:clean').invoke if Dir.pwd == Rake.application.original_dir
|
235
|
-
end
|
236
|
-
|
237
|
-
end
|
238
|
-
end
|
data/lib/buildr/java/jruby.rb
DELETED
@@ -1,117 +0,0 @@
|
|
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
|
-
require 'java'
|
18
|
-
require 'jruby'
|
19
|
-
|
20
|
-
|
21
|
-
# Buildr runs along side a JVM, using either RJB or JRuby. The Java module allows
|
22
|
-
# you to access Java classes and create Java objects.
|
23
|
-
#
|
24
|
-
# Java classes are accessed as static methods on the Java module, for example:
|
25
|
-
# str = Java.java.lang.String.new('hai!')
|
26
|
-
# str.toUpperCase
|
27
|
-
# => 'HAI!'
|
28
|
-
# Java.java.lang.String.isInstance(str)
|
29
|
-
# => true
|
30
|
-
# Java.com.sun.tools.javac.Main.compile(args)
|
31
|
-
#
|
32
|
-
# The classpath attribute allows Buildr to add JARs and directories to the classpath,
|
33
|
-
# for example, we use it to load Ant and various Ant tasks, code generators, test
|
34
|
-
# frameworks, and so forth.
|
35
|
-
#
|
36
|
-
# When using an artifact specification, Buildr will automatically download and
|
37
|
-
# install the artifact before adding it to the classpath.
|
38
|
-
#
|
39
|
-
# For example, Ant is loaded as follows:
|
40
|
-
# Java.classpath << 'org.apache.ant:ant:jar:1.7.0'
|
41
|
-
#
|
42
|
-
# Artifacts can only be downloaded after the Buildfile has loaded, giving it
|
43
|
-
# a chance to specify which remote repositories to use, so adding to classpath
|
44
|
-
# does not by itself load any libraries. You must call Java.load before accessing
|
45
|
-
# any Java classes to give Buildr a chance to load the libraries specified in the
|
46
|
-
# classpath.
|
47
|
-
#
|
48
|
-
# When building an extension, make sure to follow these rules:
|
49
|
-
# 1. Add to the classpath when the extension is loaded (i.e. in module or class
|
50
|
-
# definition), so the first call to Java.load anywhere in the code will include
|
51
|
-
# the libraries you specify.
|
52
|
-
# 2. Call Java.load once before accessing any Java classes, allowing Buildr to
|
53
|
-
# set up the classpath.
|
54
|
-
# 3. Only call Java.load when invoked, otherwise you may end up loading the JVM
|
55
|
-
# with a partial classpath, or before all remote repositories are listed.
|
56
|
-
# 4. Check on a clean build with empty local repository.
|
57
|
-
module Java
|
58
|
-
|
59
|
-
# Since we already have a JVM loaded, we can use it to guess where JAVA_HOME is.
|
60
|
-
# We set JAVA_HOME early so we can use it without calling Java.load first.
|
61
|
-
ENV['JAVA_HOME'] ||= java.lang.System.getProperty("java.home")
|
62
|
-
|
63
|
-
class << self
|
64
|
-
|
65
|
-
# Returns the classpath, an array listing directories, JAR files and
|
66
|
-
# artifacts. Use when loading the extension to add any additional
|
67
|
-
# libraries used by that extension.
|
68
|
-
#
|
69
|
-
# For example, Ant is loaded as follows:
|
70
|
-
# Java.classpath << 'org.apache.ant:ant:jar:1.7.0'
|
71
|
-
def classpath
|
72
|
-
@classpath ||= []
|
73
|
-
end
|
74
|
-
|
75
|
-
# Most platforms requires tools.jar to be on the classpath, tools.jar contains the
|
76
|
-
# Java compiler (OS X and AIX are two exceptions we know about, may be more).
|
77
|
-
# Guess where tools.jar is from JAVA_HOME, which hopefully points to the JDK,
|
78
|
-
# but maybe the JRE. Return nil if not found.
|
79
|
-
def tools_jar #:nodoc:
|
80
|
-
@tools_jar ||= ['lib/tools.jar', '../lib/tools.jar'].map { |path| File.expand_path(path, ENV['JAVA_HOME']) }.
|
81
|
-
find { |path| File.exist?(path) }
|
82
|
-
end
|
83
|
-
|
84
|
-
# Loads the JVM and all the libraries listed on the classpath. Call this
|
85
|
-
# method before accessing any Java class, but only call it from methods
|
86
|
-
# used in the build, giving the Buildfile a chance to load all extensions
|
87
|
-
# that append to the classpath and specify which remote repositories to use.
|
88
|
-
def load
|
89
|
-
return self if @loaded
|
90
|
-
|
91
|
-
# Adding jars to the jruby's $CLASSPATH should be the correct thing, however it
|
92
|
-
# seems like some tools require their jars on system class loader (javadoc, junit, etc)
|
93
|
-
# cp.each { |path| $CLASSPATH << path }
|
94
|
-
|
95
|
-
# Use system ClassLoader to add classpath
|
96
|
-
sysloader = java.lang.ClassLoader.getSystemClassLoader
|
97
|
-
add_url_method = java.lang.Class.forName('java.net.URLClassLoader').
|
98
|
-
getDeclaredMethod('addURL', [java.net.URL.java_class].to_java(java.lang.Class))
|
99
|
-
add_url_method.setAccessible(true)
|
100
|
-
add_path = lambda { |path| add_url_method.invoke(sysloader, [java.io.File.new(path).toURI.toURL].to_java(java.net.URL)) }
|
101
|
-
|
102
|
-
# Most platforms requires tools.jar to be on the classpath.
|
103
|
-
add_path[tools_jar] if tools_jar
|
104
|
-
|
105
|
-
classpath.map! { |path| Proc === path ? path.call : path }
|
106
|
-
Buildr.artifacts(classpath).map(&:to_s).each do |path|
|
107
|
-
file(path).invoke
|
108
|
-
add_path[path]
|
109
|
-
end
|
110
|
-
|
111
|
-
@loaded = true
|
112
|
-
self
|
113
|
-
end
|
114
|
-
|
115
|
-
end
|
116
|
-
|
117
|
-
end
|