Support using @ToolChainFamily in <Filename> to do the filter. This is also to fix track T365.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1720 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
wuyizhong 2006-10-11 03:50:46 +00:00
parent 188fdd0ac5
commit 91a1f0d7ac
4 changed files with 60 additions and 26 deletions

View File

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

View File

@ -110,7 +110,7 @@ public class FrameworkBuildTask extends Task{
// set Logger
//
GenBuildLogger logger = new GenBuildLogger(getProject());
EdkLog.setLogLevel(EdkLog.EDK_DEBUG);
EdkLog.setLogLevel(EdkLog.EDK_DEBUG);
EdkLog.setLogLevel(getProject().getProperty("env.LOGLEVEL"));
EdkLog.setLogger(logger);

View File

@ -363,7 +363,9 @@ public class ModuleBuildFileGenerator {
**/
private void applyCompileElement(Document document, Node root) {
//
// sourceFiles[][0] is FileType, [][1] is File name relative to Module_Dir
// sourceFiles[][0] is FileType,
// [][1] is File name relative to Module_Dir,
// [][2] is ToolChainFamily
//
String[][] sourceFiles = saq.getSourceFiles(fpdModuleId.getArch());
@ -395,9 +397,9 @@ public class ModuleBuildFileGenerator {
sourceFiles[i][1] = sourceFile.getPath();
String filetype = sourceFiles[i][0];
if (filetype != null) {
fileProcess.parseFile(sourceFiles[i][1], filetype, root, true);
fileProcess.parseFile(sourceFiles[i][1], filetype, sourceFiles[i][2], root, true);
} else {
fileProcess.parseFile(sourceFiles[i][1], root, true);
fileProcess.parseFile(sourceFiles[i][1], sourceFiles[i][2], root, true);
}
}
@ -422,7 +424,7 @@ public class ModuleBuildFileGenerator {
// Parse AutoGen.c & AutoGen.h
//
if ( ! fpdModuleId.getModule().getName().equalsIgnoreCase("Shell")) {
fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", root, false);
fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", null, root, false);
}
//
@ -431,9 +433,9 @@ public class ModuleBuildFileGenerator {
for (int i = 0; i < sourceFiles.length; i++) {
String filetype = sourceFiles[i][0];
if (filetype != null) {
fileProcess.parseFile(sourceFiles[i][1], filetype, root, false);
fileProcess.parseFile(sourceFiles[i][1], filetype, sourceFiles[i][2], root, false);
} else {
fileProcess.parseFile(sourceFiles[i][1], root, false);
fileProcess.parseFile(sourceFiles[i][1], sourceFiles[i][2], root, false);
}
}

View File

@ -38,7 +38,6 @@ import org.tianocore.build.id.PackageIdentification;
import org.tianocore.build.id.PlatformIdentification;
import org.tianocore.build.toolchain.ToolChainInfo;
import org.tianocore.common.exception.EdkException;
import org.tianocore.common.logger.EdkLog;
import org.w3c.dom.Node;
/**
@ -249,22 +248,32 @@ public class SurfaceAreaQuery {
returns = get("SourceFiles", xPath);
if (returns == null || returns.length == 0) {
return new String[0][0];
return new String[0][3];
}
Filename[] sourceFileNames = (Filename[]) returns;
List<String[]> outputList = new ArrayList<String[]>();
for (int i = 0; i < sourceFileNames.length; i++) {
List archList = sourceFileNames[i].getSupArchList();
if (arch == null || arch.equalsIgnoreCase("") || archList == null || contains(archList, arch)) {
outputList.add(new String[] {sourceFileNames[i].getToolCode(),sourceFileNames[i].getStringValue()});
if (arch == null || arch.trim().equalsIgnoreCase("") || archList == null || contains(archList, arch)) {
outputList.add(new String[] {sourceFileNames[i].getToolCode(), sourceFileNames[i].getStringValue(), sourceFileNames[i].getToolChainFamily()});
}
}
String[][] outputString = new String[outputList.size()][2];
String[][] outputString = new String[outputList.size()][3];
for (int index = 0; index < outputList.size(); index++) {
//
// ToolCode (FileType)
//
outputString[index][0] = outputList.get(index)[0];
//
// File name (relative to MODULE_DIR)
//
outputString[index][1] = outputList.get(index)[1];
//
// Tool chain family
//
outputString[index][2] = outputList.get(index)[2];
}
return outputString;
}