buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r631121 - in /incubator/buildr/trunk: ./ lib/core/ lib/java/ lib/java/org/apache/buildr/ spec/
Date Tue, 26 Feb 2008 08:01:19 GMT
Author: assaf
Date: Tue Feb 26 00:01:18 2008
New Revision: 631121

URL: http://svn.apache.org/viewvc?rev=631121&view=rev
Log:
Now detecting JUnit test cases using @Test annotation

Added:
    incubator/buildr/trunk/KEYS
    incubator/buildr/trunk/buildfile
Modified:
    incubator/buildr/trunk/CHANGELOG
    incubator/buildr/trunk/Rakefile
    incubator/buildr/trunk/lib/core/compile.rb
    incubator/buildr/trunk/lib/core/test.rb
    incubator/buildr/trunk/lib/java/org/apache/buildr/JUnitTestFilter.class
    incubator/buildr/trunk/lib/java/org/apache/buildr/JUnitTestFilter.java
    incubator/buildr/trunk/lib/java/packaging.rb
    incubator/buildr/trunk/spec/compile_spec.rb
    incubator/buildr/trunk/spec/java_test_frameworks_spec.rb
    incubator/buildr/trunk/spec/test_spec.rb

Modified: incubator/buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=631121&r1=631120&r2=631121&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Tue Feb 26 00:01:18 2008
@@ -1,8 +1,6 @@
 1.3.0 (Pending)
 * Added: Cobertura tasks can be invoked for a single project using project name as prefix
to cobetura tasks.
 * Added: Cobertura can exclude specified classes from instrumentation.
-* Fixed: More typos/documentation fixes by Lacton
-* Changed: Upgraded to Antwrap 0.7.0, thanks to Caleb Powel for relicensing under Apache
License.
 * Added: ArchiveTask#clean can be used to remove content from a package. 
 * Added: Groovy compiler.
 * Added: Mechanism to simplify creating extensions (see Extension module).
@@ -14,6 +12,7 @@
 * Added: Consolidated API for RJB and JRuby, replacing the now deprecated JavaWrapper.
 * Added: JRuby 1.1 support (Victor Hugo Borja, Nick Sieger).
 * Added: IDEA 7 task: use buildr idea7x (Shane Witbeck).
+* Changed: Upgraded to Antwrap 0.7.0, thanks to Caleb Powel for relicensing under Apache
License.
 * Changed: Upgraded to Rake 0.8, RSpec 1.1, RJB 1.1, Facets 2.2, OpenJPA 1.0.1.
 * Changed: Resources are now copied to target/resources instead of target/classes, and target/test/resources
instead of target/test-resources.
 * Changed: Test cases are now compiled into target/test/classes instead of target/test-classes.
