You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2010/03/01 05:49:57 UTC

DO NOT REPLY [Bug 48829] New: Javac task only accepts *.java files

https://issues.apache.org/bugzilla/show_bug.cgi?id=48829

           Summary: Javac task only accepts *.java files
           Product: Ant
           Version: unspecified
          Platform: PC
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: andrew@eisenberg.as


The javac task explicitly filters from the compiler all files that do not end
in *.java.

This is a problem for CompilerAdapters classes that can compile more than just
Java, for example compiler adapters for Groovy or AspectJ.  As an example of
where this is important, Eclipse's pde build will soon support custom compiler
adapters to be specified and we have just written one for AspectJ (and will
soon do one for Groovy):

https://bugs.eclipse.org/bugs/show_bug.cgi?id=303960

I propose that the Javac task accept a new attribute such as
sourceFileExtensions that can take a comma separated list of source file
extensions (eg- "*.java,*.aj,*.groovy").  And these are the source file
extensions accepted by the Javac task.

An example is something like this:

<javac destdir="dest"
compiler="org.eclipse.ajdt.core.ant.AJDT_AjcCompilerAdapter"
sourceFileExtensions="*.java,*.aj">
...

And if the sourceFileExtensions attribute is not used, then the default is
*.java (ie- the current behavior).

I believe that this is a fairly small fix to the javac task and if you think
this is a reasonable proposal, I can probably submit a patch.

thanks.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48829] Javac task only accepts *.java files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48829

--- Comment #1 from Antoine Levy-Lambert <an...@apache.org> 2010-03-01 14:05:35 UTC ---
Hello Andrew,

the Eclipse/AspectJ project supplies ant tasks too.

see http://www.eclipse.org/aspectj/doc/released/devguide/antTasks.html

The AspectJ compiler task compiles both java and aspects.

Do you think that there is scope to do things differently/better in Ant ?



Antoine

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48829] Javac task only accepts *.java files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48829

--- Comment #2 from Andrew Eisenberg <an...@eisenberg.as> 2010-03-01 16:57:56 UTC ---
There are several reasons why the iajc task is not sufficient.

1. Eclipse PDE builds do not allow the use of the iajc task, only the javac
task.  This kind of change would allow us to compile aspectj code using the
javac task.  Moreover, this change would allow any language that compiles to
java byte code to be compiled using PDE.

2. The ajc ant task is largely a copy of the javac ant task and so providing
this functionality would make this copied code largely irrelevant.

3. There is the possibility to handle extensible Java compilers.  For example,
groovy-eclipse ships with an extended JDT compiler that also handles groovy
code.  The fix proposed in this bug would allow javac to handle this compiler
as a compiler adapter without the need for a custom ant task.

4. This change would allow new compilers for JVM languages to take advantage of
the full power of the javac task when used with ant, while only implementing a
minimal amount of code.

5. More generally, it seems arbitrary to me that javac would only accept .java
files when there is a proliferation of compilers that produce java byte code
from non-Java code.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48829] Javac task only accepts *.java files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48829

--- Comment #9 from Andrew Eisenberg <an...@eisenberg.as> 2010-11-29 11:35:18 EST ---
Much appreciated...thanks.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48829] Javac task only accepts *.java files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48829

--- Comment #8 from Stefan Bodewig <bo...@apache.org> 2010-11-29 11:30:55 EST ---
and svn revision 1040174 after I finally saved all my Emacs buffers.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48829] Javac task only accepts *.java files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48829

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
            Version|unspecified                 |1.8.0
         Resolution|                            |FIXED
   Target Milestone|---                         |1.8.2

--- Comment #7 from Stefan Bodewig <bo...@apache.org> 2010-11-29 11:29:51 EST ---
I've committed your code with some formatting changes as svn revisions 1040170
,
svn revision 1040171 and svn revision 1040173

I've also removed your @author tag from CompilerAdapterExtension since we have
a
no @author tag policy inside Ant.  Let me know if this is a problem for you.

Thank you for your persistence and the nagging.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48829] Javac task only accepts *.java files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48829

--- Comment #5 from Andrew Eisenberg <an...@eisenberg.as> 2010-08-01 18:55:15 EDT ---
Created an attachment (id=25824)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25824)
First attempt at a patch

Here is a first attempt at a patch.  As described above, I created a
CompilerAdapterExtension interface and made the DefaultCompilerAdapter
implement it.  

I have not tested this yet and the patch is still a little rough (eg- no tests
and little documentation).  I am only submitting this right now to see if this
is a kind of solution that you would accept.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48829] Javac task only accepts *.java files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48829

--- Comment #6 from Andrew Eisenberg <an...@eisenberg.as> 2010-08-07 18:24:54 EDT ---
Just wondering if there is anyone around who can comment on this patch as to
whether or not it is appropriate for the next release.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48829] Javac task only accepts *.java files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48829

--- Comment #4 from Andrew Eisenberg <an...@eisenberg.as> 2010-03-02 18:23:15 UTC ---
(In reply to comment #3)
> Think its more something the compiler adapter should provide; a list of
> filetypes it likes

That sounds like a reasonable way to go, but that would imply changing the
CompilerAdapter interface to require an extra method, something like:

    String[] getSupportedFileExtensions();

The problem here is that adding this would break backwards compatibility for
all those implementors that do not implement DefaultCompilerAdapter. 
Suggestions around this problem are welcome.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48829] Javac task only accepts *.java files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48829

--- Comment #3 from Steve Loughran <st...@apache.org> 2010-03-02 13:20:57 UTC ---
Think its more something the compiler adapter should provide; a list of
filetypes it likes

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.