buildr 1.3.5-x86-mswin32 → 1.4.0-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 +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
data/lib/buildr/core/build.rb
CHANGED
@@ -52,7 +52,7 @@ module Buildr
|
|
52
52
|
task 'default'=>'build'
|
53
53
|
end
|
54
54
|
|
55
|
-
before_define do |project|
|
55
|
+
before_define(:build => [:compile, :test]) do |project|
|
56
56
|
project.recursive_task 'build'
|
57
57
|
project.recursive_task 'clean'
|
58
58
|
project.clean do
|
@@ -61,6 +61,7 @@ module Buildr
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
after_define(:build)
|
64
65
|
|
65
66
|
# *Deprecated:* Use +path_to(:target)+ instead.
|
66
67
|
def target
|
@@ -187,7 +188,7 @@ module Buildr
|
|
187
188
|
def commit(file, message)
|
188
189
|
svn 'commit', '-m', message, file
|
189
190
|
end
|
190
|
-
|
191
|
+
|
191
192
|
# :call-seq:
|
192
193
|
# tag_url(svn_url, version) => tag_url
|
193
194
|
#
|
@@ -208,24 +209,36 @@ module Buildr
|
|
208
209
|
def repo_url
|
209
210
|
svn('info', '--xml')[/<url>(.*?)<\/url>/, 1].strip
|
210
211
|
end
|
211
|
-
|
212
|
+
|
212
213
|
def copy(dir, url, message)
|
213
214
|
svn 'copy', dir, url, '-m', message
|
214
215
|
end
|
215
|
-
|
216
|
+
|
216
217
|
def remove(url, message)
|
217
218
|
svn 'remove', url, '-m', message
|
218
219
|
end
|
219
220
|
|
220
221
|
end
|
221
|
-
|
222
|
+
|
222
223
|
|
223
224
|
class Release #:nodoc:
|
224
225
|
|
225
226
|
THIS_VERSION_PATTERN = /(THIS_VERSION|VERSION_NUMBER)\s*=\s*(["'])(.*)\2/
|
226
227
|
|
227
228
|
class << self
|
228
|
-
|
229
|
+
|
230
|
+
# Use this to specify a different tag name for tagging the release in source control.
|
231
|
+
# You can set the tag name or a proc that will be called with the version number,
|
232
|
+
# for example:
|
233
|
+
# Release.tag_name = lambda { |ver| "foo-#{ver}" }
|
234
|
+
attr_accessor :tag_name
|
235
|
+
|
236
|
+
# Use this to specify a different commit message to commit the buildfile with the next version in source control.
|
237
|
+
# You can set the commit message or a proc that will be called with the next version number,
|
238
|
+
# for example:
|
239
|
+
# Release.commit_message = lambda { |ver| "Changed version number to #{ver}" }
|
240
|
+
attr_accessor :commit_message
|
241
|
+
|
229
242
|
# :call-seq:
|
230
243
|
# add(MyReleaseClass)
|
231
244
|
#
|
@@ -251,18 +264,6 @@ module Buildr
|
|
251
264
|
end
|
252
265
|
|
253
266
|
end
|
254
|
-
|
255
|
-
# Use this to specify a different tag name for tagging the release in source control.
|
256
|
-
# You can set the tag name or a proc that will be called with the version number,
|
257
|
-
# for example:
|
258
|
-
# Release.tag_name = lambda { |ver| "foo-#{ver}" }
|
259
|
-
attr_accessor :tag_name
|
260
|
-
|
261
|
-
# Use this to specify a different commit message to commit the buildfile with the next version in source control.
|
262
|
-
# You can set the commit message or a proc that will be called with the next version number,
|
263
|
-
# for example:
|
264
|
-
# Release.commit_message = lambda { |ver| "Changed version number to #{ver}" }
|
265
|
-
attr_accessor :commit_message
|
266
267
|
|
267
268
|
# :call-seq:
|
268
269
|
# make()
|
@@ -274,12 +275,12 @@ module Buildr
|
|
274
275
|
args = '-S', 'buildr', "_#{Buildr::VERSION}_", '--buildfile', release_candidate_buildfile
|
275
276
|
args << '--environment' << Buildr.environment unless Buildr.environment.to_s.empty?
|
276
277
|
args << 'clean' << 'upload' << 'DEBUG=no'
|
277
|
-
ruby *args
|
278
|
+
ruby *args
|
278
279
|
end
|
279
280
|
tag_release resolve_tag
|
280
281
|
update_version_to_next
|
281
282
|
end
|
282
|
-
|
283
|
+
|
283
284
|
# :call-seq:
|
284
285
|
# extract_version() => this_versin
|
285
286
|
#
|
@@ -291,9 +292,19 @@ module Buildr
|
|
291
292
|
rescue
|
292
293
|
fail 'Looking for THIS_VERSION = "..." in your Buildfile, none found'
|
293
294
|
end
|
294
|
-
|
295
|
+
|
296
|
+
# Use this to specify a different tag name for tagging the release in source control.
|
297
|
+
# You can set the tag name or a proc that will be called with the version number,
|
298
|
+
# for example:
|
299
|
+
# Release.find.tag_name = lambda { |ver| "foo-#{ver}" }
|
300
|
+
# Deprecated: you should use Release.tag_name instead
|
301
|
+
def tag_name=(tag_proc)
|
302
|
+
warn("Release.find.tag_name is deprecated. You should use Release.tag_name instead")
|
303
|
+
Release.tag_name=(tag_proc)
|
304
|
+
end
|
305
|
+
|
295
306
|
protected
|
296
|
-
|
307
|
+
|
297
308
|
# :call-seq:
|
298
309
|
# with_release_candidate_version() { |filename| ... }
|
299
310
|
#
|
@@ -341,7 +352,7 @@ module Buildr
|
|
341
352
|
# Return the name of the tag to tag the release with.
|
342
353
|
def resolve_tag
|
343
354
|
version = extract_version
|
344
|
-
tag = tag_name || version
|
355
|
+
tag = Release.tag_name || version
|
345
356
|
tag = tag.call(version) if Proc === tag
|
346
357
|
tag
|
347
358
|
end
|
@@ -355,7 +366,7 @@ module Buildr
|
|
355
366
|
# Return the message to use to cimmit the buildfile with the next version
|
356
367
|
def message
|
357
368
|
version = extract_version
|
358
|
-
msg = commit_message || "Changed version number to #{version}"
|
369
|
+
msg = Release.commit_message || "Changed version number to #{version}"
|
359
370
|
msg = msg.call(version) if Proc === msg
|
360
371
|
msg
|
361
372
|
end
|
@@ -372,7 +383,9 @@ module Buildr
|
|
372
383
|
if File.exist? '.git/config'
|
373
384
|
true
|
374
385
|
else
|
375
|
-
|
386
|
+
curr_pwd = Dir.pwd
|
387
|
+
Dir.chdir('..') do
|
388
|
+
return false if curr_pwd == Dir.pwd # Means going up one level is not possible.
|
376
389
|
applies_to?
|
377
390
|
end
|
378
391
|
end
|
@@ -408,7 +421,7 @@ module Buildr
|
|
408
421
|
Git.push if Git.remote
|
409
422
|
end
|
410
423
|
end
|
411
|
-
|
424
|
+
|
412
425
|
|
413
426
|
class SvnRelease < Release
|
414
427
|
class << self
|
@@ -416,7 +429,7 @@ module Buildr
|
|
416
429
|
File.exist?('.svn')
|
417
430
|
end
|
418
431
|
end
|
419
|
-
|
432
|
+
|
420
433
|
def check
|
421
434
|
fail "Uncommitted files violate the First Principle Of Release!\n"+Svn.uncommitted_files.join("\n") unless Svn.uncommitted_files.empty?
|
422
435
|
fail "SVN URL must contain 'trunk' or 'branches/...'" unless Svn.repo_url =~ /(trunk)|(branches.*)$/
|
@@ -433,7 +446,7 @@ module Buildr
|
|
433
446
|
Svn.commit Buildr.application.buildfile.to_s, message
|
434
447
|
end
|
435
448
|
end
|
436
|
-
|
449
|
+
|
437
450
|
Release.add SvnRelease
|
438
451
|
Release.add GitRelease
|
439
452
|
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
require 'buildr/core/common'
|
17
|
+
require 'buildr/core/project'
|
18
|
+
require 'buildr/core/build'
|
19
|
+
require 'buildr/core/compile'
|
20
|
+
|
21
|
+
module Buildr
|
22
|
+
class CCTask < Rake::Task
|
23
|
+
attr_accessor :delay
|
24
|
+
attr_reader :project
|
25
|
+
|
26
|
+
def initialize(*args)
|
27
|
+
super
|
28
|
+
@delay = 0.2
|
29
|
+
enhance do
|
30
|
+
monitor_and_compile
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def associate_with(project)
|
37
|
+
@project = project
|
38
|
+
end
|
39
|
+
|
40
|
+
def monitor_and_compile
|
41
|
+
# we don't want to actually fail if our dependencies don't succede
|
42
|
+
begin
|
43
|
+
[:compile, 'test:compile'].each { |name| project.task(name).invoke }
|
44
|
+
notify_build_status(true, project)
|
45
|
+
rescue Exception => ex
|
46
|
+
$stderr.puts $terminal.color(ex.message, :red)
|
47
|
+
$stderr.puts
|
48
|
+
|
49
|
+
notify_build_status(false, project)
|
50
|
+
end
|
51
|
+
|
52
|
+
main_dirs = project.compile.sources.map(&:to_s)
|
53
|
+
test_dirs = project.task('test:compile').sources.map(&:to_s)
|
54
|
+
res_dirs = project.resources.sources.map(&:to_s)
|
55
|
+
|
56
|
+
main_ext = Buildr::Compiler.select(project.compile.compiler).source_ext.map(&:to_s) unless project.compile.compiler.nil?
|
57
|
+
test_ext = Buildr::Compiler.select(project.task('test:compile').compiler).source_ext.map(&:to_s) unless project.task('test:compile').compiler.nil?
|
58
|
+
|
59
|
+
test_tail = if test_dirs.empty? then '' else ",{#{test_dirs.join ','}}/**/*.{#{test_ext.join ','}}" end
|
60
|
+
res_tail = if res_dirs.empty? then '' else ",{#{res_dirs.join ','}}/**/*" end
|
61
|
+
|
62
|
+
pattern = "{{#{main_dirs.join ','}}/**/*.{#{main_ext.join ','}}#{test_tail}#{res_tail}}"
|
63
|
+
|
64
|
+
times, _ = check_mtime pattern, {} # establish baseline
|
65
|
+
|
66
|
+
dir_names = (main_dirs + test_dirs + res_dirs).map { |file| strip_filename project, file }
|
67
|
+
if dir_names.length == 1
|
68
|
+
info "Monitoring directory: #{dir_names.first}"
|
69
|
+
else
|
70
|
+
info "Monitoring directories: [#{dir_names.join ', '}]"
|
71
|
+
end
|
72
|
+
trace "Monitoring extensions: [#{main_ext.join ', '}]"
|
73
|
+
|
74
|
+
while true
|
75
|
+
sleep delay
|
76
|
+
|
77
|
+
times, changed = check_mtime pattern, times
|
78
|
+
unless changed.empty?
|
79
|
+
info '' # better spacing
|
80
|
+
|
81
|
+
changed.each do |file|
|
82
|
+
info "Detected changes in #{strip_filename project, file}"
|
83
|
+
end
|
84
|
+
|
85
|
+
in_main = main_dirs.any? do |dir|
|
86
|
+
changed.any? { |file| file.index(dir) == 0 }
|
87
|
+
end
|
88
|
+
|
89
|
+
in_test = test_dirs.any? do |dir|
|
90
|
+
changed.any? { |file| file.index(dir) == 0 }
|
91
|
+
end
|
92
|
+
|
93
|
+
in_res = res_dirs.any? do |dir|
|
94
|
+
changed.any? { |file| file.index(dir) == 0 }
|
95
|
+
end
|
96
|
+
|
97
|
+
project.task(:compile).reenable if in_main
|
98
|
+
project.task('test:compile').reenable if in_test || in_main
|
99
|
+
|
100
|
+
successful = true
|
101
|
+
begin
|
102
|
+
project.task(:resources).filter.run if in_res
|
103
|
+
project.task(:compile).invoke if in_main
|
104
|
+
project.task('test:compile').invoke if in_test || in_main
|
105
|
+
rescue Exception => ex
|
106
|
+
$stderr.puts $terminal.color(ex.message, :red)
|
107
|
+
successful = false
|
108
|
+
end
|
109
|
+
|
110
|
+
notify_build_status(successful, project)
|
111
|
+
puts $terminal.color("Build complete", :green) if successful
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def notify_build_status(successful, project)
|
117
|
+
if RUBY_PLATFORM =~ /darwin/ && $stdout.isatty && verbose
|
118
|
+
if successful
|
119
|
+
growl_notify('Completed', 'Your build has completed', project.path_to)
|
120
|
+
else
|
121
|
+
growl_notify('Failed', 'Your build has failed with an error', project.path_to)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def check_mtime(pattern, old_times)
|
127
|
+
times = {}
|
128
|
+
changed = []
|
129
|
+
|
130
|
+
Dir.glob pattern do |fname|
|
131
|
+
times[fname] = File.mtime fname
|
132
|
+
if old_times[fname].nil? || old_times[fname] < File.mtime(fname)
|
133
|
+
changed << fname
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# detect deletion (slower than it could be)
|
138
|
+
old_times.each_key do |fname|
|
139
|
+
changed << fname unless times.has_key? fname
|
140
|
+
end
|
141
|
+
|
142
|
+
[times, changed]
|
143
|
+
end
|
144
|
+
|
145
|
+
def strip_filename(project, name)
|
146
|
+
name.gsub project.base_dir + File::SEPARATOR, ''
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
module CC
|
151
|
+
include Extension
|
152
|
+
|
153
|
+
first_time do
|
154
|
+
desc 'Execute continuous compilation, listening to changes'
|
155
|
+
Project.local_task('cc') { |name| "Executing continuous compilation for #{name}" }
|
156
|
+
end
|
157
|
+
|
158
|
+
before_define do |project|
|
159
|
+
cc = CCTask.define_task :cc
|
160
|
+
cc.send :associate_with, project
|
161
|
+
project.recursive_task(:cc)
|
162
|
+
end
|
163
|
+
|
164
|
+
def cc
|
165
|
+
task :cc
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
class Project
|
170
|
+
include CC
|
171
|
+
end
|
172
|
+
end
|
data/lib/buildr/core/checks.rb
CHANGED
@@ -139,7 +139,7 @@ module Buildr
|
|
139
139
|
|
140
140
|
include Extension
|
141
141
|
|
142
|
-
before_define do |project|
|
142
|
+
before_define(:check => :package) do |project|
|
143
143
|
# The check task can do any sort of interesting things, but the most important is running expectations.
|
144
144
|
project.task("check") do |task|
|
145
145
|
project.expectations.inject(true) do |passed, expect|
|
data/lib/buildr/core/common.rb
CHANGED
@@ -34,7 +34,7 @@ module Buildr
|
|
34
34
|
#
|
35
35
|
# compile.with COMMONS.logging
|
36
36
|
def struct(hash)
|
37
|
-
Struct.new(nil, *hash.keys).new(*hash.values)
|
37
|
+
Struct.new(nil, *hash.keys).new(*hash.values)
|
38
38
|
end
|
39
39
|
|
40
40
|
# :call-seq:
|
@@ -58,17 +58,18 @@ module Buildr
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# :call-seq:
|
61
|
-
# read(
|
62
|
-
# read(
|
61
|
+
# read(args) => string
|
62
|
+
# read(args) { |string| ... } => result
|
63
63
|
#
|
64
64
|
# Reads and returns the contents of a file. The second form yields to the block and returns
|
65
|
-
# the result of the block.
|
65
|
+
# the result of the block. The args passed to read are passed on to File.open.
|
66
66
|
#
|
67
67
|
# For example:
|
68
68
|
# puts read('README')
|
69
69
|
# read('README') { |text| puts text }
|
70
|
-
def read(
|
71
|
-
|
70
|
+
def read(*args)
|
71
|
+
args[0] = args[0].to_s
|
72
|
+
contents = File.open(*args) { |f| f.read }
|
72
73
|
if block_given?
|
73
74
|
yield contents
|
74
75
|
else
|
data/lib/buildr/core/compile.rb
CHANGED
@@ -37,7 +37,7 @@ module Buildr
|
|
37
37
|
end
|
38
38
|
|
39
39
|
# Adds a compiler to the list of supported compiler.
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# For example:
|
42
42
|
# Buildr::Compiler << Buildr::Javac
|
43
43
|
def add(compiler)
|
@@ -188,7 +188,7 @@ module Buildr
|
|
188
188
|
end
|
189
189
|
|
190
190
|
private
|
191
|
-
|
191
|
+
|
192
192
|
def findFirst(file, pattern)
|
193
193
|
match = nil
|
194
194
|
File.open(file, "r") do |infile|
|
@@ -264,7 +264,7 @@ module Buildr
|
|
264
264
|
# compile.from('src/java').into('classes').with('module1.jar')
|
265
265
|
def from(*sources)
|
266
266
|
@sources |= sources.flatten
|
267
|
-
guess_compiler if @compiler.nil? && sources.flatten.any? { |source| File.exist?(source) }
|
267
|
+
guess_compiler if @compiler.nil? && sources.flatten.any? { |source| File.exist?(source.to_s) }
|
268
268
|
self
|
269
269
|
end
|
270
270
|
|
@@ -369,7 +369,6 @@ module Buildr
|
|
369
369
|
def compiler=(name) #:nodoc:
|
370
370
|
cls = Compiler.select(name) or raise ArgumentError, "No #{name} compiler available. Did you install it?"
|
371
371
|
return self if cls === @compiler
|
372
|
-
raise "#{compiler} compiler already selected for this project" if @compiler
|
373
372
|
@compiler = cls.new(project, options)
|
374
373
|
from Array(cls.sources).map { |path| project.path_to(:source, usage, path) }.
|
375
374
|
select { |path| File.exist?(path) } if sources.empty?
|
@@ -383,7 +382,7 @@ module Buildr
|
|
383
382
|
@project, @usage = project, usage
|
384
383
|
guess_compiler
|
385
384
|
end
|
386
|
-
|
385
|
+
|
387
386
|
# Try to guess if we have a compiler to match source files.
|
388
387
|
def guess_compiler #:nodoc:
|
389
388
|
candidate = Compiler.compilers.detect { |cls| cls.applies_to?(project, self) }
|
@@ -497,7 +496,7 @@ module Buildr
|
|
497
496
|
Project.local_task('compile') { |name| "Compiling #{name}" }
|
498
497
|
end
|
499
498
|
|
500
|
-
before_define do |project|
|
499
|
+
before_define(:compile) do |project|
|
501
500
|
resources = ResourcesTask.define_task('resources')
|
502
501
|
resources.send :associate_with, project, :main
|
503
502
|
project.path_to(:source, :main, :resources).tap { |dir| resources.from dir if File.exist?(dir) }
|
@@ -507,7 +506,7 @@ module Buildr
|
|
507
506
|
project.recursive_task('compile')
|
508
507
|
end
|
509
508
|
|
510
|
-
after_define do |project|
|
509
|
+
after_define(:compile) do |project|
|
511
510
|
if project.compile.target
|
512
511
|
# This comes last because the target path is set inside the project definition.
|
513
512
|
project.build project.compile.target
|
@@ -517,7 +516,7 @@ module Buildr
|
|
517
516
|
end
|
518
517
|
end
|
519
518
|
|
520
|
-
|
519
|
+
|
521
520
|
# :call-seq:
|
522
521
|
# compile(*sources) => CompileTask
|
523
522
|
# compile(*sources) { |task| .. } => CompileTask
|