View Javadoc
1   package eu.simuline.m2latex.antTask;
2   
3   import org.apache.tools.ant.BuildException;
4   
5   import eu.simuline.m2latex.core.BuildFailureException;
6   import eu.simuline.m2latex.core.LatexProcessor;
7   
8   public class LatexCfgTask extends AbstractLatexTask {
9   
10    /**
11     * Invoked by ant executing the task. 
12     * <p>
13     * Logging: 
14     * <ul>
15     * <li>WFU01: Cannot read directory...
16     * <li>WFU03: cannot close
17     * <li>EFU07, EFU08, EFU09: if filtering a file fails.
18     * <li>WPP02: tex file may be latex main file
19     * <li>WPP03: Skipped processing of files with suffixes ...
20     * <li>WPP05: Included tex files which are no latex main files
21     * <li>WPP06: Included tex files which are no latex main files
22     * <li>WPP07: inluded/excluded files not identified by their names.
23     * <li>EEX01, EEX02, EEX03, WEX04, WEX05:
24     *      applications for preprocessing graphic files 
25     *      or processing a latex main file fails. 
26     * </ul>
27     * @throws BuildException
28     *    <ul>
29     *    <li> TSS01 if 
30     *    the tex source directory does either not exist 
31     *    or is not a directory. 
32     *    <li> TSS02 if 
33     *    the tex source processing directory does either not exist 
34     *    or is not a directory. 
35     *    <li> TSS03 if 
36     *    the output directory exists and is no directory. 
37     *    <li> TEX01 if 
38     *    invocation of applications for preprocessing graphic files 
39     *    or processing a latex main file fails 
40     *    <li> TFU01 if 
41     *    the target directory that would be returned 
42     *    exists already as a regular file. 
43     *    <li> TFU03, TFU04, TFU05, TFU06 if 
44     *    copy of output files to target folder fails. 
45     *    For details see {@link LatexProcessor#create(SortedSet<Target>)}. 
46     *    </ul>
47     */
48    public void execute() throws BuildException {
49      initialize();
50      try {
51        // may throw BuildFailureException 
52        // TSS01, TSS02, TSS03, TEX01, TFU01, TFU03, TFU04, TFU05, TFU06 
53        // may log WFU01, WFU03, EFU05, EFU07, EFU08, EFU09
54        // WPP02, WPP03, WPP05, WPP06, WPP07,
55        // EEX01, EEX02, EEX03, WEX04, WEX05 
56        this.latexProcessor.create(this.settings.getTargets());
57      } catch (BuildFailureException e) {
58        throw new BuildException(e.getMessage(), e.getCause());
59      }
60    }
61  }