blob: 4c7a25196fb6ee7285ffccdd57f8a9b722da56ca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*
* GraphicsCodeGenAntTask.java
*
* Created on March 3, 2007, 9:31 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.kitfox.salamander.parser;
import java.io.File;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.FileScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
/**
* This ant task examines a directory hierarchy containing .xml files and
* for the XML files rooted in the GraphicsCodeGen.GRAPHICS_NS namespace,
* causes code generation to be run. Task will only update code that is missing
* or out of date to minimize processing time.
*
* <code>
* <graphicsCodeGeneration>
* <fileset dir="${root.dir}">
* <include name="com/kitfox/monsters/** / *"/>
* </fileset>
* <fileset dir="${dir2}">
* </fileset>
* </graphicsCodeGeneration>
* </code>
*
* @author kitfox
*/
public class SVGParserAntTask extends Task
{
// Path examinePath;
private ArrayList<FileSet> filesets = new ArrayList<FileSet>();
/** Creates a new instance of GraphicsCodeGenAntTask */
public SVGParserAntTask()
{
}
/**
* Adds a set of files.
*/
public void addFileset(FileSet set)
{
filesets.add(set);
}
/**
* The examine path should be a subset of the classpath and include all the
* classes that should be examined for possible inclusion in the services list.
*/
// public Path createExaminePath() throws BuildException
// {
// if (examinePath == null)
// {
// examinePath = new Path(getProject());
// return examinePath;
// }
// throw new BuildException("Only one examine path can be set");
// }
public void execute() throws BuildException
{
/*
//This is necessary for ImageIO to find all pluggable image readers on the
// classpath
ImageIO.scanForPlugins();
for (FileSet fileSet: filesets)
{
FileScanner scanner = fileSet.getDirectoryScanner(getProject());
String[] files = scanner.getIncludedFiles();
File dir = fileSet.getDir();
for (String fileName: files)
{
// if (!fileName.getName().endsWith(".xml")) continue;
File file = new File(dir, fileName);
//System.err.println("*****File " + file);
//Conditionally generate code
GraphicsCodeGen.generateCode(file, true);
}
}
*/
}
}
|