Perform the conversion @throws BuildException if an error occurs during execution of this task.
()
| 89 | * @throws BuildException if an error occurs during execution of this task. |
| 90 | */ |
| 91 | @Override |
| 92 | public void execute() throws BuildException { |
| 93 | int count = 0; |
| 94 | |
| 95 | // Step through each file and convert. |
| 96 | for (FileSet fs : filesets) { |
| 97 | DirectoryScanner ds = fs.getDirectoryScanner(getProject()); |
| 98 | File basedir = ds.getBasedir(); |
| 99 | String[] files = ds.getIncludedFiles(); |
| 100 | for (String file : files) { |
| 101 | File from = new File(basedir, file); |
| 102 | File to = new File(todir, file + ".html"); |
| 103 | if (!to.exists() || (from.lastModified() > to.lastModified())) { |
| 104 | log("Converting file '" + from.getAbsolutePath() + "' to '" + to.getAbsolutePath(), |
| 105 | Project.MSG_VERBOSE); |
| 106 | try { |
| 107 | convert(from, to); |
| 108 | } catch (IOException ioe) { |
| 109 | throw new BuildException( |
| 110 | "Could not convert '" + from.getAbsolutePath() + "' to '" + to.getAbsolutePath() + "'", |
| 111 | ioe); |
| 112 | } |
| 113 | count++; |
| 114 | } |
| 115 | } |
| 116 | if (count > 0) { |
| 117 | log("Converted " + count + " file" + (count > 1 ? "s" : "") + " to " + todir.getAbsolutePath()); |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * Perform the actual copy and conversion |
nothing calls this directly
no test coverage detected