**/\r
public class FileProcess {\r
///\r
- /// The mapping information about source suffix, result suffix, file type.\r
+ /// The mapping information about source suffix, tool code, file type.\r
///\r
public final String[][] fileTypes = { {".h", "", "CHeader" }, \r
- {".c", "", "CCode" },\r
+ {".c", "CC", "CCode" },\r
{".inc", "", "ASMHeader" },\r
- {".asm", "", "ASM" }, \r
- {".S", "", "ASM" },\r
- {".s", "", "ASM" },\r
+ {".asm", "ASM", "ASM" }, \r
+ {".S", "ASM", "ASM" },\r
+ {".s", "ASM", "ASM" },\r
{".uni", "", "UNI" },\r
{".vfr", "", "VFR" },\r
{".Vfr", "", "VFR" },\r
{".FYI", "", "FFS" },\r
{".FFS", "", "FFS" },\r
{".bmp", "", "BMP" },\r
- {".i", "", "PPCode"}};\r
+ {".i", "PP", "PPCode"}};\r
///\r
/// Current ANT context. \r
///\r
@param root Root node\r
@param unicodeFirst whether build Unicode file firstly or not\r
**/\r
- public synchronized void parseFile(String filename, Node root, boolean unicodeFirst) {\r
+ public synchronized void parseFile(String filename, String family, Node root, boolean unicodeFirst) {\r
this.unicodeFirst = unicodeFirst;\r
- parseFile(filename, root);\r
+ parseFile(filename, family, root);\r
}\r
\r
/**\r
@param root Root node\r
@param unicodeFirst whether build Unicode file firstly or not\r
**/\r
- public synchronized void parseFile(String filename, String filetype, Node root, boolean unicodeFirst) {\r
+ public synchronized void parseFile(String filename, String filetype, String family, Node root, boolean unicodeFirst) {\r
this.unicodeFirst = unicodeFirst;\r
- parseFile(filename, filetype, root);\r
+ parseFile(filename, filetype, family, root);\r
}\r
\r
/**\r
@param filename Source file name\r
@param root Root node\r
**/\r
- public synchronized void parseFile(String filename, Node root) throws BuildException {\r
+ public synchronized void parseFile(String filename, String family, Node root) throws BuildException {\r
for (int i = 0; i < fileTypes.length; i++) {\r
if (filename.endsWith(fileTypes[i][0])) {\r
- parseFile(filename, fileTypes[i][2], root);\r
+ parseFile(filename, fileTypes[i][2], family, root);\r
return ;\r
}\r
}\r
@param filetype Source file type\r
@param root Root node\r
**/\r
- public synchronized void parseFile(String filename, String filetype, Node root) {\r
+ public synchronized void parseFile(String filename, String filetype, String family, Node root) {\r
+ //\r
+ // Filter file with family. Only family is specified in source file and\r
+ // not include current family will skip the file. \r
+ //\r
+ String toolCode = getToolCodeByFileType(filetype);\r
+ if (family != null && !family.trim().equalsIgnoreCase("")) {\r
+ String toolChainFamily = project.getProperty(toolCode + "_FAMILY");\r
+ if (toolChainFamily != null) {\r
+ if(!toolChainFamily.equalsIgnoreCase(family)) {\r
+ return ;\r
+ }\r
+ }\r
+ }\r
+ \r
if (unicodeFirst) {\r
if ( ! filetype.equalsIgnoreCase("UNI")){\r
return ;\r
// If define CC_EXT in tools_def.txt file, the source file with \r
// different suffix is skipped\r
//\r
- String toolsDefExtName = project.getProperty(filetype + "_EXT");\r
+ String toolsDefExtName = project.getProperty(toolCode + "_EXT");\r
if (toolsDefExtName != null) {\r
String[] exts = toolsDefExtName.split(" ");\r
for (int i = 0; i < exts.length; i++) {\r
ele.appendChild(includesEle);\r
root.appendChild(ele);\r
}\r
+ \r
+ private String getToolCodeByFileType(String fileType) {\r
+ for (int i = 0; i < fileTypes.length; i++) {\r
+ if (fileTypes[i][2].equalsIgnoreCase(fileType)) {\r
+ return fileTypes[i][1];\r
+ }\r
+ }\r
+ return null;\r
+ }\r
}
\ No newline at end of file