buildr 1.3.2-java → 1.3.3-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/CHANGELOG +66 -4
  2. data/{README → README.rdoc} +29 -16
  3. data/Rakefile +16 -20
  4. data/_buildr +38 -0
  5. data/addon/buildr/cobertura.rb +49 -45
  6. data/addon/buildr/emma.rb +238 -0
  7. data/addon/buildr/jetty.rb +1 -1
  8. data/addon/buildr/nailgun.rb +585 -661
  9. data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail$Main.class +0 -0
  10. data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail.class +0 -0
  11. data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail.java +0 -0
  12. data/bin/buildr +9 -2
  13. data/buildr.buildfile +53 -0
  14. data/buildr.gemspec +21 -14
  15. data/doc/css/default.css +51 -48
  16. data/doc/css/print.css +60 -55
  17. data/doc/images/favicon.png +0 -0
  18. data/doc/images/growl-icon.tiff +0 -0
  19. data/doc/images/project-structure.png +0 -0
  20. data/doc/pages/artifacts.textile +46 -156
  21. data/doc/pages/building.textile +63 -323
  22. data/doc/pages/contributing.textile +112 -102
  23. data/doc/pages/download.textile +19 -27
  24. data/doc/pages/extending.textile +27 -81
  25. data/doc/pages/getting_started.textile +44 -119
  26. data/doc/pages/index.textile +26 -47
  27. data/doc/pages/languages.textile +407 -0
  28. data/doc/pages/more_stuff.textile +92 -173
  29. data/doc/pages/packaging.textile +71 -239
  30. data/doc/pages/projects.textile +58 -233
  31. data/doc/pages/recipes.textile +19 -43
  32. data/doc/pages/settings_profiles.textile +39 -104
  33. data/doc/pages/testing.textile +41 -304
  34. data/doc/pages/troubleshooting.textile +29 -47
  35. data/doc/pages/whats_new.textile +69 -167
  36. data/doc/print.haml +0 -1
  37. data/doc/print.toc.yaml +1 -0
  38. data/doc/scripts/buildr-git.rb +1 -1
  39. data/doc/site.haml +1 -0
  40. data/doc/site.toc.yaml +8 -5
  41. data/{KEYS → etc/KEYS} +0 -0
  42. data/etc/git-svn-authors +16 -0
  43. data/lib/buildr.rb +2 -5
  44. data/lib/buildr/core/application.rb +192 -98
  45. data/lib/buildr/core/build.rb +140 -91
  46. data/lib/buildr/core/checks.rb +5 -5
  47. data/lib/buildr/core/common.rb +1 -1
  48. data/lib/buildr/core/compile.rb +12 -10
  49. data/lib/buildr/core/filter.rb +151 -46
  50. data/lib/buildr/core/generate.rb +9 -9
  51. data/lib/buildr/core/progressbar.rb +1 -1
  52. data/lib/buildr/core/project.rb +8 -7
  53. data/lib/buildr/core/test.rb +51 -26
  54. data/lib/buildr/core/transports.rb +22 -38
  55. data/lib/buildr/core/util.rb +78 -26
  56. data/lib/buildr/groovy.rb +18 -0
  57. data/lib/buildr/groovy/bdd.rb +105 -0
  58. data/lib/buildr/groovy/compiler.rb +138 -0
  59. data/lib/buildr/ide/eclipse.rb +102 -71
  60. data/lib/buildr/ide/idea.rb +7 -12
  61. data/lib/buildr/ide/idea7x.rb +7 -8
  62. data/lib/buildr/java.rb +4 -7
  63. data/lib/buildr/java/ant.rb +26 -5
  64. data/lib/buildr/java/bdd.rb +449 -0
  65. data/lib/buildr/java/commands.rb +9 -9
  66. data/lib/buildr/java/{compilers.rb → compiler.rb} +8 -90
  67. data/lib/buildr/java/jruby.rb +29 -11
  68. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  69. data/lib/buildr/java/packaging.rb +23 -16
  70. data/lib/buildr/java/pom.rb +1 -1
  71. data/lib/buildr/java/rjb.rb +21 -8
  72. data/lib/buildr/java/test_result.rb +308 -0
  73. data/lib/buildr/java/tests.rb +324 -0
  74. data/lib/buildr/packaging/artifact.rb +12 -11
  75. data/lib/buildr/packaging/artifact_namespace.rb +7 -4
  76. data/lib/buildr/packaging/gems.rb +3 -3
  77. data/lib/buildr/packaging/zip.rb +13 -10
  78. data/lib/buildr/resources/buildr.icns +0 -0
  79. data/lib/buildr/scala.rb +19 -0
  80. data/lib/buildr/scala/compiler.rb +109 -0
  81. data/lib/buildr/scala/tests.rb +203 -0
  82. data/rakelib/apache.rake +71 -45
  83. data/rakelib/doc.rake +2 -2
  84. data/rakelib/package.rake +3 -2
  85. data/rakelib/rspec.rake +23 -21
  86. data/rakelib/setup.rake +34 -9
  87. data/rakelib/stage.rake +4 -1
  88. data/spec/addon/cobertura_spec.rb +77 -0
  89. data/spec/addon/emma_spec.rb +120 -0
  90. data/spec/addon/test_coverage_spec.rb +255 -0
  91. data/spec/{application_spec.rb → core/application_spec.rb} +82 -4
  92. data/spec/{artifact_namespace_spec.rb → core/artifact_namespace_spec.rb} +12 -1
  93. data/spec/core/build_spec.rb +415 -0
  94. data/spec/{checks_spec.rb → core/checks_spec.rb} +2 -2
  95. data/spec/{common_spec.rb → core/common_spec.rb} +119 -30
  96. data/spec/{compile_spec.rb → core/compile_spec.rb} +17 -13
  97. data/spec/core/generate_spec.rb +33 -0
  98. data/spec/{project_spec.rb → core/project_spec.rb} +9 -6
  99. data/spec/{test_spec.rb → core/test_spec.rb} +222 -28
  100. data/spec/{transport_spec.rb → core/transport_spec.rb} +5 -9
  101. data/spec/groovy/bdd_spec.rb +80 -0
  102. data/spec/{groovy_compilers_spec.rb → groovy/compiler_spec.rb} +1 -1
  103. data/spec/ide/eclipse_spec.rb +243 -0
  104. data/spec/{java_spec.rb → java/ant.rb} +7 -17
  105. data/spec/java/bdd_spec.rb +358 -0
  106. data/spec/{java_compilers_spec.rb → java/compiler_spec.rb} +1 -1
  107. data/spec/java/java_spec.rb +88 -0
  108. data/spec/{java_packaging_spec.rb → java/packaging_spec.rb} +65 -4
  109. data/spec/{java_test_frameworks_spec.rb → java/tests_spec.rb} +31 -10
  110. data/spec/{archive_spec.rb → packaging/archive_spec.rb} +12 -2
  111. data/spec/{artifact_spec.rb → packaging/artifact_spec.rb} +12 -5
  112. data/spec/{packaging_helper.rb → packaging/packaging_helper.rb} +0 -0
  113. data/spec/{packaging_spec.rb → packaging/packaging_spec.rb} +1 -1
  114. data/spec/sandbox.rb +22 -5
  115. data/spec/{scala_compilers_spec.rb → scala/compiler_spec.rb} +1 -1
  116. data/spec/{scala_test_frameworks_spec.rb → scala/tests_spec.rb} +11 -12
  117. data/spec/spec_helpers.rb +38 -17
  118. metadata +93 -70
  119. data/lib/buildr/java/bdd_frameworks.rb +0 -265
  120. data/lib/buildr/java/groovyc.rb +0 -137
  121. data/lib/buildr/java/test_frameworks.rb +0 -450
  122. data/spec/build_spec.rb +0 -193
  123. data/spec/java_bdd_frameworks_spec.rb +0 -238
  124. data/spec/spec.opts +0 -6
