moved exception and logger classes to org.tianocore.common package
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1269 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/** @file
|
||||
This file is ANT task GenBuild.
|
||||
|
||||
The file is used to parse a specified Module, and generate its build time
|
||||
This file is ANT task GenBuild.
|
||||
|
||||
The file is used to parse a specified Module, and generate its build time
|
||||
ANT script build.xml, then call the the ANT script to build the module.
|
||||
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -32,6 +32,8 @@ import org.apache.tools.ant.taskdefs.Ant;
|
||||
import org.apache.tools.ant.taskdefs.Property;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
|
||||
import org.tianocore.common.exception.EdkException;
|
||||
import org.tianocore.common.logger.EdkLog;
|
||||
import org.tianocore.build.autogen.AutoGen;
|
||||
import org.tianocore.build.fpd.FpdParserTask;
|
||||
import org.tianocore.build.global.GenBuildLogger;
|
||||
@@ -43,8 +45,6 @@ import org.tianocore.build.id.ModuleIdentification;
|
||||
import org.tianocore.build.id.PackageIdentification;
|
||||
import org.tianocore.build.id.PlatformIdentification;
|
||||
import org.tianocore.build.tools.ModuleItem;
|
||||
import org.tianocore.exception.EdkException;
|
||||
import org.tianocore.logger.EdkLog;
|
||||
|
||||
/**
|
||||
<p>
|
||||
@@ -52,48 +52,48 @@ import org.tianocore.logger.EdkLog;
|
||||
system. The main function of this task is to parse module's surface area,
|
||||
then generate the corresponding <em>BaseName_build.xml</em> (the real ANT
|
||||
build script) and call this to build the module. The whole process including:
|
||||
1. generate AutoGen.c and AutoGen.h; 2. build all dependent library instances;
|
||||
1. generate AutoGen.c and AutoGen.h; 2. build all dependent library instances;
|
||||
3. build all source files inlcude AutoGen.c; 4. generate sections;
|
||||
5. generate FFS file if it is driver module while LIB file if it is Library module.
|
||||
5. generate FFS file if it is driver module while LIB file if it is Library module.
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
The usage is (take module <em>HelloWorld</em> for example):
|
||||
</p>
|
||||
|
||||
|
||||
<pre>
|
||||
<GenBuild
|
||||
msaFilename="HelloWorld.msa"/>
|
||||
<GenBuild
|
||||
msaFilename="HelloWorld.msa"/>
|
||||
processTo="ALL"/>
|
||||
</pre>
|
||||
|
||||
<p><code>processTo</code> provides a way to customize the whole build process.
|
||||
processTo can be one value of ALL, AUTOGEN, FILES, LIBRARYINSTANCES, SECTIONS, NONE.
|
||||
Default is ALL, means whole
|
||||
|
||||
<p><code>processTo</code> provides a way to customize the whole build process.
|
||||
processTo can be one value of ALL, AUTOGEN, FILES, LIBRARYINSTANCES, SECTIONS, NONE.
|
||||
Default is ALL, means whole
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
This task calls <code>AutoGen</code> to generate <em>AutoGen.c</em> and
|
||||
<em>AutoGen.h</em>. The task also parses the development environment
|
||||
configuration files, such as collecting package information, setting compiler
|
||||
flags and so on.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
@since GenBuild 1.0
|
||||
**/
|
||||
public class GenBuildTask extends Ant {
|
||||
|
||||
|
||||
///
|
||||
/// Module surface area file.
|
||||
///
|
||||
File msaFile;
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
///
|
||||
private String type = "all"; // = "build";
|
||||
|
||||
|
||||
///
|
||||
/// Module's Identification.
|
||||
///
|
||||
@@ -102,9 +102,9 @@ public class GenBuildTask extends Ant {
|
||||
private Vector<Property> properties = new Vector<Property>();
|
||||
|
||||
private static Stack<Hashtable> backupPropertiesStack = new Stack<Hashtable>();
|
||||
|
||||
|
||||
private boolean isSingleModuleBuild = false;
|
||||
|
||||
|
||||
/**
|
||||
Public construct method. It is necessary for ANT task.
|
||||
**/
|
||||
@@ -112,7 +112,7 @@ public class GenBuildTask extends Ant {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
|
||||
@throws BuildException
|
||||
From module build, exception from module surface area invalid.
|
||||
**/
|
||||
@@ -134,7 +134,7 @@ public class GenBuildTask extends Ant {
|
||||
Property item = iter.next();
|
||||
getProject().setProperty(item.getName(), item.getValue());
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GenBuild should specify either msaFile or moduleGuid & packageGuid
|
||||
//
|
||||
@@ -165,7 +165,7 @@ public class GenBuildTask extends Ant {
|
||||
else {
|
||||
moduleId.setLibrary(true);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Judge whether it is single module build or not
|
||||
//
|
||||
@@ -183,29 +183,29 @@ public class GenBuildTask extends Ant {
|
||||
PlatformIdentification platformId = GlobalData.getPlatform(filename);
|
||||
getProject().setProperty("PLATFORM_DIR", platformId.getFpdFile().getParent().replaceAll("(\\\\)", "/"));
|
||||
getProject().setProperty("PLATFORM_RELATIVE_DIR", platformId.getPlatformRelativeDir().replaceAll("(\\\\)", "/"));
|
||||
|
||||
|
||||
String packageGuid = getProject().getProperty("PACKAGE_GUID");
|
||||
String packageVersion = getProject().getProperty("PACKAGE_VERSION");
|
||||
PackageIdentification packageId = new PackageIdentification(packageGuid, packageVersion);
|
||||
moduleId.setPackage(packageId);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// If single module : intersection MSA supported ARCHs and tools def!!
|
||||
// else, get arch from pass down
|
||||
//
|
||||
Set<String> archListSupByToolChain = new LinkedHashSet<String>();
|
||||
String[] archs = GlobalData.getToolChainInfo().getArchs();
|
||||
|
||||
Set<String> archListSupByToolChain = new LinkedHashSet<String>();
|
||||
String[] archs = GlobalData.getToolChainInfo().getArchs();
|
||||
|
||||
for (int i = 0; i < archs.length; i ++) {
|
||||
archListSupByToolChain.add(archs[i]);
|
||||
}
|
||||
|
||||
|
||||
Set<String> archSet = new LinkedHashSet<String>();
|
||||
|
||||
|
||||
if ( getProject().getProperty("ARCH") != null) {
|
||||
String[] fpdArchList = getProject().getProperty("ARCH").split(" ");
|
||||
|
||||
|
||||
for (int i = 0; i < fpdArchList.length; i++) {
|
||||
if (archListSupByToolChain.contains(fpdArchList[i])) {
|
||||
archSet.add(fpdArchList[i]);
|
||||
@@ -213,11 +213,11 @@ public class GenBuildTask extends Ant {
|
||||
}
|
||||
}
|
||||
else {
|
||||
archSet = archListSupByToolChain;
|
||||
archSet = archListSupByToolChain;
|
||||
}
|
||||
|
||||
|
||||
String[] archList = archSet.toArray(new String[archSet.size()]);
|
||||
|
||||
|
||||
//
|
||||
// Judge if arch is all supported by current module. If not, throw Exception.
|
||||
//
|
||||
@@ -229,13 +229,13 @@ public class GenBuildTask extends Ant {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int k = 0; k < archList.length; k++) {
|
||||
|
||||
|
||||
getProject().setProperty("ARCH", archList[k]);
|
||||
|
||||
|
||||
FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, archList[k]);
|
||||
|
||||
|
||||
//
|
||||
// Whether the module is built before
|
||||
//
|
||||
@@ -247,7 +247,7 @@ public class GenBuildTask extends Ant {
|
||||
} else {
|
||||
GlobalData.registerBuiltModule(fpdModuleId);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// For Every TOOLCHAIN, TARGET
|
||||
//
|
||||
@@ -263,7 +263,7 @@ public class GenBuildTask extends Ant {
|
||||
//
|
||||
// check if any tool is defined for current target + toolchain + arch
|
||||
// don't do anything if no tools found
|
||||
//
|
||||
//
|
||||
if (GlobalData.isCommandSet(targetList[i], toolchainList[j], archList[k]) == false) {
|
||||
System.out.println("Warning: No build issued. No tools were found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");
|
||||
continue;
|
||||
@@ -278,7 +278,7 @@ public class GenBuildTask extends Ant {
|
||||
System.out.println("Build " + moduleId + " start >>>");
|
||||
System.out.println("Target: " + targetList[i] + " Tagname: " + toolchainList[j] + " Arch: " + archList[k]);
|
||||
SurfaceAreaQuery.setDoc(GlobalData.getDoc(fpdModuleId));
|
||||
|
||||
|
||||
//
|
||||
// Prepare for all other common properties
|
||||
// PACKAGE, PACKAGE_GUID, PACKAGE_VERSION, PACKAGE_DIR, PACKAGE_RELATIVE_DIR
|
||||
@@ -287,13 +287,13 @@ public class GenBuildTask extends Ant {
|
||||
// SUBSYSTEM, ENTRYPOINT, EBC_TOOL_LIB_PATH
|
||||
//
|
||||
setModuleCommonProperties(archList[k]);
|
||||
|
||||
|
||||
//
|
||||
// OutputManage prepare for
|
||||
// OutputManage prepare for
|
||||
// BIN_DIR, DEST_DIR_DEBUG, DEST_DIR_OUTPUT, BUILD_DIR, FV_DIR
|
||||
//
|
||||
OutputManager.getInstance().update(getProject());
|
||||
|
||||
|
||||
if (type.equalsIgnoreCase("all") || type.equalsIgnoreCase("build")) {
|
||||
applyBuild(targetList[i], toolchainList[j], fpdModuleId);
|
||||
}
|
||||
@@ -313,13 +313,13 @@ public class GenBuildTask extends Ant {
|
||||
}
|
||||
|
||||
/**
|
||||
This method is used to prepare Platform-related information.
|
||||
|
||||
This method is used to prepare Platform-related information.
|
||||
|
||||
<p>In Single Module Build mode, platform-related information is not ready.
|
||||
The method read the system environment variable <code>ACTIVE_PLATFORM</code>
|
||||
The method read the system environment variable <code>ACTIVE_PLATFORM</code>
|
||||
and search in the Framework Database. Note that platform name in the Framework
|
||||
Database must be unique. </p>
|
||||
|
||||
|
||||
**/
|
||||
private void prepareSingleModuleBuild(){
|
||||
//
|
||||
@@ -327,27 +327,27 @@ public class GenBuildTask extends Ant {
|
||||
// TBD: Enhance it!!!!
|
||||
//
|
||||
PackageIdentification packageId = GlobalData.getPackageForModule(moduleId);
|
||||
|
||||
|
||||
moduleId.setPackage(packageId);
|
||||
|
||||
|
||||
//
|
||||
// Read ACTIVE_PLATFORM's FPD file (Call FpdParserTask's method)
|
||||
//
|
||||
String filename = getProject().getProperty("PLATFORM_FILE");
|
||||
|
||||
|
||||
if (filename == null){
|
||||
throw new BuildException("Please set ACTIVE_PLATFORM in the file: Tools/Conf/target.txt if you want to build a single module!");
|
||||
}
|
||||
|
||||
|
||||
PlatformIdentification platformId = GlobalData.getPlatform(filename);
|
||||
|
||||
|
||||
//
|
||||
// Read FPD file
|
||||
//
|
||||
FpdParserTask fpdParser = new FpdParserTask();
|
||||
fpdParser.setProject(getProject());
|
||||
fpdParser.parseFpdFile(platformId.getFpdFile());
|
||||
|
||||
|
||||
//
|
||||
// Prepare for Platform related common properties
|
||||
// PLATFORM, PLATFORM_DIR, PLATFORM_RELATIVE_DIR
|
||||
@@ -372,7 +372,7 @@ public class GenBuildTask extends Ant {
|
||||
getProject().setProperty("PACKAGE_VERSION", packageId.getVersion());
|
||||
getProject().setProperty("PACKAGE_DIR", packageId.getPackageDir().replaceAll("(\\\\)", "/"));
|
||||
getProject().setProperty("PACKAGE_RELATIVE_DIR", packageId.getPackageRelativeDir().replaceAll("(\\\\)", "/"));
|
||||
|
||||
|
||||
//
|
||||
// MODULE or BASE_NAME, GUID or FILE_GUID, VERSION, MODULE_TYPE
|
||||
// MODULE_DIR, MODULE_RELATIVE_DIR
|
||||
@@ -391,24 +391,24 @@ public class GenBuildTask extends Ant {
|
||||
getProject().setProperty("MODULE_TYPE", moduleId.getModuleType());
|
||||
getProject().setProperty("MODULE_DIR", moduleId.getMsaFile().getParent().replaceAll("(\\\\)", "/"));
|
||||
getProject().setProperty("MODULE_RELATIVE_DIR", moduleId.getModuleRelativePath().replaceAll("(\\\\)", "/"));
|
||||
|
||||
|
||||
//
|
||||
// SUBSYSTEM
|
||||
//
|
||||
String[][] subsystemMap = { { "BASE", "EFI_BOOT_SERVICE_DRIVER"},
|
||||
{ "SEC", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "PEI_CORE", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "PEIM", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "SEC", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "PEI_CORE", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "PEIM", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "DXE_CORE", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "DXE_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "DXE_RUNTIME_DRIVER", "EFI_RUNTIME_DRIVER" },
|
||||
{ "DXE_SAL_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "DXE_SMM_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "TOOL", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "DXE_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "DXE_RUNTIME_DRIVER", "EFI_RUNTIME_DRIVER" },
|
||||
{ "DXE_SAL_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "DXE_SMM_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "TOOL", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "UEFI_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
|
||||
{ "UEFI_APPLICATION", "EFI_APPLICATION" },
|
||||
{ "USER_DEFINED", "EFI_BOOT_SERVICE_DRIVER"} };
|
||||
|
||||
{ "UEFI_APPLICATION", "EFI_APPLICATION" },
|
||||
{ "USER_DEFINED", "EFI_BOOT_SERVICE_DRIVER"} };
|
||||
|
||||
String subsystem = "EFI_BOOT_SERVICE_DRIVER";
|
||||
for (int i = 0; i < subsystemMap.length; i++) {
|
||||
if (moduleId.getModuleType().equalsIgnoreCase(subsystemMap[i][0])) {
|
||||
@@ -417,7 +417,7 @@ public class GenBuildTask extends Ant {
|
||||
}
|
||||
}
|
||||
getProject().setProperty("SUBSYSTEM", subsystem);
|
||||
|
||||
|
||||
//
|
||||
// ENTRYPOINT
|
||||
//
|
||||
@@ -427,7 +427,7 @@ public class GenBuildTask extends Ant {
|
||||
else {
|
||||
getProject().setProperty("ENTRYPOINT", "_ModuleEntryPoint");
|
||||
}
|
||||
|
||||
|
||||
getProject().setProperty("OBJECTS", "");
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ public class GenBuildTask extends Ant {
|
||||
String cmdName = GlobalData.getCommandSetting(key, fpdModuleId);
|
||||
File cmdFile = new File(cmdPath + File.separatorChar + cmdName);
|
||||
getProject().setProperty(cmd[m], cmdFile.getPath().replaceAll("(\\\\)", "/"));
|
||||
|
||||
|
||||
//
|
||||
// set CC_FLAGS
|
||||
//
|
||||
@@ -454,7 +454,7 @@ public class GenBuildTask extends Ant {
|
||||
Set<String> subset = new LinkedHashSet<String>();
|
||||
putFlagsToSet(addset, cmdFlags);
|
||||
getProject().setProperty(cmd[m] + "_FLAGS", getProject().replaceProperties(getFlags(addset, subset)));
|
||||
|
||||
|
||||
//
|
||||
// Set CC_EXT
|
||||
//
|
||||
@@ -466,7 +466,7 @@ public class GenBuildTask extends Ant {
|
||||
else {
|
||||
getProject().setProperty(cmd[m] + "_EXT", "");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// set CC_FAMILY
|
||||
//
|
||||
@@ -475,7 +475,7 @@ public class GenBuildTask extends Ant {
|
||||
if (toolChainFamily != null) {
|
||||
getProject().setProperty(cmd[m] + "_FAMILY", toolChainFamily);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// set CC_SPATH
|
||||
//
|
||||
@@ -487,7 +487,7 @@ public class GenBuildTask extends Ant {
|
||||
else {
|
||||
getProject().setProperty(cmd[m] + "_SPATH", "");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// set CC_DPATH
|
||||
//
|
||||
@@ -501,19 +501,19 @@ public class GenBuildTask extends Ant {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setMsaFile(File msaFile) {
|
||||
this.msaFile = msaFile;
|
||||
}
|
||||
|
||||
/**
|
||||
Method is for ANT to initialize MSA file.
|
||||
|
||||
Method is for ANT to initialize MSA file.
|
||||
|
||||
@param msaFilename MSA file name
|
||||
**/
|
||||
public void setMsaFile(String msaFilename) {
|
||||
String moduleDir = getProject().getProperty("MODULE_DIR");
|
||||
|
||||
|
||||
//
|
||||
// If is Single Module Build, then use the Base Dir defined in build.xml
|
||||
//
|
||||
@@ -522,17 +522,17 @@ public class GenBuildTask extends Ant {
|
||||
}
|
||||
msaFile = new File(moduleDir + File.separatorChar + msaFilename);
|
||||
}
|
||||
|
||||
|
||||
public void addConfiguredModuleItem(ModuleItem moduleItem) {
|
||||
PackageIdentification packageId = new PackageIdentification(moduleItem.getPackageGuid(), moduleItem.getPackageVersion());
|
||||
ModuleIdentification moduleId = new ModuleIdentification(moduleItem.getModuleGuid(), moduleItem.getModuleVersion());
|
||||
moduleId.setPackage(packageId);
|
||||
this.moduleId = moduleId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Add a property.
|
||||
|
||||
Add a property.
|
||||
|
||||
@param p property
|
||||
**/
|
||||
public void addProperty(Property p) {
|
||||
@@ -542,21 +542,21 @@ public class GenBuildTask extends Ant {
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws EdkException{
|
||||
//
|
||||
// AutoGen
|
||||
//
|
||||
|
||||
|
||||
AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch());
|
||||
autogen.genAutogen();
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Get compiler flags
|
||||
//
|
||||
getCompilerFlags(buildTarget, buildTagname, fpdModuleId);
|
||||
|
||||
|
||||
//
|
||||
// Prepare LIBS
|
||||
//
|
||||
@@ -566,7 +566,7 @@ public class GenBuildTask extends Ant {
|
||||
propertyLibs += " " + getProject().getProperty("BIN_DIR") + File.separatorChar + libinstances[i].getName() + ".lib";
|
||||
}
|
||||
getProject().setProperty("LIBS", propertyLibs.replaceAll("(\\\\)", "/"));
|
||||
|
||||
|
||||
//
|
||||
// if it is CUSTOM_BUILD
|
||||
// then call the exist BaseName_build.xml directly.
|
||||
@@ -581,7 +581,7 @@ public class GenBuildTask extends Ant {
|
||||
ant.execute();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Generate ${BASE_NAME}_build.xml
|
||||
// TBD
|
||||
@@ -590,7 +590,7 @@ public class GenBuildTask extends Ant {
|
||||
ModuleBuildFileGenerator fileGenerator = new ModuleBuildFileGenerator(getProject(), ffsKeyword, fpdModuleId);
|
||||
String buildFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
|
||||
fileGenerator.genBuildFile(buildFilename);
|
||||
|
||||
|
||||
//
|
||||
// Ant call ${BASE_NAME}_build.xml
|
||||
//
|
||||
@@ -601,7 +601,7 @@ public class GenBuildTask extends Ant {
|
||||
ant.init();
|
||||
ant.execute();
|
||||
}
|
||||
|
||||
|
||||
private void applyClean(FpdModuleIdentification fpdModuleId){
|
||||
//
|
||||
// if it is CUSTOM_BUILD
|
||||
@@ -618,7 +618,7 @@ public class GenBuildTask extends Ant {
|
||||
ant.execute();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
Ant ant = new Ant();
|
||||
ant.setProject(getProject());
|
||||
ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");
|
||||
@@ -626,12 +626,12 @@ public class GenBuildTask extends Ant {
|
||||
ant.setInheritAll(true);
|
||||
ant.init();
|
||||
ant.execute();
|
||||
|
||||
|
||||
//
|
||||
// Delete current module's DEST_DIR_OUTPUT
|
||||
// TBD
|
||||
}
|
||||
|
||||
|
||||
private void applyCleanall(FpdModuleIdentification fpdModuleId){
|
||||
//
|
||||
// if it is CUSTOM_BUILD
|
||||
@@ -648,7 +648,7 @@ public class GenBuildTask extends Ant {
|
||||
ant.execute();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
Ant ant = new Ant();
|
||||
ant.setProject(getProject());
|
||||
ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");
|
||||
@@ -656,7 +656,7 @@ public class GenBuildTask extends Ant {
|
||||
ant.setInheritAll(true);
|
||||
ant.init();
|
||||
ant.execute();
|
||||
|
||||
|
||||
//
|
||||
// Delete current module's DEST_DIR_OUTPUT
|
||||
// TBD
|
||||
@@ -667,17 +667,17 @@ public class GenBuildTask extends Ant {
|
||||
|
||||
/**
|
||||
Separate the string and instore in set.
|
||||
|
||||
<p> String is separated by Java Regulation Expression
|
||||
|
||||
<p> String is separated by Java Regulation Expression
|
||||
"[^\\\\]?(\".*?[^\\\\]\")[ \t,]+". </p>
|
||||
|
||||
|
||||
<p>For example: </p>
|
||||
|
||||
|
||||
<pre>
|
||||
"/nologo", "/W3", "/WX"
|
||||
"/C", "/DSTRING_DEFINES_FILE=\"BdsStrDefs.h\""
|
||||
</pre>
|
||||
|
||||
|
||||
@param set store the separated string
|
||||
@param str string to separate
|
||||
**/
|
||||
@@ -693,10 +693,10 @@ public class GenBuildTask extends Ant {
|
||||
set.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Generate the final flags string will be used by compile command.
|
||||
|
||||
Generate the final flags string will be used by compile command.
|
||||
|
||||
@param add the add flags set
|
||||
@param sub the sub flags set
|
||||
@return final flags after add set substract sub set
|
||||
@@ -715,7 +715,7 @@ public class GenBuildTask extends Ant {
|
||||
private void pushProperties() {
|
||||
backupPropertiesStack.push(getProject().getProperties());
|
||||
}
|
||||
|
||||
|
||||
private void popProperties() {
|
||||
Hashtable backupProperties = backupPropertiesStack.pop();
|
||||
Set keys = backupProperties.keySet();
|
||||
|
@@ -3,13 +3,13 @@
|
||||
|
||||
This class is to generate Autogen.h and Autogen.c according to module surface area
|
||||
or library surface area.
|
||||
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
@@ -44,7 +44,8 @@ import org.tianocore.build.global.SurfaceAreaQuery;
|
||||
import org.tianocore.build.id.ModuleIdentification;
|
||||
import org.tianocore.build.id.PackageIdentification;
|
||||
import org.tianocore.build.pcd.action.PCDAutoGenAction;
|
||||
import org.tianocore.logger.EdkLog;
|
||||
|
||||
import org.tianocore.common.logger.EdkLog;
|
||||
|
||||
/**
|
||||
* This class is to generate Autogen.h and Autogen.c according to module surface
|
||||
@@ -55,9 +56,9 @@ public class AutoGen {
|
||||
// / The output path of Autogen.h and Autogen.c
|
||||
// /
|
||||
private String outputPath;
|
||||
///
|
||||
/// The name of FV directory
|
||||
///
|
||||
///
|
||||
/// The name of FV directory
|
||||
///
|
||||
private String fvDir;
|
||||
// /
|
||||
// / The base name of module or library.
|
||||
@@ -92,7 +93,7 @@ public class AutoGen {
|
||||
// / dependence on library instance surface area.
|
||||
// /
|
||||
private Set<String> mGuidList = new HashSet<String>();
|
||||
|
||||
|
||||
//
|
||||
// The dependence package list which recoreded in module or library surface
|
||||
// area and it's dependence on library instance surface are.
|
||||
@@ -100,24 +101,24 @@ public class AutoGen {
|
||||
private List<PackageIdentification> mDepPkgList = new LinkedList<PackageIdentification>();
|
||||
|
||||
//
|
||||
// For non library module, add its library instance's construct and destructor to
|
||||
// For non library module, add its library instance's construct and destructor to
|
||||
// list.
|
||||
//
|
||||
//
|
||||
private List<String> libConstructList = new ArrayList<String>();
|
||||
private List<String> libDestructList = new ArrayList<String>();
|
||||
|
||||
//
|
||||
// List to store SetVirtalAddressMapCallBack, ExitBootServiceCallBack
|
||||
//
|
||||
// List to store SetVirtalAddressMapCallBack, ExitBootServiceCallBack
|
||||
//
|
||||
private List<String> setVirtalAddList = new ArrayList<String>();
|
||||
private List<String> exitBootServiceList = new ArrayList<String>();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct function
|
||||
*
|
||||
*
|
||||
* This function mainly initialize some member variable.
|
||||
*
|
||||
*
|
||||
* @param outputPath
|
||||
* Output path of AutoGen file.
|
||||
* @param baseName
|
||||
@@ -135,9 +136,9 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* saveFile function
|
||||
*
|
||||
*
|
||||
* This function save the content in stringBuffer to file.
|
||||
*
|
||||
*
|
||||
* @param fileName
|
||||
* The name of file.
|
||||
* @param fileBuffer
|
||||
@@ -176,10 +177,10 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* genAutogen function
|
||||
*
|
||||
*
|
||||
* This function call libGenAutoGen or moduleGenAutogen function, which
|
||||
* dependence on generate library autogen or module autogen.
|
||||
*
|
||||
*
|
||||
* @throws BuildException
|
||||
* Failed to creat AutoGen.c & AutoGen.h.
|
||||
*/
|
||||
@@ -210,9 +211,9 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* moduleGenAutogen function
|
||||
*
|
||||
*
|
||||
* This function generates AutoGen.c & AutoGen.h for module.
|
||||
*
|
||||
*
|
||||
* @throws BuildException
|
||||
* Faile to create module AutoGen.c & AutoGen.h.
|
||||
*/
|
||||
@@ -231,9 +232,9 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* libGenAutogen function
|
||||
*
|
||||
*
|
||||
* This function generates AutoGen.c & AutoGen.h for library.
|
||||
*
|
||||
*
|
||||
* @throws BuildException
|
||||
* Faile to create library AutoGen.c & AutoGen.h
|
||||
*/
|
||||
@@ -250,9 +251,9 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* moduleGenAutogenH
|
||||
*
|
||||
*
|
||||
* This function generates AutoGen.h for module.
|
||||
*
|
||||
*
|
||||
* @throws BuildException
|
||||
* Failed to generate AutoGen.h.
|
||||
*/
|
||||
@@ -340,9 +341,9 @@ public class AutoGen {
|
||||
fileBuffer.append("\r\n");
|
||||
|
||||
//
|
||||
// If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to
|
||||
// If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to
|
||||
// {DEST_DIR_DRBUG}/FlashMap.h
|
||||
//
|
||||
//
|
||||
if (SurfaceAreaQuery.isHaveTianoR8FlashMap()) {
|
||||
fileBuffer.append(CommonDefinition.include);
|
||||
fileBuffer.append(" <");
|
||||
@@ -372,9 +373,9 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* moduleGenAutogenC
|
||||
*
|
||||
*
|
||||
* This function generates AutoGen.c for module.
|
||||
*
|
||||
*
|
||||
* @throws BuildException
|
||||
* Failed to generate AutoGen.c.
|
||||
*/
|
||||
@@ -452,7 +453,7 @@ public class AutoGen {
|
||||
// autogen.c
|
||||
//
|
||||
LibInstanceToAutogenC(fileBuffer);
|
||||
|
||||
|
||||
//
|
||||
// Get module dependent Package identification.
|
||||
//
|
||||
@@ -461,9 +462,9 @@ public class AutoGen {
|
||||
if (!this.mDepPkgList.contains(packages[i])){
|
||||
this.mDepPkgList.add(packages[i]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Write consumed ppi, guid, protocol to autogen.c
|
||||
//
|
||||
@@ -472,7 +473,7 @@ public class AutoGen {
|
||||
GuidGuidToAutogenC(fileBuffer);
|
||||
|
||||
//
|
||||
// Call pcd autogen.
|
||||
// Call pcd autogen.
|
||||
//
|
||||
this.myPcdAutogen = new PCDAutoGenAction(moduleId, this.arch, false, null);
|
||||
try {
|
||||
@@ -480,7 +481,7 @@ public class AutoGen {
|
||||
} catch (Exception exp) {
|
||||
throw new PcdAutogenException (exp.getMessage());
|
||||
}
|
||||
|
||||
|
||||
if (this.myPcdAutogen != null) {
|
||||
fileBuffer.append("\r\n");
|
||||
fileBuffer.append(this.myPcdAutogen.OutputC());
|
||||
@@ -494,9 +495,9 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* libGenAutogenH
|
||||
*
|
||||
*
|
||||
* This function generates AutoGen.h for library.
|
||||
*
|
||||
*
|
||||
* @throws BuildException
|
||||
* Failed to generate AutoGen.c.
|
||||
*/
|
||||
@@ -537,7 +538,7 @@ public class AutoGen {
|
||||
|
||||
//
|
||||
// Write consumed package's mdouleInfo related *.h file to autogen.h.
|
||||
//
|
||||
//
|
||||
moduleType = SurfaceAreaQuery.getModuleType();
|
||||
PackageIdentification[] cosumedPkglist = SurfaceAreaQuery
|
||||
.getDependencePkg(this.arch);
|
||||
@@ -571,9 +572,9 @@ public class AutoGen {
|
||||
fileBuffer.append("\r\n");
|
||||
|
||||
//
|
||||
// If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to
|
||||
// If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to
|
||||
// {DEST_DIR_DRBUG}/FlashMap.h
|
||||
//
|
||||
//
|
||||
if (SurfaceAreaQuery.isHaveTianoR8FlashMap()) {
|
||||
fileBuffer.append(CommonDefinition.include);
|
||||
fileBuffer.append(" <");
|
||||
@@ -604,9 +605,9 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* libGenAutogenC
|
||||
*
|
||||
*
|
||||
* This function generates AutoGen.h for library.
|
||||
*
|
||||
*
|
||||
* @throws BuildException
|
||||
* Failed to generate AutoGen.c.
|
||||
*/
|
||||
@@ -622,11 +623,11 @@ public class AutoGen {
|
||||
fileBuffer.append("\r\n");
|
||||
|
||||
//
|
||||
// Call pcd autogen.
|
||||
// Call pcd autogen.
|
||||
//
|
||||
this.myPcdAutogen = new PCDAutoGenAction(this.moduleId,
|
||||
this.arch,
|
||||
true,
|
||||
true,
|
||||
SurfaceAreaQuery.getModulePcdEntryNameArray());
|
||||
try {
|
||||
this.myPcdAutogen.execute();
|
||||
@@ -646,10 +647,10 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* LibraryClassToAutogenH
|
||||
*
|
||||
*
|
||||
* This function returns *.h files declared by library classes which are
|
||||
* consumed or produced by current build module or library.
|
||||
*
|
||||
*
|
||||
* @param libClassList
|
||||
* List of library class which consumed or produce by current
|
||||
* build module or library.
|
||||
@@ -689,9 +690,9 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* IncludesToAutogenH
|
||||
*
|
||||
*
|
||||
* This function add include file in AutoGen.h file.
|
||||
*
|
||||
*
|
||||
* @param packageNameList
|
||||
* List of module depended package.
|
||||
* @param moduleType
|
||||
@@ -727,10 +728,10 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* EntryPointToAutoGen
|
||||
*
|
||||
*
|
||||
* This function convert <ModuleEntryPoint> & <ModuleUnloadImage>
|
||||
* information in mas to AutoGen.c
|
||||
*
|
||||
*
|
||||
* @param entryPointList
|
||||
* List of entry point.
|
||||
* @param fileBuffer
|
||||
@@ -833,7 +834,7 @@ public class AutoGen {
|
||||
.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
|
||||
fileBuffer.append(" );\r\n");
|
||||
entryPointCount++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
fileBuffer.append("EFI_STATUS\r\n");
|
||||
@@ -918,7 +919,7 @@ public class AutoGen {
|
||||
fileBuffer.append(" )\r\n\r\n");
|
||||
fileBuffer.append("{\r\n");
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < entryPointList.length; i++) {
|
||||
fileBuffer
|
||||
.append(" if (SetJump (&mJumpContext) == 0) {\r\n");
|
||||
@@ -927,7 +928,7 @@ public class AutoGen {
|
||||
fileBuffer.append(" (ImageHandle, SystemTable));\r\n");
|
||||
fileBuffer.append(" ASSERT (FALSE);\r\n");
|
||||
fileBuffer.append(" }\r\n");
|
||||
|
||||
|
||||
}
|
||||
fileBuffer.append(" return mDriverEntryPointStatus;\r\n");
|
||||
fileBuffer.append("}\r\n\r\n");
|
||||
@@ -945,10 +946,10 @@ public class AutoGen {
|
||||
fileBuffer.append(" LongJump (&mJumpContext, (UINTN)-1);\r\n");
|
||||
fileBuffer.append(" ASSERT (FALSE);\r\n");
|
||||
fileBuffer.append("}\r\n\r\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Add "ModuleUnloadImage" for DxeSmmDriver module type;
|
||||
//
|
||||
@@ -1034,10 +1035,10 @@ public class AutoGen {
|
||||
fileBuffer.append("{\r\n");
|
||||
fileBuffer.append(" return EFI_SUCCESS;\r\n");
|
||||
fileBuffer.append("}\r\n");
|
||||
|
||||
|
||||
}else {
|
||||
for (int i = 0; i < entryPointList.length; i++) {
|
||||
|
||||
|
||||
fileBuffer.append("EFI_STATUS\r\n");
|
||||
fileBuffer.append("EFIAPI\r\n");
|
||||
fileBuffer.append(entryPointList[i]);
|
||||
@@ -1114,7 +1115,7 @@ public class AutoGen {
|
||||
fileBuffer.append("}\r\n\r\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Add ModuleUnloadImage for DxeDriver and UefiDriver module type.
|
||||
//
|
||||
@@ -1184,10 +1185,10 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* PpiGuidToAutogenc
|
||||
*
|
||||
*
|
||||
* This function gets GUIDs from SPD file accrodeing to <PPIs> information
|
||||
* and write those GUIDs to AutoGen.c.
|
||||
*
|
||||
*
|
||||
* @param fileBuffer
|
||||
* String Buffer for Autogen.c file.
|
||||
* @throws BuildException
|
||||
@@ -1200,7 +1201,7 @@ public class AutoGen {
|
||||
// Get the all PPI adn PPI Notify from MSA file,
|
||||
// then add those PPI ,and PPI Notify name to list.
|
||||
//
|
||||
|
||||
|
||||
String[] ppiList = SurfaceAreaQuery.getPpiArray(this.arch);
|
||||
for (int i = 0; i < ppiList.length; i++) {
|
||||
this.mPpiList.add(ppiList[i]);
|
||||
@@ -1238,10 +1239,10 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* ProtocolGuidToAutogenc
|
||||
*
|
||||
*
|
||||
* This function gets GUIDs from SPD file accrodeing to <Protocol>
|
||||
* information and write those GUIDs to AutoGen.c.
|
||||
*
|
||||
*
|
||||
* @param fileBuffer
|
||||
* String Buffer for Autogen.c file.
|
||||
* @throws BuildException
|
||||
@@ -1271,8 +1272,8 @@ public class AutoGen {
|
||||
//
|
||||
Iterator protocolIterator = this.mProtocolList.iterator();
|
||||
String protocolKeyWord = null;
|
||||
|
||||
|
||||
|
||||
|
||||
while (protocolIterator.hasNext()) {
|
||||
protocolKeyWord = protocolIterator.next().toString();
|
||||
cNameGuid = GlobalData.getProtocolGuid(this.mDepPkgList, protocolKeyWord);
|
||||
@@ -1295,13 +1296,13 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* GuidGuidToAutogenc
|
||||
*
|
||||
*
|
||||
* This function gets GUIDs from SPD file accrodeing to <Guids> information
|
||||
* and write those GUIDs to AutoGen.c.
|
||||
*
|
||||
*
|
||||
* @param fileBuffer
|
||||
* String Buffer for Autogen.c file.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void GuidGuidToAutogenC(StringBuffer fileBuffer) throws AutoGenException {
|
||||
String[] cNameGuid = null;
|
||||
@@ -1339,11 +1340,11 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* LibInstanceToAutogenC
|
||||
*
|
||||
*
|
||||
* This function adds dependent library instance to autogen.c,which
|
||||
* includeing library's constructor, destructor, and library dependent ppi,
|
||||
* protocol, guid, pcd information.
|
||||
*
|
||||
*
|
||||
* @param fileBuffer
|
||||
* String buffer for AutoGen.c
|
||||
* @throws BuildException
|
||||
@@ -1367,10 +1368,10 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* LibConstructorToAutogenc
|
||||
*
|
||||
*
|
||||
* This function writes library constructor list to AutoGen.c. The library
|
||||
* constructor's parameter and return value depend on module type.
|
||||
*
|
||||
*
|
||||
* @param libInstanceList
|
||||
* List of library construct name.
|
||||
* @param moduleType
|
||||
@@ -1508,10 +1509,10 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* LibDestructorToAutogenc
|
||||
*
|
||||
*
|
||||
* This function writes library destructor list to AutoGen.c. The library
|
||||
* destructor's parameter and return value depend on module type.
|
||||
*
|
||||
*
|
||||
* @param libInstanceList
|
||||
* List of library destructor name.
|
||||
* @param moduleType
|
||||
@@ -1588,7 +1589,7 @@ public class AutoGen {
|
||||
//
|
||||
// If no library destructor function, return EFI_SUCCESS.
|
||||
//
|
||||
|
||||
|
||||
for (int i = 0; i < libInstanceList.size(); i++) {
|
||||
if (isFirst) {
|
||||
fileBuffer.append(" EFI_STATUS Status;\r\n");
|
||||
@@ -1608,10 +1609,10 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* ExternsDriverBindingToAutoGenC
|
||||
*
|
||||
*
|
||||
* This function is to write DRIVER_BINDING, COMPONENT_NAME,
|
||||
* DRIVER_CONFIGURATION, DRIVER_DIAGNOSTIC in AutoGen.c.
|
||||
*
|
||||
*
|
||||
* @param fileBuffer
|
||||
* String buffer for AutoGen.c
|
||||
*/
|
||||
@@ -1762,10 +1763,10 @@ public class AutoGen {
|
||||
|
||||
/**
|
||||
* ExternCallBackToAutoGenC
|
||||
*
|
||||
*
|
||||
* This function adds <SetVirtualAddressMapCallBack> and
|
||||
* <ExitBootServicesCallBack> infomation to AutoGen.c
|
||||
*
|
||||
*
|
||||
* @param fileBuffer
|
||||
* String buffer for AutoGen.c
|
||||
* @throws BuildException
|
||||
@@ -1773,10 +1774,10 @@ public class AutoGen {
|
||||
void ExternCallBackToAutoGenC(StringBuffer fileBuffer)
|
||||
throws BuildException {
|
||||
//
|
||||
// Collect module's <SetVirtualAddressMapCallBack> and
|
||||
// <ExitBootServiceCallBack> and add to setVirtualAddList
|
||||
// Collect module's <SetVirtualAddressMapCallBack> and
|
||||
// <ExitBootServiceCallBack> and add to setVirtualAddList
|
||||
// exitBootServiceList.
|
||||
//
|
||||
//
|
||||
String[] setVirtuals = SurfaceAreaQuery.getSetVirtualAddressMapCallBackArray();
|
||||
String[] exitBoots = SurfaceAreaQuery.getExitBootServicesCallBackArray();
|
||||
if (setVirtuals != null) {
|
||||
@@ -1791,8 +1792,8 @@ public class AutoGen {
|
||||
}
|
||||
//
|
||||
// Add c code in autogen.c which relate to <SetVirtualAddressMapCallBack>
|
||||
// and <ExitBootServicesCallBack>
|
||||
//
|
||||
// and <ExitBootServicesCallBack>
|
||||
//
|
||||
String moduleType = this.moduleId.getModuleType();
|
||||
boolean UefiOrDxeModule = false;
|
||||
int Count = 0;
|
||||
@@ -1879,8 +1880,8 @@ public class AutoGen {
|
||||
}
|
||||
//
|
||||
// If module is not DXE_DRIVER, DXE_RUNTIME_DIRVER, UEFI_DRIVER
|
||||
// UEFI_APPLICATION and DXE_SAL_DRIVER add the NULL at the end of
|
||||
// _gDriverSetVirtualAddressMapEvent list.
|
||||
// UEFI_APPLICATION and DXE_SAL_DRIVER add the NULL at the end of
|
||||
// _gDriverSetVirtualAddressMapEvent list.
|
||||
//
|
||||
if (!UefiOrDxeModule) {
|
||||
fileBuffer.append(",\r\n NULL");
|
||||
@@ -1966,15 +1967,15 @@ public class AutoGen {
|
||||
}
|
||||
|
||||
private void copyFlashMapHToDebugDir() throws AutoGenException{
|
||||
|
||||
|
||||
File inFile = new File(fvDir + File.separatorChar + CommonDefinition.flashMapH);
|
||||
int size = (int)inFile.length();
|
||||
byte[] buffer = new byte[size];
|
||||
File outFile = new File (this.outputPath + File.separatorChar + CommonDefinition.tianoR8FlashMapH);
|
||||
//
|
||||
// If TianoR8FlashMap.h existed and the flashMap.h don't change,
|
||||
// If TianoR8FlashMap.h existed and the flashMap.h don't change,
|
||||
// do nothing.
|
||||
//
|
||||
//
|
||||
if ((!outFile.exists()) ||(inFile.lastModified() - outFile.lastModified()) >= 0) {
|
||||
try{
|
||||
if (inFile.exists()) {
|
||||
@@ -1992,7 +1993,7 @@ public class AutoGen {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*This function first order the library instances, then collect
|
||||
*library instance 's PPI, Protocol, GUID,
|
||||
@@ -2094,9 +2095,9 @@ public class AutoGen {
|
||||
.getLibDestructorName();
|
||||
|
||||
//
|
||||
// Collect SetVirtualAddressMapCallBack and
|
||||
// Collect SetVirtualAddressMapCallBack and
|
||||
// ExitBootServiceCallBack.
|
||||
//
|
||||
//
|
||||
setVirtuals = SurfaceAreaQuery.getSetVirtualAddressMapCallBackArray();
|
||||
exitBoots = SurfaceAreaQuery.getExitBootServicesCallBackArray();
|
||||
if (setVirtuals != null) {
|
||||
|
@@ -2,20 +2,20 @@
|
||||
GenBuildException class.
|
||||
|
||||
The class handle the exception throwed by entity class.
|
||||
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
**/
|
||||
package org.tianocore.build.exception;
|
||||
|
||||
import org.tianocore.exception.EdkException;
|
||||
import org.tianocore.common.exception.EdkException;
|
||||
|
||||
/**
|
||||
The class handle the exception throwed by entity class.
|
||||
@@ -24,13 +24,13 @@ public class GenBuildException extends EdkException {
|
||||
static final long serialVersionUID = -8034897190740066937L;
|
||||
/**
|
||||
Constructure function
|
||||
|
||||
|
||||
@param expStr exception message string.
|
||||
**/
|
||||
public GenBuildException(String expStr) {
|
||||
super("[GenBuildException]:" + expStr);
|
||||
}
|
||||
|
||||
|
||||
public GenBuildException() {
|
||||
super();
|
||||
}
|
||||
|
@@ -2,20 +2,20 @@
|
||||
TianoToolsException class.
|
||||
|
||||
The class handle the exception throwed by entity class.
|
||||
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
**/
|
||||
package org.tianocore.build.exception;
|
||||
|
||||
import org.tianocore.exception.EdkException;
|
||||
import org.tianocore.common.exception.EdkException;
|
||||
|
||||
/**
|
||||
The class handle the exception throwed by entity class.
|
||||
@@ -24,17 +24,17 @@ public class TianoToolsException extends EdkException {
|
||||
static final long serialVersionUID = -8034897190740066935L;
|
||||
/**
|
||||
Constructure function
|
||||
|
||||
|
||||
@param expStr exception message string.
|
||||
**/
|
||||
public TianoToolsException(String expStr) {
|
||||
super("[TianoToolsException]:" + expStr);
|
||||
}
|
||||
|
||||
|
||||
public TianoToolsException() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public TianoToolsException (Exception e, String message){
|
||||
super(e, message);
|
||||
}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/** @file
|
||||
This file is ANT task FpdParserTask.
|
||||
|
||||
This file is ANT task FpdParserTask.
|
||||
|
||||
FpdParserTask is used to parse FPD (Framework Platform Description) and generate
|
||||
build.out.xml. It is for Package or Platform build use.
|
||||
|
||||
build.out.xml. It is for Package or Platform build use.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -32,61 +32,61 @@ import org.apache.tools.ant.taskdefs.Ant;
|
||||
import org.apache.tools.ant.taskdefs.Property;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
|
||||
import org.tianocore.common.exception.EdkException;
|
||||
import org.tianocore.pcd.action.ActionMessage;
|
||||
import org.tianocore.build.global.GlobalData;
|
||||
import org.tianocore.build.global.OutputManager;
|
||||
import org.tianocore.build.global.SurfaceAreaQuery;
|
||||
import org.tianocore.build.id.FpdModuleIdentification;
|
||||
import org.tianocore.build.id.ModuleIdentification;
|
||||
import org.tianocore.build.id.PlatformIdentification;
|
||||
import org.tianocore.pcd.action.ActionMessage;
|
||||
import org.tianocore.build.pcd.action.PlatformPcdPreprocessActionForBuilding;
|
||||
import org.tianocore.build.toolchain.ToolChainAttribute;
|
||||
import org.tianocore.build.toolchain.ToolChainElement;
|
||||
import org.tianocore.build.toolchain.ToolChainMap;
|
||||
import org.tianocore.exception.EdkException;
|
||||
|
||||
/**
|
||||
<code>FpdParserTask</code> is an ANT task. The main function is parsing Framework
|
||||
Platform Descritpion (FPD) XML file and generating its ANT build script for
|
||||
corresponding platform.
|
||||
Platform Descritpion (FPD) XML file and generating its ANT build script for
|
||||
corresponding platform.
|
||||
|
||||
<p>The task sets global properties PLATFORM, PLATFORM_DIR, PLATFORM_RELATIVE_DIR
|
||||
and BUILD_DIR. </p>
|
||||
|
||||
|
||||
<p>The task generates ${PLATFORM}_build.xml file which will be called by top level
|
||||
build.xml. The task also generate Fv.inf files (File is for Tool GenFvImage)
|
||||
build.xml. The task also generate Fv.inf files (File is for Tool GenFvImage)
|
||||
and flash definition file (File is for Tool FlashMap) if necessary. </p>
|
||||
|
||||
|
||||
<p>FpdParserTask task stores all FPD information to GlobalData. And parse
|
||||
tools definition file to set up compiler options for different Target and
|
||||
different ToolChainTag. </p>
|
||||
|
||||
|
||||
<p>The method parseFpdFile is also prepared for single module build. </p>
|
||||
|
||||
|
||||
<p>The usage is (take NT32 Platform for example):</p>
|
||||
|
||||
<pre>
|
||||
<FPDParser platformName="Nt32" />
|
||||
</pre>
|
||||
|
||||
<p>The task will initialize all information through parsing Framework Database,
|
||||
<p>The task will initialize all information through parsing Framework Database,
|
||||
SPD, Tool chain configuration files. </p>
|
||||
|
||||
@since GenBuild 1.0
|
||||
**/
|
||||
public class FpdParserTask extends Task {
|
||||
|
||||
|
||||
private String platformName;
|
||||
|
||||
private File fpdFile = null;
|
||||
|
||||
|
||||
private PlatformIdentification platformId;
|
||||
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
///
|
||||
private String type;
|
||||
|
||||
|
||||
///
|
||||
/// Mapping from modules identification to out put file name
|
||||
///
|
||||
@@ -98,10 +98,10 @@ public class FpdParserTask extends Task {
|
||||
private Map<String, Set<FpdModuleIdentification>> fvs = new HashMap<String, Set<FpdModuleIdentification>>();
|
||||
|
||||
///
|
||||
/// FpdParserTask can specify some ANT properties.
|
||||
/// FpdParserTask can specify some ANT properties.
|
||||
///
|
||||
private Vector<Property> properties = new Vector<Property>();
|
||||
|
||||
|
||||
private boolean isUnified = true;
|
||||
|
||||
|
||||
@@ -112,19 +112,19 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
|
||||
/**
|
||||
ANT task's entry method. The main steps is described as following:
|
||||
|
||||
ANT task's entry method. The main steps is described as following:
|
||||
|
||||
<ul>
|
||||
<li>Initialize global information (Framework DB, SPD files and all MSA files
|
||||
<li>Initialize global information (Framework DB, SPD files and all MSA files
|
||||
listed in SPD). This step will execute only once in whole build process;</li>
|
||||
<li>Parse specified FPD file; </li>
|
||||
<li>Generate FV.inf files; </li>
|
||||
<li>Generate PlatformName_build.xml file for Flatform build; </li>
|
||||
<li>Collect PCD information. </li>
|
||||
</ul>
|
||||
|
||||
|
||||
@throws BuildException
|
||||
Surface area is not valid.
|
||||
Surface area is not valid.
|
||||
**/
|
||||
public void execute() throws BuildException {
|
||||
// Remove !!
|
||||
@@ -135,17 +135,17 @@ public class FpdParserTask extends Task {
|
||||
platformId = GlobalData.getPlatformByName(platformName);
|
||||
fpdFile = platformId.getFpdFile();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Parse FPD file
|
||||
//
|
||||
parseFpdFile();
|
||||
|
||||
|
||||
//
|
||||
// Prepare BUILD_DIR
|
||||
//
|
||||
isUnified = OutputManager.getInstance().prepareBuildDir(getProject());
|
||||
|
||||
|
||||
//
|
||||
// For every Target and ToolChain
|
||||
//
|
||||
@@ -156,13 +156,13 @@ public class FpdParserTask extends Task {
|
||||
//
|
||||
// Prepare FV_DIR
|
||||
//
|
||||
String ffsCommonDir = getProject().getProperty("BUILD_DIR") + File.separatorChar
|
||||
+ targetList[i] + File.separatorChar
|
||||
String ffsCommonDir = getProject().getProperty("BUILD_DIR") + File.separatorChar
|
||||
+ targetList[i] + File.separatorChar
|
||||
+ toolchainList[j];
|
||||
File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");
|
||||
fvDir.mkdirs();
|
||||
getProject().setProperty("FV_DIR", fvDir.getPath().replaceAll("(\\\\)", "/"));
|
||||
|
||||
|
||||
//
|
||||
// Gen Fv.inf files
|
||||
//
|
||||
@@ -175,11 +175,11 @@ public class FpdParserTask extends Task {
|
||||
//
|
||||
PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, isUnified);
|
||||
fileGenerator.genBuildFile();
|
||||
|
||||
|
||||
//
|
||||
// Ant call ${PLATFORM}_build.xml
|
||||
//
|
||||
|
||||
|
||||
Ant ant = new Ant();
|
||||
ant.setProject(getProject());
|
||||
ant.setAntfile(platformId.getFpdFile().getParent() + File.separatorChar + platformId.getName() + "_build.xml");
|
||||
@@ -187,17 +187,17 @@ public class FpdParserTask extends Task {
|
||||
ant.setInheritAll(true);
|
||||
ant.init();
|
||||
ant.execute();
|
||||
|
||||
|
||||
// GlobalData.log.info("Fpd build end. ");
|
||||
}
|
||||
|
||||
/**
|
||||
Generate Fv.inf files. The Fv.inf file is composed with four
|
||||
parts: Options, Attributes, Components and Files. The Fv.inf files
|
||||
Generate Fv.inf files. The Fv.inf file is composed with four
|
||||
parts: Options, Attributes, Components and Files. The Fv.inf files
|
||||
will be under FV_DIR.
|
||||
|
||||
|
||||
@throws BuildException
|
||||
File write FV.inf files error.
|
||||
File write FV.inf files error.
|
||||
**/
|
||||
private void genFvInfFiles(String ffsCommonDir) throws BuildException {
|
||||
String[] validFv = SurfaceAreaQuery.getFpdValidImageNames();
|
||||
@@ -211,14 +211,14 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
|
||||
getProject().setProperty("FV_FILENAME", validFv[i]);
|
||||
|
||||
|
||||
File fvFile = new File(getProject().replaceProperties( getProject().getProperty("FV_DIR") + File.separatorChar + validFv[i] + ".inf"));
|
||||
fvFile.getParentFile().mkdirs();
|
||||
|
||||
try {
|
||||
FileWriter fw = new FileWriter(fvFile);
|
||||
BufferedWriter bw = new BufferedWriter(fw);
|
||||
|
||||
|
||||
//
|
||||
// Options
|
||||
//
|
||||
@@ -239,7 +239,7 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
bw.newLine();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Attributes;
|
||||
//
|
||||
@@ -260,7 +260,7 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
bw.newLine();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Components
|
||||
//
|
||||
@@ -281,7 +281,7 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
bw.newLine();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Files
|
||||
//
|
||||
@@ -306,10 +306,10 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
/**
|
||||
This method is used for Single Module Build.
|
||||
|
||||
|
||||
|
||||
|
||||
@throws BuildException
|
||||
FPD file is not valid.
|
||||
FPD file is not valid.
|
||||
**/
|
||||
public void parseFpdFile(File fpdFile) throws BuildException {
|
||||
this.fpdFile = fpdFile;
|
||||
@@ -317,19 +317,19 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
|
||||
/**
|
||||
Parse FPD file.
|
||||
|
||||
Parse FPD file.
|
||||
|
||||
@throws BuildException
|
||||
FPD file is not valid.
|
||||
FPD file is not valid.
|
||||
**/
|
||||
private void parseFpdFile() throws BuildException {
|
||||
try {
|
||||
XmlObject doc = XmlObject.Factory.parse(fpdFile);
|
||||
|
||||
|
||||
if (!doc.validate()) {
|
||||
throw new BuildException("Platform Surface Area file [" + fpdFile.getPath() + "] format is invalid!");
|
||||
}
|
||||
|
||||
|
||||
Map<String, XmlObject> map = new HashMap<String, XmlObject>();
|
||||
map.put("PlatformSurfaceArea", doc);
|
||||
SurfaceAreaQuery.setDoc(map);
|
||||
@@ -345,7 +345,7 @@ public class FpdParserTask extends Task {
|
||||
getProject().setProperty("PLATFORM_RELATIVE_DIR", platformId.getPlatformRelativeDir().replaceAll("(\\\\)", "/"));
|
||||
|
||||
//
|
||||
// Build mode. User-defined output dir.
|
||||
// Build mode. User-defined output dir.
|
||||
//
|
||||
String buildMode = SurfaceAreaQuery.getFpdIntermediateDirectories();
|
||||
String userDefinedOutputDir = SurfaceAreaQuery.getFpdOutputDirectory();
|
||||
@@ -356,9 +356,9 @@ public class FpdParserTask extends Task {
|
||||
// TBD. Deal PCD and BuildOption related Info
|
||||
//
|
||||
GlobalData.setFpdBuildOptions(SurfaceAreaQuery.getFpdBuildOptions());
|
||||
|
||||
|
||||
GlobalData.setToolChainPlatformInfo(SurfaceAreaQuery.getFpdToolChainInfo());
|
||||
|
||||
|
||||
//
|
||||
// Parse all list modules SA
|
||||
//
|
||||
@@ -371,7 +371,7 @@ public class FpdParserTask extends Task {
|
||||
parseToolChainOptions();
|
||||
|
||||
SurfaceAreaQuery.setDoc(map);
|
||||
|
||||
|
||||
//
|
||||
// Pcd Collection. Call CollectPCDAction to collect pcd info.
|
||||
//
|
||||
@@ -383,9 +383,9 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Parse all modules listed in FPD file.
|
||||
Parse all modules listed in FPD file.
|
||||
**/
|
||||
private void parseModuleSAFiles() throws EdkException{
|
||||
Map<FpdModuleIdentification, Map<String, XmlObject>> moduleSAs = SurfaceAreaQuery.getFpdModules();
|
||||
@@ -397,11 +397,11 @@ public class FpdParserTask extends Task {
|
||||
Iterator iter = keys.iterator();
|
||||
while (iter.hasNext()) {
|
||||
FpdModuleIdentification fpdModuleId = (FpdModuleIdentification) iter.next();
|
||||
|
||||
|
||||
//
|
||||
// Judge if Module is existed?
|
||||
// Judge if Module is existed?
|
||||
// TBD
|
||||
|
||||
|
||||
GlobalData.registerFpdModuleSA(fpdModuleId, moduleSAs.get(fpdModuleId));
|
||||
|
||||
//
|
||||
@@ -413,7 +413,7 @@ public class FpdParserTask extends Task {
|
||||
|
||||
fpdModuleId.setFvBinding(fvBinding);
|
||||
updateFvs(fvBinding, fpdModuleId);
|
||||
|
||||
|
||||
//
|
||||
// Prepare for out put file name
|
||||
//
|
||||
@@ -424,13 +424,13 @@ public class FpdParserTask extends Task {
|
||||
if (baseName == null) {
|
||||
baseName = moduleId.getName();
|
||||
}
|
||||
outfiles.put(fpdModuleId, fpdModuleId.getArch() + File.separatorChar
|
||||
+ moduleId.getGuid() + "-" + baseName
|
||||
outfiles.put(fpdModuleId, fpdModuleId.getArch() + File.separatorChar
|
||||
+ moduleId.getGuid() + "-" + baseName
|
||||
+ getSuffix(moduleId.getModuleType()));
|
||||
|
||||
//
|
||||
// parse module build options, if any
|
||||
//
|
||||
//
|
||||
SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));
|
||||
GlobalData.addModuleToolChainOption(fpdModuleId, parseModuleBuildOptions(false));
|
||||
GlobalData.addModuleToolChainFamilyOption(fpdModuleId, parseModuleBuildOptions(true));
|
||||
@@ -445,7 +445,7 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
return parseOptions(options);
|
||||
}
|
||||
|
||||
|
||||
private ToolChainMap parsePlatformBuildOptions(boolean toolChainFamilyFlag) throws EdkException {
|
||||
String[][] options = SurfaceAreaQuery.getPlatformBuildOptions(toolChainFamilyFlag);
|
||||
if (options == null || options.length == 0) {
|
||||
@@ -469,7 +469,7 @@ public class FpdParserTask extends Task {
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
private void parseToolChainFamilyOptions() throws EdkException {
|
||||
GlobalData.setPlatformToolChainFamilyOption(parsePlatformBuildOptions(true));
|
||||
}
|
||||
@@ -479,8 +479,8 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
|
||||
/**
|
||||
Add the current module to corresponding FV.
|
||||
|
||||
Add the current module to corresponding FV.
|
||||
|
||||
@param fvName current FV name
|
||||
@param moduleName current module identification
|
||||
**/
|
||||
@@ -506,8 +506,8 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
|
||||
/**
|
||||
Get the suffix based on module type. Current relationship are listed:
|
||||
|
||||
Get the suffix based on module type. Current relationship are listed:
|
||||
|
||||
<pre>
|
||||
<b>ModuleType</b> <b>Suffix</b>
|
||||
BASE .FFS
|
||||
@@ -524,7 +524,7 @@ public class FpdParserTask extends Task {
|
||||
UEFI_APPLICATION .APP
|
||||
USER_DEFINED .FFS
|
||||
</pre>
|
||||
|
||||
|
||||
@param moduleType module type
|
||||
@return
|
||||
@throws BuildException
|
||||
@@ -536,13 +536,13 @@ public class FpdParserTask extends Task {
|
||||
}
|
||||
|
||||
String[][] suffix = { { "BASE", ".FFS"},
|
||||
{ "SEC", ".SEC" }, { "PEI_CORE", ".PEI" },
|
||||
{ "SEC", ".SEC" }, { "PEI_CORE", ".PEI" },
|
||||
{ "PEIM", ".PEI" }, { "DXE_CORE", ".DXE" },
|
||||
{ "DXE_DRIVER", ".DXE" }, { "DXE_RUNTIME_DRIVER", ".DXE" },
|
||||
{ "DXE_SAL_DRIVER", ".DXE" }, { "DXE_SMM_DRIVER", ".DXE" },
|
||||
{ "DXE_DRIVER", ".DXE" }, { "DXE_RUNTIME_DRIVER", ".DXE" },
|
||||
{ "DXE_SAL_DRIVER", ".DXE" }, { "DXE_SMM_DRIVER", ".DXE" },
|
||||
{ "TOOL", ".FFS" }, { "UEFI_DRIVER", ".DXE" },
|
||||
{ "UEFI_APPLICATION", ".APP" }, { "USER_DEFINED", ".FFS" } };
|
||||
|
||||
|
||||
for (int i = 0; i < suffix.length; i++) {
|
||||
if (suffix[i][0].equalsIgnoreCase(moduleType)) {
|
||||
return suffix[i][1];
|
||||
@@ -554,8 +554,8 @@ public class FpdParserTask extends Task {
|
||||
return ".FFS";
|
||||
}
|
||||
/**
|
||||
Add a property.
|
||||
|
||||
Add a property.
|
||||
|
||||
@param p property
|
||||
**/
|
||||
public void addProperty(Property p) {
|
||||
@@ -573,6 +573,6 @@ public class FpdParserTask extends Task {
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -17,20 +17,22 @@ Abstract:
|
||||
--*/
|
||||
|
||||
package org.tianocore.build.global;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.tianocore.logger.LogMethod;
|
||||
|
||||
import org.tianocore.common.logger.LogMethod;
|
||||
|
||||
public class GenBuildLogger implements LogMethod {
|
||||
private Project project;
|
||||
public GenBuildLogger(Project project) {
|
||||
this.project = project;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void putMessage(Object msgSource, int msgLevel, String msg) {
|
||||
if (this.project != null){
|
||||
this.project.log(msg, Project.MSG_INFO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@@ -1,10 +1,10 @@
|
||||
/** @file
|
||||
GlobalData class.
|
||||
|
||||
GlobalData class.
|
||||
|
||||
GlobalData provide initializing, instoring, querying and update global data.
|
||||
It is a bridge to intercommunicate between multiple component, such as AutoGen,
|
||||
PCD and so on.
|
||||
|
||||
PCD and so on.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -27,6 +27,10 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
|
||||
import org.tianocore.common.exception.EdkException;
|
||||
import org.tianocore.common.logger.EdkLog;
|
||||
import org.tianocore.pcd.entity.MemoryDatabaseManager;
|
||||
import org.tianocore.DbPathAndFilename;
|
||||
import org.tianocore.FrameworkDatabaseDocument;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument;
|
||||
@@ -35,44 +39,41 @@ import org.tianocore.build.id.FpdModuleIdentification;
|
||||
import org.tianocore.build.id.ModuleIdentification;
|
||||
import org.tianocore.build.id.PackageIdentification;
|
||||
import org.tianocore.build.id.PlatformIdentification;
|
||||
import org.tianocore.pcd.entity.MemoryDatabaseManager;
|
||||
import org.tianocore.build.toolchain.ToolChainAttribute;
|
||||
import org.tianocore.build.toolchain.ToolChainConfig;
|
||||
import org.tianocore.build.toolchain.ToolChainElement;
|
||||
import org.tianocore.build.toolchain.ToolChainInfo;
|
||||
import org.tianocore.build.toolchain.ToolChainKey;
|
||||
import org.tianocore.build.toolchain.ToolChainMap;
|
||||
import org.tianocore.exception.EdkException;
|
||||
import org.tianocore.logger.EdkLog;
|
||||
|
||||
/**
|
||||
GlobalData provide initializing, instoring, querying and update global data.
|
||||
It is a bridge to intercommunicate between multiple component, such as AutoGen,
|
||||
PCD and so on.
|
||||
|
||||
<p>Note that all global information are initialized incrementally. All data will
|
||||
PCD and so on.
|
||||
|
||||
<p>Note that all global information are initialized incrementally. All data will
|
||||
parse and record only of necessary during build time. </p>
|
||||
|
||||
|
||||
@since GenBuild 1.0
|
||||
**/
|
||||
public class GlobalData {
|
||||
|
||||
public static Logger log = Logger.getAnonymousLogger();
|
||||
|
||||
|
||||
///
|
||||
/// Record current WORKSPACE Directory
|
||||
///
|
||||
private static String workspaceDir = "";
|
||||
|
||||
|
||||
///
|
||||
/// Be used to ensure Global data will be initialized only once.
|
||||
///
|
||||
private static boolean globalFlag = false;
|
||||
|
||||
|
||||
///
|
||||
/// Framework Database information: package list and platform list
|
||||
///
|
||||
private static Set<PackageIdentification> packageList = new HashSet<PackageIdentification>();
|
||||
private static Set<PackageIdentification> packageList = new HashSet<PackageIdentification>();
|
||||
|
||||
private static Set<PlatformIdentification> platformList = new HashSet<PlatformIdentification>();
|
||||
|
||||
@@ -93,17 +94,17 @@ public class GlobalData {
|
||||
private static XmlObject fpdBuildOptions;
|
||||
|
||||
private static XmlObject fpdDynamicPcds;
|
||||
|
||||
|
||||
///
|
||||
/// Parsed modules list
|
||||
///
|
||||
private static Map<FpdModuleIdentification, Map<String, XmlObject>> parsedModules = new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();
|
||||
|
||||
|
||||
///
|
||||
/// built modules list with ARCH, TARGET, TOOLCHAIN
|
||||
///
|
||||
private static Set<FpdModuleIdentification> builtModules = new HashSet<FpdModuleIdentification>();
|
||||
|
||||
|
||||
///
|
||||
/// PCD memory database stored all PCD information which collected from FPD,MSA and SPD.
|
||||
///
|
||||
@@ -117,7 +118,7 @@ public class GlobalData {
|
||||
/// toolsDef - build tool program information
|
||||
/// fpdBuildOption - all modules's build options for tool tag or tool chain families
|
||||
/// moduleSaBuildOption - build options for a specific module
|
||||
///
|
||||
///
|
||||
private static ToolChainConfig toolsDef;
|
||||
|
||||
private static ToolChainInfo toolChainInfo;
|
||||
@@ -133,8 +134,8 @@ public class GlobalData {
|
||||
/**
|
||||
Parse framework database (DB) and all SPD files listed in DB to initialize
|
||||
the environment for next build. This method will only be executed only once
|
||||
in the whole build process.
|
||||
|
||||
in the whole build process.
|
||||
|
||||
@param workspaceDatabaseFile the file name of framework database
|
||||
@param workspaceDir current workspace directory path
|
||||
@throws BuildException
|
||||
@@ -149,11 +150,11 @@ public class GlobalData {
|
||||
}
|
||||
globalFlag = true;
|
||||
|
||||
//
|
||||
//
|
||||
// Backup workspace directory. It will be used by other method
|
||||
//
|
||||
GlobalData.workspaceDir = workspaceDir.replaceAll("(\\\\)", "/");
|
||||
|
||||
|
||||
//
|
||||
// Parse tools definition file
|
||||
//
|
||||
@@ -164,7 +165,7 @@ public class GlobalData {
|
||||
File toolsDefFile = new File(workspaceDir + File.separatorChar + toolsDefFilename);
|
||||
System.out.println("Using tool definiton file [" + toolsDefFile.getPath() + "].");
|
||||
toolsDef = new ToolChainConfig(toolsDefFile);
|
||||
|
||||
|
||||
//
|
||||
// Parse Framework Database
|
||||
//
|
||||
@@ -228,10 +229,10 @@ public class GlobalData {
|
||||
throw new BuildException("Parse WORKSPACE Database file [" + dbFile.getPath() + "] Error.\n" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the current WORKSPACE Directory.
|
||||
|
||||
Get the current WORKSPACE Directory.
|
||||
|
||||
@return current workspace directory
|
||||
**/
|
||||
public synchronized static String getWorkspacePath() {
|
||||
@@ -245,7 +246,7 @@ public class GlobalData {
|
||||
public synchronized static File getMsaFile(ModuleIdentification moduleId) throws BuildException {
|
||||
File msaFile = null;
|
||||
//
|
||||
// TBD. Do only when package is null.
|
||||
// TBD. Do only when package is null.
|
||||
//
|
||||
Iterator iter = packageList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
@@ -271,7 +272,7 @@ public class GlobalData {
|
||||
if (moduleId.getPackage() != null) {
|
||||
return moduleId.getPackage();
|
||||
}
|
||||
|
||||
|
||||
PackageIdentification packageId = null;
|
||||
Iterator iter = packageList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
@@ -289,19 +290,19 @@ public class GlobalData {
|
||||
return packageId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Difference between build and parse: ToolChain and Target
|
||||
**/
|
||||
public synchronized static boolean isModuleBuilt(FpdModuleIdentification moduleId) {
|
||||
return builtModules.contains(moduleId);
|
||||
}
|
||||
|
||||
|
||||
public synchronized static void registerBuiltModule(FpdModuleIdentification fpdModuleId) {
|
||||
builtModules.add(fpdModuleId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public synchronized static void registerFpdModuleSA(FpdModuleIdentification fpdModuleId, Map<String, XmlObject> doc) {
|
||||
Map<String, XmlObject> result = new HashMap<String, XmlObject>();
|
||||
Set keySet = doc.keySet();
|
||||
@@ -320,11 +321,11 @@ public class GlobalData {
|
||||
|
||||
/**
|
||||
Query overrided module surface area information. If current is Package
|
||||
or Platform build, also include the information from FPD file.
|
||||
|
||||
<p>Note that surface area parsing is incremental. That means the method will
|
||||
or Platform build, also include the information from FPD file.
|
||||
|
||||
<p>Note that surface area parsing is incremental. That means the method will
|
||||
only parse the MSA and MBD files if necessary. </p>
|
||||
|
||||
|
||||
@param moduleName the base name of the module
|
||||
@return the overrided module surface area information
|
||||
@throws BuildException
|
||||
@@ -340,12 +341,12 @@ public class GlobalData {
|
||||
// First part: get the MSA files info
|
||||
//
|
||||
doc.putAll(getNativeMsa(moduleId));
|
||||
|
||||
|
||||
//
|
||||
// Second part: put build options
|
||||
//
|
||||
doc.put("BuildOptions", fpdBuildOptions);
|
||||
|
||||
|
||||
//
|
||||
// Third part: get Module info from FPD, such as Library instances, PCDs
|
||||
//
|
||||
@@ -365,11 +366,11 @@ public class GlobalData {
|
||||
return getDoc(fpdModuleId);
|
||||
}
|
||||
/**
|
||||
Query the native MSA information with module base name.
|
||||
|
||||
<p>Note that MSA parsing is incremental. That means the method will
|
||||
Query the native MSA information with module base name.
|
||||
|
||||
<p>Note that MSA parsing is incremental. That means the method will
|
||||
only to parse the MSA files when never parsed before. </p>
|
||||
|
||||
|
||||
@param moduleName the base name of the module
|
||||
@return the native MSA information
|
||||
@throws BuildException
|
||||
@@ -384,7 +385,7 @@ public class GlobalData {
|
||||
nativeMsa.put(moduleId, msaMap);
|
||||
return msaMap;
|
||||
}
|
||||
|
||||
|
||||
public synchronized static Map<String, XmlObject> getNativeMsa(File msaFile) throws BuildException {
|
||||
if (! msaFile.exists()) {
|
||||
throw new BuildException("Module Surface Area file [" + msaFile.getPath() + "] can't be found!");
|
||||
@@ -418,13 +419,13 @@ public class GlobalData {
|
||||
throw new BuildException(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, XmlObject> getFpdBuildOptions() {
|
||||
Map<String, XmlObject> map = new HashMap<String, XmlObject>();
|
||||
map.put("BuildOptions", fpdBuildOptions);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public static void setFpdBuildOptions(XmlObject fpdBuildOptions) {
|
||||
GlobalData.fpdBuildOptions = cloneXmlObject(fpdBuildOptions, true);
|
||||
}
|
||||
@@ -439,7 +440,7 @@ public class GlobalData {
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
|
||||
|
||||
public static Set<ModuleIdentification> getModules(PackageIdentification packageId){
|
||||
Spd spd = spdTable.get(packageId);
|
||||
if (spd == null ) {
|
||||
@@ -572,7 +573,7 @@ public class GlobalData {
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public synchronized static PlatformIdentification getPlatformByName(String name) throws BuildException {
|
||||
Iterator iter = platformList.iterator();
|
||||
while(iter.hasNext()){
|
||||
@@ -583,7 +584,7 @@ public class GlobalData {
|
||||
}
|
||||
throw new BuildException("Can't find platform [" + name + "] in the current WORKSPACE database!");
|
||||
}
|
||||
|
||||
|
||||
public synchronized static PlatformIdentification getPlatform(String filename) throws BuildException {
|
||||
File file = new File(workspaceDir + File.separatorChar + filename);
|
||||
Iterator iter = platformList.iterator();
|
||||
@@ -595,7 +596,7 @@ public class GlobalData {
|
||||
}
|
||||
throw new BuildException("Can't find platform file [" + filename + "] in the current WORKSPACE database!");
|
||||
}
|
||||
|
||||
|
||||
public synchronized static PackageIdentification refreshPackageIdentification(PackageIdentification packageId) throws BuildException {
|
||||
Iterator iter = packageList.iterator();
|
||||
while(iter.hasNext()){
|
||||
@@ -608,7 +609,7 @@ public class GlobalData {
|
||||
}
|
||||
throw new BuildException("Can't find package GUID value " + packageId.getGuid() + " in the current workspace!");
|
||||
}
|
||||
|
||||
|
||||
public synchronized static ModuleIdentification refreshModuleIdentification(ModuleIdentification moduleId) throws BuildException {
|
||||
// System.out.println("1");
|
||||
// System.out.println("##" + moduleId.getGuid());
|
||||
@@ -632,7 +633,7 @@ public class GlobalData {
|
||||
}
|
||||
throw new BuildException("Can't find module GUID value " + moduleId.getGuid() + " in package, " + packageId + ", in the current workspace!");
|
||||
}
|
||||
|
||||
|
||||
public synchronized static Set<PackageIdentification> getPackageList(){
|
||||
return packageList;
|
||||
}
|
||||
@@ -702,7 +703,7 @@ public class GlobalData {
|
||||
|
||||
public static String getCommandSetting(String[] commandDescription, FpdModuleIdentification fpdModuleId) throws EdkException {
|
||||
ToolChainKey toolChainKey = new ToolChainKey(commandDescription);
|
||||
ToolChainMap toolChainConfig = toolsDef.getConfig();
|
||||
ToolChainMap toolChainConfig = toolsDef.getConfig();
|
||||
String setting = null;
|
||||
|
||||
if (!commandDescription[ToolChainElement.ATTRIBUTE.value].equals(ToolChainAttribute.FLAGS.toString())) {
|
||||
@@ -731,7 +732,7 @@ public class GlobalData {
|
||||
toolChainFamilyKey.setKey(ToolChainAttribute.FLAGS.toString(), ToolChainElement.ATTRIBUTE.value);
|
||||
|
||||
option = moduleToolChainFamilyOption.get(fpdModuleId);
|
||||
if (option != null) {
|
||||
if (option != null) {
|
||||
setting = option.get(toolChainFamilyKey);
|
||||
}
|
||||
}
|
||||
@@ -761,7 +762,7 @@ public class GlobalData {
|
||||
|
||||
return setting;
|
||||
}
|
||||
|
||||
|
||||
public static void setToolChainEnvInfo(ToolChainInfo envInfo) {
|
||||
toolChainEnvInfo = envInfo;
|
||||
}
|
||||
@@ -803,17 +804,17 @@ public class GlobalData {
|
||||
//
|
||||
// For PCD
|
||||
//
|
||||
public synchronized static Map<FpdModuleIdentification, XmlObject>
|
||||
public synchronized static Map<FpdModuleIdentification, XmlObject>
|
||||
getFpdModuleSaXmlObject(String xmlObjectName) {
|
||||
Set<FpdModuleIdentification> fpdModuleSASet = fpdModuleSA.keySet();
|
||||
Iterator item = fpdModuleSASet.iterator();
|
||||
|
||||
|
||||
|
||||
Map<FpdModuleIdentification, XmlObject> SAPcdBuildDef = new HashMap<FpdModuleIdentification, XmlObject>();
|
||||
Map<String, XmlObject> SANode = new HashMap<String, XmlObject>();
|
||||
FpdModuleIdentification moduleId;
|
||||
while (item.hasNext()) {
|
||||
|
||||
|
||||
moduleId = (FpdModuleIdentification) item.next();
|
||||
SANode = fpdModuleSA.get(moduleId);
|
||||
try{
|
||||
|
@@ -23,8 +23,11 @@ import java.util.Stack;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.apache.xmlbeans.XmlString;
|
||||
|
||||
import org.tianocore.BuildOptionsDocument;
|
||||
import org.tianocore.CNameType;
|
||||
import org.tianocore.ExternsDocument;
|
||||
@@ -57,20 +60,20 @@ import org.tianocore.FilenameDocument.Filename;
|
||||
import org.tianocore.MsaHeaderDocument.MsaHeader;
|
||||
import org.tianocore.ProtocolsDocument.Protocols.Protocol;
|
||||
import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
|
||||
|
||||
import org.tianocore.common.logger.EdkLog;
|
||||
import org.tianocore.build.id.FpdModuleIdentification;
|
||||
import org.tianocore.build.id.ModuleIdentification;
|
||||
import org.tianocore.build.id.PackageIdentification;
|
||||
import org.tianocore.build.id.PlatformIdentification;
|
||||
import org.tianocore.build.toolchain.ToolChainInfo;
|
||||
import org.tianocore.logger.EdkLog;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* SurfaceAreaQuery class is used to query Surface Area information from msa,
|
||||
* mbd, spd and fpd files.
|
||||
*
|
||||
*
|
||||
* This class should not instantiated. All the public interfaces is static.
|
||||
*
|
||||
*
|
||||
* @since GenBuild 1.0
|
||||
*/
|
||||
public class SurfaceAreaQuery {
|
||||
@@ -105,7 +108,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Set a Surface Area document for query later
|
||||
*
|
||||
*
|
||||
* @param map
|
||||
* A Surface Area document in TopLevelElementName/XmlObject
|
||||
* format.
|
||||
@@ -120,7 +123,7 @@ public class SurfaceAreaQuery {
|
||||
* Push current used Surface Area document into query stack. The given new
|
||||
* document will be used for any immediately followed getXXX() callings,
|
||||
* untill pop() is called.
|
||||
*
|
||||
*
|
||||
* @param newMap
|
||||
* The TopLevelElementName/XmlObject format of a Surface Area
|
||||
* document.
|
||||
@@ -180,7 +183,7 @@ public class SurfaceAreaQuery {
|
||||
/**
|
||||
* Search all XML documents stored in "map" for the specified xPath, using
|
||||
* relative path (starting with '$this')
|
||||
*
|
||||
*
|
||||
* @param xPath
|
||||
* xpath query string array
|
||||
* @returns An array of XmlObject if elements are found at the specified
|
||||
@@ -219,7 +222,7 @@ public class SurfaceAreaQuery {
|
||||
/**
|
||||
* Search XML documents named by "rootName" for the given xPath, using
|
||||
* relative path (starting with '$this')
|
||||
*
|
||||
*
|
||||
* @param rootName
|
||||
* The top level element name
|
||||
* @param xPath
|
||||
@@ -255,7 +258,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve SourceFiles/Filename for specified ARCH type
|
||||
*
|
||||
*
|
||||
* @param arch
|
||||
* architecture name
|
||||
* @returns An 2 dimension string array if elements are found at the known
|
||||
@@ -282,7 +285,7 @@ public class SurfaceAreaQuery {
|
||||
outputList.add(new String[] {sourceFileNames[i].getToolCode(),sourceFileNames[i].getStringValue()});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String[][] outputString = new String[outputList.size()][2];
|
||||
for (int index = 0; index < outputList.size(); index++) {
|
||||
outputString[index][0] = outputList.get(index)[0];
|
||||
@@ -293,7 +296,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve /PlatformDefinitions/OutputDirectory from FPD
|
||||
*
|
||||
*
|
||||
* @returns Directory names array if elements are found at the known xpath
|
||||
* @returns Empty if nothing is found at the known xpath
|
||||
*/
|
||||
@@ -317,7 +320,7 @@ public class SurfaceAreaQuery {
|
||||
}
|
||||
PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0];
|
||||
if(item.getIntermediateDirectories() == null) {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return item.getIntermediateDirectories().toString();
|
||||
@@ -334,7 +337,7 @@ public class SurfaceAreaQuery {
|
||||
ModuleSaBuildOptionsDocument.ModuleSaBuildOptions item = (ModuleSaBuildOptionsDocument.ModuleSaBuildOptions)returns[0];
|
||||
return item.getFfsFormatKey();
|
||||
}
|
||||
|
||||
|
||||
public static String getModuleFvBindingKeyword() {
|
||||
String[] xPath = new String[] { "/" };
|
||||
|
||||
@@ -345,7 +348,7 @@ public class SurfaceAreaQuery {
|
||||
ModuleSaBuildOptionsDocument.ModuleSaBuildOptions item = (ModuleSaBuildOptionsDocument.ModuleSaBuildOptions)returns[0];
|
||||
return item.getFvBinding();
|
||||
}
|
||||
|
||||
|
||||
public static List getModuleSupportedArchs() {
|
||||
String[] xPath = new String[] { "/" };
|
||||
|
||||
@@ -356,17 +359,17 @@ public class SurfaceAreaQuery {
|
||||
ModuleDefinitionsDocument.ModuleDefinitions item = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];
|
||||
return item.getSupportedArchitectures();
|
||||
}
|
||||
|
||||
|
||||
public static BuildOptionsDocument.BuildOptions.Ffs[] getFpdFfs() {
|
||||
String[] xPath = new String[] {"/Ffs"};
|
||||
|
||||
|
||||
Object[] returns = get("BuildOptions", xPath);
|
||||
if (returns == null || returns.length == 0) {
|
||||
return new BuildOptionsDocument.BuildOptions.Ffs[0];
|
||||
}
|
||||
return (BuildOptionsDocument.BuildOptions.Ffs[])returns;
|
||||
}
|
||||
|
||||
|
||||
public static String getModuleOutputFileBasename() {
|
||||
String[] xPath = new String[] { "/" };
|
||||
|
||||
@@ -377,18 +380,18 @@ public class SurfaceAreaQuery {
|
||||
ModuleDefinitionsDocument.ModuleDefinitions item = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];
|
||||
return item.getOutputFileBasename();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve BuildOptions/Option or Arch/Option
|
||||
*
|
||||
*
|
||||
* @param toolChainFamilyFlag
|
||||
* if true, retrieve options for toolchain family; otherwise for
|
||||
* toolchain
|
||||
*
|
||||
*
|
||||
* @returns String[][5] name, target, toolchain, arch, coommand of options
|
||||
* if elements are found at the known xpath. String[0][] if dont
|
||||
* find element.
|
||||
*
|
||||
*
|
||||
* @returns Empty array if nothing is there
|
||||
*/
|
||||
public static String[][] getOptions(String from, String[] xPath, boolean toolChainFamilyFlag) {
|
||||
@@ -441,7 +444,7 @@ public class SurfaceAreaQuery {
|
||||
}
|
||||
|
||||
archList = new ArrayList<String>();
|
||||
List archEnumList = option.getSupArchList();
|
||||
List archEnumList = option.getSupArchList();
|
||||
if (archEnumList == null) {
|
||||
archList.add(null);
|
||||
} else {
|
||||
@@ -477,7 +480,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
public static String[][] getModuleBuildOptions(boolean toolChainFamilyFlag) {
|
||||
String[] xPath;
|
||||
|
||||
|
||||
if (toolChainFamilyFlag == true) {
|
||||
xPath = new String[] {
|
||||
"/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
|
||||
@@ -488,8 +491,8 @@ public class SurfaceAreaQuery {
|
||||
"/Options/Option[@TagName]", };
|
||||
}
|
||||
return getOptions("ModuleSaBuildOptions", xPath, toolChainFamilyFlag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String[][] getPlatformBuildOptions(boolean toolChainFamilyFlag) {
|
||||
String[] xPath;
|
||||
|
||||
@@ -513,7 +516,7 @@ public class SurfaceAreaQuery {
|
||||
if (returns == null || returns.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0];
|
||||
ToolChainInfo toolChainInfo = new ToolChainInfo();
|
||||
toolChainInfo.addTargets(item.getBuildTargets().toString());
|
||||
@@ -524,7 +527,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve <xxxHeader>/ModuleType
|
||||
*
|
||||
*
|
||||
* @returns The module type name if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -542,10 +545,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve PackageDependencies/Package
|
||||
*
|
||||
*
|
||||
* @param arch
|
||||
* Architecture name
|
||||
*
|
||||
*
|
||||
* @returns package name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -554,17 +557,17 @@ public class SurfaceAreaQuery {
|
||||
String packageGuid = null;
|
||||
String packageVersion = null;
|
||||
|
||||
|
||||
|
||||
xPath = new String[] { "/Package" };
|
||||
|
||||
|
||||
Object[] returns = get("PackageDependencies", xPath);
|
||||
if (returns == null) {
|
||||
return new PackageIdentification[0];
|
||||
}
|
||||
|
||||
//
|
||||
// Get packageIdentification
|
||||
//
|
||||
// Get packageIdentification
|
||||
//
|
||||
List<PackageIdentification> packageIdList = new ArrayList<PackageIdentification>();
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];
|
||||
@@ -579,7 +582,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
//
|
||||
// transfer packageIdentification list to array.
|
||||
//
|
||||
//
|
||||
PackageIdentification[] packageIdArray = new PackageIdentification[packageIdList.size()];
|
||||
for (int i = 0; i < packageIdList.size(); i++) {
|
||||
packageIdArray[i] = new PackageIdentification(null, packageIdList.get(i).getGuid(),packageIdList.get(i).getVersion());
|
||||
@@ -589,10 +592,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve LibraryClassDefinitions/LibraryClass for specified usage
|
||||
*
|
||||
*
|
||||
* @param usage
|
||||
* Library class usage
|
||||
*
|
||||
*
|
||||
* @returns LibraryClass objects list if elements are found at the known
|
||||
* xpath
|
||||
* @returns null if nothing is there
|
||||
@@ -614,7 +617,7 @@ public class SurfaceAreaQuery {
|
||||
List<String> libraryClassName = new ArrayList<String>();
|
||||
for (int i = 0; i < libraryClassList.length; i++) {
|
||||
List archList = libraryClassList[i].getSupArchList();
|
||||
|
||||
|
||||
if (arch == null || contains(archList, arch)) {
|
||||
libraryClassName.add(libraryClassList[i].getKeyword());
|
||||
}
|
||||
@@ -628,7 +631,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve ModuleEntryPoint names
|
||||
*
|
||||
*
|
||||
* @returns ModuleEntryPoint name list if elements are found at the known
|
||||
* xpath
|
||||
* @returns null if nothing is there
|
||||
@@ -653,10 +656,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* retrieve Protocol for specified usage
|
||||
*
|
||||
*
|
||||
* @param usage
|
||||
* Protocol usage arch Architecture
|
||||
*
|
||||
*
|
||||
* @returns Protocol String list if elements are found at the known xpath
|
||||
* @returns String[0] if nothing is there
|
||||
*/
|
||||
@@ -693,10 +696,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* retrieve Protocol for specified usage
|
||||
*
|
||||
*
|
||||
* @param arch
|
||||
* Architecture
|
||||
*
|
||||
*
|
||||
* @returns Protocol String list if elements are found at the known xpath
|
||||
* @returns String[0] if nothing is there
|
||||
*/
|
||||
@@ -716,7 +719,7 @@ public class SurfaceAreaQuery {
|
||||
Protocol[] returnlList = (Protocol[]) returns;
|
||||
|
||||
List<String> protocolList = new ArrayList<String>();
|
||||
|
||||
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
List archList = returnlList[i].getSupArchList();
|
||||
if (archList == null || contains(archList, arch)){
|
||||
@@ -732,10 +735,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve ProtocolNotify for specified usage
|
||||
*
|
||||
*
|
||||
* @param usage
|
||||
* ProtocolNotify usage
|
||||
*
|
||||
*
|
||||
* @returns String[] if elements are found at the known xpath
|
||||
* @returns String[0] if nothing is there
|
||||
*/
|
||||
@@ -754,13 +757,13 @@ public class SurfaceAreaQuery {
|
||||
}
|
||||
|
||||
List<String> protocolNotifyList = new ArrayList<String>();
|
||||
|
||||
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
List archList = ((ProtocolNotify) returns[i]).getSupArchList();
|
||||
if (archList == null || contains(archList, arch)){
|
||||
protocolNotifyList.add(((ProtocolNotify) returns[i]).getProtocolNotifyCName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
String[] protocolNotifyArray = new String[protocolNotifyList.size()];
|
||||
for (int i = 0; i < protocolNotifyList.size(); i++) {
|
||||
@@ -771,10 +774,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve ProtocolNotify for specified usage
|
||||
*
|
||||
*
|
||||
* @param usage
|
||||
* ProtocolNotify usage
|
||||
*
|
||||
*
|
||||
* @returns String[] if elements are found at the known xpath
|
||||
* @returns String[0] if nothing is there
|
||||
*/
|
||||
@@ -811,7 +814,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve ModuleUnloadImage names
|
||||
*
|
||||
*
|
||||
* @returns ModuleUnloadImage name list if elements are found at the known
|
||||
* xpath
|
||||
* @returns null if nothing is there
|
||||
@@ -836,7 +839,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve Extern
|
||||
*
|
||||
*
|
||||
* @returns Extern objects list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -853,10 +856,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve PpiNotify for specified arch
|
||||
*
|
||||
*
|
||||
* @param arch
|
||||
* PpiNotify arch
|
||||
*
|
||||
*
|
||||
* @returns String[] if elements are found at the known xpath
|
||||
* @returns String[0] if nothing is there
|
||||
*/
|
||||
@@ -874,14 +877,14 @@ public class SurfaceAreaQuery {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<String> ppiNotifyList = new ArrayList<String>();
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
List archList = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getSupArchList();
|
||||
if (archList == null || contains(archList, arch)){
|
||||
ppiNotifyList.add(((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName());
|
||||
ppiNotifyList.add(((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
String[] ppiNotifyArray = new String[ppiNotifyList.size()];
|
||||
for (int i = 0; i < ppiNotifyList.size(); i++) {
|
||||
@@ -893,11 +896,11 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve PpiNotify for specified usage and arch
|
||||
*
|
||||
*
|
||||
* @param arch
|
||||
* PpiNotify arch usage PpiNotify usage
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @returns String[] if elements are found at the known xpath
|
||||
* @returns String[0] if nothing is there
|
||||
*/
|
||||
@@ -934,10 +937,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve Ppi for specified arch
|
||||
*
|
||||
*
|
||||
* @param arch
|
||||
* Ppi arch
|
||||
*
|
||||
*
|
||||
* @returns String[] if elements are found at the known xpath
|
||||
* @returns String[0] if nothing is there
|
||||
*/
|
||||
@@ -959,9 +962,9 @@ public class SurfaceAreaQuery {
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
List archList = ((PPIsDocument.PPIs.Ppi) returns[i]).getSupArchList();
|
||||
if (archList == null || contains(archList, arch)){
|
||||
ppiList.add(((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName());
|
||||
ppiList.add(((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
String[] ppiArray = new String[ppiList.size()];
|
||||
for (int i = 0; i < ppiList.size(); i++) {
|
||||
@@ -972,11 +975,11 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve PpiNotify for specified usage and arch
|
||||
*
|
||||
*
|
||||
* @param arch
|
||||
* PpiNotify arch usage PpiNotify usage
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @returns String[] if elements are found at the known xpath
|
||||
* @returns String[0] if nothing is there
|
||||
*/
|
||||
@@ -1013,10 +1016,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve GuidEntry information for specified usage
|
||||
*
|
||||
*
|
||||
* @param arch
|
||||
* GuidEntry arch
|
||||
*
|
||||
*
|
||||
* @returns GuidEntry objects list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -1038,9 +1041,9 @@ public class SurfaceAreaQuery {
|
||||
for (int i = 0; i < returns.length; i++) {
|
||||
List archList = ((GuidsDocument.Guids.GuidCNames) returns[i]).getSupArchList();
|
||||
if (archList == null || contains(archList, arch)){
|
||||
guidList.add(((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName());
|
||||
guidList.add(((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
String[] guidArray = new String[guidList.size()];
|
||||
for (int i = 0; i < guidList.size(); i++) {
|
||||
@@ -1052,10 +1055,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve GuidEntry information for specified usage
|
||||
*
|
||||
*
|
||||
* @param arch
|
||||
* GuidEntry arch usage GuidEntry usage
|
||||
*
|
||||
*
|
||||
* @returns GuidEntry objects list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -1091,12 +1094,12 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve Library instance information
|
||||
*
|
||||
*
|
||||
* @param arch
|
||||
* Architecture name
|
||||
* @param usage
|
||||
* Library instance usage
|
||||
*
|
||||
*
|
||||
* @returns library instance name list if elements are found at the known
|
||||
* xpath
|
||||
* @returns null if nothing is there
|
||||
@@ -1112,7 +1115,7 @@ public class SurfaceAreaQuery {
|
||||
xPath = new String[] { "/Instance" };
|
||||
} else {
|
||||
//
|
||||
// Since Schema don't have SupArchList now, so the follow Xpath is
|
||||
// Since Schema don't have SupArchList now, so the follow Xpath is
|
||||
// equal to "/Instance" and [not(@SupArchList) or @SupArchList= arch]
|
||||
// don't have effect.
|
||||
//
|
||||
@@ -1167,7 +1170,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrive library's constructor name
|
||||
*
|
||||
*
|
||||
* @returns constructor name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -1185,7 +1188,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrive library's destructor name
|
||||
*
|
||||
*
|
||||
* @returns destructor name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -1206,7 +1209,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrive DriverBinding names
|
||||
*
|
||||
*
|
||||
* @returns DriverBinding name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -1217,7 +1220,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrive ComponentName names
|
||||
*
|
||||
*
|
||||
* @returns ComponentName name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -1228,7 +1231,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrive DriverConfig names
|
||||
*
|
||||
*
|
||||
* @returns DriverConfig name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -1239,7 +1242,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrive DriverDiag names
|
||||
*
|
||||
*
|
||||
* @returns DriverDiag name list if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -1250,7 +1253,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrive SetVirtualAddressMapCallBack names
|
||||
*
|
||||
*
|
||||
* @returns SetVirtualAddressMapCallBack name list if elements are found at
|
||||
* the known xpath
|
||||
* @returns null if nothing is there
|
||||
@@ -1262,7 +1265,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrive ExitBootServicesCallBack names
|
||||
*
|
||||
*
|
||||
* @returns ExitBootServicesCallBack name list if elements are found at the
|
||||
* known xpath
|
||||
* @returns null if nothing is there
|
||||
@@ -1274,7 +1277,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve module surface area file information
|
||||
*
|
||||
*
|
||||
* @returns ModuleSA objects list if elements are found at the known xpath
|
||||
* @returns Empty ModuleSA list if nothing is there
|
||||
*/
|
||||
@@ -1348,11 +1351,11 @@ public class SurfaceAreaQuery {
|
||||
}
|
||||
for (int j = 0; j < archList.length; j++) {
|
||||
FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId, archList[j]);
|
||||
|
||||
|
||||
if (fvBinding != null) {
|
||||
fpdSaId.setFvBinding(fvBinding);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Put element to Map<FpdModuleIdentification, Map<String,
|
||||
// Object>>.
|
||||
@@ -1365,7 +1368,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve valid image names
|
||||
*
|
||||
*
|
||||
* @returns valid iamges name list if elements are found at the known xpath
|
||||
* @returns empty list if nothing is there
|
||||
*/
|
||||
@@ -1384,37 +1387,37 @@ public class SurfaceAreaQuery {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static Node getFpdUserExtensionPreBuild() {
|
||||
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" };
|
||||
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" };
|
||||
|
||||
Object[] queryResult = get("PlatformSurfaceArea", xPath);
|
||||
if (queryResult == null || queryResult.length == 0) {
|
||||
return null;
|
||||
}
|
||||
UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0];
|
||||
|
||||
|
||||
return a.getDomNode();
|
||||
}
|
||||
|
||||
|
||||
public static Node getFpdUserExtensionPostBuild() {
|
||||
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" };
|
||||
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" };
|
||||
|
||||
Object[] queryResult = get("PlatformSurfaceArea", xPath);
|
||||
if (queryResult == null || queryResult.length == 0) {
|
||||
return null;
|
||||
}
|
||||
UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0];
|
||||
|
||||
|
||||
return a.getDomNode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve FV image option information
|
||||
*
|
||||
*
|
||||
* @param fvName
|
||||
* FV image name
|
||||
*
|
||||
*
|
||||
* @returns option name/value list if elements are found at the known xpath
|
||||
* @returns empty list if nothing is there
|
||||
*/
|
||||
@@ -1478,10 +1481,10 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve FV image attributes information
|
||||
*
|
||||
*
|
||||
* @param fvName
|
||||
* FV image name
|
||||
*
|
||||
*
|
||||
* @returns attribute name/value list if elements are found at the known
|
||||
* xpath
|
||||
* @returns empty list if nothing is there
|
||||
@@ -1495,7 +1498,7 @@ public class SurfaceAreaQuery {
|
||||
}
|
||||
ArrayList<String[]> list = new ArrayList<String[]>();
|
||||
for (int i = 0; i < queryResult.length; i++) {
|
||||
|
||||
|
||||
FvImagesDocument.FvImages.FvImage.FvImageOptions item = (FvImagesDocument.FvImages.FvImage.FvImageOptions) queryResult[i];
|
||||
List<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> namevalues = item.getNameValueList();
|
||||
Iterator iter = namevalues.iterator();
|
||||
@@ -1515,7 +1518,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve flash definition file name
|
||||
*
|
||||
*
|
||||
* @returns file name if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -1539,21 +1542,21 @@ public class SurfaceAreaQuery {
|
||||
}
|
||||
|
||||
String[][] result = new String[queryResult.length][2];
|
||||
|
||||
|
||||
for (int i = 0; i < queryResult.length; i++) {
|
||||
FvImagesDocument.FvImages.NameValue item = (FvImagesDocument.FvImages.NameValue)queryResult[i];
|
||||
result[i][0] = item.getName();
|
||||
result[i][1] = item.getValue();
|
||||
}
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve FV image component options
|
||||
*
|
||||
*
|
||||
* @param fvName
|
||||
* FV image name
|
||||
*
|
||||
*
|
||||
* @returns name/value pairs list if elements are found at the known xpath
|
||||
* @returns empty list if nothing is there
|
||||
*/
|
||||
@@ -1580,12 +1583,12 @@ public class SurfaceAreaQuery {
|
||||
result[i][0] = list.get(i)[0];
|
||||
result[i][1] = list.get(i)[1];
|
||||
}
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve PCD tokens
|
||||
*
|
||||
*
|
||||
* @returns CName/ItemType pairs list if elements are found at the known
|
||||
* xpath
|
||||
* @returns null if nothing is there
|
||||
@@ -1603,7 +1606,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve MAS header
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
@@ -1635,12 +1638,12 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve Extern Specification
|
||||
*
|
||||
*
|
||||
* @param
|
||||
*
|
||||
*
|
||||
* @return String[] If have specification element in the <extern> String[0]
|
||||
* If no specification element in the <extern>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public static String[] getExternSpecificaiton() {
|
||||
@@ -1661,7 +1664,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retreive MsaFile which in SPD
|
||||
*
|
||||
*
|
||||
* @param
|
||||
* @return String[][3] The string sequence is ModuleName, ModuleGuid,
|
||||
* ModuleVersion, MsaFile String[0][] If no msafile in SPD
|
||||
@@ -1811,7 +1814,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* getSpdPpi() Retrieve the SPD PPI Entry
|
||||
*
|
||||
*
|
||||
* @param
|
||||
* @return Map<String, String[2]> if get the PPI entry from SPD. Key - PPI
|
||||
* Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI
|
||||
@@ -1843,7 +1846,7 @@ public class SurfaceAreaQuery {
|
||||
|
||||
/**
|
||||
* Retrieve module Guid string
|
||||
*
|
||||
*
|
||||
* @returns GUILD string if elements are found at the known xpath
|
||||
* @returns null if nothing is there
|
||||
*/
|
||||
@@ -1875,7 +1878,7 @@ public class SurfaceAreaQuery {
|
||||
/**
|
||||
Get name array of PCD in a module. In one module, token space
|
||||
is same, and token name should not be conflicted.
|
||||
|
||||
|
||||
@return String[]
|
||||
**/
|
||||
public static String[] getModulePcdEntryNameArray() {
|
||||
@@ -1927,7 +1930,7 @@ public class SurfaceAreaQuery {
|
||||
}
|
||||
|
||||
ExternsDocument.Externs ext = (ExternsDocument.Externs)returns[0];
|
||||
|
||||
|
||||
if (ext.getTianoR8FlashMapH()){
|
||||
return true;
|
||||
}else {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/** @file
|
||||
ConfigReader class.
|
||||
|
||||
ConfigReader is used to read tool chain config file with flat format.
|
||||
|
||||
|
||||
ConfigReader is used to read tool chain config file with flat format.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
package org.tianocore.build.toolchain;
|
||||
|
||||
import org.tianocore.exception.EdkException;
|
||||
import org.tianocore.common.exception.EdkException;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -23,10 +23,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
|
||||
ConfigReader is used to read tool chain config file with flat format. Comments
|
||||
is line starting with character '#'.
|
||||
|
||||
|
||||
@since GenBuild 1.0
|
||||
**/
|
||||
public class ConfigReader {
|
||||
@@ -35,14 +35,14 @@ public class ConfigReader {
|
||||
|
||||
|
||||
/**
|
||||
Public construct method.
|
||||
Public construct method.
|
||||
**/
|
||||
public ConfigReader () {
|
||||
}
|
||||
|
||||
/**
|
||||
Default filepath is ".".
|
||||
|
||||
|
||||
@param filename the config file name like "target.txt"
|
||||
@return the variables defined in file
|
||||
**/
|
||||
@@ -52,8 +52,8 @@ public class ConfigReader {
|
||||
|
||||
/**
|
||||
Get all variables defined in config file. the config file format is flat
|
||||
with "A=B". If line started with '#' looks as comments.
|
||||
|
||||
with "A=B". If line started with '#' looks as comments.
|
||||
|
||||
@param confPath the path of config file
|
||||
@param filename the file name of the config file
|
||||
@return the variables defined in the config file
|
||||
@@ -78,7 +78,7 @@ public class ConfigReader {
|
||||
// without '=', or start with '='
|
||||
//
|
||||
int index;
|
||||
if (str.length() == 0 || str.startsWith("#") ||
|
||||
if (str.length() == 0 || str.startsWith("#") ||
|
||||
(index = str.indexOf('=')) <= 0) {
|
||||
continue;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class ConfigReader {
|
||||
|
||||
public static synchronized ToolChainMap parseToolChainConfig(File ConfigFile) throws EdkException {
|
||||
ToolChainMap map = new ToolChainMap();
|
||||
|
||||
|
||||
try {
|
||||
FileReader reader = new FileReader(ConfigFile);
|
||||
BufferedReader in = new BufferedReader(reader);
|
||||
@@ -114,7 +114,7 @@ public class ConfigReader {
|
||||
// without '=', or start with '='
|
||||
//
|
||||
int index;
|
||||
if (str.length() == 0 || str.startsWith("#") ||
|
||||
if (str.length() == 0 || str.startsWith("#") ||
|
||||
(index = str.indexOf('=')) <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/** @file
|
||||
ToolChainConfig class.
|
||||
|
||||
|
||||
ToolChainFactory class parse all config files and get tool chain information.
|
||||
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -16,7 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
package org.tianocore.build.toolchain;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.tianocore.exception.EdkException;
|
||||
|
||||
import org.tianocore.common.exception.EdkException;
|
||||
import org.tianocore.build.toolchain.ToolChainKey;
|
||||
import org.tianocore.build.toolchain.ToolChainMap;
|
||||
|
||||
@@ -26,9 +27,9 @@ import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
ToolChainFactory class parse all config files and get tool chain information.
|
||||
|
||||
|
||||
**/
|
||||
public class ToolChainConfig {
|
||||
///
|
||||
@@ -37,7 +38,7 @@ public class ToolChainConfig {
|
||||
private ToolChainMap config = null;
|
||||
///
|
||||
/// tool chain information (how many targets, archs, etc.)
|
||||
///
|
||||
///
|
||||
private ToolChainInfo info = new ToolChainInfo();
|
||||
|
||||
/**
|
||||
@@ -48,7 +49,7 @@ public class ToolChainConfig {
|
||||
|
||||
/**
|
||||
Public construct method.
|
||||
|
||||
|
||||
@param toolChainFile File object representing the tool chain configuration file
|
||||
**/
|
||||
public ToolChainConfig (File toolChainFile) {
|
||||
@@ -64,7 +65,7 @@ public class ToolChainConfig {
|
||||
/**
|
||||
Collect target, tool chain tag, arch and command information from key part
|
||||
of configuration
|
||||
|
||||
|
||||
@param toolChainDefKey The set of keys in tool chain configuration
|
||||
**/
|
||||
private void parseToolChainDefKey (Set<ToolChainKey> toolChainDefKey) {
|
||||
@@ -80,8 +81,8 @@ public class ToolChainConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
Return the tool chain configuration information in a Map form
|
||||
|
||||
Return the tool chain configuration information in a Map form
|
||||
|
||||
@return ToolChainMap Tool chain configurations in a ToolChainMap
|
||||
**/
|
||||
public ToolChainMap getConfig() {
|
||||
@@ -90,7 +91,7 @@ public class ToolChainConfig {
|
||||
|
||||
/**
|
||||
Return the tool chain's target, arch, tag and commands information
|
||||
|
||||
|
||||
@return ToolChainInfo
|
||||
**/
|
||||
public ToolChainInfo getConfigInfo() {
|
||||
@@ -99,7 +100,7 @@ public class ToolChainConfig {
|
||||
|
||||
/**
|
||||
override toString()
|
||||
|
||||
|
||||
@return String The converted configuration string in name=value form
|
||||
**/
|
||||
public String toString() {
|
||||
|
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
package org.tianocore.build.toolchain;
|
||||
|
||||
import org.tianocore.exception.EdkException;
|
||||
import org.tianocore.common.exception.EdkException;
|
||||
|
||||
public class ToolChainKey implements java.io.Serializable, Comparable<ToolChainKey> {
|
||||
static final long serialVersionUID = -8034897190740066933L;
|
||||
|
Reference in New Issue
Block a user