buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niklaus Giger (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (BUILDR-641) should allow java files without a class definition (e.g package-info.java)
Date Thu, 03 May 2012 19:18:49 GMT

     [ https://issues.apache.org/jira/browse/BUILDR-641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Niklaus Giger updated BUILDR-641:
---------------------------------

    Description: 
A project with a project-info.java file consisting only of a line like "package java.lang.applet;"
will always get recompiled, as running javac will not create a package-info.class file.
See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles

Rewording the title to 'should allow java files without a class definition', as there are
may be other (pathological) cases where a *.java file consists only of comments.

  was:
A project with a project-info.java file consisting only of a line like "package java.lang.applet;"
will always get recompiled, as running javac will not create a package-info.class file.
See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles


        Summary: should allow java files without a class definition (e.g package-info.java)
 (was: Dependency resolution for java should ignore package-info.java)



diff --git a/spec/core/compile_spec.rb b/spec/core/compile_spec.rb
index 05a45d4..8caa162 100644
--- a/spec/core/compile_spec.rb
+++ b/spec/core/compile_spec.rb
@@ -179,6 +179,13 @@ describe Buildr::CompileTask, '#sources' do
     sources.each { |src| file(src.pathmap('classes/thepackage/%n.class')).should exist }
   end
 
+  it 'should allow java files without a class definition' do
+    @sources ||= ['package.java'].map { |f| File.join('src/main/java/thepackage', f) }.
+    each { |src| write src, "package thepackage; " }
+    compile_task.from(File.dirname(sources.first)).into('classes').invoke
+    sources.each { |src| file(src.pathmap('classes/thepackage/%n.class')).should exist }
+  end
+
   it 'should allow directories' do
     compile_task.from(File.dirname(sources.first)).into('classes').invoke
     sources.each { |src| file(src.pathmap('classes/thepackage/%n.class')).should exist }
                
> should allow java files without a class definition (e.g package-info.java)
> --------------------------------------------------------------------------
>
>                 Key: BUILDR-641
>                 URL: https://issues.apache.org/jira/browse/BUILDR-641
>             Project: Buildr
>          Issue Type: Bug
>          Components: Compilers
>    Affects Versions: 1.4.6
>            Reporter: Niklaus Giger
>
> A project with a project-info.java file consisting only of a line like "package java.lang.applet;"
will always get recompiled, as running javac will not create a package-info.class file.
> See http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles
> Rewording the title to 'should allow java files without a class definition', as there
are may be other (pathological) cases where a *.java file consists only of comments.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message