@@ -47,7 +47,7 @@ module Java
47
47
  cmd_args += (options[:java_args] || (ENV['JAVA_OPTS'] || ENV['JAVA_OPTIONS']).to_s.split).flatten
48
48
  cmd_args += args.flatten.compact
49
49
  unless Buildr.application.options.dryrun
50
- puts "Running #{name}" if verbose
50
+ info "Running #{name}"
51
51
  block = lambda { |ok, res| fail "Failed to execute #{name}, see errors above" unless ok } unless block
52
52
  puts cmd_args.join(' ') if Buildr.application.options.trace
53
53
  cmd_args = cmd_args.map(&:inspect).join(' ') if Util.win_os?
@@ -83,13 +83,13 @@ module Java
83
83
  end
84
84
  cmd_args << '-source' << options[:source] if options[:source]
85
85
  classpath = classpath_from(options)
86
- tools = File.expand_path('lib/tools.jar', ENV['JAVA_HOME']) if ENV['JAVA_HOME']
87
- classpath << tools if tools && File.exist?(tools)
86
+ tools = Java.tools_jar
87
+ classpath << tools if tools
88
88
  cmd_args << '-classpath' << classpath.join(File::PATH_SEPARATOR) unless classpath.empty?
89
89
  cmd_args += files
90
90
  unless Buildr.application.options.dryrun
