Author: assaf
Date: Wed Aug 27 19:59:10 2008
New Revision: 689705

URL: http://svn.apache.org/viewvc?rev=689705&view=rev
Log:
Fixed: BUILDR-138 ScalaTest premature use of Buildr::Repositories inconsistent 
with customizing locations.

Modified:
    incubator/buildr/trunk/CHANGELOG
    incubator/buildr/trunk/lib/buildr/core/test.rb
    incubator/buildr/trunk/lib/buildr/java/test_frameworks.rb
    incubator/buildr/trunk/spec/sandbox.rb

Modified: incubator/buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=689705&r1=689704&r2=689705&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Wed Aug 27 19:59:10 2008
@@ -37,6 +37,8 @@
           using #options instead of #using (Lacton).
 * Fixed:  Should not display "(in `pwd`, development)" when using --quiet.
 * Fixed:  Release task's regexp to find either THIS_VERSION and VERSION_NUMBER.
+* Fixed:  BUILDR-138 ScalaTest premature use of Buildr::Repositories
+          inconsistent with customizing locations.
 * Docs:   BUILDR-111 Troubleshoot tip when Buildr's bin directory shows up in
           RUBYLIB (Geoffrey Ruscoe).
 

Modified: incubator/buildr/trunk/lib/buildr/core/test.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/test.rb?rev=689705&r1=689704&r2=689705&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/test.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/test.rb Wed Aug 27 19:59:10 2008
@@ -85,7 +85,7 @@
         # Returns a list of dependencies for this framework.  Defaults to 
obtaining a list of
         # artifact specifications from the REQUIRES constant.
         def dependencies
-          @dependencies ||= FileList[*(const_get('REQUIRES') rescue [])]
+          @dependencies ||= Buildr.artifacts(*(const_get('REQUIRES') rescue 
[]))
         end
 
       end

Modified: incubator/buildr/trunk/lib/buildr/java/test_frameworks.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/test_frameworks.rb?rev=689705&r1=689704&r2=689705&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/test_frameworks.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/test_frameworks.rb Wed Aug 27 
19:59:10 2008
@@ -106,6 +106,7 @@
     REQUIRES = ["org.scalacheck:scalacheck:jar:#{VERSION}"]
   end
   
+  
   # JUnit test framework, the default test framework for Java tests.
   #
   # Support the following options:
@@ -300,51 +301,21 @@
   # * :environment -- Hash of environment variables available to the test case.
   # * :java_args   -- Arguments passed as is to the JVM.
   class ScalaTest < TestFramework::Base
+
+    # ScalaTest version number.
+    VERSION = '0.9.3' unless const_defined?('VERSION')
+    # ScalaTest dependencies
+    REQUIRES = ["org.scalatest:scalatest:jar:#{VERSION}"] + 
+                JMock::REQUIRES + 
+                ScalaSpecs::REQUIRES + 
+                ScalaCheck::REQUIRES
     
     class << self
-      # ScalaTest version number.
-      VERSION = '0.9.3' unless const_defined?('VERSION')
-
-      # ScalaTest dependencies
-      DEPENDS = ["org.scalatest:scalatest:jar:#{VERSION}"] + 
-                 JMock::REQUIRES + 
-                 ScalaSpecs::REQUIRES + 
-                 ScalaCheck::REQUIRES
-
-      ENABLED = DEPENDS.all? { |d| 
File.exist?(Buildr::Repositories.instance.locate(d)) } 
-
-      desc "Download Scala artifacts"
-      task "buildr:scala:download" do
-        ScalaTest.download_dependencies
-      end
-        
-      def required_artifacts
-        ENABLED ? DEPENDS : []
-      end
-      
-      def download_dependencies
-        DEPENDS.each { |d| Buildr.artifact(d).invoke }
-      end
-      
       def applies_to?(project) #:nodoc:
-        if project.test.compile.language == :scala && !ENABLED
-          download_dependencies
-          fail "You must re-run buildr after downloading Scala artifacts for 
the first time"
-        end
         project.test.compile.language == :scala
-      end  
-
-      def available?(artifact_spec) #:nodoc:
-        File.exist?(Buildr::Repositories.instance.locate(artifact_spec))
-      end
+      end 
     end
 
-    REQUIRES = required_artifacts
-    
-    # ScalaTest ant task
-    Java.classpath << "org.apache.ant:ant-junit:jar:#{Ant::VERSION}"
-    Java.classpath << REQUIRES
-
     include TestFramework::JavaTest
 
     # annotation-based group inclusion
@@ -367,6 +338,7 @@
     end
 
     def run(tests, dependencies) #:nodoc:
+      self.class.dependencies.each(&:invoke)
       mkpath task.report_to.to_s
       success = []
       scalatest = tests.select { |t| t !~ /Specs?$/ }
@@ -396,7 +368,8 @@
         # Use Ant to execute the ScalaTest task, gives us performance and 
reporting.
         reportFile = File.join(task.report_to.to_s, "TEST-#{suite}.txt")
         Buildr.ant('scalatest') do |ant|
-          ant.taskdef :name=>'scalatest', 
:classname=>'org.scalatest.tools.ScalaTestTask'
+          ant.taskdef :name=>'scalatest', 
:classname=>'org.scalatest.tools.ScalaTestTask',
+            :classpath=>self.class.dependencies.join(File::PATH_SEPARATOR)
           ant.scalatest :runpath=>dependencies.join(File::PATH_SEPARATOR) do
             ant.suite    :classname=>suite
             ant.reporter :type=>'stdout', :config=>reporter_options

Modified: incubator/buildr/trunk/spec/sandbox.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/sandbox.rb?rev=689705&r1=689704&r2=689705&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/sandbox.rb (original)
+++ incubator/buildr/trunk/spec/sandbox.rb Wed Aug 27 19:59:10 2008
@@ -24,7 +24,6 @@
 require 'buildr/java/groovyc'
 Java.load # Anything added to the classpath.
 task('buildr:scala:download').invoke
-Buildr::ScalaTest::ENABLED = true
 artifacts(TestFramework.frameworks.map(&:dependencies).flatten).each { |a| 
file(a).invoke }
 
 ENV['HOME'] = File.expand_path('tmp/home')


Reply via email to