git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277036 13f79535-47bb-0310-9956-ffa450edef68master
@@ -164,13 +164,13 @@ public final class AnsiColorLogger extends DefaultLogger { | |||||
prop.load(in); | prop.load(in); | ||||
} | } | ||||
String err = prop.getProperty("AnsiColorLogger.ERROR_COLOR"); | |||||
String errC = prop.getProperty("AnsiColorLogger.ERROR_COLOR"); | |||||
String warn = prop.getProperty("AnsiColorLogger.WARNING_COLOR"); | String warn = prop.getProperty("AnsiColorLogger.WARNING_COLOR"); | ||||
String info = prop.getProperty("AnsiColorLogger.INFO_COLOR"); | String info = prop.getProperty("AnsiColorLogger.INFO_COLOR"); | ||||
String verbose = prop.getProperty("AnsiColorLogger.VERBOSE_COLOR"); | String verbose = prop.getProperty("AnsiColorLogger.VERBOSE_COLOR"); | ||||
String debug = prop.getProperty("AnsiColorLogger.DEBUG_COLOR"); | String debug = prop.getProperty("AnsiColorLogger.DEBUG_COLOR"); | ||||
if (err != null) { | |||||
errColor = PREFIX + err + SUFFIX; | |||||
if (errC != null) { | |||||
errColor = PREFIX + errC + SUFFIX; | |||||
} | } | ||||
if (warn != null) { | if (warn != null) { | ||||
warnColor = PREFIX + warn + SUFFIX; | warnColor = PREFIX + warn + SUFFIX; | ||||
@@ -397,7 +397,7 @@ public class PropertyFile extends Task { | |||||
*/ | */ | ||||
private void executeInteger(String oldValue) throws BuildException { | private void executeInteger(String oldValue) throws BuildException { | ||||
int currentValue = DEFAULT_INT_VALUE; | int currentValue = DEFAULT_INT_VALUE; | ||||
int newValue = DEFAULT_INT_VALUE; | |||||
int newV = DEFAULT_INT_VALUE; | |||||
DecimalFormat fmt = (pattern != null) ? new DecimalFormat(pattern) | DecimalFormat fmt = (pattern != null) ? new DecimalFormat(pattern) | ||||
@@ -416,7 +416,7 @@ public class PropertyFile extends Task { | |||||
} | } | ||||
if (operation == Operation.EQUALS_OPER) { | if (operation == Operation.EQUALS_OPER) { | ||||
newValue = currentValue; | |||||
newV = currentValue; | |||||
} else { | } else { | ||||
int operationValue = 1; | int operationValue = 1; | ||||
if (value != null) { | if (value != null) { | ||||
@@ -430,13 +430,13 @@ public class PropertyFile extends Task { | |||||
} | } | ||||
if (operation == Operation.INCREMENT_OPER) { | if (operation == Operation.INCREMENT_OPER) { | ||||
newValue = currentValue + operationValue; | |||||
newV = currentValue + operationValue; | |||||
} else if (operation == Operation.DECREMENT_OPER) { | } else if (operation == Operation.DECREMENT_OPER) { | ||||
newValue = currentValue - operationValue; | |||||
newV = currentValue - operationValue; | |||||
} | } | ||||
} | } | ||||
this.newValue = fmt.format(newValue); | |||||
this.newValue = fmt.format(newV); | |||||
} | } | ||||
/** | /** | ||||
@@ -447,7 +447,7 @@ public class PropertyFile extends Task { | |||||
* not contained in the property file. | * not contained in the property file. | ||||
*/ | */ | ||||
private void executeString(String oldValue) throws BuildException { | private void executeString(String oldValue) throws BuildException { | ||||
String newValue = DEFAULT_STRING_VALUE; | |||||
String newV = DEFAULT_STRING_VALUE; | |||||
String currentValue = getCurrentValue(oldValue); | String currentValue = getCurrentValue(oldValue); | ||||
@@ -456,11 +456,11 @@ public class PropertyFile extends Task { | |||||
} | } | ||||
if (operation == Operation.EQUALS_OPER) { | if (operation == Operation.EQUALS_OPER) { | ||||
newValue = currentValue; | |||||
newV = currentValue; | |||||
} else if (operation == Operation.INCREMENT_OPER) { | } else if (operation == Operation.INCREMENT_OPER) { | ||||
newValue = currentValue + value; | |||||
newV = currentValue + value; | |||||
} | } | ||||
this.newValue = newValue; | |||||
this.newValue = newV; | |||||
} | } | ||||
/** | /** | ||||
@@ -422,7 +422,7 @@ public class ReplaceRegExp extends Task { | |||||
pw.flush(); | pw.flush(); | ||||
} else { | } else { | ||||
String buf = fileUtils.readFully(br); | |||||
String buf = FileUtils.readFully(br); | |||||
if (buf == null) { | if (buf == null) { | ||||
buf = ""; | buf = ""; | ||||
} | } | ||||
@@ -28,7 +28,7 @@ import org.apache.tools.ant.types.Commandline; | |||||
*/ | */ | ||||
public class CCMReconfigure extends Continuus { | public class CCMReconfigure extends Continuus { | ||||
private String project = null; | |||||
private String ccmProject = null; | |||||
private boolean recurse = false; | private boolean recurse = false; | ||||
private boolean verbose = false; | private boolean verbose = false; | ||||
@@ -89,7 +89,7 @@ public class CCMReconfigure extends Continuus { | |||||
* @return value of project. | * @return value of project. | ||||
*/ | */ | ||||
public String getCcmProject() { | public String getCcmProject() { | ||||
return project; | |||||
return ccmProject; | |||||
} | } | ||||
/** | /** | ||||
@@ -97,7 +97,7 @@ public class CCMReconfigure extends Continuus { | |||||
* @param v Value to assign to project. | * @param v Value to assign to project. | ||||
*/ | */ | ||||
public void setCcmProject(String v) { | public void setCcmProject(String v) { | ||||
this.project = v; | |||||
this.ccmProject = v; | |||||
} | } | ||||
@@ -54,7 +54,7 @@ public abstract class ClearCase extends Task { | |||||
* @param dir the directory containing the cleartool executable | * @param dir the directory containing the cleartool executable | ||||
*/ | */ | ||||
public final void setClearToolDir(String dir) { | public final void setClearToolDir(String dir) { | ||||
mClearToolDir = getProject().translatePath(dir); | |||||
mClearToolDir = Project.translatePath(dir); | |||||
} | } | ||||
/** | /** | ||||
@@ -149,7 +149,7 @@ public abstract class ClearCase extends Task { | |||||
Commandline.Argument arg = exe.createArg(); | Commandline.Argument arg = exe.createArg(); | ||||
exe.setExecutable(cmdline.getExecutable()); | exe.setExecutable(cmdline.getExecutable()); | ||||
arg.setLine(cmdline.toString(cmdline.getArguments())); | |||||
arg.setLine(Commandline.toString(cmdline.getArguments())); | |||||
exe.setOutputproperty(outV); | exe.setOutputproperty(outV); | ||||
exe.execute(); | exe.execute(); | ||||
// System.out.println( "runS: " + outV + " : " + aProj.getProperty( outV )); | // System.out.println( "runS: " + outV + " : " + aProj.getProperty( outV )); | ||||
@@ -354,16 +354,16 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||||
} | } | ||||
protected DescriptorHandler getDescriptorHandler(File srcDir) { | protected DescriptorHandler getDescriptorHandler(File srcDir) { | ||||
DescriptorHandler handler = new DescriptorHandler(getTask(), srcDir); | |||||
DescriptorHandler h = new DescriptorHandler(getTask(), srcDir); | |||||
registerKnownDTDs(handler); | |||||
registerKnownDTDs(h); | |||||
// register any DTDs supplied by the user | // register any DTDs supplied by the user | ||||
for (Iterator i = getConfig().dtdLocations.iterator(); i.hasNext();) { | for (Iterator i = getConfig().dtdLocations.iterator(); i.hasNext();) { | ||||
EjbJar.DTDLocation dtdLocation = (EjbJar.DTDLocation) i.next(); | EjbJar.DTDLocation dtdLocation = (EjbJar.DTDLocation) i.next(); | ||||
handler.registerDTD(dtdLocation.getPublicId(), dtdLocation.getLocation()); | |||||
h.registerDTD(dtdLocation.getPublicId(), dtdLocation.getLocation()); | |||||
} | } | ||||
return handler; | |||||
return h; | |||||
} | } | ||||
/** | /** | ||||
@@ -392,7 +392,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool { | |||||
// examples = /org/objectweb/fooAppli/foo/Foo-ejb-jar.xml | // examples = /org/objectweb/fooAppli/foo/Foo-ejb-jar.xml | ||||
// examples = /org/objectweb/fooAppli/foo/Foo.xml (JOnAS convention) | // examples = /org/objectweb/fooAppli/foo/Foo.xml (JOnAS convention) | ||||
String jonasDescriptorName; // JOnAS-specific DD | |||||
String jonasDN; // JOnAS-specific DD | |||||
boolean jonasConvention = false; // true if the JOnAS convention is used for the DD | boolean jonasConvention = false; // true if the JOnAS convention is used for the DD | ||||
String path; // Directory path of the EJB descriptor | String path; // Directory path of the EJB descriptor | ||||
String fileName; // EJB descriptor file name | String fileName; // EJB descriptor file name | ||||
@@ -439,15 +439,15 @@ public class JonasDeploymentTool extends GenericDeploymentTool { | |||||
remainder = descriptorName.substring(endOfBaseName + 1); | remainder = descriptorName.substring(endOfBaseName + 1); | ||||
if (jonasConvention) { | if (jonasConvention) { | ||||
jonasDescriptorName = path + "jonas-" + baseName + ".xml"; | |||||
jonasDN = path + "jonas-" + baseName + ".xml"; | |||||
} else { | } else { | ||||
jonasDescriptorName = path + baseName + "jonas-" + remainder; | |||||
jonasDN = path + baseName + "jonas-" + remainder; | |||||
} | } | ||||
log("Standard EJB descriptor name: " + descriptorName, Project.MSG_VERBOSE); | log("Standard EJB descriptor name: " + descriptorName, Project.MSG_VERBOSE); | ||||
log("JOnAS-specific descriptor name: " + jonasDescriptorName, Project.MSG_VERBOSE); | |||||
log("JOnAS-specific descriptor name: " + jonasDN, Project.MSG_VERBOSE); | |||||
return jonasDescriptorName; | |||||
return jonasDN; | |||||
} | } | ||||
protected String getJarBaseName(String descriptorFileName) { | protected String getJarBaseName(String descriptorFileName) { | ||||
@@ -256,9 +256,9 @@ public final class JarLibManifestTask extends Task { | |||||
throws BuildException { | throws BuildException { | ||||
final int size = extensions.size(); | final int size = extensions.size(); | ||||
for (int i = 0; i < size; i++) { | for (int i = 0; i < size; i++) { | ||||
final Extension extension = (Extension) extensions.get(i); | |||||
final Extension ext = (Extension) extensions.get(i); | |||||
final String prefix = listPrefix + i + "-"; | final String prefix = listPrefix + i + "-"; | ||||
Extension.addExtension(extension, prefix, attributes); | |||||
Extension.addExtension(ext, prefix, attributes); | |||||
} | } | ||||
} | } | ||||
@@ -51,7 +51,7 @@ public class JJDoc extends Task { | |||||
private static final String DEFAULT_SUFFIX_TEXT = ".txt"; | private static final String DEFAULT_SUFFIX_TEXT = ".txt"; | ||||
// required attributes | // required attributes | ||||
private File target = null; | |||||
private File targetFile = null; | |||||
private File javaccHome = null; | private File javaccHome = null; | ||||
private CommandlineJava cmdl = new CommandlineJava(); | private CommandlineJava cmdl = new CommandlineJava(); | ||||
@@ -85,7 +85,7 @@ public class JJDoc extends Task { | |||||
* The javacc grammar file to process. | * The javacc grammar file to process. | ||||
*/ | */ | ||||
public void setTarget(File target) { | public void setTarget(File target) { | ||||
this.target = target; | |||||
this.targetFile = target; | |||||
} | } | ||||
/** | /** | ||||
@@ -110,8 +110,8 @@ public class JJDoc extends Task { | |||||
.setValue("-" + name + ":" + value.toString()); | .setValue("-" + name + ":" + value.toString()); | ||||
} | } | ||||
if (target == null || !target.isFile()) { | |||||
throw new BuildException("Invalid target: " + target); | |||||
if (targetFile == null || !targetFile.isFile()) { | |||||
throw new BuildException("Invalid target: " + targetFile); | |||||
} | } | ||||
if (outputFile != null) { | if (outputFile != null) { | ||||
@@ -120,17 +120,17 @@ public class JJDoc extends Task { | |||||
} | } | ||||
// use the directory containing the target as the output directory | // use the directory containing the target as the output directory | ||||
File javaFile = new File(createOutputFileName(target, outputFile, | |||||
File javaFile = new File(createOutputFileName(targetFile, outputFile, | |||||
plainText)); | plainText)); | ||||
if (javaFile.exists() | if (javaFile.exists() | ||||
&& target.lastModified() < javaFile.lastModified()) { | |||||
log("Target is already built - skipping (" + target + ")", | |||||
&& targetFile.lastModified() < javaFile.lastModified()) { | |||||
log("Target is already built - skipping (" + targetFile + ")", | |||||
Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
return; | return; | ||||
} | } | ||||
cmdl.createArgument().setValue(target.getAbsolutePath()); | |||||
cmdl.createArgument().setValue(targetFile.getAbsolutePath()); | |||||
final Path classpath = cmdl.createClasspath(getProject()); | final Path classpath = cmdl.createClasspath(getProject()); | ||||
final File javaccJar = JavaCC.getArchiveFile(javaccHome); | final File javaccJar = JavaCC.getArchiveFile(javaccHome); | ||||
@@ -161,10 +161,10 @@ public class JJDoc extends Task { | |||||
} | } | ||||
} | } | ||||
private String createOutputFileName(File target, String optionalOutputFile, | |||||
private String createOutputFileName(File targetFile, String optionalOutputFile, | |||||
boolean plainText) { | boolean plainText) { | ||||
String suffix = DEFAULT_SUFFIX_HTML; | String suffix = DEFAULT_SUFFIX_HTML; | ||||
String javaccFile = target.getAbsolutePath().replace('\\', '/'); | |||||
String javaccFile = targetFile.getAbsolutePath().replace('\\', '/'); | |||||
if (plainText) { | if (plainText) { | ||||
suffix = DEFAULT_SUFFIX_TEXT; | suffix = DEFAULT_SUFFIX_TEXT; | ||||
@@ -60,7 +60,7 @@ public class JJTree extends Task { | |||||
// required attributes | // required attributes | ||||
private File outputDirectory = null; | private File outputDirectory = null; | ||||
private File target = null; | |||||
private File targetFile = null; | |||||
private File javaccHome = null; | private File javaccHome = null; | ||||
private CommandlineJava cmdl = new CommandlineJava(); | private CommandlineJava cmdl = new CommandlineJava(); | ||||
@@ -164,8 +164,8 @@ public class JJTree extends Task { | |||||
/** | /** | ||||
* The jjtree grammar file to process. | * The jjtree grammar file to process. | ||||
*/ | */ | ||||
public void setTarget(File target) { | |||||
this.target = target; | |||||
public void setTarget(File targetFile) { | |||||
this.targetFile = targetFile; | |||||
} | } | ||||
/** | /** | ||||
@@ -189,8 +189,8 @@ public class JJTree extends Task { | |||||
cmdl.createArgument().setValue("-" + name + ":" + value.toString()); | cmdl.createArgument().setValue("-" + name + ":" + value.toString()); | ||||
} | } | ||||
if (target == null || !target.isFile()) { | |||||
throw new BuildException("Invalid target: " + target); | |||||
if (targetFile == null || !targetFile.isFile()) { | |||||
throw new BuildException("Invalid target: " + targetFile); | |||||
} | } | ||||
File javaFile = null; | File javaFile = null; | ||||
@@ -202,7 +202,7 @@ public class JJTree extends Task { | |||||
cmdl.createArgument().setValue("-OUTPUT_DIRECTORY:" | cmdl.createArgument().setValue("-OUTPUT_DIRECTORY:" | ||||
+ getDefaultOutputDirectory()); | + getDefaultOutputDirectory()); | ||||
javaFile = new File(createOutputFileName(target, outputFile, | |||||
javaFile = new File(createOutputFileName(targetFile, outputFile, | |||||
null)); | null)); | ||||
} else { | } else { | ||||
if (!outputDirectory.isDirectory()) { | if (!outputDirectory.isDirectory()) { | ||||
@@ -216,14 +216,14 @@ public class JJTree extends Task { | |||||
+ outputDirectory.getAbsolutePath() | + outputDirectory.getAbsolutePath() | ||||
.replace('\\', '/')); | .replace('\\', '/')); | ||||
javaFile = new File(createOutputFileName(target, outputFile, | |||||
javaFile = new File(createOutputFileName(targetFile, outputFile, | |||||
outputDirectory | outputDirectory | ||||
.getPath())); | .getPath())); | ||||
} | } | ||||
if (javaFile.exists() | if (javaFile.exists() | ||||
&& target.lastModified() < javaFile.lastModified()) { | |||||
log("Target is already built - skipping (" + target + ")", | |||||
&& targetFile.lastModified() < javaFile.lastModified()) { | |||||
log("Target is already built - skipping (" + targetFile + ")", | |||||
Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
return; | return; | ||||
} | } | ||||
@@ -233,7 +233,7 @@ public class JJTree extends Task { | |||||
+ outputFile.replace('\\', '/')); | + outputFile.replace('\\', '/')); | ||||
} | } | ||||
cmdl.createArgument().setValue(target.getAbsolutePath()); | |||||
cmdl.createArgument().setValue(targetFile.getAbsolutePath()); | |||||
final Path classpath = cmdl.createClasspath(getProject()); | final Path classpath = cmdl.createClasspath(getProject()); | ||||
final File javaccJar = JavaCC.getArchiveFile(javaccHome); | final File javaccJar = JavaCC.getArchiveFile(javaccHome); | ||||
@@ -264,11 +264,11 @@ public class JJTree extends Task { | |||||
} | } | ||||
} | } | ||||
private String createOutputFileName(File target, String optionalOutputFile, | |||||
private String createOutputFileName(File targetFile, String optionalOutputFile, | |||||
String outputDirectory) { | String outputDirectory) { | ||||
optionalOutputFile = validateOutputFile(optionalOutputFile, | optionalOutputFile = validateOutputFile(optionalOutputFile, | ||||
outputDirectory); | outputDirectory); | ||||
String jjtreeFile = target.getAbsolutePath().replace('\\', '/'); | |||||
String jjtreeFile = targetFile.getAbsolutePath().replace('\\', '/'); | |||||
if ((optionalOutputFile == null) || optionalOutputFile.equals("")) { | if ((optionalOutputFile == null) || optionalOutputFile.equals("")) { | ||||
int filePos = jjtreeFile.lastIndexOf("/"); | int filePos = jjtreeFile.lastIndexOf("/"); | ||||
@@ -67,7 +67,7 @@ public class JavaCC extends Task { | |||||
// required attributes | // required attributes | ||||
private File outputDirectory = null; | private File outputDirectory = null; | ||||
private File target = null; | |||||
private File targetFile = null; | |||||
private File javaccHome = null; | private File javaccHome = null; | ||||
private CommandlineJava cmdl = new CommandlineJava(); | private CommandlineJava cmdl = new CommandlineJava(); | ||||
@@ -262,8 +262,8 @@ public class JavaCC extends Task { | |||||
/** | /** | ||||
* The grammar file to process. | * The grammar file to process. | ||||
*/ | */ | ||||
public void setTarget(File target) { | |||||
this.target = target; | |||||
public void setTarget(File targetFile) { | |||||
this.targetFile = targetFile; | |||||
} | } | ||||
/** | /** | ||||
@@ -288,13 +288,13 @@ public class JavaCC extends Task { | |||||
} | } | ||||
// check the target is a file | // check the target is a file | ||||
if (target == null || !target.isFile()) { | |||||
throw new BuildException("Invalid target: " + target); | |||||
if (targetFile == null || !targetFile.isFile()) { | |||||
throw new BuildException("Invalid target: " + targetFile); | |||||
} | } | ||||
// use the directory containing the target as the output directory | // use the directory containing the target as the output directory | ||||
if (outputDirectory == null) { | if (outputDirectory == null) { | ||||
outputDirectory = new File(target.getParent()); | |||||
outputDirectory = new File(targetFile.getParent()); | |||||
} else if (!outputDirectory.isDirectory()) { | } else if (!outputDirectory.isDirectory()) { | ||||
throw new BuildException("Outputdir not a directory."); | throw new BuildException("Outputdir not a directory."); | ||||
} | } | ||||
@@ -302,12 +302,12 @@ public class JavaCC extends Task { | |||||
+ outputDirectory.getAbsolutePath()); | + outputDirectory.getAbsolutePath()); | ||||
// determine if the generated java file is up-to-date | // determine if the generated java file is up-to-date | ||||
final File javaFile = getOutputJavaFile(outputDirectory, target); | |||||
if (javaFile.exists() && target.lastModified() < javaFile.lastModified()) { | |||||
log("Target is already built - skipping (" + target + ")", Project.MSG_VERBOSE); | |||||
final File javaFile = getOutputJavaFile(outputDirectory, targetFile); | |||||
if (javaFile.exists() && targetFile.lastModified() < javaFile.lastModified()) { | |||||
log("Target is already built - skipping (" + targetFile + ")", Project.MSG_VERBOSE); | |||||
return; | return; | ||||
} | } | ||||
cmdl.createArgument().setValue(target.getAbsolutePath()); | |||||
cmdl.createArgument().setValue(targetFile.getAbsolutePath()); | |||||
final Path classpath = cmdl.createClasspath(getProject()); | final Path classpath = cmdl.createClasspath(getProject()); | ||||
final File javaccJar = JavaCC.getArchiveFile(javaccHome); | final File javaccJar = JavaCC.getArchiveFile(javaccHome); | ||||
@@ -334,11 +334,11 @@ public class JUnitTask extends Task { | |||||
* @return boolean equivalent of the value | * @return boolean equivalent of the value | ||||
*/ | */ | ||||
public boolean asBoolean() { | public boolean asBoolean() { | ||||
String value = getValue(); | |||||
return "true".equals(value) | |||||
|| "on".equals(value) | |||||
|| "yes".equals(value) | |||||
|| "withOutAndErr".equals(value); | |||||
String v = getValue(); | |||||
return "true".equals(v) | |||||
|| "on".equals(v) | |||||
|| "yes".equals(v) | |||||
|| "withOutAndErr".equals(v); | |||||
} | } | ||||
} | } | ||||
@@ -174,8 +174,8 @@ public abstract class AbstractMetamataTask extends Task { | |||||
// set the classpath as the jar file | // set the classpath as the jar file | ||||
File jar = getMetamataJar(metamataHome); | File jar = getMetamataJar(metamataHome); | ||||
final Path classPath = cmdl.createClasspath(getProject()); | |||||
classPath.createPathElement().setLocation(jar); | |||||
final Path cp = cmdl.createClasspath(getProject()); | |||||
cp.createPathElement().setLocation(jar); | |||||
// set the metamata.home property | // set the metamata.home property | ||||
final Commandline.Argument vmArgs = cmdl.createVmArgument(); | final Commandline.Argument vmArgs = cmdl.createVmArgument(); | ||||
@@ -43,15 +43,15 @@ import org.apache.tools.ant.util.JavaEnvUtils; | |||||
*/ | */ | ||||
public class MParse extends AbstractMetamataTask { | public class MParse extends AbstractMetamataTask { | ||||
private File target = null; | |||||
private File targetFile = null; | |||||
private boolean verbose = false; | private boolean verbose = false; | ||||
private boolean debugparser = false; | private boolean debugparser = false; | ||||
private boolean debugscanner = false; | private boolean debugscanner = false; | ||||
private boolean cleanup = false; | private boolean cleanup = false; | ||||
/** The .jj file to process; required. */ | /** The .jj file to process; required. */ | ||||
public void setTarget(File target) { | |||||
this.target = target; | |||||
public void setTarget(File targetFile) { | |||||
this.targetFile = targetFile; | |||||
} | } | ||||
/** set verbose mode */ | /** set verbose mode */ | ||||
@@ -106,9 +106,9 @@ public class MParse extends AbstractMetamataTask { | |||||
// set the classpath as the jar files | // set the classpath as the jar files | ||||
File[] jars = getMetamataLibs(); | File[] jars = getMetamataLibs(); | ||||
final Path classPath = cmdl.createClasspath(getProject()); | |||||
final Path cp = cmdl.createClasspath(getProject()); | |||||
for (int i = 0; i < jars.length; i++) { | for (int i = 0; i < jars.length; i++) { | ||||
classPath.createPathElement().setLocation(jars[i]); | |||||
cp.createPathElement().setLocation(jars[i]); | |||||
} | } | ||||
// set the metamata.home property | // set the metamata.home property | ||||
@@ -132,12 +132,12 @@ public class MParse extends AbstractMetamataTask { | |||||
protected void _execute(ExecuteStreamHandler handler) throws BuildException { | protected void _execute(ExecuteStreamHandler handler) throws BuildException { | ||||
// target has been checked as a .jj, see if there is a matching | // target has been checked as a .jj, see if there is a matching | ||||
// java file and if it is needed to run to process the grammar | // java file and if it is needed to run to process the grammar | ||||
String pathname = target.getAbsolutePath(); | |||||
String pathname = targetFile.getAbsolutePath(); | |||||
int pos = pathname.length() - ".jj".length(); | int pos = pathname.length() - ".jj".length(); | ||||
pathname = pathname.substring(0, pos) + ".java"; | pathname = pathname.substring(0, pos) + ".java"; | ||||
File javaFile = new File(pathname); | File javaFile = new File(pathname); | ||||
if (javaFile.exists() && target.lastModified() < javaFile.lastModified()) { | |||||
getProject().log("Target is already build - skipping (" + target + ")"); | |||||
if (javaFile.exists() && targetFile.lastModified() < javaFile.lastModified()) { | |||||
getProject().log("Target is already build - skipping (" + targetFile + ")"); | |||||
return; | return; | ||||
} | } | ||||
@@ -160,10 +160,10 @@ public class MParse extends AbstractMetamataTask { | |||||
optionsFile = null; | optionsFile = null; | ||||
} | } | ||||
if (cleanup) { | if (cleanup) { | ||||
String name = target.getName(); | |||||
String name = targetFile.getName(); | |||||
int pos = name.length() - ".jj".length(); | int pos = name.length() - ".jj".length(); | ||||
name = "__jj" + name.substring(0, pos) + ".sunjj"; | name = "__jj" + name.substring(0, pos) + ".sunjj"; | ||||
final File sunjj = new File(target.getParent(), name); | |||||
final File sunjj = new File(targetFile.getParent(), name); | |||||
if (sunjj.exists()) { | if (sunjj.exists()) { | ||||
getProject().log("Removing stale file: " + sunjj.getName()); | getProject().log("Removing stale file: " + sunjj.getName()); | ||||
sunjj.delete(); | sunjj.delete(); | ||||
@@ -210,11 +210,11 @@ public class MParse extends AbstractMetamataTask { | |||||
} | } | ||||
// check that the target is ok and resolve it. | // check that the target is ok and resolve it. | ||||
if (target == null || !target.isFile() | |||||
|| !target.getName().endsWith(".jj")) { | |||||
throw new BuildException("Invalid target: " + target); | |||||
if (targetFile == null || !targetFile.isFile() | |||||
|| !targetFile.getName().endsWith(".jj")) { | |||||
throw new BuildException("Invalid target: " + targetFile); | |||||
} | } | ||||
target = getProject().resolveFile(target.getPath()); | |||||
targetFile = getProject().resolveFile(targetFile.getPath()); | |||||
} | } | ||||
/** | /** | ||||
@@ -240,7 +240,7 @@ public class MParse extends AbstractMetamataTask { | |||||
options.addElement("-sourcepath"); | options.addElement("-sourcepath"); | ||||
options.addElement(sourcePath.toString()); | options.addElement(sourcePath.toString()); | ||||
} | } | ||||
options.addElement(target.getAbsolutePath()); | |||||
options.addElement(targetFile.getAbsolutePath()); | |||||
return options; | return options; | ||||
} | } | ||||