91
- puts 'Running apt' if verbose
92
- puts (['apt'] + cmd_args).join(' ') if Buildr.application.options.trace
91
+ info 'Running apt'
92
+ trace (['apt'] + cmd_args).join(' ')
93
93
  Java.load
94
94
  Java.com.sun.tools.apt.Main.process(cmd_args.to_java(Java.java.lang.String)) == 0 or
95
95
  fail 'Failed to process annotations, see errors above'
@@ -124,8 +124,8 @@ module Java
124
124
  cmd_args += options[:javac_args].flatten if options[:javac_args]
125
125
  cmd_args += files
126
126
  unless Buildr.application.options.dryrun
127
- puts "Compiling #{files.size} source files in #{name}" if verbose
128
- puts (['javac'] + cmd_args).join(' ') if Buildr.application.options.trace
127
+ info "Compiling #{files.size} source files in #{name}"
128
+ trace (['javac'] + cmd_args).join(' ')
129
129
  Java.load
130
130
  Java.com.sun.tools.javac.Main.compile(cmd_args.to_java(Java.java.lang.String)) == 0 or
131
131
  fail 'Failed to compile, see errors above'
@@ -174,8 +174,8 @@ module Java
174
174
  cmd_args += args.flatten.uniq
175
175
  name = options[:name] || Dir.pwd
176
176
  unless Buildr.application.options.dryrun
177
- puts "Generating Javadoc for #{name}" if verbose
178
- puts (['javadoc'] + cmd_args).join(' ') if Buildr.application.options.trace
177
+ info "Generating Javadoc for #{name}"
178
+ trace (['javadoc'] + cmd_args).join(' ')
179
179
  Java.load
180
180
  Java.com.sun.tools.javadoc.Main.execute(cmd_args.to_java(Java.java.lang.String)) == 0 or
181
181
  fail 'Failed to generate Javadocs, see errors above'
@@ -54,8 +54,8 @@ module Buildr
54
54
  def compile(sources, target, dependencies) #:nodoc:
55
55
  check_options options, OPTIONS
56
56
  cmd_args = []
57
- tools = File.expand_path('lib/tools.jar', ENV['JAVA_HOME']) if ENV['JAVA_HOME']
58
- dependencies << tools if tools && File.exist?(tools)
57
+ # tools.jar contains the Java compiler.
58
+ dependencies << Java.tools_jar if Java.tools_jar
59
59
  cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR) unless dependencies.empty?
60
60
  source_paths = sources.select { |source| File.directory?(source) }
61
61
  cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty?
@@ -63,7 +63,7 @@ module Buildr
63
63
  cmd_args += javac_args
64
64
  cmd_args += files_from_sources(sources)
65
65
  unless Buildr.application.options.dryrun
66
- puts (['javac'] + cmd_args).join(' ') if Buildr.application.options.trace
66
+ trace((['javac'] + cmd_args).join(' '))
67
67
  Java.load
68
68
  Java.com.sun.tools.javac.Main.compile(cmd_args.to_java(Java.java.lang.String)) == 0 or
69
69
  fail 'Failed to compile, see errors above'
@@ -89,88 +89,7 @@ module Buildr
89
89
  end
90
90
 
91
91
  end
92
-
93
-
94
- # Scalac compiler:
95
- # compile.using(:scalac)
96
- # Used by default if .scala files are found in the src/main/scala directory (or src/test/scala)
97
- # and sets the target directory to target/classes (or target/test/classes).
98
- #
99
- # Accepts the following options:
100
- # * :warnings -- Generate warnings if true (opposite of -nowarn).
101
- # * :deprecation -- Output source locations where deprecated APIs are used.
102
- # * :optimise -- Generates faster bytecode by applying optimisations to the program.
103
- # * :target -- Class file compatibility with specified release.
104
- # * :debug -- Generate debugging info.
105
- # * :other -- Array of options to pass to the Scalac compiler as is, e.g. -Xprint-types
106
- class Scalac < Base
107
- class << self
108
- def scala_home
109
- @home ||= ENV['SCALA_HOME']
110
- end
111
-
112
- def dependencies
113
- [ 'scala-library.jar', 'scala-compiler.jar'].map { |jar| File.expand_path("lib/#{jar}", scala_home) }
114
- end
115
-
116
- def use_fsc
117
- ENV["USE_FSC"] =~ /^(yes|on|true)$/i
118
- end
119
- end
120
-
121
- OPTIONS = [:warnings, :deprecation, :optimise, :target, :debug, :other]
122
- Java.classpath << dependencies
123
-
124
- specify :language=>:scala, :target=>'classes', :target_ext=>'class', :packaging=>:jar
125
-
126
- def initialize(project, options) #:nodoc:
127
- super
128
- options[:debug] = Buildr.options.debug if options[:debug].nil?
129
- options[:warnings] = verbose if options[:warnings].nil?
130
- options[:deprecation] ||= false
131
- options[:optimise] ||= false
132
- end
133
-
134
- def compile(sources, target, dependencies) #:nodoc:
135
- check_options options, OPTIONS
136
-
137
- cmd_args = []
138
- cmd_args << '-classpath' << (dependencies + Scalac.dependencies).join(File::PATH_SEPARATOR)
139
- source_paths = sources.select { |source| File.directory?(source) }
140
- cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty?
141
- cmd_args << '-d' << File.expand_path(target)
142
- cmd_args += scalac_args
143
- cmd_args += files_from_sources(sources)
144
-
145
- unless Buildr.application.options.dryrun
146
- Scalac.scala_home or fail 'Are we forgetting something? SCALA_HOME not set.'
147
- puts (['scalac'] + cmd_args).join(' ') if Buildr.application.options.trace
148
- if Scalac.use_fsc
149
- system(([File.expand_path('bin/fsc', Scalac.scala_home)] + cmd_args).join(' ')) or
150
- fail 'Failed to compile, see errors above'
151
- else
152
- Java.load
153
- Java.scala.tools.nsc.Main.process(cmd_args.to_java(Java.java.lang.String))
154
- fail 'Failed to compile, see errors above' if Java.scala.tools.nsc.Main.reporter.hasErrors
155
- end
156
- end
157
- end
158
-
159
- private
160
-
161
- # Returns Scalac command line arguments from the set of options.
162
- def scalac_args #:nodoc:
163
- args = []
164
- args << "-nowarn" unless options[:warnings]
165
- args << "-verbose" if Buildr.application.options.trace
166
- args << "-g" if options[:debug]
167
- args << "-deprecation" if options[:deprecation]
168
- args << "-optimise" if options[:optimise]
169
- args << "-target:jvm-" + options[:target].to_s if options[:target]
170
- args + Array(options[:other])
171
- end
172
-
173
- end
92
+
174
93
  end
175
94
 
176
95
 
@@ -338,8 +257,8 @@ module Buildr
338
257
  end
339
258
  cmd_args += sources.flatten.uniq
340
259
  unless Buildr.application.options.dryrun
341
- puts "Generating Javadoc for #{name}" if verbose
342
- puts (['javadoc'] + cmd_args).join(' ') if Buildr.application.options.trace
260
+ info "Generating Javadoc for #{name}"
261
+ trace (['javadoc'] + cmd_args).join(' ')
343
262
  Java.load
