buildr 1.4.1-x86-mswin32 → 1.4.2-x86-mswin32
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.
- data/CHANGELOG +68 -11
- data/_buildr +2 -0
- data/addon/buildr/hibernate.rb +8 -5
- data/addon/buildr/jetty.rb +1 -1
- data/addon/buildr/openjpa.rb +0 -2
- data/addon/buildr/xmlbeans.rb +1 -1
- data/buildr.gemspec +13 -9
- data/doc/_layouts/default.html +3 -1
- data/doc/contributing.textile +10 -2
- data/doc/css/default.css +6 -6
- data/doc/download.textile +7 -7
- data/doc/languages.textile +2 -2
- data/doc/more_stuff.textile +41 -33
- data/doc/packaging.textile +6 -3
- data/doc/releasing.textile +116 -0
- data/doc/scripts/install-linux.sh +7 -6
- data/doc/testing.textile +14 -0
- data/lib/buildr.rb +2 -2
- data/lib/buildr/core.rb +0 -6
- data/lib/buildr/core/application.rb +25 -2
- data/lib/buildr/core/build.rb +66 -15
- data/lib/buildr/core/compile.rb +10 -1
- data/lib/buildr/core/filter.rb +1 -1
- data/lib/buildr/core/progressbar.rb +8 -3
- data/lib/buildr/core/test.rb +57 -6
- data/lib/buildr/core/transports.rb +18 -13
- data/lib/buildr/core/util.rb +19 -3
- data/lib/buildr/groovy/compiler.rb +2 -2
- data/lib/buildr/ide/eclipse.rb +32 -12
- data/lib/buildr/java/ant.rb +3 -3
- data/lib/buildr/java/bdd.rb +1 -2
- data/lib/buildr/java/cobertura.rb +10 -9
- data/lib/buildr/java/commands.rb +22 -21
- data/lib/buildr/java/compiler.rb +2 -2
- data/lib/buildr/java/doc.rb +1 -1
- data/lib/buildr/java/ecj.rb +71 -0
- data/lib/buildr/java/emma.rb +1 -1
- data/lib/buildr/java/external.rb +9 -9
- data/lib/buildr/java/jruby.rb +5 -0
- data/lib/buildr/java/packaging.rb +4 -3
- data/lib/buildr/java/rjb.rb +4 -6
- data/lib/buildr/java/tests.rb +9 -4
- data/lib/buildr/packaging/archive.rb +7 -3
- data/lib/buildr/packaging/artifact.rb +153 -38
- data/lib/buildr/packaging/gems.rb +2 -3
- data/lib/buildr/packaging/package.rb +19 -12
- data/lib/buildr/packaging/tar.rb +1 -1
- data/lib/buildr/packaging/ziptask.rb +1 -1
- data/lib/buildr/scala/bdd.rb +7 -3
- data/lib/buildr/scala/compiler.rb +2 -2
- data/lib/buildr/scala/doc.rb +3 -3
- data/lib/buildr/scala/tests.rb +7 -3
- data/lib/buildr/version.rb +18 -0
- data/rakelib/all-in-one.rake +1 -1
- data/rakelib/doc.rake +13 -3
- data/rakelib/metrics.rake +39 -0
- data/spec/core/application_spec.rb +13 -12
- data/spec/core/build_spec.rb +166 -7
- data/spec/core/cc_spec.rb +1 -1
- data/spec/core/checks_spec.rb +1 -1
- data/spec/core/common_spec.rb +10 -1
- data/spec/core/compile_spec.rb +1 -1
- data/spec/core/extension_spec.rb +1 -1
- data/spec/core/generate_spec.rb +1 -1
- data/spec/core/project_spec.rb +1 -1
- data/spec/core/test_spec.rb +124 -11
- data/spec/core/transport_spec.rb +10 -3
- data/spec/core/util_spec.rb +18 -2
- data/spec/groovy/bdd_spec.rb +1 -1
- data/spec/groovy/compiler_spec.rb +3 -3
- data/spec/ide/eclipse_spec.rb +63 -1
- data/spec/ide/idea7x_spec.rb +1 -1
- data/spec/java/ant_spec.rb +1 -1
- data/spec/java/bdd_spec.rb +1 -1
- data/spec/java/cobertura_spec.rb +29 -2
- data/spec/java/commands_spec.rb +61 -2
- data/spec/java/compiler_spec.rb +3 -3
- data/spec/java/ecj_spec.rb +115 -0
- data/spec/java/emma_spec.rb +1 -1
- data/spec/java/external_spec.rb +10 -8
- data/spec/java/java_spec.rb +14 -6
- data/spec/java/packaging_spec.rb +41 -15
- data/spec/java/test_coverage_helper.rb +1 -1
- data/spec/java/tests_spec.rb +1 -1
- data/spec/packaging/archive_spec.rb +12 -1
- data/spec/packaging/artifact_namespace_spec.rb +1 -1
- data/spec/packaging/artifact_spec.rb +197 -7
- data/spec/packaging/packaging_spec.rb +12 -12
- data/spec/sandbox.rb +8 -3
- data/spec/scala/bdd_spec.rb +3 -3
- data/spec/scala/compiler_spec.rb +7 -7
- data/spec/scala/scala.rb +3 -3
- data/spec/scala/tests_spec.rb +3 -3
- data/spec/spec_helpers.rb +11 -1
- data/spec/version_requirement_spec.rb +1 -1
- metadata +220 -85
- data/rakelib/jekylltask.rb +0 -120
data/lib/buildr/java/commands.rb
CHANGED
@@ -42,7 +42,7 @@ module Java
|
|
42
42
|
# * :verbose -- If true, prints the command and all its argument.
|
43
43
|
def java(*args, &block)
|
44
44
|
options = Hash === args.last ? args.pop : {}
|
45
|
-
options[:verbose] ||=
|
45
|
+
options[:verbose] ||= trace?(:java)
|
46
46
|
rake_check_options options, :classpath, :java_args, :properties, :name, :verbose
|
47
47
|
|
48
48
|
name = options[:name]
|
@@ -51,8 +51,8 @@ module Java
|
|
51
51
|
end
|
52
52
|
|
53
53
|
cmd_args = [path_to_bin('java')]
|
54
|
-
|
55
|
-
cmd_args << '-classpath' <<
|
54
|
+
cp = classpath_from(options)
|
55
|
+
cmd_args << '-classpath' << cp.join(File::PATH_SEPARATOR) unless cp.empty?
|
56
56
|
options[:properties].each { |k, v| cmd_args << "-D#{k}=#{v}" } if options[:properties]
|
57
57
|
cmd_args += (options[:java_args] || (ENV['JAVA_OPTS'] || ENV['JAVA_OPTIONS']).to_s.split).flatten
|
58
58
|
cmd_args += args.flatten.compact
|
@@ -84,23 +84,21 @@ module Java
|
|
84
84
|
|
85
85
|
files = args.flatten.map(&:to_s).
|
86
86
|
collect { |arg| File.directory?(arg) ? FileList["#{arg}/**/*.java"] : arg }.flatten
|
87
|
-
cmd_args = [
|
87
|
+
cmd_args = [ trace?(:apt) ? '-verbose' : '-nowarn' ]
|
88
88
|
if options[:compile]
|
89
89
|
cmd_args << '-d' << options[:output].to_s
|
90
90
|
else
|
91
91
|
cmd_args << '-nocompile' << '-s' << options[:output].to_s
|
92
92
|
end
|
93
93
|
cmd_args << '-source' << options[:source] if options[:source]
|
94
|
-
|
95
|
-
|
96
|
-
classpath << tools if tools
|
97
|
-
cmd_args << '-classpath' << classpath.join(File::PATH_SEPARATOR) unless classpath.empty?
|
94
|
+
cp = classpath_from(options)
|
95
|
+
cmd_args << '-classpath' << cp.join(File::PATH_SEPARATOR) unless cp.empty?
|
98
96
|
cmd_args += files
|
99
97
|
unless Buildr.application.options.dryrun
|
100
98
|
info 'Running apt'
|
101
99
|
trace (['apt'] + cmd_args).join(' ')
|
102
100
|
Java.load
|
103
|
-
Java
|
101
|
+
::Java::com.sun.tools.apt.Main.process(cmd_args.to_java(::Java::java.lang.String)) == 0 or
|
104
102
|
fail 'Failed to process annotations, see errors above'
|
105
103
|
end
|
106
104
|
end
|
@@ -122,21 +120,22 @@ module Java
|
|
122
120
|
rake_check_options options, :classpath, :sourcepath, :output, :javac_args, :name
|
123
121
|
|
124
122
|
files = args.flatten.each { |f| f.invoke if f.respond_to?(:invoke) }.map(&:to_s).
|
125
|
-
collect { |arg| File.directory?(arg) ? FileList["#{arg}/**/*.java"] : arg }.flatten
|
123
|
+
collect { |arg| File.directory?(arg) ? FileList["#{File.expand_path(arg)}/**/*.java"] : File.expand_path(arg) }.flatten
|
126
124
|
name = options[:name] || Dir.pwd
|
127
125
|
|
128
126
|
cmd_args = []
|
129
|
-
|
130
|
-
cmd_args << '-classpath' <<
|
131
|
-
cmd_args << '-sourcepath' << options[:sourcepath].join(File::PATH_SEPARATOR) if options[:sourcepath]
|
132
|
-
cmd_args << '-d' << options[:output].to_s if options[:output]
|
127
|
+
cp = classpath_from(options)
|
128
|
+
cmd_args << '-classpath' << cp.join(File::PATH_SEPARATOR) unless cp.empty?
|
129
|
+
cmd_args << '-sourcepath' << [options[:sourcepath]].flatten.join(File::PATH_SEPARATOR) if options[:sourcepath]
|
130
|
+
cmd_args << '-d' << File.expand_path(options[:output].to_s) if options[:output]
|
133
131
|
cmd_args += options[:javac_args].flatten if options[:javac_args]
|
134
132
|
cmd_args += files
|
135
133
|
unless Buildr.application.options.dryrun
|
134
|
+
mkdir_p options[:output] if options[:output]
|
136
135
|
info "Compiling #{files.size} source files in #{name}"
|
137
136
|
trace (['javac'] + cmd_args).join(' ')
|
138
137
|
Java.load
|
139
|
-
Java
|
138
|
+
::Java::com.sun.tools.javac.Main.compile(cmd_args.to_java(::Java::java.lang.String)) == 0 or
|
140
139
|
fail 'Failed to compile, see errors above'
|
141
140
|
end
|
142
141
|
end
|
@@ -159,8 +158,9 @@ module Java
|
|
159
158
|
# * array -- Option with set of values separated by spaces.
|
160
159
|
def javadoc(*args)
|
161
160
|
options = Hash === args.last ? args.pop : {}
|
162
|
-
|
163
|
-
|
161
|
+
fail "No output defined for javadoc" if options[:output].nil?
|
162
|
+
options[:output] = File.expand_path(options[:output].to_s)
|
163
|
+
cmd_args = [ '-d', options[:output], trace?(:javadoc) ? '-verbose' : '-quiet' ]
|
164
164
|
options.reject { |key, value| [:output, :name, :sourcepath, :classpath].include?(key) }.
|
165
165
|
each { |key, value| value.invoke if value.respond_to?(:invoke) }.
|
166
166
|
each do |key, value|
|
@@ -180,13 +180,14 @@ module Java
|
|
180
180
|
cmd_args << "-#{option}" << paths.flatten.map(&:to_s).join(File::PATH_SEPARATOR) unless paths.empty?
|
181
181
|
end
|
182
182
|
end
|
183
|
-
|
183
|
+
files = args.each {|arg| arg.invoke if arg.respond_to?(:invoke)}.collect {|arg| arg.is_a?(Project) ? arg.compile.sources.collect{|dir| Dir["#{File.expand_path(dir.to_s)}/**/*.java"]} : File.expand_path(arg.to_s) }
|
184
|
+
cmd_args += files.flatten.uniq.map(&:to_s)
|
184
185
|
name = options[:name] || Dir.pwd
|
185
186
|
unless Buildr.application.options.dryrun
|
186
187
|
info "Generating Javadoc for #{name}"
|
187
188
|
trace (['javadoc'] + cmd_args).join(' ')
|
188
189
|
Java.load
|
189
|
-
Java
|
190
|
+
::Java::com.sun.tools.javadoc.Main.execute(cmd_args.to_java(::Java::java.lang.String)) == 0 or
|
190
191
|
fail 'Failed to generate Javadocs, see errors above'
|
191
192
|
end
|
192
193
|
end
|
@@ -199,9 +200,9 @@ module Java
|
|
199
200
|
# Returns the path to the specified Java command (with no argument to java itself).
|
200
201
|
def path_to_bin(name = nil)
|
201
202
|
home = ENV['JAVA_HOME'] or fail 'Are we forgetting something? JAVA_HOME not set.'
|
202
|
-
bin =
|
203
|
+
bin = Util.normalize_path(File.join(home, 'bin'))
|
203
204
|
fail 'JAVA_HOME environment variable does not point to a valid JRE/JDK installation.' unless File.exist? bin
|
204
|
-
|
205
|
+
Util.normalize_path(File.join(bin, name.to_s))
|
205
206
|
end
|
206
207
|
|
207
208
|
# :call-seq:
|
data/lib/buildr/java/compiler.rb
CHANGED
@@ -76,7 +76,7 @@ module Buildr
|
|
76
76
|
def javac_args #:nodoc:
|
77
77
|
args = []
|
78
78
|
args << '-nowarn' unless options[:warnings]
|
79
|
-
args << '-verbose' if
|
79
|
+
args << '-verbose' if trace? :javac
|
80
80
|
args << '-g' if options[:debug]
|
81
81
|
args << '-deprecation' if options[:deprecation]
|
82
82
|
args << '-source' << options[:source].to_s if options[:source]
|
@@ -109,7 +109,7 @@ module Buildr
|
|
109
109
|
def apt(*sources)
|
110
110
|
sources = compile.sources if sources.empty?
|
111
111
|
file(path_to(:target, 'generated/apt')=>sources) do |task|
|
112
|
-
cmd_args = [
|
112
|
+
cmd_args = [ trace?(:apt) ? '-verbose' : '-nowarn' ]
|
113
113
|
cmd_args << '-nocompile' << '-s' << task.name
|
114
114
|
cmd_args << '-source' << compile.options.source if compile.options.source
|
115
115
|
classpath = Buildr.artifacts(compile.dependencies).map(&:to_s).each { |t| task(t).invoke }
|
data/lib/buildr/java/doc.rb
CHANGED
@@ -34,7 +34,7 @@ module Buildr
|
|
34
34
|
specify :language => :java, :source_ext => 'java'
|
35
35
|
|
36
36
|
def generate(sources, target, options = {})
|
37
|
-
cmd_args = [ '-d', target,
|
37
|
+
cmd_args = [ '-d', target, trace?(:javadoc) ? '-verbose' : '-quiet' ]
|
38
38
|
options.reject { |key, value| [:sourcepath, :classpath].include?(key) }.
|
39
39
|
each { |key, value| value.invoke if value.respond_to?(:invoke) }.
|
40
40
|
each do |key, value|
|
@@ -0,0 +1,71 @@
|
|
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 Compiler
|
18
|
+
|
19
|
+
class Ecj < Javac
|
20
|
+
|
21
|
+
OPTIONS = Buildr::Compiler::Javac::OPTIONS
|
22
|
+
|
23
|
+
specify :language=>:java, :sources => 'java', :source_ext => 'java',
|
24
|
+
:target=>'classes', :target_ext=>'class', :packaging=>:jar
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
def compile(sources, target, dependencies) #:nodoc:
|
29
|
+
check_options options, OPTIONS
|
30
|
+
cmd_args = []
|
31
|
+
# tools.jar contains the Java compiler.
|
32
|
+
dependencies << Java.tools_jar if Java.tools_jar
|
33
|
+
cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR) unless dependencies.empty?
|
34
|
+
source_paths = sources.select { |source| File.directory?(source) }
|
35
|
+
cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty?
|
36
|
+
cmd_args << '-d' << File.expand_path(target)
|
37
|
+
cmd_args += ecj_args
|
38
|
+
cmd_args += files_from_sources(sources)
|
39
|
+
unless Buildr.application.options.dryrun
|
40
|
+
trace((%w[javac -classpath org.eclipse.jdt.internal.compiler.batch.Main] + cmd_args).join(' '))
|
41
|
+
Java.load
|
42
|
+
Java.org.eclipse.jdt.internal.compiler.batch.Main.compile(cmd_args.join(" ")) or
|
43
|
+
fail 'Failed to compile, see errors above'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
# See arg list here: http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm
|
50
|
+
def ecj_args #:nodoc:
|
51
|
+
args = []
|
52
|
+
args << '-warn:none' unless options[:warnings]
|
53
|
+
args << '-verbose' if trace?(:ecj)
|
54
|
+
args << '-g' if options[:debug]
|
55
|
+
args << '-deprecation' if options[:deprecation]
|
56
|
+
args << '-source' << options[:source].to_s if options[:source]
|
57
|
+
args << '-target' << options[:target].to_s if options[:target]
|
58
|
+
case options[:lint]
|
59
|
+
when Array then args << "-Xlint:#{options[:lint].join(',')}"
|
60
|
+
when String then args << "-Xlint:#{options[:lint]}"
|
61
|
+
when true then args << '-Xlint'
|
62
|
+
end
|
63
|
+
args + Array(options[:other])
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
Java.classpath << "org.eclipse.jdt.core.compiler:ecj:jar:3.5.1"
|
70
|
+
# Adding ecj before javac
|
71
|
+
Buildr::Compiler.compilers.unshift Buildr::Compiler::Ecj
|
data/lib/buildr/java/emma.rb
CHANGED
@@ -62,7 +62,7 @@ module Buildr
|
|
62
62
|
Buildr.ant 'emma' do |ant|
|
63
63
|
ant.taskdef :resource=>'emma_ant.properties',
|
64
64
|
:classpath=>Buildr.artifacts(dependencies).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
|
65
|
-
ant.emma :verbosity=>(
|
65
|
+
ant.emma :verbosity=>(trace?(:emma) ? 'verbose' : 'warning') do
|
66
66
|
yield ant
|
67
67
|
end
|
68
68
|
end
|
data/lib/buildr/java/external.rb
CHANGED
@@ -16,13 +16,13 @@
|
|
16
16
|
module Buildr
|
17
17
|
module Compiler
|
18
18
|
class ExternalJavac< Buildr::Compiler::Javac
|
19
|
-
|
19
|
+
|
20
20
|
OPTIONS = [:jvm, :warnings, :debug, :deprecation, :source, :target, :lint, :other]
|
21
|
-
|
21
|
+
|
22
22
|
specify :language=>:java, :sources => 'java', :source_ext => 'java',
|
23
23
|
:target=>'classes', :target_ext=>'class', :packaging=>:jar
|
24
|
-
|
25
|
-
|
24
|
+
|
25
|
+
|
26
26
|
def compile(sources, target, dependencies) #:nodoc:
|
27
27
|
check_options options, OPTIONS
|
28
28
|
cmd_args = []
|
@@ -47,12 +47,12 @@ module Buildr
|
|
47
47
|
end
|
48
48
|
|
49
49
|
private
|
50
|
-
|
50
|
+
|
51
51
|
# See arg list here: http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm
|
52
52
|
def externaljavac_args #:nodoc:
|
53
|
-
args = []
|
53
|
+
args = []
|
54
54
|
args << '-nowarn' unless options[:warnings]
|
55
|
-
args << '-verbose' if
|
55
|
+
args << '-verbose' if trace?(:javac)
|
56
56
|
args << '-g' if options[:debug]
|
57
57
|
args << '-deprecation' if options[:deprecation]
|
58
58
|
args << '-source' << options[:source].to_s if options[:source]
|
@@ -64,9 +64,9 @@ module Buildr
|
|
64
64
|
end
|
65
65
|
args + Array(options[:other])
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
data/lib/buildr/java/jruby.rb
CHANGED
@@ -59,6 +59,11 @@ module Java
|
|
59
59
|
# Since we already have a JVM loaded, we can use it to guess where JAVA_HOME is.
|
60
60
|
# We set JAVA_HOME early so we can use it without calling Java.load first.
|
61
61
|
ENV['JAVA_HOME'] ||= java.lang.System.getProperty("java.home")
|
62
|
+
|
63
|
+
# This version is the minimal version Buildr will support.
|
64
|
+
# Any older version of JRuby will raise an exception.
|
65
|
+
JRUBY_MIN_VERSION = '1.5.1'
|
66
|
+
raise "JRuby must be at least at version #{JRUBY_MIN_VERSION}" unless JRUBY_VERSION >= JRUBY_MIN_VERSION
|
62
67
|
|
63
68
|
class << self
|
64
69
|
|
@@ -256,8 +256,9 @@ module Buildr
|
|
256
256
|
super
|
257
257
|
@classes = []
|
258
258
|
@libs = []
|
259
|
-
|
260
|
-
@
|
259
|
+
enhance do |war|
|
260
|
+
@libs.each {|lib| lib.invoke}
|
261
|
+
@classes.to_a.flatten.each { |classes| include classes, :as => 'WEB-INF/classes' }
|
261
262
|
path('WEB-INF/lib').include Buildr.artifacts(@libs) unless @libs.nil? || @libs.empty?
|
262
263
|
end
|
263
264
|
end
|
@@ -607,7 +608,7 @@ module Buildr
|
|
607
608
|
# Call this when you want the project (and all its sub-projects) to create a source distribution.
|
608
609
|
# You can use the source distribution in an IDE when debugging.
|
609
610
|
#
|
610
|
-
# A source distribution is a
|
611
|
+
# A source distribution is a jar package with the classifier 'sources', which includes all the
|
611
612
|
# sources used by the compile task.
|
612
613
|
#
|
613
614
|
# Packages use the project's manifest and meta_inf properties, which you can override by passing
|
data/lib/buildr/java/rjb.rb
CHANGED
@@ -134,12 +134,10 @@ module Java
|
|
134
134
|
private
|
135
135
|
|
136
136
|
def __package__(name) #:nodoc:
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
package.instance_variable_set :@name, name
|
142
|
-
const_set(const, package)
|
137
|
+
Module.new.tap do |m|
|
138
|
+
m.extend Package
|
139
|
+
m.instance_variable_set :@name, name
|
140
|
+
end
|
143
141
|
end
|
144
142
|
|
145
143
|
end
|
data/lib/buildr/java/tests.rb
CHANGED
@@ -219,10 +219,15 @@ module Buildr
|
|
219
219
|
end
|
220
220
|
|
221
221
|
def tests(dependencies) #:nodoc:
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
222
|
+
if (self.class.version[0,1].to_i < 4)
|
223
|
+
filter_classes(dependencies, :interfaces => %w{junit.framework.TestCase})
|
224
|
+
else
|
225
|
+
filter_classes(dependencies,
|
226
|
+
:interfaces => %w{junit.framework.TestCase},
|
227
|
+
:class_annotations => %w{org.junit.runner.RunWith},
|
228
|
+
:method_annotations => %w{org.junit.Test})
|
229
|
+
end
|
230
|
+
|
226
231
|
end
|
227
232
|
|
228
233
|
def run(tests, dependencies) #:nodoc:
|
@@ -202,6 +202,7 @@ module Buildr
|
|
202
202
|
end
|
203
203
|
|
204
204
|
def include_as(source, as)
|
205
|
+
|
205
206
|
@sources << proc { source }
|
206
207
|
@actions << proc do |file_map|
|
207
208
|
file = source.to_s
|
@@ -216,11 +217,14 @@ module Buildr
|
|
216
217
|
file_map[dest] = file
|
217
218
|
end
|
218
219
|
end
|
219
|
-
|
220
|
-
|
221
|
-
|
220
|
+
unless as == "."
|
221
|
+
trace "Adding #{@path}#{as}/"
|
222
|
+
file_map["#{@path}#{as}/"] = file #as is a folder, so the trailing / is required.
|
223
|
+
end
|
224
|
+
else
|
222
225
|
file_map["#{@path}#{as}"] = file
|
223
226
|
end
|
227
|
+
|
224
228
|
end
|
225
229
|
end
|
226
230
|
end
|
@@ -17,6 +17,7 @@
|
|
17
17
|
require 'buildr/core/project'
|
18
18
|
require 'buildr/core/transports'
|
19
19
|
require 'buildr/packaging/artifact_namespace'
|
20
|
+
require 'fileutils'
|
20
21
|
|
21
22
|
|
22
23
|
module Buildr
|
@@ -27,6 +28,9 @@ module Buildr
|
|
27
28
|
desc "Download all artifacts' sources"
|
28
29
|
task 'artifacts:sources'
|
29
30
|
|
31
|
+
desc "Download all artifacts' javadoc"
|
32
|
+
task 'artifacts:javadoc'
|
33
|
+
|
30
34
|
# Mixin with a task to make it behave like an artifact. Implemented by the packaging tasks.
|
31
35
|
#
|
32
36
|
# An artifact has an identifier, group identifier, type, version number and
|
@@ -41,7 +45,7 @@ module Buildr
|
|
41
45
|
|
42
46
|
class << self
|
43
47
|
private
|
44
|
-
|
48
|
+
|
45
49
|
# :stopdoc:
|
46
50
|
def included(mod)
|
47
51
|
mod.extend self
|
@@ -60,7 +64,7 @@ module Buildr
|
|
60
64
|
base.instance_eval { alias :uninstall :uninstall_old } if base.respond_to? :uninstall_old
|
61
65
|
base.instance_eval { alias :upload :upload_old } if base.respond_to? :upload_old
|
62
66
|
end
|
63
|
-
|
67
|
+
|
64
68
|
# :startdoc:
|
65
69
|
end
|
66
70
|
|
@@ -126,6 +130,17 @@ module Buildr
|
|
126
130
|
sources_task
|
127
131
|
end
|
128
132
|
|
133
|
+
# :call-seq:
|
134
|
+
# javadoc_artifact => Artifact
|
135
|
+
#
|
136
|
+
# Convenience method that returns the associated javadoc artifact
|
137
|
+
def javadoc_artifact
|
138
|
+
javadoc_spec = to_spec_hash.merge(:classifier=>'javadoc')
|
139
|
+
javadoc_task = OptionalArtifact.define_task(Buildr.repositories.locate(javadoc_spec))
|
140
|
+
javadoc_task.send :apply_spec, javadoc_spec
|
141
|
+
javadoc_task
|
142
|
+
end
|
143
|
+
|
129
144
|
# :call-seq:
|
130
145
|
# pom_xml => string
|
131
146
|
#
|
@@ -143,13 +158,16 @@ module Buildr
|
|
143
158
|
end
|
144
159
|
|
145
160
|
def install
|
146
|
-
pom.install if pom && pom != self
|
147
161
|
invoke
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
162
|
+
in_local_repository = Buildr.repositories.locate(self)
|
163
|
+
if name != in_local_repository
|
164
|
+
if pom && pom != self
|
165
|
+
pom.invoke
|
166
|
+
pom.install
|
167
|
+
end
|
168
|
+
mkpath File.dirname(in_local_repository)
|
169
|
+
cp name, in_local_repository, :preserve => false
|
170
|
+
info "Installed #{name} to #{in_local_repository}"
|
153
171
|
end
|
154
172
|
end
|
155
173
|
|
@@ -230,7 +248,7 @@ module Buildr
|
|
230
248
|
# The default artifact type.
|
231
249
|
DEFAULT_TYPE = :jar
|
232
250
|
|
233
|
-
include ActsAsArtifact
|
251
|
+
include ActsAsArtifact, Buildr
|
234
252
|
|
235
253
|
class << self
|
236
254
|
|
@@ -332,7 +350,7 @@ module Buildr
|
|
332
350
|
# if the artifact knows how to build itself (e.g. download from a different location),
|
333
351
|
# so don't perform it if the task found a different way to create the artifact.
|
334
352
|
task.enhance do
|
335
|
-
|
353
|
+
if download_needed? task
|
336
354
|
info "Downloading #{to_spec}"
|
337
355
|
download
|
338
356
|
pom.invoke rescue nil if pom && pom != self
|
@@ -349,30 +367,52 @@ module Buildr
|
|
349
367
|
# install test
|
350
368
|
# See also Buildr#install and Buildr#upload.
|
351
369
|
def from(path)
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
mkpath File.dirname(name)
|
357
|
-
pom.invoke unless type == :pom
|
358
|
-
|
359
|
-
cp path, name
|
360
|
-
info "Installed #{path} as #{to_spec}"
|
361
|
-
end
|
370
|
+
@from = path.is_a?(Rake::Task) ? path : File.expand_path(path.to_s)
|
371
|
+
enhance [@from] do
|
372
|
+
mkpath File.dirname(name)
|
373
|
+
cp @from.to_s, name
|
362
374
|
end
|
363
|
-
unless
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
375
|
+
pom.content pom_xml unless pom == self || pom.has_content?
|
376
|
+
self
|
377
|
+
end
|
378
|
+
|
379
|
+
# :call-seq:
|
380
|
+
# content(string) => self
|
381
|
+
#
|
382
|
+
# Use this when you want to install or upload an artifact from a given content, for example:
|
383
|
+
# readme = artifact('com.example:readme:txt:1.0').content(<<-EOF
|
384
|
+
# Please visit our website at http://example.com/readme
|
385
|
+
# <<EOF
|
386
|
+
# install readme
|
387
|
+
#
|
388
|
+
# If the argument is not a string, it will be converted to a string using to_s
|
389
|
+
def content(string = nil)
|
390
|
+
return @content unless string
|
391
|
+
|
392
|
+
unless @content
|
393
|
+
enhance do
|
394
|
+
write name, @content
|
395
|
+
end
|
396
|
+
|
397
|
+
class << self
|
398
|
+
# Force overwriting target since we don't have source file
|
399
|
+
# to check for timestamp modification
|
400
|
+
def needed?
|
401
|
+
true
|
402
|
+
end
|
368
403
|
end
|
369
404
|
end
|
370
|
-
|
405
|
+
@content = string
|
406
|
+
pom.content pom_xml unless pom == self || pom.has_content?
|
371
407
|
self
|
372
408
|
end
|
373
409
|
|
374
410
|
protected
|
375
411
|
|
412
|
+
def has_content?
|
413
|
+
@from || @content
|
414
|
+
end
|
415
|
+
|
376
416
|
# :call-seq:
|
377
417
|
# download
|
378
418
|
#
|
@@ -389,7 +429,7 @@ module Buildr
|
|
389
429
|
exact_success = remote.find do |repo_url|
|
390
430
|
begin
|
391
431
|
path = "#{group_path}/#{id}/#{version}/#{File.basename(name)}"
|
392
|
-
|
432
|
+
download_artifact(repo_url + path)
|
393
433
|
true
|
394
434
|
rescue URI::NotFoundError
|
395
435
|
false
|
@@ -414,7 +454,8 @@ module Buildr
|
|
414
454
|
snapshot_url = current_snapshot_repo_url(repo_url)
|
415
455
|
if snapshot_url
|
416
456
|
begin
|
417
|
-
|
457
|
+
download_artifact snapshot_url
|
458
|
+
true
|
418
459
|
rescue URI::NotFoundError
|
419
460
|
false
|
420
461
|
end
|
@@ -430,10 +471,13 @@ module Buildr
|
|
430
471
|
metadata_xml = StringIO.new
|
431
472
|
URI.download repo_url + metadata_path, metadata_xml
|
432
473
|
metadata = REXML::Document.new(metadata_xml.string).root
|
433
|
-
timestamp = REXML::XPath.first(metadata, '//timestamp')
|
434
|
-
build_number = REXML::XPath.first(metadata, '//buildNumber')
|
474
|
+
timestamp = REXML::XPath.first(metadata, '//timestamp')
|
475
|
+
build_number = REXML::XPath.first(metadata, '//buildNumber')
|
476
|
+
error "No timestamp provided for the snapshot #{to_spec}" if timestamp.nil?
|
477
|
+
error "No build number provided for the snapshot #{to_spec}" if build_number.nil?
|
478
|
+
return nil if timestamp.nil? || build_number.nil?
|
435
479
|
snapshot_of = version[0, version.size - 9]
|
436
|
-
repo_url + "#{group_path}/#{id}/#{version}/#{id}-#{snapshot_of}-#{timestamp}-#{build_number}.#{type}"
|
480
|
+
repo_url + "#{group_path}/#{id}/#{version}/#{id}-#{snapshot_of}-#{timestamp.text}-#{build_number.text}.#{type}"
|
437
481
|
rescue URI::NotFoundError
|
438
482
|
nil
|
439
483
|
end
|
@@ -442,6 +486,71 @@ module Buildr
|
|
442
486
|
def fail_download(remote_uris)
|
443
487
|
fail "Failed to download #{to_spec}, tried the following repositories:\n#{remote_uris.join("\n")}"
|
444
488
|
end
|
489
|
+
|
490
|
+
protected
|
491
|
+
|
492
|
+
# :call-seq:
|
493
|
+
# needed?
|
494
|
+
#
|
495
|
+
# Validates whether artifact is required to be downloaded from repository
|
496
|
+
def needed?
|
497
|
+
return true if snapshot? && File.exist?(name) && old?
|
498
|
+
super
|
499
|
+
end
|
500
|
+
|
501
|
+
private
|
502
|
+
|
503
|
+
# :call-seq:
|
504
|
+
# download_artifact
|
505
|
+
#
|
506
|
+
# Downloads artifact from given repository,
|
507
|
+
# supports downloading snapshot artifact with relocation on succeed to local repository
|
508
|
+
def download_artifact(path)
|
509
|
+
download_file = "#{name}.#{Time.new.to_i}"
|
510
|
+
begin
|
511
|
+
URI.download path, download_file
|
512
|
+
if File.exist?(download_file)
|
513
|
+
FileUtils.mkdir_p(File.dirname(name))
|
514
|
+
FileUtils.mv(download_file, name)
|
515
|
+
end
|
516
|
+
ensure
|
517
|
+
File.delete(download_file) if File.exist?(download_file)
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
521
|
+
# :call-seq:
|
522
|
+
# :download_needed?
|
523
|
+
#
|
524
|
+
# Validates whether artifact is required to be downloaded from repository
|
525
|
+
def download_needed?(task)
|
526
|
+
return true if !File.exist?(name)
|
527
|
+
|
528
|
+
if snapshot?
|
529
|
+
return false if offline? && File.exist?(name)
|
530
|
+
return true if update_snapshot? || old?
|
531
|
+
end
|
532
|
+
|
533
|
+
return false
|
534
|
+
end
|
535
|
+
|
536
|
+
def update_snapshot?
|
537
|
+
Buildr.application.options.update_snapshots
|
538
|
+
end
|
539
|
+
|
540
|
+
def offline?
|
541
|
+
Buildr.application.options.work_offline
|
542
|
+
end
|
543
|
+
|
544
|
+
# :call-seq:
|
545
|
+
# old?
|
546
|
+
#
|
547
|
+
# Checks whether existing artifact is older than period from build settings or one day
|
548
|
+
def old?
|
549
|
+
settings = Buildr.application.settings
|
550
|
+
time_to_be_old = settings.user[:expire_time] || settings.build[:expire_time] || 60 * 60 * 24
|
551
|
+
File.mtime(name).to_i < (Time.new.to_i - time_to_be_old)
|
552
|
+
end
|
553
|
+
|
445
554
|
end
|
446
555
|
|
447
556
|
|
@@ -639,15 +748,18 @@ module Buildr
|
|
639
748
|
# To specify an artifact and the means for creating it:
|
640
749
|
# download(artifact('dojo:dojo-widget:zip:2.0')=>
|
641
750
|
# 'http://download.dojotoolkit.org/release-2.0/dojo-2.0-widget.zip')
|
642
|
-
def artifact(spec, &block) #:yields:task
|
751
|
+
def artifact(spec, path = nil, &block) #:yields:task
|
643
752
|
spec = artifact_ns.fetch(spec) if spec.kind_of?(Symbol)
|
644
753
|
spec = Artifact.to_hash(spec)
|
645
754
|
unless task = Artifact.lookup(spec)
|
646
|
-
task = Artifact.define_task(repositories.locate(spec))
|
755
|
+
task = Artifact.define_task(path || repositories.locate(spec))
|
647
756
|
task.send :apply_spec, spec
|
648
757
|
Rake::Task['rake:artifacts'].enhance [task]
|
649
758
|
Artifact.register(task)
|
650
|
-
|
759
|
+
unless spec[:type] == :pom
|
760
|
+
Rake::Task['artifacts:sources'].enhance [task.sources_artifact]
|
761
|
+
Rake::Task['artifacts:javadoc'].enhance [task.javadoc_artifact]
|
762
|
+
end
|
651
763
|
end
|
652
764
|
task.enhance &block
|
653
765
|
end
|
@@ -748,7 +860,7 @@ module Buildr
|
|
748
860
|
end
|
749
861
|
|
750
862
|
# :call-seq:
|
751
|
-
# install(artifacts)
|
863
|
+
# install(artifacts) => install_task
|
752
864
|
#
|
753
865
|
# Installs the specified artifacts in the local repository as part of the install task.
|
754
866
|
#
|
@@ -759,9 +871,12 @@ module Buildr
|
|
759
871
|
artifacts = artifacts(args)
|
760
872
|
raise ArgumentError, 'This method can only install artifacts' unless artifacts.all? { |f| f.respond_to?(:to_spec) }
|
761
873
|
all = (artifacts + artifacts.map { |artifact| artifact.pom }).uniq
|
762
|
-
task('install').tap do |
|
763
|
-
|
764
|
-
|
874
|
+
task('install').tap do |install|
|
875
|
+
install.enhance(all) do
|
876
|
+
all.each(&:install)
|
877
|
+
end
|
878
|
+
install.enhance &block if block
|
879
|
+
task('uninstall') do
|
765
880
|
all.map(&:to_s ).each { |file| rm file if File.exist?(file) }
|
766
881
|
end
|
767
882
|
end
|