git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277929 13f79535-47bb-0310-9956-ffa450edef68master
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2001-2004 The Apache Software Foundation | |||
* Copyright 2001-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -39,7 +39,7 @@ public abstract class Pack extends Task { | |||
/** | |||
* the required destination file. | |||
* @param zipFile | |||
* @param zipFile the destination file | |||
*/ | |||
public void setZipfile(File zipFile) { | |||
this.zipFile = zipFile; | |||
@@ -47,7 +47,7 @@ public abstract class Pack extends Task { | |||
/** | |||
* the required destination file. | |||
* @param zipFile | |||
* @param zipFile the destination file | |||
*/ | |||
public void setDestfile(File zipFile) { | |||
setZipfile(zipFile); | |||
@@ -55,7 +55,7 @@ public abstract class Pack extends Task { | |||
/** | |||
* the file to compress; required. | |||
* @param src | |||
* @param src the source file | |||
*/ | |||
public void setSrc(File src) { | |||
source = src; | |||
@@ -88,7 +88,7 @@ public abstract class Pack extends Task { | |||
/** | |||
* validate, then hand off to the subclass | |||
* @throws BuildException | |||
* @throws BuildException on error | |||
*/ | |||
public void execute() throws BuildException { | |||
validate(); | |||
@@ -107,8 +107,8 @@ public abstract class Pack extends Task { | |||
/** | |||
* zip a stream to an output stream | |||
* @param in | |||
* @param zOut | |||
* @param in the stream to zip | |||
* @param zOut the output stream | |||
* @throws IOException | |||
*/ | |||
private void zipFile(InputStream in, OutputStream zOut) | |||
@@ -123,9 +123,9 @@ public abstract class Pack extends Task { | |||
/** | |||
* zip a file to an output stream | |||
* @param file | |||
* @param zOut | |||
* @throws IOException | |||
* @param file the file to zip | |||
* @param zOut the output stream | |||
* @throws IOException on error | |||
*/ | |||
protected void zipFile(File file, OutputStream zOut) | |||
throws IOException { | |||
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2000-2004 The Apache Software Foundation | |||
* Copyright 2000-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -81,11 +81,16 @@ public class Property extends Task { | |||
protected boolean userProperty; // set read-only properties | |||
/** | |||
* Constructor for Property. | |||
*/ | |||
public Property() { | |||
this(false); | |||
} | |||
/** | |||
* Constructor for Property. | |||
* @param userProperty if true this is a user property | |||
* @since Ant 1.5 | |||
*/ | |||
protected Property(boolean userProperty) { | |||
@@ -93,6 +98,10 @@ public class Property extends Task { | |||
} | |||
/** | |||
* Constructor for Property. | |||
* @param userProperty if true this is a user property | |||
* @param fallback a project to use to look for references if the reference is | |||
* not in the current project | |||
* @since Ant 1.5 | |||
*/ | |||
protected Property(boolean userProperty, Project fallback) { | |||
@@ -108,6 +117,10 @@ public class Property extends Task { | |||
this.name = name; | |||
} | |||
/** | |||
* Get the property name. | |||
* @return the property name | |||
*/ | |||
public String getName() { | |||
return name; | |||
} | |||
@@ -136,6 +149,10 @@ public class Property extends Task { | |||
this.value = value; | |||
} | |||
/** | |||
* Get the property value. | |||
* @return the property value | |||
*/ | |||
public String getValue() { | |||
return value; | |||
} | |||
@@ -150,6 +167,10 @@ public class Property extends Task { | |||
this.file = file; | |||
} | |||
/** | |||
* Get the file attribute. | |||
* @return the file attribute | |||
*/ | |||
public File getFile() { | |||
return file; | |||
} | |||
@@ -164,6 +185,10 @@ public class Property extends Task { | |||
this.url = url; | |||
} | |||
/** | |||
* Get the url attribute. | |||
* @return the url attribute | |||
*/ | |||
public URL getUrl() { | |||
return url; | |||
} | |||
@@ -183,6 +208,8 @@ public class Property extends Task { | |||
} | |||
/** | |||
* Get the prefix attribute. | |||
* @return the prefix attribute | |||
* @since Ant 1.5 | |||
*/ | |||
public String getPrefix() { | |||
@@ -202,6 +229,10 @@ public class Property extends Task { | |||
this.ref = ref; | |||
} | |||
/** | |||
* Get the refid attribute. | |||
* @return the refid attribute | |||
*/ | |||
public Reference getRefid() { | |||
return ref; | |||
} | |||
@@ -216,6 +247,10 @@ public class Property extends Task { | |||
this.resource = resource; | |||
} | |||
/** | |||
* Get the resource attribute. | |||
* @return the resource attribute | |||
*/ | |||
public String getResource() { | |||
return resource; | |||
} | |||
@@ -245,6 +280,8 @@ public class Property extends Task { | |||
} | |||
/** | |||
* Get the environment attribute. | |||
* @return the environment attribute | |||
* @since Ant 1.5 | |||
*/ | |||
public String getEnvironment() { | |||
@@ -265,6 +302,7 @@ public class Property extends Task { | |||
/** | |||
* The classpath to use when looking up a resource. | |||
* @return a path to be configured | |||
*/ | |||
public Path createClasspath() { | |||
if (this.classpath == null) { | |||
@@ -276,12 +314,15 @@ public class Property extends Task { | |||
/** | |||
* the classpath to use when looking up a resource, | |||
* given as reference to a <path> defined elsewhere | |||
* @param r a reference to a classpath | |||
*/ | |||
public void setClasspathRef(Reference r) { | |||
createClasspath().setRefid(r); | |||
} | |||
/** | |||
* Get the classpath used when looking up a resource. | |||
* @return the classpath | |||
* @since Ant 1.5 | |||
*/ | |||
public Path getClasspath() { | |||
@@ -289,6 +330,7 @@ public class Property extends Task { | |||
} | |||
/** | |||
* @param userProperty ignored | |||
* @deprecated This was never a supported feature and has been | |||
* deprecated without replacement | |||
* @ant.attribute ignore="true" | |||
@@ -310,6 +352,7 @@ public class Property extends Task { | |||
* set the property in the project to the value. | |||
* if the task was give a file, resource or env attribute | |||
* here is where it is loaded | |||
* @throws BuildException on error | |||
*/ | |||
public void execute() throws BuildException { | |||
if (getProject() == null) { | |||
@@ -373,6 +416,7 @@ public class Property extends Task { | |||
/** | |||
* load properties from a url | |||
* @param url url to load from | |||
* @throws BuildException on error | |||
*/ | |||
protected void loadUrl(URL url) throws BuildException { | |||
Properties props = new Properties(); | |||
@@ -396,6 +440,7 @@ public class Property extends Task { | |||
/** | |||
* load properties from a file | |||
* @param file file to load | |||
* @throws BuildException on error | |||
*/ | |||
protected void loadFile(File file) throws BuildException { | |||
Properties props = new Properties(); | |||
@@ -490,6 +535,7 @@ public class Property extends Task { | |||
/** | |||
* iterate through a set of properties, | |||
* resolve them then assign them | |||
* @param props the properties to iterate over | |||
*/ | |||
protected void addProperties(Properties props) { | |||
resolveAllProperties(props); | |||
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2001-2004 The Apache Software Foundation | |||
* Copyright 2001-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -74,7 +74,6 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||
return filename; | |||
} | |||
/** | |||
* Turns off or on this recorder. | |||
* | |||
@@ -87,12 +86,16 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||
} | |||
} | |||
/** | |||
* @see BuildListener#buildStarted(BuildEvent) | |||
*/ | |||
public void buildStarted(BuildEvent event) { | |||
log("> BUILD STARTED", Project.MSG_DEBUG); | |||
} | |||
/** | |||
* @see BuildListener#buildFinished(BuildEvent) | |||
*/ | |||
public void buildFinished(BuildEvent event) { | |||
log("< BUILD FINISHED", Project.MSG_DEBUG); | |||
@@ -135,7 +138,9 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||
public void subBuildStarted(BuildEvent event) { | |||
} | |||
/** | |||
* @see BuildListener#targetStarted(BuildEvent) | |||
*/ | |||
public void targetStarted(BuildEvent event) { | |||
log(">> TARGET STARTED -- " + event.getTarget(), Project.MSG_DEBUG); | |||
log(StringUtils.LINE_SEP + event.getTarget().getName() + ":", | |||
@@ -143,7 +148,9 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||
targetStartTime = System.currentTimeMillis(); | |||
} | |||
/** | |||
* @see BuildListener#targetFinished(BuildEvent) | |||
*/ | |||
public void targetFinished(BuildEvent event) { | |||
log("<< TARGET FINISHED -- " + event.getTarget(), Project.MSG_DEBUG); | |||
@@ -153,18 +160,24 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||
flush(); | |||
} | |||
/** | |||
* @see BuildListener#taskStarted(BuildEvent) | |||
*/ | |||
public void taskStarted(BuildEvent event) { | |||
log(">>> TASK STARTED -- " + event.getTask(), Project.MSG_DEBUG); | |||
} | |||
/** | |||
* @see BuildListener#taskFinished(BuildEvent) | |||
*/ | |||
public void taskFinished(BuildEvent event) { | |||
log("<<< TASK FINISHED -- " + event.getTask(), Project.MSG_DEBUG); | |||
flush(); | |||
} | |||
/** | |||
* @see BuildListener#messageLogged(BuildEvent) | |||
*/ | |||
public void messageLogged(BuildEvent event) { | |||
log("--- MESSAGE LOGGED", Project.MSG_DEBUG); | |||
@@ -207,25 +220,35 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||
} | |||
} | |||
/** | |||
* @see BuildLogger#setMessageOutputLevel(int) | |||
*/ | |||
public void setMessageOutputLevel(int level) { | |||
if (level >= Project.MSG_ERR && level <= Project.MSG_DEBUG) { | |||
loglevel = level; | |||
} | |||
} | |||
/** | |||
* @see BuildLogger#setOutputPrintStream(PrintStream) | |||
*/ | |||
public void setOutputPrintStream(PrintStream output) { | |||
closeFile(); | |||
out = output; | |||
} | |||
/** | |||
* @see BuildLogger#setEmacMode(boolean) | |||
*/ | |||
public void setEmacsMode(boolean emacsMode) { | |||
this.emacsMode = emacsMode; | |||
} | |||
/** | |||
* @see BuildLogger#setErrorPrintStream(PrintStream) | |||
*/ | |||
public void setErrorPrintStream(PrintStream err) { | |||
setOutputPrintStream(err); | |||
} | |||
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2000,2002-2004 The Apache Software Foundation | |||
* Copyright 2000,2002-2005 The Apache Software Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -64,6 +64,8 @@ public class TaskOutputStream extends OutputStream { | |||
* Write a character to the output stream. This method looks | |||
* to make sure that there isn't an error being reported and | |||
* will flush each line of input out to the project's log stream. | |||
* @param c the character to write | |||
* @throws IOException on error | |||
*/ | |||
public void write(int c) throws IOException { | |||