344
263
  Java.com.sun.tools.javadoc.Main.execute(cmd_args.to_java(Java.java.lang.String)) == 0 or
345
264
  fail 'Failed to generate Javadocs, see errors above'
@@ -410,8 +329,8 @@ module Buildr
410
329
  cmd_args += (sources.map(&:to_s) - [task.name]).
411
330
  map { |file| File.directory?(file) ? FileList["#{file}/**/*.java"] : file }.flatten
412
331
  unless Buildr.application.options.dryrun
413
- puts 'Running apt' if verbose
414
- puts (['apt'] + cmd_args).join(' ') if Buildr.application.options.trace
332
+ info 'Running apt'
333
+ trace (['apt'] + cmd_args).join(' ')
415
334
  Java.com.sun.tools.apt.Main.process(cmd_args.to_java(Java.java.lang.String)) == 0 or
416
335
  fail 'Failed to process annotations, see errors above'
417
336
  end
@@ -423,7 +342,6 @@ module Buildr
423
342
  end
424
343
 
425
344
  Buildr::Compiler << Buildr::Compiler::Javac
426
- Buildr::Compiler << Buildr::Compiler::Scalac
427
345
  class Buildr::Project
428
346
  include Buildr::Javadoc
429
347
  include Buildr::Apt
@@ -56,6 +56,10 @@ require 'jruby'
56
56
  # 4. Check on a clean build with empty local repository.
57
57
  module Java
58
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
+
59
63
  class << self
60
64
 
61
65
  # Returns the classpath, an array listing directories, JAR files and
@@ -67,6 +71,15 @@ module Java
67
71
  def classpath
68
72
  @classpath ||= []
69
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
70
83
 
71
84
  # Loads the JVM and all the libraries listed on the classpath. Call this
72
85
  # method before accessing any Java class, but only call it from methods
@@ -74,22 +87,27 @@ module Java
74
87
  # that append to the classpath and specify which remote repositories to use.
75
88
  def load
76
89
  return self if @loaded
77
- cp = Buildr.artifacts(classpath).map(&:to_s).each { |path| file(path).invoke }
78
- #cp ||= java.lang.System.getProperty('java.class.path').split(':').compact
79
- # Use system ClassLoader to add classpath.
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
80
96
  sysloader = java.lang.ClassLoader.getSystemClassLoader
81
97
  add_url_method = java.lang.Class.forName('java.net.URLClassLoader').
82
- getDeclaredMethod('addURL', [java.net.URL].to_java(java.lang.Class))
98
+ getDeclaredMethod('addURL', [java.net.URL.java_class].to_java(java.lang.Class))
83
99
  add_url_method.setAccessible(true)
84
100
  add_path = lambda { |path| add_url_method.invoke(sysloader, [java.io.File.new(path).toURI.toURL].to_java(java.net.URL)) }
85
- # Include tools (compiler, Javadoc, etc) for all platforms except OS/X.
86
- unless Config::CONFIG['host_os'] =~ /darwin/i
87
- home = ENV['JAVA_HOME'] or fail 'Are we forgetting something? JAVA_HOME not set.'
88
- tools = File.expand_path('lib/tools.jar', home)
89
- raise "Missing #{tools}, perhaps your JAVA_HOME is not correclty set" unless File.file?(tools)
90
- add_path[tools]
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]
91
109
  end
92
- cp.each { |path| add_path[path] }
110
+
93
111
  @loaded = true
94
112
  self
95
113
  end
