buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toulm...@apache.org
Subject svn commit: r998372 - in /buildr/trunk: CHANGELOG lib/buildr/java/commands.rb spec/java/commands_spec.rb
Date Sat, 18 Sep 2010 00:12:51 GMT
Author: toulmean
Date: Sat Sep 18 00:12:51 2010
New Revision: 998372

URL: http://svn.apache.org/viewvc?rev=998372&view=rev
Log:
BUILDR-482: Javadoc : cannot load class java.com.sun.tools.javadoc.Main

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/java/commands.rb
    buildr/trunk/spec/java/commands_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=998372&r1=998371&r2=998372&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sat Sep 18 00:12:51 2010
@@ -33,6 +33,7 @@
 * Fixed:  BUILDR-477 Error while parsing maven-metadata.xml
 * Fixed:  BUILDR-479 Enforce using a minimal version of jruby
 * Fixed:  BUILDR-481 Antwrap monkey-patching in core.rb
+* Fixed:  BUILDR-482 Javadoc : cannot load class java.com.sun.tools.javadoc.Main
 * Fixed:  BUILDR-488 artifact poms not reinstalled
 * Fixed:  BUILDR-491 sftp download goes into infinite loop
 * Fixed:  BUILDR-498 Artifact download fails with "negative argument" if 

Modified: buildr/trunk/lib/buildr/java/commands.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/commands.rb?rev=998372&r1=998371&r2=998372&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/commands.rb (original)
+++ buildr/trunk/lib/buildr/java/commands.rb Sat Sep 18 00:12:51 2010
@@ -181,8 +181,10 @@ module Java
             cmd_args << "-#{option}" << paths.flatten.map(&:to_s).join(File::PATH_SEPARATOR)
unless paths.empty?
           end
         end
-        cmd_args += args.flatten.uniq
+        files = args.each {|arg| arg.invoke if arg.respond_to?(:invoke)}.collect {|arg| arg.is_a?(Project)
? Dir["#{arg.compile.sources}/**/*.java"] : arg }
+        cmd_args += files.flatten.uniq.map(&:to_s)
         name = options[:name] || Dir.pwd
+        fail "No output defined for javadoc" if options[:output].nil?
         unless Buildr.application.options.dryrun
           info "Generating Javadoc for #{name}"
           trace (['javadoc'] + cmd_args).join(' ')

Modified: buildr/trunk/spec/java/commands_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/commands_spec.rb?rev=998372&r1=998371&r2=998372&view=diff
==============================================================================
--- buildr/trunk/spec/java/commands_spec.rb (original)
+++ buildr/trunk/spec/java/commands_spec.rb Sat Sep 18 00:12:51 2010
@@ -61,4 +61,33 @@ BUILD
       lambda { Java::Commands.javac("Foo.java", :classpath => File.expand_path("lib"))
}.should change {File.exist?("Foo.class")}.to(true)
     end
   end
+  
+  describe "Java::Commands.javadoc" do
+    
+    it "should fail if no output is defined" do
+      lambda { Java::Commands.javadoc("Foo.java") }.should raise_error(/No output defined
for javadoc/)
+    end
+    
+    it "should create javadoc" do
+      write "Foo.java", "public class Foo {}"
+      lambda { Java::Commands.javadoc("Foo.java", :output => "doc") }.should change {File.exist?("doc/Foo.html")}.to(true)
+    end
+    
+    it "should accept file tasks as arguments" do
+      foo = file("Foo.java") do |file|
+        file.enhance do
+          write file.to_s, "public class Foo {}"
+        end
+      end
+      lambda { Java::Commands.javadoc(foo, :output => "doc") }.should change {File.exist?("doc/Foo.html")}.to(true)
+    end
+      
+    it "should accept projects as arguments" do
+      write "src/main/java/Foo.java", "public class Foo {}"
+      write "src/main/java/bar/Foobar.java", "package bar; public class Foobar {}"
+      define "foo" do
+      end
+      lambda { Java::Commands.javadoc(project("foo"), :output => "doc") }.should change
{File.exist?("doc/Foo.html") && File.exist?("doc/bar/Foobar.html")}.to(true)
+    end
+  end
 end
\ No newline at end of file



Mime
View raw message