You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/01/20 12:28:53 UTC

svn commit: r613535 - in /incubator/buildr/trunk: doc/pages/ lib/buildr/ lib/core/ lib/java/ spec/

Author: assaf
Date: Sun Jan 20 03:28:46 2008
New Revision: 613535

URL: http://svn.apache.org/viewvc?rev=613535&view=rev
Log:
Freeze/unfreeze are now tasks, and some bug fixes discovered when building Ode

Modified:
    incubator/buildr/trunk/doc/pages/download.textile
    incubator/buildr/trunk/lib/buildr/cobertura.rb
    incubator/buildr/trunk/lib/buildr/openjpa.rb
    incubator/buildr/trunk/lib/buildr/xmlbeans.rb
    incubator/buildr/trunk/lib/core/application.rb
    incubator/buildr/trunk/lib/core/compile.rb
    incubator/buildr/trunk/lib/core/help.rb
    incubator/buildr/trunk/lib/core/project.rb
    incubator/buildr/trunk/lib/core/test.rb
    incubator/buildr/trunk/lib/java/ant.rb
    incubator/buildr/trunk/lib/java/compilers.rb
    incubator/buildr/trunk/lib/java/java.rb
    incubator/buildr/trunk/lib/java/packaging.rb
    incubator/buildr/trunk/lib/java/test_frameworks.rb
    incubator/buildr/trunk/spec/transport_spec.rb

Modified: incubator/buildr/trunk/doc/pages/download.textile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/pages/download.textile?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/pages/download.textile (original)
+++ incubator/buildr/trunk/doc/pages/download.textile Sun Jan 20 03:28:46 2008
@@ -25,6 +25,12 @@
 
 Other distributions may use different package manages, like @yum@ and @emerge@.
 
+We recommend you first upgrade to the latest version of Ruby gems:
+
+{{{!sh
+$ sudo gem update --system
+}}}
+
 Before installing Buildr, please set the @JAVA_HOME@ environment variable to
 point to your JDK distribution.  Next, use Ruby Gem to install Buildr:
 
