📄 project.java
字号:
* sensible way. The file separators are then converted to their platform * specific versions. * * @param toProcess The path to be translated. * May be <code>null</code>. * * @return the native version of the specified path or * an empty string if the path is <code>null</code> or empty. * * @deprecated since 1.7 * Use FileUtils.translatePath instead. * * @see PathTokenizer */ public static String translatePath(String toProcess) { return FileUtils.translatePath(toProcess); } /** * Convenience method to copy a file from a source to a destination. * No filtering is performed. * * @param sourceFile Name of file to copy from. * Must not be <code>null</code>. * @param destFile Name of file to copy to. * Must not be <code>null</code>. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ public void copyFile(String sourceFile, String destFile) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile); } /** * Convenience method to copy a file from a source to a destination * specifying if token filtering should be used. * * @param sourceFile Name of file to copy from. * Must not be <code>null</code>. * @param destFile Name of file to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ public void copyFile(String sourceFile, String destFile, boolean filtering) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null); } /** * Convenience method to copy a file from a source to a * destination specifying if token filtering should be used and if * source files may overwrite newer destination files. * * @param sourceFile Name of file to copy from. * Must not be <code>null</code>. * @param destFile Name of file to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * @param overwrite Whether or not the destination file should be * overwritten if it already exists. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ public void copyFile(String sourceFile, String destFile, boolean filtering, boolean overwrite) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null, overwrite); } /** * Convenience method to copy a file from a source to a * destination specifying if token filtering should be used, if * source files may overwrite newer destination files, and if the * last modified time of the resulting file should be set to * that of the source file. * * @param sourceFile Name of file to copy from. * Must not be <code>null</code>. * @param destFile Name of file to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * @param overwrite Whether or not the destination file should be * overwritten if it already exists. * @param preserveLastModified Whether or not the last modified time of * the resulting file should be set to that * of the source file. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ public void copyFile(String sourceFile, String destFile, boolean filtering, boolean overwrite, boolean preserveLastModified) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null, overwrite, preserveLastModified); } /** * Convenience method to copy a file from a source to a destination. * No filtering is performed. * * @param sourceFile File to copy from. * Must not be <code>null</code>. * @param destFile File to copy to. * Must not be <code>null</code>. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ public void copyFile(File sourceFile, File destFile) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile); } /** * Convenience method to copy a file from a source to a destination * specifying if token filtering should be used. * * @param sourceFile File to copy from. * Must not be <code>null</code>. * @param destFile File to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ public void copyFile(File sourceFile, File destFile, boolean filtering) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null); } /** * Convenience method to copy a file from a source to a * destination specifying if token filtering should be used and if * source files may overwrite newer destination files. * * @param sourceFile File to copy from. * Must not be <code>null</code>. * @param destFile File to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * @param overwrite Whether or not the destination file should be * overwritten if it already exists. * * @exception IOException if the file cannot be copied. * * @deprecated since 1.4.x */ public void copyFile(File sourceFile, File destFile, boolean filtering, boolean overwrite) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null, overwrite); } /** * Convenience method to copy a file from a source to a * destination specifying if token filtering should be used, if * source files may overwrite newer destination files, and if the * last modified time of the resulting file should be set to * that of the source file. * * @param sourceFile File to copy from. * Must not be <code>null</code>. * @param destFile File to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * @param overwrite Whether or not the destination file should be * overwritten if it already exists. * @param preserveLastModified Whether or not the last modified time of * the resulting file should be set to that * of the source file. * * @exception IOException if the file cannot be copied. * * @deprecated since 1.4.x */ public void copyFile(File sourceFile, File destFile, boolean filtering, boolean overwrite, boolean preserveLastModified) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null, overwrite, preserveLastModified); } /** * Call File.setLastModified(long time) on Java above 1.1, and logs * a warning on Java 1.1. * * @param file The file to set the last modified time on. * Must not be <code>null</code>. * * @param time the required modification time. * * @deprecated since 1.4.x * * @exception BuildException if the last modified time cannot be set * despite running on a platform with a version * above 1.1. */ public void setFileLastModified(File file, long time) throws BuildException { FILE_UTILS.setFileLastModified(file, time); log("Setting modification time for " + file, MSG_VERBOSE); } /** * Return the boolean equivalent of a string, which is considered * <code>true</code> if either <code>"on"</code>, <code>"true"</code>, * or <code>"yes"</code> is found, ignoring case. * * @param s The string to convert to a boolean value. * * @return <code>true</code> if the given string is <code>"on"</code>, * <code>"true"</code> or <code>"yes"</code>, or * <code>false</code> otherwise. */ public static boolean toBoolean(String s) { return ("on".equalsIgnoreCase(s) || "true".equalsIgnoreCase(s) || "yes".equalsIgnoreCase(s)); } /** * Get the Project instance associated with the specified object. * @param o the object to query. * @return Project instance, if any. * @since Ant 1.7.1 */ public static Project getProject(Object o) { if (o instanceof ProjectComponent) { return ((ProjectComponent) o).getProject(); } try { Method m = o.getClass().getMethod("getProject", (Class[]) null); if (Project.class == m.getReturnType()) { return (Project) m.invoke(o, (Object[]) null); } } catch (Exception e) { //too bad } return null; } /** * Topologically sort a set of targets. Equivalent to calling * <code>topoSort(new String[] {root}, targets, true)</code>. * * @param root The name of the root target. The sort is created in such * a way that the sequence of Targets up to the root * target is the minimum possible such sequence. * Must not be <code>null</code>. * @param targetTable A Hashtable mapping names to Targets. * Must not be <code>null</code>. * @return a Vector of ALL Target objects in sorted order. * @exception BuildException if there is a cyclic dependency among the * targets, or if a named target does not exist. */ public final Vector topoSort(String root, Hashtable targetTable) throws BuildException { return topoSort(new String[] {root}, targetTable, true); } /** * Topologically sort a set of targets. Equivalent to calling * <code>topoSort(new String[] {root}, targets, returnAll)</code>. * * @param root The name of the root target. The sort is created in such * a way that the sequence of Targets up to the root * target is the minimum possible such sequence. * Must not be <code>null</code>. * @param targetTable A Hashtable mapping names to Targets. * Must not be <code>null</code>. * @param returnAll <code>boolean</code> indicating whether to return all * targets, or the execution sequence only. * @return a Vector of Target objects in sorted order. * @exception BuildException if there is a cyclic dependency among the * targets, or if a named target does not exist. * @since Ant 1.6.3 */ public final Vector topoSort(String root, Hashtable targetTable, boolean returnAll) throws BuildException { return topoSort(new String[] {root}, targetTable, returnAll); } /** * Topologically sort a set of targets. * * @param root <code>String[]</code> containing the names of the root targets. * The sort is created in such a way that the ordered sequence of * Targets is the minimum possible such sequence to the specified * root targets. * Must not be <code>null</code>. * @param targetTable A map of names to targets (String to Target). * Must not be <code>null</code>. * @param returnAll <code>boolean</code> indicating whether to return all * targets, or the execution sequence only. * @return a Vector of Target objects in sorted order. * @exception BuildException if there is a cyclic dependency among the * targets, or if a named target does not exist. * @since Ant 1.6.3 */ public final Vector topoSort(String[] root, Hashtable targetTable, boolean returnAll) throws BuildException { Vector ret = new Vector(); Hashtable state = new Hashtable(); Stack visiting = new Stack(); // We first run a DFS based sort using each root as a starting node. // This creates the minimum sequence of Targets to the root node(s). // We then do a sort on any remaining unVISITED targets. // This is unnecessary for doing our build, but it catches // circular dependencies or missing Targets on the entire // dependency tree, not just on the Targets that depend on the // build Target. for (int i = 0; i < root.length; i++) { String st = (String) (state.get(root[i])); if (st == null) { tsort(root[i], targetTable, state, visiting, ret); } else if (st == VISITING) { throw new RuntimeException("Unexpected node in visiting state: " + root[i]); } } StringBuffer buf = new StringBuffer("Build sequence for target(s)"); for (int j = 0; j < root.length; j++) { buf.append((j == 0) ? " `" : ", `").append(root[j]).append('\''); } buf.append(" is " + ret); log(buf.toString(), MSG_VERBOSE); Vector complete = (returnAll) ? ret : new Vector(ret); for (Enumeration en = targetTable.keys(); en.hasMoreElements();) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -