File file = (File) iter.next();
path.createPathElement().setLocation(file);
if (!isJava5Compile
- && Util.Constants.JAVA5_SRC.equals(file.getName())) {
+ && (Util.Constants.JAVA5_SRC.equals(file.getName())
+ || Util.Constants.JAVA5_TESTSRC.equals(file.getName()))) {
isJava5Compile = true;
}
if (!hasSourceDirectories) {
javac.setSource("1.3");
} else {
javac.setSource("1.5");
- javac.setTarget("1.5");
+ javac.setTarget("1.5");
+ // TODO allow modules to mix 1.5 and prior code by omitting 1.5
// gack if non-java5 and non-testsrc in this build
for (Iterator iter = module.getSrcDirs().iterator(); iter.hasNext();) {
String name = ((File) iter.next()).getName();
if (!Util.Constants.JAVA5_SRC.equals(name)
- && !Util.Constants.TESTSRC.equals(name)) {
+ && !Util.Constants.JAVA5_TESTSRC.equals(name)) {
String m = "modules mixing pre-15 and 15 source are built with -target 1.5";
throw new BuildException(m + ": " + name);
}
File srcDir = (File) iter.next();
String lcname = srcDir.getName().toLowerCase();
if (trimTesting
- && Util.Constants.TESTSRC.equals(lcname)) {
+ && (Util.Constants.TESTSRC.equals(lcname)
+ || Util.Constants.JAVA5_TESTSRC.equals(lcname))) {
iter.remove();
} else if (!Util.JAVA5_VM
- && Util.Constants.JAVA5_SRC.equals(lcname)) {
+ && (Util.Constants.JAVA5_SRC.equals(lcname)
+ || Util.Constants.JAVA5_TESTSRC.equals(lcname))) {
// assume optional for pre-1.5 builds
iter.remove();
}
public static class Constants {
public static final String TESTSRC = "testsrc";
public static final String JAVA5_SRC = "java5-src";
+ public static final String JAVA5_TESTSRC = "java5-testsrc";
}
// XXX quick hack for Java 5 support
public static final boolean JAVA5_VM;