@@ -26,8 +25,10 @@
 * Changed: JUnit test framework now runs on all classes that extend junit.framework.TestCase.
 * Changed: Scalac compiler now used by the regular compile task, the scalac task is deprecated.
 * Changed: RDoc are now generated using Allison (http://blog.evanweaver.com/files/doc/fauna/allison).
+* Changed: Resource tasks no longer generate target directory if there are no resources to
copy over.
 * Removed: Prepare tasks removed.
 * Removed: All deprecated features since 1.1.  If you've seen warnings before, except the
build to break.
+* Fixed: More typos/documentation fixes by Lacton
 * Fixed: Artifact.pom resolves artifact without classifier, i.e org.testng:testng:jar:jdk15:5.1
uses org.testng:testng:pom:5.1 (Tommy).
 * Fixed: More patches towards JRuby support, courtesy of Vic Borja.
 * Fixed: Error when downloading a file from a server which answers with a response with no
content length.

Added: incubator/buildr/trunk/KEYS
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/KEYS?rev=631121&view=auto
==============================================================================
--- incubator/buildr/trunk/KEYS (added)
+++ incubator/buildr/trunk/KEYS Tue Feb 26 00:01:18 2008
@@ -0,0 +1,119 @@
+This file contains the PGP keys of various developers.
+
+Users: pgp < KEYS
+       gpg --import KEYS
+Developers:
+        pgp -kxa <your name> and append it to this file.
+        (pgpk -ll <your name> && pgpk -xa <your name>) >> this
file.
+        (gpg --list-sigs <your name>
+             && gpg --armor --export <your name>) >> this file.
+
+
+pub   1024D/4A9EA70E 2007-08-27
+uid                  Matthieu Riou (CODE SIGNING KEY) <mriou@apache.org>
+sig 3        4A9EA70E 2007-08-27  Matthieu Riou (CODE SIGNING KEY) <mriou@apache.org>
+sub   2048g/2BB53026 2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OQEZeZywYut4VSwkp7pPVlJQ8AIgxCl8HDtQriHVs
+Fls3Xa/FyXfaeXQVKp9w3WLr5ONMLhUmJxPnG+mvdUJgR6yebKdYZVFpXfwOeMhM
+ZdAYT/Hg7HmfwJpoJONrtlejR1VmNYY1rzb9jVplTqCCm1BDJDsJWUfPkiI7T/bx
+o8l4Rq7hNESfvjGOTO7OwBYkIR0GossAAwUIALvlj5JTYFWoj+u/pa5qovgx702G
+Rrw4dgMiqKdVYWJZahjmUjs9uqCI1nVROKeSHs3j+3kxH8YGHBlkJo/6yicrZpIm
+mO74Abxi0+yjN9T7GpuZ9rYnYNvBSUA5hqEuMGFOeSU8ZznPsG7fBTWhuknxxOrU
+mGjHGOQZXwcq0GSzZwVGkBZ1gIb0a4wwsk86uMubi5bD3I0MSVWh2ZUBZfAr5MPg
+dQ1PI9tib1G6J0JhKY+95yOwujdqrmpBxdRtxN3IMIzpe2nBwlkP9CDNKhJn+sKB
+MRClYk6vHp6Q+W4ikln/P62H0CrOfh3jzAYfNcW/lxlp6ZbsRVrwhr+nM3mISQQY
+EQIACQUCRtMnvQIbDAAKCRD6yNe+Sp6nDppoAJ0ZNcruq5Jc0aZ1yvNLQORewQa7
+WQCgn7JcUG0i3/7Kk4101XIhgfNgXww=
+=dGgn
+-----END PGP PUBLIC KEY BLOCK-----
+
+
+pub   1024D/2EED13CE 2007-05-09
+uid                  Alex Boisvert (CODE SIGNING KEY) <alex.boisvert@gmail.com>
+sig 3        2EED13CE 2007-05-09  Alex Boisvert (CODE SIGNING KEY) <alex.boisvert@gmail.com>
+sub   1024g/54BC5E9F 2007-05-09
+sig          2EED13CE 2007-05-09  Alex Boisvert (CODE SIGNING KEY) <alex.boisvert@gmail.com>
+
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+mQGiBEZCQ80RBACdngN/JZod5XLn8Was2AbSutxP/H5WssX/StS+0BLNRn+FMhtn
+xXKkJwqKtqbKoHzEKK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IACQUCRkJD
+zgIbDAAKCRD2wlUSLu0TzhPzAJ93zO3DP6/fcA1yfbFSSbgLGI7+/wCdFMH1Ptl8
+sGH4v6GYUVHyfKnWKbg=
+=X6Yk
+-----END PGP PUBLIC KEY BLOCK-----
+
+
+pub   1024D/14A8A2BA 2007-06-12
+uid                  Assaf Arkin <assaf@apache.org>
+sig 3        14A8A2BA 2007-06-12  Assaf Arkin <assaf@apache.org>
+sub   2048g/8CA2779E 2007-06-12
+sig          14A8A2BA 2007-06-12  Assaf Arkin <assaf@apache.org>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.7 (GNU/Linux)
+
+mQGiBEZvELsRBADBaOF4FVOIkkzA6XlK4lX8TbV5J3crP4M+1I5BWuKsA5oZYCkX
+ARjYfSC62K2fsTSwGTU6M684M+DOKljhjFhs24bL7Yr/1iAEh1RC+aQJ0HJw8ME4
+yxU/WSez6KzQJ8fV7M6MOg9fwI3pf27USf91cdbjLMdi4mvAIbkA/ECi7wCgveA6
+nXpXF8fsKkr+Ijl5FBWYlA0EAIQRzcX12CkFOtJsGHkzZpcInKZkimBKUxrL0lK0
+/EahOPpWjzHdV64OVspgnFECmipwQBLzNAH16XEb9ikwum0PCKj4BnIgkmFjZfFA
+lHLQTqN+JeSCDHI1vxwPfKh2MOrCbCU3EBQgcWhO/WakK/AXyu9bertGum1oNAc/
+LkFkA/sE1/7A2ZMyQVYxwigcYjI5FpfA3PI/Irxup38bQ4atuQrLx/vLbNrDPStw
+yECB6oo3/acjGDkoEH9dergxyID4aZaGb3vJmtuzNrxJzxIkHepodTN0hXi2kLft
+K0B6Vo6Ufv9eaeHnEf/1460JbDAq7w2g5JTnFkRnnWKet+ghQLQeQXNzYWYgQXJr
+aW4gPGFzc2FmQGFwYWNoZS5vcmc+iGAEExECACAFAkZvELsCGwMGCwkIBwMCBBUC
+CAMEFgIDAQIeAQIXgAAKCRDXkC1vFKiiuoEUAJ9rm/RkZdJSP9bGmcE3cteTa/IG
+JwCeOxg1QVZ0qv6kjOM2RxfaHJeD3EC5Ag0ERm8QuxAIAIeYs8PNbNLFnaXV7Y/N
+UJ07s1D/0+USJwUVJ/SX4AVyx8CYVMXo+lu9le+JeJfVI2dRlbIes2H8o4WevOP8
+k831oUfqgLF8FKjYE/2Gt6vDWRT9kcN/mxTo0NeVhAIEVSI1Nkppj1B+05IXEJvb
+ZaS4GXW/tXXthVTtgHvjEA0maWMMFvUz1HlfEoepzsKTxxiGQJeRIz4hyRE1nuV+
+bUIXItUYBBaj1Y5prQkzI2WjA75hw+4ZeHYM7wgzWP/1MZwylUicvYsEtJeKXZRw
+IZrKZelffcIZB3OZMUQuJyFMcRz5AVgHLuFTfG7yMLTMxWTNa2b09p8l0TnJuhbI
+0g8AAwUH/iAEbtT42jvt+EsJIz37K1yV5RMKA6ApAsbRkNOAwXQgdEqky/c26KBa
+Ug4nAdAUm+5Hkx/R3F2wKsxSWiWneNM93tInQH0xdfHPCICfmyUPzTS0igEktqQw
+AWYpegKNXzKg+SmKJZsME50bgEZCB2zPIp/AHmG4SbI9THYvPjHbQKf0yzIO0dIw
+xPxKI0dFSASg3oebANtLAUIPIV/QLNWhPwxT/Qe3aBNc5rfl7vSkVv7loBHE/1lj
+++MUlrkmzegJAg9u9GSEfoxFjVbK176IdlJoflZnv1pFkGRbBvOaaCVCllLVJMZS
+HlzsreJCFPVgnK3/PMUn2XauF9Y9MjCISQQYEQIACQUCRm8QuwIbDAAKCRDXkC1v
+FKiiuuCjAJ9UhVa0wHAzYXPJatNdgbkHJuQOqgCbB+lDb7ZGGjC9wToAI/ha1Pz+
+T6Y=
+=uoUw
+-----END PGP PUBLIC KEY BLOCK-----

Modified: incubator/buildr/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/Rakefile?rev=631121&r1=631120&r2=631121&view=diff
==============================================================================
--- incubator/buildr/trunk/Rakefile (original)
+++ incubator/buildr/trunk/Rakefile Tue Feb 26 00:01:18 2008
@@ -47,6 +47,13 @@
 
 # Packaging and local installation.
 #
+task 'compile' do
+  say 'Compiling Java libraries ... '
+  `buildr compile`
+  say 'OK'
+end
+task 'package'=>'compile'
+
 ruby_spec = specify(Gem::Platform::RUBY)
 ruby_package = Rake::GemPackageTask.new(ruby_spec) { |pkg| pkg.need_tar = pkg.need_zip =
true }
 
@@ -54,7 +61,7 @@
 jruby_package = Rake::GemPackageTask.new(jruby_spec) { |pkg| pkg.need_tar = pkg.need_zip
= false }
 
 desc 'Install the package locally'
-task :install=>:package do |task|
+task 'install'=>'package' do |task|
   if RUBY_PLATFORM =~ /java/ 
     cmd = %w(jruby -S gem install)
     pkg = jruby_package
@@ -67,7 +74,7 @@
 end
 
 desc 'Uninstall previously installed packaged'
-task :uninstall do |task|
+task 'uninstall' do |task|
   if RUBY_PLATFORM =~ /java/ 
     cmd = %w(jruby -S gem uninstall)
     pkg = jruby_package
@@ -230,15 +237,6 @@
   task 'check' do
     status = `svn status`
     fail "Cannot release unless all local changes are in SVN:\n#{status}" unless status.empty?
-  end
-
-  # Compile Java libraries.
-  task 'prepare' do
-    say 'Compiling Java libraries ... '
-    FileList['lib/**/*.class'].each { |file| rm file }
-    `buildr compile`
-    FileList['lib/**/*.java'].each { |src| fail "Can't find .class file for #{src}!" unless
File.exist?(src.ext('class')) }
-    say 'OK'
   end
 
   # Tests, specs and coverage reports.

Added: incubator/buildr/trunk/buildfile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/buildfile?rev=631121&view=auto
==============================================================================
--- incubator/buildr/trunk/buildfile (added)
+++ incubator/buildr/trunk/buildfile Tue Feb 26 00:01:18 2008
@@ -0,0 +1,9 @@
+require 'buildr/jetty'
+
+options = :javac, { :source=>'1.4', :target=>'1.4', :debug=>false }
+define 'java' do
+  compile.from(FileList['lib/java/**/*.java']).into('lib/java').using(*options).with(Buildr::JUnit::REQUIRES)
+end
+define 'buildr' do
+  compile.from(FileList['lib/buildr/**/*.java']).into('lib/buildr').using(*options).with(Buildr::Jetty::REQUIRES)
+end

Modified: incubator/buildr/trunk/lib/core/compile.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/compile.rb?rev=631121&r1=631120&r2=631121&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/compile.rb (original)
+++ incubator/buildr/trunk/lib/core/compile.rb Tue Feb 26 00:01:18 2008
@@ -14,7 +14,7 @@
 # the License.
 
 
-require "core/common"
+require 'core/common'
 
 module Buildr
 
@@ -199,7 +199,7 @@
   #
   # Likewise, dependencies are invoked before compiling. All dependencies are evaluated as
   # #artifacts, so you can pass artifact specifications and even projects:
-  #   compile.with("module1.jar", "log4j:log4j:jar:1.0", project("foo"))
+  #   compile.with('module1.jar', 'log4j:log4j:jar:1.0', project('foo'))
   #
   # Creates a file task for the target directory, so executing that task as a dependency
will
   # execute the compile task first.
@@ -243,7 +243,7 @@
     # Adds source directories and files to compile, and returns self.
     #
     # For example:
-    #   compile.from("src/java").into("classes").with("module1.jar")
+    #   compile.from('src/java').into('classes').with('module1.jar')
     def from(*sources)  
       @sources |= sources.flatten
       self
@@ -273,7 +273,7 @@
     # tasks, projects, etc. Use this rather than setting the dependencies array directly.
     #
     # For example:
-    #   compile.with("module1.jar", "log4j:log4j:jar:1.0", project("foo"))
+    #   compile.with('module1.jar', 'log4j:log4j:jar:1.0', project('foo'))
     def with(*specs)
       @dependencies |= Buildr.artifacts(specs.flatten).uniq
       self
@@ -306,7 +306,7 @@
     # select the compiler.
     #
     # For example:
-    #   compile.using(:warnings=>true, :source=>"1.5")
+    #   compile.using(:warnings=>true, :source=>'1.5')
     #   compile.using(:scala)
     def using(*args)
       args.pop.each { |key, value| options.send "#{key}=", value } if Hash === args.last
@@ -404,8 +404,7 @@
       super
       @filter = Buildr::Filter.new
       enhance do
-        mkpath target.to_s, :verbose=>false
-        filter.run unless filter.sources.empty?
+        filter.run if target && !sources.empty?
       end
     end
 
@@ -433,7 +432,7 @@
     # Adds additional directories from which to copy resources.
     #
     # For example:
-    #   resources.from _("src/etc')
+    #   resources.from _('src/etc')
     def from(*sources)
       filter.from *sources
       self
@@ -445,17 +444,25 @@
     end
 
     # :call-seq:
-    #   target() => task
+    #   target => task
     #
     # Returns the filter's target directory as a file task.
     def target
+      filter.into @project.path_to(:target, @usage, :resources) unless filter.target || sources.empty?
       filter.target
     end
 
+  protected
+
     def prerequisites #:nodoc:
       super + filter.sources.flatten
     end
 
+    # Associates this task with project and particular usage (:main, :test).
+    def associate_with(project, usage) #:nodoc:
+      @project, @usage = project, usage
+    end
+
   end
 
 
@@ -471,8 +478,8 @@
 
     before_define do |project|
       resources = ResourcesTask.define_task('resources')
+      resources.send :associate_with, project, :main
       project.path_to(:source, :main, :resources).tap { |dir| resources.from dir if File.exist?(dir)
}
-      resources.filter.into project.path_to(:target, :main, :resources)
       resources.filter.using Buildr.profile
 
       compile = CompileTask.define_task('compile'=>resources)
@@ -481,11 +488,12 @@
     end
 
     after_define do |project|
-      if project.resources.target
-        file project.resources.target.to_s=>project.resources do |task|
-          mkpath task.name, :verbose=>false
-        end
-      end
+      # TODO: Is this necessary?
+      #if project.resources.target
+      #  file project.resources.target.to_s=>project.resources do |task|
+      #    mkpath task.name, :verbose=>false
+      #  end
+      #end
       if project.compile.target
         # This comes last because the target path is set inside the project definition.
         project.build project.compile.target
@@ -562,20 +570,20 @@
   class Options
 
     # Returns the debug option (environment variable DEBUG).
-    def debug()
-      (ENV["DEBUG"] || ENV["debug"]) !~ /(no|off|false)/
+    def debug
+      (ENV['DEBUG'] || ENV['debug']) !~ /(no|off|false)/
     end
 
     # Sets the debug option (environment variable DEBUG).
     #
     # You can turn this option off directly, or by setting the environment variable
-    # DEBUG to "no". For example:
+    # DEBUG to +no+. For example:
     #   buildr build DEBUG=no
     #
     # The release tasks runs a build with <tt>DEBUG=no</tt>.
     def debug=(flag)
-      ENV["debug"] = nil
-      ENV["DEBUG"] = flag.to_s
+      ENV['debug'] = nil
+      ENV['DEBUG'] = flag.to_s
     end
 
   end

Modified: incubator/buildr/trunk/lib/core/test.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/test.rb?rev=631121&r1=631120&r2=631121&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/test.rb (original)
+++ incubator/buildr/trunk/lib/core/test.rb Tue Feb 26 00:01:18 2008
@@ -539,8 +539,8 @@
 
       # Similar to the regular resources task but using different paths.
       resources = ResourcesTask.define_task('test:resources')
+      resources.send :associate_with, project, :test
       project.path_to(:src, :test, :resources).tap { |dir| resources.from dir if File.exist?(dir)
}
-      resources.filter.into project.path_to(:target, :test, :resources)
 
       # Similar to the regular compile task but using different paths.
       compile = CompileTask.define_task('test:compile'=>[project.compile, resources])
@@ -555,11 +555,9 @@
       test = project.test
       # Dependency on compiled code, its dependencies and resources.
       test.with project.compile.dependencies
-      test.with Array(project.compile.target) if project.compile.target
-      test.with Array(project.resources.target)
+      test.with [project.compile.target, project.resources.target].compact
       # Dependency on compiled tests and resources.  Dependencies added using with.
-      test.dependencies.concat Array(test.compile.target) if test.compile.target
-      test.dependencies.concat Array(test.resources.target) if test.resources.sources
+      test.dependencies.concat [test.compile.target, test.resources.target].compact
       # Picking up the test frameworks adds further dependencies.
       test.framework
 

Modified: incubator/buildr/trunk/lib/java/org/apache/buildr/JUnitTestFilter.class
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/org/apache/buildr/JUnitTestFilter.class?rev=631121&r1=631120&r2=631121&view=diff
==============================================================================
Binary files - no diff available.

Modified: incubator/buildr/trunk/lib/java/org/apache/buildr/JUnitTestFilter.java
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/org/apache/buildr/JUnitTestFilter.java?rev=631121&r1=631120&r2=631121&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/org/apache/buildr/JUnitTestFilter.java (original)
+++ incubator/buildr/trunk/lib/java/org/apache/buildr/JUnitTestFilter.java Tue Feb 26 00:01:18
2008
@@ -17,6 +17,7 @@
 
 package org.apache.buildr;
 
+import java.lang.reflect.Method;
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
@@ -43,10 +44,20 @@
   public String[] filter(String[] names) throws ClassNotFoundException {
     Vector testCases = new Vector();
     Class testCase = _loader.loadClass("junit.framework.TestCase");
-    for (int i = 0 ; i < names.length ; ++i) {
+    Class annotation = _loader.loadClass("org.junit.Test");
+    for (int i = names.length ; i-- > 0 ;) {
       Class cls = _loader.loadClass(names[i]);
-      if (testCase.isAssignableFrom(cls))
+      if (testCase.isAssignableFrom(cls)) {
         testCases.add(names[i]);
+      } else {
+        Method[] methods = cls.getMethods();
+        for (int j = methods.length ; j-- > 0 ;) {
+          if (methods[j].getAnnotation(annotation) != null) {
+            testCases.add(names[i]);
+            break;
+          }
+        }
+      }
     }
     String[] result = new String[testCases.size()];
     testCases.toArray(result);

Modified: incubator/buildr/trunk/lib/java/packaging.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/packaging.rb?rev=631121&r1=631120&r2=631121&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/packaging.rb (original)
+++ incubator/buildr/trunk/lib/java/packaging.rb Tue Feb 26 00:01:18 2008
@@ -552,8 +552,7 @@
       def package_as_jar(file_name) #:nodoc:
         Java::JarTask.define_task(file_name).tap do |jar|
           jar.with :manifest=>manifest, :meta_inf=>meta_inf
-          jar.with compile.target if compile.target
-          jar.with resources.target if resources.target
+          jar.with [compile.target, resources.target].compact
         end
       end
 
@@ -561,10 +560,7 @@
         Java::WarTask.define_task(file_name).tap do |war|
           war.with :manifest=>manifest, :meta_inf=>meta_inf
           # Add libraries in WEB-INF lib, and classes in WEB-INF classes
-          classes = []
-          classes << compile.target if compile.target
-          classes << resources.target if resources.target
-          war.with :classes=>classes
+          war.with :classes=>[compile.target, resources.target].compact
           war.with :libs=>compile.dependencies
           # Add included files, or the webapp directory.
           webapp = path_to(:source, :main, :webapp)
@@ -577,8 +573,7 @@
           aar.with :manifest=>manifest, :meta_inf=>meta_inf
           aar.with :wsdls=>path_to(:source, :main, :axis2, '*.wsdl')
           aar.with :services_xml=>path_to(:source, :main, :axis2, 'services.xml') 
-          aar.with compile.target if compile.target
-          aar.with resources.target if resources.target
+          aar.with [compile.target, resources.target].compact
           aar.with :libs=>compile.dependencies
         end
       end

Modified: incubator/buildr/trunk/spec/compile_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/compile_spec.rb?rev=631121&r1=631120&r2=631121&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/compile_spec.rb (original)
+++ incubator/buildr/trunk/spec/compile_spec.rb Tue Feb 26 00:01:18 2008
@@ -474,6 +474,10 @@
     define('foo').resources.sources.first.should point_to_path('src/main/resources')
   end
 
+  it 'should include src/main/resources directory only if it exists' do
+    define('foo').resources.sources.should be_empty
+  end
+
   it 'should accept prerequisites' do
     tasks = ['task1', 'task2'].each { |name| task(name) }
     define('foo') { resources 'task1', 'task2' }
@@ -509,6 +513,7 @@
   end
 
   it 'should set target directory to target/resources' do
+    write 'src/main/resources/foo'
     define('foo').resources.target.to_s.should point_to_path('target/resources')
   end
 
@@ -518,8 +523,21 @@
   end
 
   it 'should create file task for target directory' do
-    define('foo').resources.should_receive(:execute)
+    write 'src/main/resources/foo'
+    define 'foo'
     project('foo').file('target/resources').invoke
+    file('target/resources/foo').should exist
+  end
+
+  it 'should copy resources to target directory' do
+    write 'src/main/resources/foo', 'Foo'
+    define('foo').compile.invoke
+    file('target/resources/foo').should contain('Foo')
+  end
+
+  it 'should not create target directory unless there are resources' do
+    define('foo').compile.invoke
+    file('target/resources').should_not exist
   end
 
   it 'should not be recursive' do

Modified: incubator/buildr/trunk/spec/java_test_frameworks_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/java_test_frameworks_spec.rb?rev=631121&r1=631120&r2=631121&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/java_test_frameworks_spec.rb (original)
+++ incubator/buildr/trunk/spec/java_test_frameworks_spec.rb Tue Feb 26 00:01:18 2008
@@ -63,6 +63,20 @@
     project('foo').test.tests.should include('com.example.FirstTest', 'com.example.AnotherOne')
   end
 
+  it 'should include public classes with annotated test cases' do
+    write 'src/test/java/com/example/FirstTest.java', <<-JAVA
+      package com.example;
+      import org.junit.Test;
+      public class FirstTest {
+        public void utilityMethod() { }
+        @Test
+        public void annotated() { }
+      }
+    JAVA
+    define('foo').test.invoke
+    project('foo').test.tests.should include('com.example.FirstTest')
+  end
+
   it 'should ignore classes not extending junit.framework.TestCase' do
     write 'src/test/java/NotATest.java', <<-JAVA
       public class NotATest { }

Modified: incubator/buildr/trunk/spec/test_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/test_spec.rb?rev=631121&r1=631120&r2=631121&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/test_spec.rb (original)
+++ incubator/buildr/trunk/spec/test_spec.rb Tue Feb 26 00:01:18 2008
@@ -49,8 +49,9 @@
   end
 
   it 'should respond to :resources and add prerequisites to test:resources' do
+    file('prereq').should_receive :invoke_prerequisites
     test_task.resources 'prereq'
-    test_task.resources.prerequisites.should include('prereq')
+    test_task.compile.invoke
   end
 
   it 'should respond to :resources and add action for test:resources' do
@@ -188,6 +189,7 @@
   end
 
   it 'should include the main resources target in its dependencies' do
+    write 'src/main/resources/test'
     define('foo').test.dependencies.should include(project('foo').resources.target)
   end
 
@@ -202,6 +204,7 @@
   end
 
   it 'should include the test resources target in its dependencies' do
+    write 'src/test/resources/test'
     define('foo').test.dependencies.should include(project('foo').test.resources.target)
   end
 
@@ -450,7 +453,7 @@
 
 describe Buildr::Project, 'test:resources' do
   it 'should ignore resources unless they exist' do
-    define('foo') { test.resources.sources.should be_empty }
+    define('foo').test.resources.sources.should be_empty
   end
 
   it 'should pick resources from src/test/resources if found' do
@@ -459,7 +462,9 @@
   end
 
   it 'should copy to the resources target directory' do
-    define('foo', :target=>'targeted') { test.resources.target.should eql(file('targeted/test/resources'))
}
+    write 'src/test/resources/foo', 'Foo'
+    define('foo', :target=>'targeted').test.invoke
+    file('targeted/test/resources/foo').should contain('Foo')
   end
 
   it 'should execute alongside compile task' do
@@ -587,7 +592,7 @@
     project('foo').test.tests.should_not include('baz')
   end
 
-  it 'should execute only the named tasts' do
+  it 'should execute only the named tests' do
     write 'src/test/java/TestSomething.java',
       'public class TestSomething extends junit.framework.TestCase { public void testNothing()
{} }'
     write 'src/test/java/TestFails.java', 'class TestFails {}'



Mime
View raw message