@@ -0,0 +1,116 @@
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
+ # | \ / _ \ | \| |/ _ \_ _| | __| \_ _|_ _| |_ _| || |_ _/ __|
18
+ # | |) | (_) | | .` | (_) || | | _|| |) | | | | | | | __ || |\__ \
19
+ # |___/ \___/ |_|\_|\___/ |_| |___|___/___| |_| |_| |_||_|___|___/
20
+ #
21
+ # ___ ___ _ ___
22
+ # | __|_ _| | | __| CHANGES TO THIS FILE WILL BE LOST
23
+ # | _| | || |__| _| AUTO-GENERATED BY BUILDR on <%= Time.now %>
24
+ # |_| |___|____|___| PREFER TO EDIT JtestR CONFIGURATION FILE:
25
+ #
26
+ # <%= user_config %>
27
+
28
+ begin
29
+
30
+ <%= jruby_gem %>
31
+ <%= dependencies.map(&:to_s).inspect %>.each { |dep| $CLASSPATH << dep }
32
+ <%= runner.gems.inspect %>.each { |ary| JRuby.gem(*ary.flatten) }
33
+ <%= runner.requires.inspect %>.each { |rb| Kernel.require rb }
34
+
35
+ jtestr = JtestR::TestRunner.new
36
+
37
+ class << jtestr
38
+ def config(&block)
39
+ @config_blocks ||= []
40
+ @config_blocks << block if block
41
+ @config_blocks
42
+ end
43
+
44
+ def load_configuration
45
+ super
46
+ config.each { |block| @configuration.instance_eval(&block) }
47
+ end
48
+ end
49
+
50
+ jtestr.config do
51
+ classpath [] # already loaded
52
+ add_common_classpath false
53
+
54
+ <% ts = ( @jtestr_tests[:junit] & tests ).map { |c| 'Java.' + c } %>
55
+ junit [<%= ts.join(', ') %>]
56
+
57
+ <% ts = ( @jtestr_tests[:testng] & tests ).map { |c| 'Java.' + c } %>
58
+ testng [<%= ts.join(', ') %>]
59
+
60
+ <% ts = @jtestr_tests[:testunit] & tests %>
61
+ test_unit <%= ts.inspect %>
62
+
63
+ <% ts = @jtestr_tests[:story] & tests %>
64
+ story <%= ts.inspect %>
65
+
66
+ <% ts = @jtestr_tests[:rspec] & tests %>
67
+ rspec <%= ts.inspect %>
68
+
69
+ <% ts = @jtestr_tests[:expect] & tests %>
70
+ expectations <%= ts.inspect %>
71
+
72
+ ignore __FILE__
73
+
74
+ if File.file?(<%= user_config.inspect %>)
75
+ ignore <%= user_config.inspect %>
76
+ load <%= user_config.inspect %>
77
+ end
78
+ end # config
79
+
80
+ fake_out = StringIO.new
81
+
82
+ <% if runner.output == false %>
83
+ output = fake_out
84
+ <% elsif runner.output.kind_of?(String) %>
85
+ output = File.open(<%= result.output.inspect %>, 'w')
86
+ <% else %>
87
+ output = STDOUT
88
+ <% end %>
89
+
90
+
91
+ args = [ '<%= spec_dir %>', # the directory to search for jtestr files
92
+ JtestR::SimpleLogger::ERR, # log level
93
+ JtestR::GenericResultHandler::QUIET, #output level
94
+ fake_out, # output STDOUT
95
+ [], # groups to run
96
+ Buildr::TestFramework::TestResult::RSpecResultHandler, # result handler
97
+ [] # classpath
98
+ ]
99
+
100
+ argv = <%= runner.rspec.inspect %> || []
101
+ argv.push *<%= tests.inspect %>
102
+ Buildr::TestFramework::TestResult::RSpecResultHandler.init(argv, output, output)
103
+
104
+ jtestr.run *args
105
+
106
+ rescue => e
107
+ Buildr::TestFramework::TestResult::Error.dump_yaml('<%= runner.result %>', e) rescue \
108
+ puts "-[--- ERROR ---]-", e.class, e.message, *e.backtrace
109
+ end
110
+
111
+ exit 0 # let buildr find the erros from the result yaml
112
+
113
+ # Local Variables:
114
+ # mode: ruby
115
+ # End:
116
+
@@ -31,7 +31,7 @@ module Buildr
31
31
 
32
32
  class << self
33
33
 
34
- # :call_seq:
34
+ # :call-seq:
35
35
  # parse(str) => manifest
36
36
  #
37
37
  # Parse a string in MANIFEST.MF format and return a new Manifest.
@@ -51,7 +51,7 @@ module Buildr
51
51
  }
52
52
  end
53
53
 
