Package org.apache.tools.ant.taskdefs
Class Patch
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.Patch
- All Implemented Interfaces:
- Cloneable
Patches a file by applying a 'diff' file to it; requires "patch" to be
 on the execution path.
- Since:
- Ant 1.1
- 
Field SummaryFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidexecute()execute patchvoidsetBackups(boolean backups) flag to create backups; optional, default=falsevoidsetDestfile(File file) The name of a file to send the output to, instead of patching the file(s) in place; optional.voidThe directory to run the patch command in, defaults to the project's base directory.voidsetFailOnError(boolean value) Iftrue, stop the build process if the patch command exits with an error status.voidsetIgnorewhitespace(boolean ignore) flag to ignore whitespace differences; default=falsevoidsetOriginalfile(File file) The file to patch; optional if it can be inferred from the diff filevoidsetPatchfile(File file) The file containing the diff output; required.voidsetQuiet(boolean q) Work silently unless an error occurs; optional, default=falsevoidsetReverse(boolean r) Assume patch was created with old and new files swapped; optional, default=falsevoidsetStrip(int num) Strip the smallest prefix containing num leading slashes from filenames.Methods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
- 
Constructor Details- 
Patchpublic Patch()
 
- 
- 
Method Details- 
setOriginalfileThe file to patch; optional if it can be inferred from the diff file- Parameters:
- file- the file to patch
 
- 
setDestfileThe name of a file to send the output to, instead of patching the file(s) in place; optional.- Parameters:
- file- the file to send the output to
- Since:
- Ant 1.6
 
- 
setPatchfileThe file containing the diff output; required.- Parameters:
- file- the file containing the diff output
 
- 
setBackupspublic void setBackups(boolean backups) flag to create backups; optional, default=false- Parameters:
- backups- if true create backups
 
- 
setIgnorewhitespacepublic void setIgnorewhitespace(boolean ignore) flag to ignore whitespace differences; default=false- Parameters:
- ignore- if true ignore whitespace differences
 
- 
setStripStrip the smallest prefix containing num leading slashes from filenames.patch's -p option. - Parameters:
- num- number of lines to strip
- Throws:
- BuildException- if num is < 0, or other errors
 
- 
setQuietpublic void setQuiet(boolean q) Work silently unless an error occurs; optional, default=false- Parameters:
- q- if true suppress set the -s option on the patch command
 
- 
setReversepublic void setReverse(boolean r) Assume patch was created with old and new files swapped; optional, default=false- Parameters:
- r- if true set the -R option on the patch command
 
- 
setDirThe directory to run the patch command in, defaults to the project's base directory.- Parameters:
- directory- the directory to run the patch command in
- Since:
- Ant 1.5
 
- 
setFailOnErrorpublic void setFailOnError(boolean value) Iftrue, stop the build process if the patch command exits with an error status.- Parameters:
- value-- trueif it should halt, otherwise- false. The default is- false.
- Since:
- Ant 1.8.0
 
- 
executeexecute patch- Overrides:
- executein class- Task
- Throws:
- BuildException- when it all goes a bit pear shaped
 
 
-