buildr 1.3.5-java → 1.4.0-java
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 +148 -132
- 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/generate.rb
CHANGED
@@ -21,7 +21,7 @@ module Buildr
|
|
21
21
|
module Generate #:nodoc:
|
22
22
|
|
23
23
|
task 'generate' do
|
24
|
-
script = nil
|
24
|
+
script = nil
|
25
25
|
choose do |menu|
|
26
26
|
menu.header = "To use Buildr you need a buildfile. Do you want me to create one?"
|
27
27
|
|
@@ -29,12 +29,12 @@ module Buildr
|
|
29
29
|
menu.choice("From directory structure") { script = Generate.from_directory(Dir.pwd).join("\n") }
|
30
30
|
menu.choice("Skip") { }
|
31
31
|
end
|
32
|
-
|
33
|
-
if script
|
32
|
+
|
33
|
+
if script
|
34
34
|
buildfile = File.expand_path(Buildr::Application::DEFAULT_BUILDFILES.first)
|
35
35
|
File.open(buildfile, "w") { |file| file.write script }
|
36
36
|
puts "Created #{buildfile}"
|
37
|
-
end
|
37
|
+
end
|
38
38
|
end
|
39
39
|
|
40
40
|
class << self
|
@@ -107,7 +107,7 @@ define "#{name}" do
|
|
107
107
|
proxy = settings['proxies'].first['proxy'].find { |proxy|
|
108
108
|
proxy["active"].nil? || proxy["active"].to_s =~ /true/
|
109
109
|
} rescue nil
|
110
|
-
|
110
|
+
|
111
111
|
if proxy
|
112
112
|
url = %{#{proxy["protocol"].first}://#{proxy["host"].first}:#{proxy["port"].first}}
|
113
113
|
exclude = proxy["nonProxyHosts"].to_s.gsub("|", ",") if proxy["nonProxyHosts"]
|
@@ -189,7 +189,7 @@ define "#{name}" do
|
|
189
189
|
script << "end"
|
190
190
|
script.flatten
|
191
191
|
end
|
192
|
-
|
192
|
+
|
193
193
|
end
|
194
194
|
end
|
195
|
-
end
|
195
|
+
end
|
data/lib/buildr/core/help.rb
CHANGED
data/lib/buildr/core/osx.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
# Let's see if we can use Growl. Must be running from console in verbose mode.
|
18
18
|
if $stdout.isatty && verbose
|
19
|
-
|
19
|
+
def growl_notify(type, title, message)
|
20
20
|
begin
|
21
21
|
# Loading Ruby Cocoa can slow the build down (hooks on Object class), so we're
|
22
22
|
# saving the best for last and only requiring it at the very end.
|
@@ -27,7 +27,7 @@ if $stdout.isatty && verbose
|
|
27
27
|
# Register with Growl, that way you can turn notifications on/off from system preferences.
|
28
28
|
OSX::NSDistributedNotificationCenter.defaultCenter.
|
29
29
|
postNotificationName_object_userInfo_deliverImmediately(:GrowlApplicationRegistrationNotification, nil,
|
30
|
-
{ :ApplicationName=>'Buildr', :AllNotifications=>['Completed', 'Failed'],
|
30
|
+
{ :ApplicationName=>'Buildr', :AllNotifications=>['Completed', 'Failed'],
|
31
31
|
:ApplicationIcon=>icon.TIFFRepresentation }, true)
|
32
32
|
|
33
33
|
OSX::NSDistributedNotificationCenter.defaultCenter.
|
@@ -39,8 +39,8 @@ if $stdout.isatty && verbose
|
|
39
39
|
# calls raises an exception; system doesn't have osx/cocoa, e.g. MacPorts Ruby 1.9,
|
40
40
|
# so we also need to rescue LoadError.
|
41
41
|
end
|
42
|
-
end
|
43
|
-
|
44
|
-
Buildr.application.on_completion { |title, message|
|
45
|
-
Buildr.application.on_failure { |title, message, ex|
|
42
|
+
end
|
43
|
+
|
44
|
+
Buildr.application.on_completion { |title, message| growl_notify('Completed', title, message) if verbose }
|
45
|
+
Buildr.application.on_failure { |title, message, ex| growl_notify('Failed', title, message) if verbose }
|
46
46
|
end
|
@@ -66,7 +66,7 @@ class ProgressBar
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def title
|
69
|
-
@title.size > ProgressBar.width / 5 ? (@title[0, ProgressBar.width / 5 - 2] + '..') : @title
|
69
|
+
@title.size > ProgressBar.width / 5 ? (@title[0, ProgressBar.width / 5 - 2] + '..') : @title
|
70
70
|
end
|
71
71
|
|
72
72
|
def count
|
@@ -93,7 +93,7 @@ class ProgressBar
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def elapsed
|
96
|
-
'Time: %s' % duration(Time.now - @start)
|
96
|
+
'Time: %s' % duration(Time.now - @start)
|
97
97
|
end
|
98
98
|
|
99
99
|
def rate
|
@@ -130,7 +130,7 @@ protected
|
|
130
130
|
@output.print "\r", " " * (ProgressBar.width - 1), "\r"
|
131
131
|
@output.flush
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
def render
|
135
135
|
return unless @output
|
136
136
|
format, *args = @format
|
@@ -143,7 +143,7 @@ protected
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def changed?
|
146
|
-
return false unless @output && Time.now - @last_time > 0.1
|
146
|
+
return false unless @output && Time.now - @last_time > 0.1
|
147
147
|
return human(@count) != human(@previous) if @total == 0
|
148
148
|
return true if (@count - @previous) >= @total / 100
|
149
149
|
return Time.now - @last_time > 1
|
data/lib/buildr/core/project.rb
CHANGED
@@ -210,8 +210,8 @@ module Buildr
|
|
210
210
|
@projects[name] = project
|
211
211
|
# Set the project properties first, actions may use them.
|
212
212
|
properties.each { |name, value| project.send "#{name}=", value } if properties
|
213
|
-
#
|
214
|
-
# Don't cache list of
|
213
|
+
# Setup to call before/after define extension callbacks
|
214
|
+
# Don't cache list of extensions, since project may add new extensions.
|
215
215
|
project.enhance do |project|
|
216
216
|
project.send :call_callbacks, :before_define
|
217
217
|
project.enhance do |project|
|
@@ -219,14 +219,14 @@ module Buildr
|
|
219
219
|
end
|
220
220
|
end
|
221
221
|
project.enhance do |project|
|
222
|
-
@on_define.each { |
|
222
|
+
@on_define.each { |extension| extension[project] }
|
223
223
|
end if @on_define
|
224
224
|
# Enhance the project using the definition block.
|
225
225
|
project.enhance { project.instance_exec project, &block } if block
|
226
226
|
|
227
227
|
# Top-level project? Invoke the project definition. Sub-project? We don't invoke
|
228
228
|
# the project definiton yet (allow project calls to establish order of evaluation),
|
229
|
-
# but must do so before the parent project's definition is done.
|
229
|
+
# but must do so before the parent project's definition is done.
|
230
230
|
project.parent.enhance { project.invoke } if project.parent
|
231
231
|
end
|
232
232
|
end
|
@@ -375,11 +375,15 @@ module Buildr
|
|
375
375
|
project if Project === project
|
376
376
|
end
|
377
377
|
|
378
|
-
#
|
379
|
-
def
|
380
|
-
@
|
378
|
+
# Loaded extension modules.
|
379
|
+
def extension_modules #:nodoc:
|
380
|
+
@extension_modules ||= []
|
381
381
|
end
|
382
382
|
|
383
|
+
# Extension callbacks that apply to all projects
|
384
|
+
def global_callbacks #:nodoc:
|
385
|
+
@global_callbacks ||= []
|
386
|
+
end
|
383
387
|
end
|
384
388
|
|
385
389
|
|
@@ -402,11 +406,8 @@ module Buildr
|
|
402
406
|
@parent = task(split[0...-1].join(':'))
|
403
407
|
raise "No parent project #{split[0...-1].join(':')}" unless @parent && Project === parent
|
404
408
|
end
|
405
|
-
|
406
|
-
@callbacks =
|
407
|
-
methods = callbacks.select { |callback| callback.respond_to?(state) }.map { |callback| callback.method(state) }
|
408
|
-
hash.update(state=>methods)
|
409
|
-
end
|
409
|
+
# Inherit all global callbacks
|
410
|
+
@callbacks = Project.global_callbacks.dup
|
410
411
|
end
|
411
412
|
|
412
413
|
# :call-seq:
|
@@ -587,6 +588,16 @@ module Buildr
|
|
587
588
|
%Q{project(#{name.inspect})}
|
588
589
|
end
|
589
590
|
|
591
|
+
def callbacks #:nodoc:
|
592
|
+
# global + project_local callbacks for this project
|
593
|
+
@callbacks ||= []
|
594
|
+
end
|
595
|
+
|
596
|
+
def calledback #:nodoc:
|
597
|
+
# project-local callbacks that have been called
|
598
|
+
@calledback ||= {}
|
599
|
+
end
|
600
|
+
|
590
601
|
protected
|
591
602
|
|
592
603
|
# :call-seq:
|
@@ -626,14 +637,35 @@ module Buildr
|
|
626
637
|
end
|
627
638
|
end
|
628
639
|
|
629
|
-
# Call all callbacks for a particular
|
630
|
-
def call_callbacks(
|
631
|
-
|
632
|
-
|
640
|
+
# Call all extension callbacks for a particular phase, e.g. :before_define, :after_define.
|
641
|
+
def call_callbacks(phase) #:nodoc:
|
642
|
+
remaining = @callbacks.select { |cb| cb.phase == phase }
|
643
|
+
known_callbacks = remaining.map { |cb| cb.name }
|
644
|
+
|
645
|
+
# call each extension in order
|
646
|
+
until remaining.empty?
|
647
|
+
callback = first_satisfied(remaining, known_callbacks)
|
648
|
+
if callback.nil?
|
649
|
+
hash = remaining.map { |cb| { cb.name => cb.dependencies} }
|
650
|
+
fail "Unsatisfied dependencies in extensions for #{phase}: #{hash.inspect}"
|
651
|
+
end
|
652
|
+
callback.blocks.each { |b| b.call(self) }
|
653
|
+
end
|
633
654
|
end
|
634
|
-
|
635
|
-
|
636
|
-
|
655
|
+
|
656
|
+
private
|
657
|
+
|
658
|
+
# find first callback with satisfied dependencies
|
659
|
+
def first_satisfied(r, known_callbacks)
|
660
|
+
remaining_names = r.map { |cb| cb.name }
|
661
|
+
res = r.find do |cb|
|
662
|
+
cb.dependencies.each do |dep|
|
663
|
+
fail "Unknown #{phase.inspect} extension dependency: #{dep.inspect}" unless known_callbacks.index(dep)
|
664
|
+
end
|
665
|
+
satisfied = cb.dependencies.find { |dep| remaining_names.index(dep) } == nil
|
666
|
+
cb if satisfied
|
667
|
+
end
|
668
|
+
r.delete res
|
637
669
|
end
|
638
670
|
|
639
671
|
end
|
@@ -707,6 +739,22 @@ module Buildr
|
|
707
739
|
# end
|
708
740
|
module Extension
|
709
741
|
|
742
|
+
# Extension callback details
|
743
|
+
class Callback #:nodoc:
|
744
|
+
attr_accessor :phase, :name, :dependencies, :blocks
|
745
|
+
|
746
|
+
def initialize(phase, name, dependencies, blocks)
|
747
|
+
@phase = phase
|
748
|
+
@name = name
|
749
|
+
@dependencies = dependencies
|
750
|
+
@blocks = (blocks ? (Array === blocks ? blocks : [blocks]) : [])
|
751
|
+
end
|
752
|
+
|
753
|
+
def merge(callback)
|
754
|
+
Callback.new(phase, name, @dependencies + callback.dependencies, @blocks + callback.blocks)
|
755
|
+
end
|
756
|
+
end
|
757
|
+
|
710
758
|
def self.included(base) #:nodoc:
|
711
759
|
base.extend ClassMethods
|
712
760
|
end
|
@@ -715,49 +763,109 @@ module Buildr
|
|
715
763
|
module ClassMethods
|
716
764
|
|
717
765
|
def included(base) #:nodoc:
|
718
|
-
# When included in Project, add
|
719
|
-
if Project == base && !base.
|
720
|
-
base.
|
721
|
-
|
766
|
+
# When included in Project, add module instance, merge callbacks and call first_time.
|
767
|
+
if Project == base && !base.extension_modules.include?(module_callbacks)
|
768
|
+
base.extension_modules << module_callbacks
|
769
|
+
merge_callbacks(base.global_callbacks, module_callbacks)
|
770
|
+
first_time = module_callbacks.select { |c| c.phase == :first_time }
|
771
|
+
first_time.each do |c|
|
772
|
+
c.blocks.each { |b| b.call }
|
773
|
+
end
|
722
774
|
end
|
723
775
|
end
|
724
776
|
|
725
777
|
def extended(base) #:nodoc:
|
726
|
-
# When extending project,
|
778
|
+
# When extending project, merge after_define callbacks and call before_define callback(s)
|
779
|
+
# immediately
|
727
780
|
if Project === base
|
728
|
-
callbacks
|
729
|
-
|
730
|
-
|
781
|
+
merge_callbacks(base.callbacks, module_callbacks.select { |cb| cb.phase == :after_define })
|
782
|
+
calls = module_callbacks.select { |cb| cb.phase == :before_define }
|
783
|
+
calls.each do |cb|
|
784
|
+
cb.blocks.each { |b| b.call(base) } unless base.calledback[cb]
|
785
|
+
base.calledback[cb] = cb
|
786
|
+
end
|
731
787
|
end
|
732
788
|
end
|
733
789
|
|
734
|
-
# This block will be called once for any particular extension.
|
790
|
+
# This block will be called once for any particular extension included in Project.
|
735
791
|
# You can use this to setup top-level and local tasks.
|
736
792
|
def first_time(&block)
|
737
|
-
|
738
|
-
meta.send :define_method, :first_time, &block
|
793
|
+
module_callbacks << Callback.new(:first_time, self.name, [], block)
|
739
794
|
end
|
740
795
|
|
741
796
|
# This block is called once for the project with the project instance,
|
742
797
|
# right before running the project definition. You can use this to add
|
743
798
|
# tasks and set properties that will be used in the project definition.
|
744
|
-
|
745
|
-
|
799
|
+
#
|
800
|
+
# The block may be named and dependencies may be declared similar to Rake
|
801
|
+
# task dependencies:
|
802
|
+
#
|
803
|
+
# before_define(:my_setup) do |project|
|
804
|
+
# # do stuff on project
|
805
|
+
# end
|
806
|
+
#
|
807
|
+
# # my_setup code must run before :compile
|
808
|
+
# before_define(:compile => :my_setup)
|
809
|
+
#
|
810
|
+
def before_define(*args, &block)
|
811
|
+
if args.empty?
|
812
|
+
name = self.name
|
813
|
+
deps = []
|
814
|
+
else
|
815
|
+
name, args, deps = Buildr.application.resolve_args(args)
|
816
|
+
end
|
817
|
+
module_callbacks << Callback.new(:before_define, name, deps, block)
|
746
818
|
end
|
747
819
|
|
748
820
|
# This block is called once for the project with the project instance,
|
749
821
|
# right after running the project definition. You can use this to do
|
750
822
|
# any post-processing that depends on the project definition.
|
751
|
-
|
752
|
-
|
823
|
+
#
|
824
|
+
# The block may be named and dependencies may be declared similar to Rake
|
825
|
+
# task dependencies:
|
826
|
+
#
|
827
|
+
# after_define(:my_setup) do |project|
|
828
|
+
# # do stuff on project
|
829
|
+
# end
|
830
|
+
#
|
831
|
+
# # my_setup code must run before :compile (but only after project is defined)
|
832
|
+
# after_define(:compile => :my_setup)
|
833
|
+
#
|
834
|
+
def after_define(*args, &block)
|
835
|
+
if args.empty?
|
836
|
+
name = self.name
|
837
|
+
deps = []
|
838
|
+
else
|
839
|
+
name, args, deps = Buildr.application.resolve_args(args)
|
840
|
+
end
|
841
|
+
module_callbacks << Callback.new(:after_define, name, deps, block)
|
753
842
|
end
|
754
843
|
|
755
844
|
private
|
756
845
|
|
757
|
-
def
|
758
|
-
|
846
|
+
def module_callbacks
|
847
|
+
begin
|
848
|
+
const_get('Callbacks')
|
849
|
+
rescue
|
850
|
+
callbacks = []
|
851
|
+
const_set('Callbacks', callbacks)
|
852
|
+
end
|
759
853
|
end
|
760
854
|
|
855
|
+
def merge_callbacks(base, merge)
|
856
|
+
# index by phase and name
|
857
|
+
index = base.inject({}) { |hash,cb| { [cb.phase, cb.name] => cb } }
|
858
|
+
merge.each do |cb|
|
859
|
+
existing = index[[cb.phase, cb.name]]
|
860
|
+
if existing
|
861
|
+
base[base.index(existing)] = existing.merge(cb)
|
862
|
+
else
|
863
|
+
base << cb
|
864
|
+
end
|
865
|
+
index[[cb.phase, cb.name]] = cb
|
866
|
+
end
|
867
|
+
base
|
868
|
+
end
|
761
869
|
end
|
762
870
|
|
763
871
|
end
|
data/lib/buildr/core/shell.rb
CHANGED
@@ -22,29 +22,29 @@ module Buildr
|
|
22
22
|
module Shell
|
23
23
|
|
24
24
|
class BeanShell < Base
|
25
|
-
|
25
|
+
|
26
26
|
include JavaRebel
|
27
|
-
|
27
|
+
|
28
28
|
VERSION = '2.0b4'
|
29
29
|
|
30
30
|
class << self
|
31
31
|
def version
|
32
32
|
Buildr.settings.build['bsh'] || VERSION
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def artifact
|
36
36
|
"org.beanshell:bsh:jar:#{version}"
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def lang
|
40
40
|
:java
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def to_sym
|
44
44
|
:bsh
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def launch
|
49
49
|
cp = project.compile.dependencies + [project.path_to(:target, :classes), Buildr.artifact(BeanShell.artifact)]
|
50
50
|
Java::Commands.java 'bsh.Console', {
|
@@ -53,32 +53,32 @@ module Buildr
|
|
53
53
|
:java_args => rebel_args
|
54
54
|
}
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
end # BeanShell
|
58
58
|
|
59
|
-
|
59
|
+
|
60
60
|
class JIRB < Base
|
61
61
|
include JavaRebel
|
62
|
-
|
63
|
-
JRUBY_VERSION = '1.
|
64
|
-
|
65
|
-
class << self
|
62
|
+
|
63
|
+
JRUBY_VERSION = '1.4.0'
|
64
|
+
|
65
|
+
class << self
|
66
66
|
def lang
|
67
67
|
:none
|
68
68
|
end
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
def launch
|
72
72
|
if jruby_home # if JRuby is installed, use it
|
73
|
-
cp = project.compile.dependencies +
|
73
|
+
cp = project.compile.dependencies +
|
74
74
|
[project.path_to(:target, :classes)] +
|
75
75
|
Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}*.jar")
|
76
|
-
|
76
|
+
|
77
77
|
props = {
|
78
78
|
'jruby.home' => jruby_home,
|
79
79
|
'jruby.lib' => "#{jruby_home}#{File::SEPARATOR}lib"
|
80
80
|
}
|
81
|
-
|
81
|
+
|
82
82
|
if not Util.win_os?
|
83
83
|
uname = `uname -m`
|
84
84
|
cpu = if uname =~ /i[34567]86/
|
@@ -88,24 +88,24 @@ module Buildr
|
|
88
88
|
elsif uname =~ /amd64|x86_64/
|
89
89
|
'amd64'
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
os = `uname -s | tr '[A-Z]' '[a-z]'`
|
93
93
|
path = if os == 'darwin'
|
94
94
|
'darwin'
|
95
95
|
else
|
96
96
|
"#{os}-#{cpu}"
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
props['jna.boot.library.path'] = "#{jruby_home}/lib/native/#{path}"
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
props['jruby.script'] = if Util.win_os? then 'jruby.bat' else 'jruby' end
|
103
103
|
props['jruby.shell'] = if Util.win_os? then 'cmd.exe' else '/bin/sh' end
|
104
|
-
|
104
|
+
|
105
105
|
args = [
|
106
106
|
"-Xbootclasspath/a:#{Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}jruby*.jar").join File::PATH_SEPARATOR}"
|
107
107
|
]
|
108
|
-
|
108
|
+
|
109
109
|
Java::Commands.java 'org.jruby.Main', "#{jruby_home}#{File::SEPARATOR}bin#{File::SEPARATOR}jirb", {
|
110
110
|
:properties => props.merge(rebel_props(project)),
|
111
111
|
:classpath => cp,
|
@@ -116,7 +116,7 @@ module Buildr
|
|
116
116
|
jruby_artifact,
|
117
117
|
project.path_to(:target, :classes)
|
118
118
|
]
|
119
|
-
|
119
|
+
|
120
120
|
Java::Commands.java 'org.jruby.Main', '--command', 'irb', {
|
121
121
|
:properties => rebel_props(project),
|
122
122
|
:classpath => cp,
|
@@ -133,33 +133,33 @@ module Buildr
|
|
133
133
|
version = Buildr.settings.build['jruby'] || JRUBY_VERSION
|
134
134
|
"org.jruby:jruby-complete:jar:#{version}"
|
135
135
|
end
|
136
|
-
|
136
|
+
|
137
137
|
end
|
138
|
-
|
138
|
+
|
139
139
|
class Clojure < Base
|
140
140
|
include JavaRebel
|
141
|
-
|
141
|
+
|
142
142
|
JLINE_VERSION = '0.9.94'
|
143
|
-
|
143
|
+
|
144
144
|
class << self
|
145
145
|
def lang
|
146
146
|
:none
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
def to_sym
|
150
150
|
:clj # more common than `clojure`
|
151
151
|
end
|
152
152
|
end
|
153
|
-
|
153
|
+
|
154
154
|
# don't build if it's *only* Clojure sources
|
155
155
|
def build?
|
156
156
|
!has_source?(:clojure) or has_source?(:java) or has_source?(:scala) or has_source?(:groovy)
|
157
157
|
end
|
158
|
-
|
158
|
+
|
159
159
|
def launch
|
160
160
|
fail 'Are we forgetting something? CLOJURE_HOME not set.' unless clojure_home
|
161
|
-
|
162
|
-
cp = project.compile.dependencies +
|
161
|
+
|
162
|
+
cp = project.compile.dependencies +
|
163
163
|
[
|
164
164
|
if build?
|
165
165
|
project.path_to(:target, :classes)
|
@@ -169,7 +169,7 @@ module Buildr
|
|
169
169
|
File.expand_path('clojure.jar', clojure_home),
|
170
170
|
'jline:jline:jar:0.9.94'
|
171
171
|
]
|
172
|
-
|
172
|
+
|
173
173
|
if build?
|
174
174
|
Java::Commands.java 'jline.ConsoleRunner', 'clojure.lang.Repl', {
|
175
175
|
:properties => rebel_props(project),
|
@@ -180,12 +180,12 @@ module Buildr
|
|
180
180
|
Java::Commands.java 'jline.ConsoleRunner', 'clojure.lang.Repl', :classpath => cp
|
181
181
|
end
|
182
182
|
end
|
183
|
-
|
183
|
+
|
184
184
|
private
|
185
185
|
def clojure_home
|
186
186
|
@home ||= ENV['CLOJURE_HOME']
|
187
187
|
end
|
188
|
-
|
188
|
+
|
189
189
|
def has_source?(lang)
|
190
190
|
File.exists? project.path_to(:src, :main, lang)
|
191
191
|
end
|