54
- # :call_seq:
54
+ # :call-seq:
55
55
  # from_zip(file) => manifest
56
56
  #
57
57
  # Parse the MANIFEST.MF entry of a ZIP (or JAR) file and return a new Manifest.
@@ -62,7 +62,7 @@ module Buildr
62
62
  end
63
63
  end
64
64
 
65
- # :call_seq:
65
+ # :call-seq:
66
66
  # update_manifest(file) { |manifest| ... }
67
67
  #
68
68
  # Updates the MANIFEST.MF entry of a ZIP (or JAR) file. Reads the MANIFEST.MF,
@@ -168,14 +168,14 @@ module Buildr
168
168
  if manifest
169
169
  # Tempfiles gets deleted on garbage collection, so we're going to hold on to it
170
170
  # through instance variable not closure variable.
171
- Tempfile.open 'MANIFEST.MF' do |@manifest_tmp|
172
- self.manifest = File.read(manifest.to_s) if String === manifest || Rake::Task === manifest
173
- self.manifest = Manifest.new(manifest) unless Manifest === manifest
174
- @manifest_tmp.write Manifest::STANDARD_HEADER
175
- @manifest_tmp.write manifest.to_s
176
- @manifest_tmp.write "\n"
177
- path('META-INF').include @manifest_tmp.path, :as=>'MANIFEST.MF'
178
- end
171
+ @manifest_tmp = Tempfile.new('MANIFEST.MF')
172
+ self.manifest = File.read(manifest.to_s) if String === manifest || Rake::Task === manifest
173
+ self.manifest = Manifest.new(manifest) unless Manifest === manifest
174
+ @manifest_tmp.write Manifest::STANDARD_HEADER
175
+ @manifest_tmp.write manifest.to_s
176
+ @manifest_tmp.write "\n"
177
+ @manifest_tmp.rewind
178
+ path('META-INF').include @manifest_tmp.path, :as=>'MANIFEST.MF'
179
179
  end
180
180
  end
181
181
  end
@@ -546,7 +546,7 @@ module Buildr
546
546
  return @descriptor if @descriptor
547
547
  descriptor_path = path_to('META-INF/application.xml')
548
548
  @descriptor = file(descriptor_path) do |task|
549
- puts "Creating EAR Descriptor: #{task.to_s}" if Buildr.application.options.trace
549
+ trace "Creating EAR Descriptor: #{task.to_s}"
550
550
  mkpath File.dirname(task.name), :verbose=>false
551
551
  File.open(task.name, 'w') { |file| file.print task.xml }
552
552
  end
@@ -572,12 +572,19 @@ module Buildr
572
572
 
573
573
  before_define do |project|
574
574
  ::Java.load
575
- project.manifest ||= project.parent && project.parent.manifest ||
576
- { 'Build-By'=>ENV['USER'], 'Build-Jdk'=>ENV_JAVA['java.version'],
575
+ if project.parent && project.parent.manifest
576
+ project.manifest = project.parent.manifest.dup
577
+ else
578
+ project.manifest = {
579
+ 'Build-By'=>ENV['USER'], 'Build-Jdk'=>ENV_JAVA['java.version'],
577
580
  'Implementation-Title'=>project.comment || project.name,
578
581
  'Implementation-Version'=>project.version }
579
- project.meta_inf ||= project.parent && project.parent.meta_inf ||
580
- [project.file('LICENSE')].select { |file| File.exist?(file.to_s) }
582
+ end
583
+ if project.parent && project.parent.meta_inf
584
+ project.meta_inf = project.parent.meta_inf.dup
585
+ else
586
+ project.meta_inf = [project.file('LICENSE')].select { |file| File.exist?(file.to_s) }
587
+ end
581
588
  end
582
589
 
583
590
 
@@ -51,7 +51,7 @@ module Buildr
51
51
  when String
52
52
  filename = File.expand_path(source)
53
53
  unless pom = cache[filename]
54
- puts "Loading m2 pom file from #{filename}" if Buildr.application.options.trace
54
+ trace "Loading m2 pom file from #{filename}"
55
55
  pom = POM.new(IO.read(filename))
56
56
  cache[filename] = pom
57
57
  end