Browse Source

Add new 'listfiles' attribute to allow for listing the source files being

handed off to the compiler.
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271591 13f79535-47bb-0310-9956-ffa450edef68
master
Diane Holt 23 years ago
parent
commit
dd2124bdb1
2 changed files with 24 additions and 0 deletions
  1. +3
    -0
      WHATSNEW
  2. +21
    -0
      src/main/org/apache/tools/ant/taskdefs/Javac.java

+ 3
- 0
WHATSNEW View File

@@ -176,6 +176,9 @@ Other changes:


* you can now specify the -sourcepath for <javac> explicitly. * you can now specify the -sourcepath for <javac> explicitly.


* <javac> now supports a new "listfiles" attribute to list the source
files it's handing off to the compiler.

* The compiler implementation for javac can now be chosen on a task by * The compiler implementation for javac can now be chosen on a task by
task basis. Use the new compiler attribute of <javac> to override task basis. Use the new compiler attribute of <javac> to override
the build.compiler property. the build.compiler property.


+ 21
- 0
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -136,6 +136,7 @@ public class Javac extends MatchingTask {
private Vector implementationSpecificArgs = new Vector(); private Vector implementationSpecificArgs = new Vector();


protected boolean failOnError = true; protected boolean failOnError = true;
protected boolean listFiles = false;
protected File[] compileList = new File[0]; protected File[] compileList = new File[0];


private String source; private String source;
@@ -370,6 +371,18 @@ public class Javac extends MatchingTask {
return extdirs.createPath(); return extdirs.createPath();
} }


/**
* List the source files being handed off to the compiler
*/
public void setListfiles(boolean list) {
listFiles = list;
}

/** Get the listfiles flag. */
public boolean getListfiles() {
return listFiles;
}

/** /**
* Throw a BuildException if compilation fails * Throw a BuildException if compilation fails
*/ */
@@ -806,6 +819,14 @@ public class Javac extends MatchingTask {
+ (compileList.length == 1 ? "" : "s") + (compileList.length == 1 ? "" : "s")
+ (destDir != null ? " to " + destDir : "")); + (destDir != null ? " to " + destDir : ""));


if (listFiles) {
for (int i=0 ; i < compileList.length ; i++)
{
String filename = compileList[i].getAbsolutePath();
log(filename) ;
}
}

CompilerAdapter adapter = CompilerAdapter adapter =
CompilerAdapterFactory.getCompiler(compilerImpl, this); CompilerAdapterFactory.getCompiler(compilerImpl, this);




Loading…
Cancel
Save