@@ -57,6 +63,19 @@
 recent version of Ruby and Ruby Gems (see "Building Ruby on
 OS/X":http://hivelogic.com/narrative/articles/ruby-rails-mongrel-mysql-osx)
 
+We recommend you first upgrade to the latest version of Ruby gems:
+
+{{{!sh
+$ sudo gem update --system
+}}}
+
+Before installing Buildr, please set the @JAVA_HOME@ environment variable to
+point to your JDK distribution, typically with:
+
+{{{!sh
+$ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
+}}}
+
 To install Buildr:
 
 {{{!sh
@@ -86,6 +105,12 @@
 If you don't already have Ruby installed, now is the time to do it.  The
 easiest way to install Ruby is using the "one-click
 installer":http://rubyinstaller.rubyforge.org/.
+
+We recommend you first upgrade to the latest version of Ruby gems:
+
+{{{!sh
+$ sudo gem update --system
+}}}
 
 Before installing Buildr, please set the @JAVA_HOME@ environment variable to
 point to your JDK distribution.  Next, use Ruby Gem to install Buildr:

Modified: incubator/buildr/trunk/lib/buildr/cobertura.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/cobertura.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/cobertura.rb (original)
+++ incubator/buildr/trunk/lib/buildr/cobertura.rb Sun Jan 20 03:28:46 2008
@@ -42,7 +42,7 @@
             # We now have two target directories with bytecode. It would make sense to remove compile.target
             # and add instrumented instead, but apparently Cobertura only creates some of the classes, so
             # we need both directories and instrumented must come first.
-            project.test.classpath.unshift instrumented
+            project.test.dependencies.unshift instrumented
             project.test.with requires
             project.test.options[:properties]["net.sourceforge.cobertura.datafile"] = data_file
             project.clean { rm_rf instrumented.to_s, :verbose=>false }

Modified: incubator/buildr/trunk/lib/buildr/openjpa.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/openjpa.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/openjpa.rb (original)
+++ incubator/buildr/trunk/lib/buildr/openjpa.rb Sun Jan 20 03:28:46 2008
@@ -7,7 +7,7 @@
 
     VERSION = "1.0.1"
 
-    REQUIRES = [ "org.apache.openjpa:openjpa-all:jar:#{VERSION}",
+    REQUIRES = [ "org.apache.openjpa:openjpa:jar:#{VERSION}",
       "commons-collections:commons-collections:jar:3.1",
       "commons-dbcp:commons-dbcp:jar:1.2.1", 
       "commons-lang:commons-lang:jar:2.1",
@@ -60,7 +60,7 @@
     end
 
     def open_jpa_enhance(options = nil)
-      jpa_options = { :output=>compile.target, :classpath=>compile.classpath,
+      jpa_options = { :output=>compile.target, :classpath=>compile.dependencies,
                       :properties=>path_to(:source, :main, :resources, 'META-INF/persistence.xml') }
       OpenJPA.enhance jpa_options.merge(options || {})
     end

Modified: incubator/buildr/trunk/lib/buildr/xmlbeans.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/xmlbeans.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/xmlbeans.rb (original)
+++ incubator/buildr/trunk/lib/buildr/xmlbeans.rb Sun Jan 20 03:28:46 2008
@@ -46,7 +46,7 @@
         XMLBeans.compile args.flatten, :output=>task.name,
           :javasource=>compile.options.source, :xsb=>compile.target
       end
-      compile.from(generated).with(STAX, XMLBEANS)
+      compile.using(:javac).from(generated).with(STAX, XMLBEANS)
       # Once compiled, we need to copy the generated XSB/XSD and one (magical?) class file
       # into the target directory, or the rest is useless.
       compile do |task|

Modified: incubator/buildr/trunk/lib/core/application.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/application.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/application.rb (original)
+++ incubator/buildr/trunk/lib/core/application.rb Sun Jan 20 03:28:46 2008
@@ -4,47 +4,43 @@
   # since the top-level tasks come from there. When running from +buildr+, we get to load
   # Rake and set everything up, and we use our own Application full of cool Buildr features.
   if defined?(Rake)
-    Rake.application.top_level_tasks.unshift task("buildr:initialize")
+    Rake.application.top_level_tasks.unshift task('buildr:initialize')
   else
 
-    require "rake"
+    require 'rake'
 
     class Application < Rake::Application #:nodoc:
 
-      DEFAULT_BUILDFILES = ["buildfile", "Buildfile"] + DEFAULT_RAKEFILES
+      DEFAULT_BUILDFILES = ['buildfile', 'Buildfile'] + DEFAULT_RAKEFILES
 
       OPTIONS = [     # :nodoc:
-        ['--help',     '-H', GetoptLong::NO_ARGUMENT,
-          "Display this help message."],
-        ['--nosearch', '-N', GetoptLong::NO_ARGUMENT,
-          "Do not search parent directories for the buildfile."],
+        ['--help',     '-h', GetoptLong::NO_ARGUMENT,
+          'Display this help message.'],
+        ['--nosearch', '-n', GetoptLong::NO_ARGUMENT,
+          'Do not search parent directories for the buildfile.'],
         ['--quiet',    '-q', GetoptLong::NO_ARGUMENT,
-          "Do not log messages to standard output."],
+          'Do not log messages to standard output.'],
         ['--buildfile', '-f', GetoptLong::REQUIRED_ARGUMENT,
-          "Use FILE as the buildfile."],
+          'Use FILE as the buildfile.'],
         ['--require',  '-r', GetoptLong::REQUIRED_ARGUMENT,
-          "Require MODULE before executing buildfile."],
+          'Require MODULE before executing buildfile.'],
         ['--trace',    '-t', GetoptLong::NO_ARGUMENT,
-          "Turn on invoke/execute tracing, enable full backtrace."],
-        ['--version',  '-V', GetoptLong::NO_ARGUMENT,
-          "Display the program version."],
+          'Turn on invoke/execute tracing, enable full backtrace.'],
+        ['--version',  '-v', GetoptLong::NO_ARGUMENT,
+          'Display the program version.'],
         ['--environment', '-e', GetoptLong::REQUIRED_ARGUMENT,
-          "Environment name (e.g. development, test, production)."],
-        ['--freeze',   "-F",  GetoptLong::NO_ARGUMENT,
-         "Freezes the Buildfile so it always uses Buildr version #{Buildr::VERSION}"],
-        ['--unfreeze', "-U",  GetoptLong::NO_ARGUMENT,
-         "Unfreezes the Buildfile to use the latest version of Buildr"]
+          'Environment name (e.g. development, test, production).']
       ]
 
       def initialize()
         super
         @rakefiles = DEFAULT_BUILDFILES
-        @name = "Buildr"
+        @name = 'Buildr'
         @requires = []
         opts = GetoptLong.new(*command_line_options)
         opts.each { |opt, value| do_option(opt, value) }
         collect_tasks
-        top_level_tasks.unshift "buildr:initialize"
+        top_level_tasks.unshift 'buildr:initialize'
       end
 
       def run()
@@ -60,34 +56,17 @@
         when '--help'
           help
           exit
-        when "--buildfile"
+        when '--buildfile'
           @rakefiles.clear
           @rakefiles << value
         when '--version'
-          puts "Buildr, version #{Buildr::VERSION}"
+          puts "Buildr #{Buildr::VERSION} #{RUBY_PLATFORM[/java/] && '(JRuby)'}"
           exit
         when '--environment'
           ENV['BUILDR_ENV'] = value
-        when "--freeze" 
-          find_buildfile
-          puts "Freezing the Buildfile so it always uses Buildr version #{Buildr::VERSION}"
-          original = File.read(rakefile)
-          if original =~ /gem\s*(["'])buildr\1/
-            modified = original.sub(/gem\s*(["'])buildr\1\s*,\s*(["']).*\2/, %{gem "buildr", "#{Buildr::VERSION}"})
-          else
-            modified = %{gem "buildr", "#{Buildr::VERSION}"\n} + original
-          end
-          File.open(rakefile, "w") { |file| file.write modified }
-          exit
-        when "--unfreeze"
-          find_buildfile
-          puts "Unfreezing the Buildfile to use the latest version of Buildr from your Gems repository."
-          modified = File.read(rakefile).sub(/^\s*gem\s*(["'])buildr\1.*\n/, "")
-          File.open(rakefile, "w") { |file| file.write modified }
-          exit
-        when "--require"
+        when '--require'
           @requires << value
-        when "--nosearch", "--quiet", "--trace"
+        when '--nosearch', '--quiet', '--trace'
           super
         end
       end
@@ -95,11 +74,11 @@
       def find_buildfile()
         here = Dir.pwd
         while ! have_rakefile
-          Dir.chdir("..")
+          Dir.chdir('..')
           if Dir.pwd == here || options.nosearch
             error = "No Buildfile found (looking for: #{@rakefiles.join(', ')})"
             if STDIN.isatty
-              chdir(original_dir) { task("generate").invoke }
+              chdir(original_dir) { task('generate').invoke }
               exit 1
             else
               raise error
@@ -119,14 +98,14 @@
       def usage()
         puts "Buildr #{Buildr::VERSION} #{RUBY_PLATFORM[/java/] && '(JRuby)'}"
         puts
-        puts "Usage:"
-        puts "  buildr [-f buildfile] {options} targets..."
+        puts 'Usage:'
+        puts '  buildr [-f buildfile] {options} targets...'
       end
 
       def help()
         usage
         puts
-        puts "Options:"
+        puts 'Options:'
         OPTIONS.sort.each do |long, short, mode, desc|
           if mode == GetoptLong::REQUIRED_ARGUMENT
             if desc =~ /\b([A-Z]{2,})\b/
@@ -137,8 +116,8 @@
           printf "      %s\n", desc
         end
         puts
-        puts "For help with your buildfile:"
-        puts "  buildr help"
+        puts 'For help with your buildfile:'
+        puts '  buildr help'
       end
 
       def command_line_options
@@ -157,8 +136,8 @@
     def load_tasks_and_local_files() #:nodoc:
       return false if @build_files
       # Load the settings files.
-      @build_files = [ File.expand_path("buildr.rb", Gem::user_home), "buildr.rb" ].select { |file| File.exist?(file) }
-      @build_files += [ File.expand_path("buildr.rake", Gem::user_home), File.expand_path("buildr.rake") ].
+      @build_files = [ File.expand_path('buildr.rb', Gem::user_home), 'buildr.rb' ].select { |file| File.exist?(file) }
+      @build_files += [ File.expand_path('buildr.rake', Gem::user_home), File.expand_path('buildr.rake') ].
         select { |file| File.exist?(file) }.each { |file| warn "Please use '#{file.ext('rb')}' instead of '#{file}'" }
       #Load local tasks that can be used in the Buildfile.
       @build_files += Dir["#{Dir.pwd}/tasks/*.rake"]
@@ -179,7 +158,7 @@
       [Rake.application.rakefile].compact + @build_files
     end
 
-    task "buildr:initialize" do
+    task 'buildr:initialize' do
       Buildr.load_tasks_and_local_files
     end
 

Modified: incubator/buildr/trunk/lib/core/compile.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/compile.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/compile.rb (original)
+++ incubator/buildr/trunk/lib/core/compile.rb Sun Jan 20 03:28:46 2008
@@ -190,7 +190,7 @@
           raise 'No compiler selected and can\'t determine which compiler to use' unless compiler
           raise 'No target directory specified' unless target
           mkpath target.to_s, :verbose=>false
-          puts "Compiling #{task.name}" if verbose
+          puts "Compiling #{task.name.gsub(/:[^:]*$/, '')}" if verbose
           @compiler.compile(sources.map(&:to_s), target.to_s, dependencies.map(&:to_s))
           # By touching the target we let other tasks know we did something,
           # and also prevent recompiling again for dependencies.
@@ -439,7 +439,11 @@
     end
 
     after_define do |project|
-      file(project.resources.target.to_s => project.resources) if project.resources.target
+      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

Modified: incubator/buildr/trunk/lib/core/help.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/help.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/help.rb (original)
+++ incubator/buildr/trunk/lib/core/help.rb Sun Jan 20 03:28:46 2008
@@ -1,68 +1,42 @@
-require "core/common"
-require "core/project"
+require 'core/common'
+require 'core/project'
 
 module Buildr
-  module Help
-
-    class Topic
-
-      def initialize(content = nil, &proc)
-        @content, @proc = content, @proc
-      end
-
-      def content
-        @content ||= @proc.call if @proc
-      end
-
-      def content=(content)
-        @content = content
-      end
-
-      def match(against)
-        nil
-      end
-
-    end
-
-    class Main < Topic
-     
-      def initialize
-        @texters = []
-      end
-
-      def content
-        @texters.each { |texter| texter.call }.join("\n")
-      end
-
-      def <<(&texter)
-        @texters << texter
-      end
-
-    end
 
+  module Help #:nodoc:
     class << self
 
-      def topics
-        @topics ||= { 'main'=>Main.new }
+      def <<(arg)
+        if arg.respond_to?(:call) 
+          texters << arg
+        else
+          texters << lambda { arg }
+        end
       end
 
-      def topic(name)
-        topics[name]
+      def to_s
+        texters.map(&:call).join("\n")
       end
 
-      def match(against)
-        topic = topics[against]
-        content = [topic && topic.content]
-        topics.inject(content) { |content, (name, topic)| topic.match(aginst) }.compact
+    protected
+      def texters
+        @texters ||= []
       end
 
     end
+  end
 
+  class << self
+    def help(&block)
+      Help << block if block_given?
+      Help
+    end
   end
+
 end
 
 
-task "help" do
+task 'help' do
   # Greeater.
   Rake.application.usage
   puts
@@ -70,7 +44,7 @@
   # Show only the top-level projects.
   projects.reject(&:parent).tap do |top_level|
     unless top_level.empty?
-      puts "Top-level projects (buildr help:projects for full list):"
+      puts 'Top-level projects (buildr help:projects for full list):'
       width = [top_level.map(&:name).map(&:size), 20].flatten.max
       top_level.each do |project|
         puts project.comment.blank? ? project.name : ("  %-#{width}s  # %s" % [project.name, project.comment])
@@ -80,11 +54,12 @@
   end
 
   # Show all the top-level tasks, excluding projects.
-  puts "Common tasks:"
-  task("help:tasks").invoke
+  puts 'Common tasks:'
+  task('help:tasks').invoke
   puts
-  puts "For help on command line options:"
-  puts "  buildr --help"
+  puts 'For help on command line options:'
+  puts '  buildr --help'
+  puts Buildr.help.to_s
 end
 
 
@@ -96,24 +71,24 @@
   # Use this to enhance the help task, e.g. to print some important information about your build,
   # configuration options, build instructions, etc.
   def help(&block)
-    Buildr.help.topics['main'] << block
+    Buildr.help << block
   end
 
 end
 
 
-namespace "help" do
+namespace 'help' do
 
-  desc "List all projects defined by this buildfile"
-  task "projects" do
+  desc 'List all projects defined by this buildfile'
+  task 'projects' do
     width = projects.map(&:name).map(&:size).max
     projects.each do |project|
       puts project.comment.blank? ? "  #{project.name}" : ("  %-#{width}s  # %s" % [project.name, project.comment])
     end
   end
 
-  desc "List all tasks available from this buildfile"
-  task "tasks" do
+  desc 'List all tasks available from this buildfile'
+  task 'tasks' do
     Rake.application.tasks.select(&:comment).reject { |task| Project === task }.tap do |tasks|
       width = [tasks.map(&:name).map(&:size), 20].flatten.max
       tasks.each do |task|

Modified: incubator/buildr/trunk/lib/core/project.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/project.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/project.rb (original)
+++ incubator/buildr/trunk/lib/core/project.rb Sun Jan 20 03:28:46 2008
@@ -874,6 +874,25 @@
     task 'initialize' do
       projects
     end
+
+    desc "Freezes the Buildfile so it always uses Buildr version #{Buildr::VERSION}"
+    task 'freeze' do
+      puts "Freezing the Buildfile so it always uses Buildr version #{Buildr::VERSION}"
+      original = File.read(Rake.application.rakefile)
+      if original =~ /gem\s*(["'])buildr\1/
+        modified = original.sub(/gem\s*(["'])buildr\1\s*,\s*(["']).*\2/, %{gem "buildr", "#{Buildr::VERSION}"})
+      else
+        modified = %{gem "buildr", "#{Buildr::VERSION}"\n} + original
+      end
+      File.open(Rake.application.rakefile, "w") { |file| file.write modified }
+    end
+
+    desc 'Unfreezes the Buildfile to use the latest version of Buildr'
+    task 'unfreeze' do
+      puts 'Unfreezing the Buildfile to use the latest version of Buildr from your Gems repository.'
+      modified = File.read(Rake.application.rakefile).sub(/^\s*gem\s*(["'])buildr\1.*\n/, "")
+      File.open(Rake.application.rakefile, "w") { |file| file.write modified }
+    end
   end
 
 

Modified: incubator/buildr/trunk/lib/core/test.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/test.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/test.rb (original)
+++ incubator/buildr/trunk/lib/core/test.rb Sun Jan 20 03:28:46 2008
@@ -653,9 +653,7 @@
 
   end
 
-  task('help') do
-    puts <<-HELP
-
+  Buildr.help << <<-HELP
 To run a full build without running any tests:
   buildr test=no
 To run specific test:
@@ -663,7 +661,6 @@
 To run integration tests:
   buildr integration
     HELP
-  end
 
 end
 

Modified: incubator/buildr/trunk/lib/java/ant.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/ant.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/ant.rb (original)
+++ incubator/buildr/trunk/lib/java/ant.rb Sun Jan 20 03:28:46 2008
@@ -45,9 +45,9 @@
 
   include Ant
 
-  task('help') do
-    puts
-    puts "Using Java #{ENV_JAVA['java.version']}, Ant #{Ant::VERSION}."
+  Buildr.help do
+    Java.load
+    "\nUsing Java #{ENV_JAVA['java.version']}, Ant #{Ant::VERSION}."
   end
 
 end

Modified: incubator/buildr/trunk/lib/java/compilers.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/compilers.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/compilers.rb (original)
+++ incubator/buildr/trunk/lib/java/compilers.rb Sun Jan 20 03:28:46 2008
@@ -380,7 +380,7 @@
         classpath = Buildr.artifacts(compile.dependencies).map(&:to_s).each { |t| task(t).invoke }
         cmd_args << '-cp' << classpath.join(File::PATH_SEPARATOR) unless classpath.empty?
         cmd_args += (sources.map(&:to_s) - [task.name]).
-          map { |arg| File.directory?(file) ? FileList["#{file}/**/*.java"] : file }.flatten
+          map { |file| File.directory?(file) ? FileList["#{file}/**/*.java"] : file }.flatten
         unless Rake.application.options.dryrun
           puts 'Running apt' if verbose
           puts (['apt'] + cmd_args).join(' ') if Rake.application.options.trace

Modified: incubator/buildr/trunk/lib/java/java.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/java.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/java.rb (original)
+++ incubator/buildr/trunk/lib/java/java.rb Sun Jan 20 03:28:46 2008
@@ -205,7 +205,7 @@
   # You still need to call Java.load before using any Java code: it resolves, downloads
   # and installs various dependencies that are required on the classpath before calling
   # any Java code (e.g. Ant and its tasks).
-  class Wrapper
+  class JavaWrapper
 
     include Singleton
 
@@ -221,7 +221,7 @@
 
     # *Deprecated:* No longer necessary.
     def setup
-      fail 'Deprecated: This method does not work with the new API'
+      fail 'Deprecated: This method does not work with the new API and is no longer necessary.'
     end
     
     # *Deprecated:* Use Java.load instead.
@@ -229,6 +229,8 @@
       warn_deprecated 'Use Java.load instead.'
       Java.load
     end
+
+    alias :onload :setup
 
     # *Deprecated:* Use Java.pkg.pkg.ClassName to import a Java class.
     def import(class_name)

Modified: incubator/buildr/trunk/lib/java/packaging.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/packaging.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/packaging.rb (original)
+++ incubator/buildr/trunk/lib/java/packaging.rb Sun Jan 20 03:28:46 2008
@@ -480,8 +480,8 @@
       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 unless compile.sources.empty?
-          jar.with resources.target unless resources.sources.empty?
+          jar.with compile.target if compile.target
+          jar.with resources.target if resources.target
         end
       end
 
@@ -490,8 +490,8 @@
           war.with :manifest=>manifest, :meta_inf=>meta_inf
           # Add libraries in WEB-INF lib, and classes in WEB-INF classes
           classes = []
-          classes << compile.target unless compile.sources.empty?
-          classes << resources.target unless resources.sources.empty?
+          classes << compile.target if compile.target
+          classes << resources.target if resources.target
           war.with :classes=>classes
           war.with :libs=>compile.dependencies
           # Add included files, or the webapp directory.
@@ -505,8 +505,8 @@
           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 unless compile.sources.empty?
-          aar.with resources.target unless resources.sources.empty?
+          aar.with compile.target if compile.target
+          aar.with resources.target if resources.target
           aar.with :libs=>compile.dependencies
         end
       end

Modified: incubator/buildr/trunk/lib/java/test_frameworks.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/test_frameworks.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/test_frameworks.rb (original)
+++ incubator/buildr/trunk/lib/java/test_frameworks.rb Sun Jan 20 03:28:46 2008
@@ -1,7 +1,6 @@
 require 'core/build'
 require 'core/compile'
 require 'java/ant'
-require 'core/help'
 
 
 module Buildr

Modified: incubator/buildr/trunk/spec/transport_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/transport_spec.rb?rev=613535&r1=613534&r2=613535&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/transport_spec.rb (original)
+++ incubator/buildr/trunk/spec/transport_spec.rb Sun Jan 20 03:28:46 2008
@@ -200,7 +200,6 @@
 end
 
 
-
 describe URI::HTTP, '#read' do
   before do
     @proxy = 'http://john:smith@myproxy:8080'
@@ -272,5 +271,13 @@
     @http.stub!(:request).and_yield(ok)
     Net::HTTP.should_receive(:new).and_return(@http)
     @uri.read :progress=>true
+  end
+
+  it 'should use HTTP Basic authentication' do
+    Net::HTTP.should_receive(:new).and_return(@http)
+    request = mock('request')
+    Net::HTTP::Get.should_receive(:new).and_return(request)
+    request.should_receive(:basic_auth).with('john', 'secret')
+    URI("http://john:secret@#{@host_domain}").read
   end
 end