**/\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
**/\r
private void applyCompileElement(Document document, Node root) {\r
//\r
- // sourceFiles[][0] is FileType, [][1] is File name relative to Module_Dir\r
+ // sourceFiles[][0] is FileType, \r
+ // [][1] is File name relative to Module_Dir, \r
+ // [][2] is ToolChainFamily\r
//\r
String[][] sourceFiles = saq.getSourceFiles(fpdModuleId.getArch());\r
\r
sourceFiles[i][1] = sourceFile.getPath();\r
String filetype = sourceFiles[i][0];\r
if (filetype != null) {\r
- fileProcess.parseFile(sourceFiles[i][1], filetype, root, true);\r
+ fileProcess.parseFile(sourceFiles[i][1], filetype, sourceFiles[i][2], root, true);\r
} else {\r
- fileProcess.parseFile(sourceFiles[i][1], root, true);\r
+ fileProcess.parseFile(sourceFiles[i][1], sourceFiles[i][2], root, true);\r
}\r
}\r
\r
// Parse AutoGen.c & AutoGen.h\r
//\r
if ( ! fpdModuleId.getModule().getName().equalsIgnoreCase("Shell")) {\r
- fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", root, false);\r
+ fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", null, root, false);\r
}\r
\r
//\r
for (int i = 0; i < sourceFiles.length; i++) {\r
String filetype = sourceFiles[i][0];\r
if (filetype != null) {\r
- fileProcess.parseFile(sourceFiles[i][1], filetype, root, false);\r
+ fileProcess.parseFile(sourceFiles[i][1], filetype, sourceFiles[i][2], root, false);\r
} else {\r
- fileProcess.parseFile(sourceFiles[i][1], root, false);\r
+ fileProcess.parseFile(sourceFiles[i][1], sourceFiles[i][2], root, false);\r
}\r
}\r
\r
import org.tianocore.build.id.PlatformIdentification;\r
import org.tianocore.build.toolchain.ToolChainInfo;\r
import org.tianocore.common.exception.EdkException;\r
-import org.tianocore.common.logger.EdkLog;\r
import org.w3c.dom.Node;\r
\r
/**\r
returns = get("SourceFiles", xPath);\r
\r
if (returns == null || returns.length == 0) {\r
- return new String[0][0];\r
+ return new String[0][3];\r
}\r
\r
Filename[] sourceFileNames = (Filename[]) returns;\r
List<String[]> outputList = new ArrayList<String[]>();\r
for (int i = 0; i < sourceFileNames.length; i++) {\r
List archList = sourceFileNames[i].getSupArchList();\r
- if (arch == null || arch.equalsIgnoreCase("") || archList == null || contains(archList, arch)) {\r
- outputList.add(new String[] {sourceFileNames[i].getToolCode(),sourceFileNames[i].getStringValue()});\r
+ if (arch == null || arch.trim().equalsIgnoreCase("") || archList == null || contains(archList, arch)) {\r
+ outputList.add(new String[] {sourceFileNames[i].getToolCode(), sourceFileNames[i].getStringValue(), sourceFileNames[i].getToolChainFamily()});\r
}\r
}\r
\r
- String[][] outputString = new String[outputList.size()][2];\r
+ String[][] outputString = new String[outputList.size()][3];\r
for (int index = 0; index < outputList.size(); index++) {\r
+ //\r
+ // ToolCode (FileType)\r
+ //\r
outputString[index][0] = outputList.get(index)[0];\r
+ //\r
+ // File name (relative to MODULE_DIR)\r
+ //\r
outputString[index][1] = outputList.get(index)[1];\r
+ //\r
+ // Tool chain family\r
+ //\r
+ outputString[index][2] = outputList.get(index)[2];\r
}\r
return outputString;\r
}\r