summaryrefslogtreecommitdiff
path: root/Tools/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Source')
-rw-r--r--Tools/Source/GenBuild/GenBuild.msa13
-rw-r--r--Tools/Source/GenBuild/build.xml1
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java2
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java2
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java31
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java50
-rw-r--r--Tools/Source/PcdTools/PcdTools.msa45
-rw-r--r--Tools/Source/PcdTools/build.xml52
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/action/ActionMessage.java (renamed from Tools/Source/GenBuild/org/tianocore/build/pcd/action/ActionMessage.java)3
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/action/BuildAction.java (renamed from Tools/Source/GenBuild/org/tianocore/build/pcd/action/BuildAction.java)10
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/entity/CommonDefinition.java354
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java (renamed from Tools/Source/GenBuild/org/tianocore/build/pcd/entity/DynamicTokenValue.java)4
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java (renamed from Tools/Source/GenBuild/org/tianocore/build/pcd/entity/MemoryDatabaseManager.java)14
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/entity/SkuInstance.java (renamed from Tools/Source/GenBuild/org/tianocore/build/pcd/entity/SkuInstance.java)2
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java (renamed from Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java)22
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageIdentification.java97
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java (renamed from Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java)46
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/exception/BuildActionException.java (renamed from Tools/Source/GenBuild/org/tianocore/build/pcd/exception/BuildActionException.java)2
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/exception/EntityException.java (renamed from Tools/Source/GenBuild/org/tianocore/build/pcd/exception/EntityException.java)2
-rw-r--r--Tools/Source/PcdTools/org/tianocore/pcd/exception/UIException.java (renamed from Tools/Source/GenBuild/org/tianocore/build/pcd/exception/UIException.java)2
20 files changed, 637 insertions, 117 deletions
diff --git a/Tools/Source/GenBuild/GenBuild.msa b/Tools/Source/GenBuild/GenBuild.msa
index 0fe46bb..7175504 100644
--- a/Tools/Source/GenBuild/GenBuild.msa
+++ b/Tools/Source/GenBuild/GenBuild.msa
@@ -66,21 +66,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Filename>org/tianocore/build/id/PlatformIdentification.java</Filename>
<Filename>org/tianocore/build/ModuleBuildFileGenerator.java</Filename>
<Filename>org/tianocore/build/OutputDirSetup.java</Filename>
- <Filename>org/tianocore/build/pcd/action/ActionMessage.java</Filename>
- <Filename>org/tianocore/build/pcd/action/BuildAction.java</Filename>
<Filename>org/tianocore/build/pcd/action/CollectPCDAction.java</Filename>
<Filename>org/tianocore/build/pcd/action/PCDAutoGenAction.java</Filename>
- <Filename>org/tianocore/build/pcd/action/ShowPCDDatabaseAction.java</Filename>
- <Filename>org/tianocore/build/pcd/action/UIAction.java</Filename>
- <Filename>org/tianocore/build/pcd/entity/DynamicTokenValue.java</Filename>
- <Filename>org/tianocore/build/pcd/entity/MemoryDatabaseManager.java</Filename>
- <Filename>org/tianocore/build/pcd/entity/SkuInstance.java</Filename>
- <Filename>org/tianocore/build/pcd/entity/Token.java</Filename>
- <Filename>org/tianocore/build/pcd/entity/UsageInstance.java</Filename>
- <Filename>org/tianocore/build/pcd/exception/BuildActionException.java</Filename>
- <Filename>org/tianocore/build/pcd/exception/EntityException.java</Filename>
- <Filename>org/tianocore/build/pcd/exception/UIException.java</Filename>
- <Filename>org/tianocore/build/pcd/ui/PCDDatabaseFrame.java</Filename>
<Filename>org/tianocore/build/toolchain/ConfigReader.java</Filename>
<Filename>org/tianocore/build/toolchain/ToolChainAttribute.java</Filename>
<Filename>org/tianocore/build/toolchain/ToolChainConfig.java</Filename>
diff --git a/Tools/Source/GenBuild/build.xml b/Tools/Source/GenBuild/build.xml
index e40e756..b61e251 100644
--- a/Tools/Source/GenBuild/build.xml
+++ b/Tools/Source/GenBuild/build.xml
@@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<path id="classpath">
<fileset dir="${WORKSPACE}/Tools/Jars" includes="SurfaceArea.jar"/>
<fileset dir="${WORKSPACE}/Tools/Jars" includes="Common.jar"/>
+ <fileset dir="${WORKSPACE}/Tools/Jars" includes="PcdTools.jar"/>
<fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
</path>
<property name="buildDir" value="build"/>
diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
index 39d4d6f..bd87b6e 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
@@ -39,7 +39,7 @@ 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.build.pcd.action.ActionMessage;
+import org.tianocore.pcd.action.ActionMessage;
import org.tianocore.build.pcd.action.CollectPCDAction;
import org.tianocore.build.toolchain.ToolChainAttribute;
import org.tianocore.build.toolchain.ToolChainElement;
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
index a769816..b02af3d 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
@@ -35,7 +35,7 @@ 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.pcd.entity.MemoryDatabaseManager;
+import org.tianocore.pcd.entity.MemoryDatabaseManager;
import org.tianocore.build.toolchain.ToolChainAttribute;
import org.tianocore.build.toolchain.ToolChainConfig;
import org.tianocore.build.toolchain.ToolChainElement;
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
index 8242a4c..e0a3eb6 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
@@ -41,17 +41,19 @@ import org.tianocore.ModuleSADocument;
import org.tianocore.PcdBuildDefinitionDocument;
import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition;
import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.build.autogen.CommonDefinition;
import org.tianocore.build.fpd.FpdParserTask;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.build.pcd.action.ActionMessage;
-import org.tianocore.build.pcd.entity.DynamicTokenValue;
-import org.tianocore.build.pcd.entity.MemoryDatabaseManager;
-import org.tianocore.build.pcd.entity.SkuInstance;
-import org.tianocore.build.pcd.entity.Token;
-import org.tianocore.build.pcd.entity.UsageInstance;
-import org.tianocore.build.pcd.exception.EntityException;
+import org.tianocore.build.id.ModuleIdentification;
+import org.tianocore.pcd.action.ActionMessage;
+import org.tianocore.pcd.entity.CommonDefinition;
+import org.tianocore.pcd.entity.DynamicTokenValue;
+import org.tianocore.pcd.entity.MemoryDatabaseManager;
+import org.tianocore.pcd.entity.SkuInstance;
+import org.tianocore.pcd.entity.Token;
+import org.tianocore.pcd.entity.UsageIdentification;
+import org.tianocore.pcd.entity.UsageInstance;
+import org.tianocore.pcd.exception.EntityException;
/**
CStructTypeDeclaration
@@ -1893,6 +1895,8 @@ public class CollectPCDAction {
String datum = null;
int maxDatumSize = 0;
String[] tokenSpaceStrRet = null;
+ UsageIdentification usageId = null;
+ ModuleIdentification moduleId = null;
//
// ----------------------------------------------
@@ -2112,10 +2116,17 @@ public class CollectPCDAction {
// 2.1.4), Create an usage instance for this token.
// ------------------------------------------------
//
+ moduleId = modules.get(index).getModuleId().getModule();
+ usageId = new UsageIdentification (moduleId.getName(),
+ moduleId.getGuid(),
+ moduleId.getPackage().getName(),
+ moduleId.getPackage().getGuid(),
+ modules.get(index).getModuleId().getArch(),
+ moduleId.getVersion(),
+ moduleId.getModuleType());
usageInstance = new UsageInstance(token,
- modules.get(index).getModuleId().getModule(),
+ usageId,
pcdType,
- modules.get(index).getModuleId().getArch(),
datum,
maxDatumSize);
token.addUsageInstance(usageInstance);
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
index 2707c5d..40d2b32 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
@@ -29,11 +29,14 @@ import org.apache.xmlbeans.XmlObject;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.global.SurfaceAreaQuery;
import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.pcd.entity.MemoryDatabaseManager;
-import org.tianocore.build.pcd.entity.Token;
-import org.tianocore.build.pcd.entity.UsageInstance;
-import org.tianocore.build.pcd.exception.BuildActionException;
-import org.tianocore.build.pcd.exception.EntityException;
+import org.tianocore.pcd.entity.MemoryDatabaseManager;
+import org.tianocore.pcd.entity.Token;
+import org.tianocore.pcd.entity.UsageInstance;
+import org.tianocore.pcd.exception.BuildActionException;
+import org.tianocore.pcd.exception.EntityException;
+import org.tianocore.pcd.entity.UsageIdentification;
+import org.tianocore.pcd.action.BuildAction;
+import org.tianocore.pcd.action.ActionMessage;
/** This class is to manage how to generate the PCD information into Autogen.c and
Autogen.h.
@@ -44,9 +47,9 @@ public class PCDAutoGenAction extends BuildAction {
///
private MemoryDatabaseManager dbManager;
///
- /// The identification for a module.
+ /// The identification for a UsageInstance.
///
- private ModuleIdentification moduleId;
+ private UsageIdentification usageId;
///
/// The arch of current module
///
@@ -72,17 +75,8 @@ public class PCDAutoGenAction extends BuildAction {
@param moduleName the module name parameter.
**/
- public void setModuleId(ModuleIdentification moduleId) {
- this.moduleId = moduleId;
- }
-
- /**
- set Arch parameter.
-
- @param arch
- **/
- public void setArch(String arch) {
- this.arch = arch;
+ public void setUsageId(UsageIdentification usageId) {
+ this.usageId = usageId;
}
/**
@@ -136,12 +130,18 @@ public class PCDAutoGenAction extends BuildAction {
String arch,
boolean isBuildUsedLibrary,
String[] pcdNameArrayInMsa) {
+ UsageIdentification usageId = new UsageIdentification(moduleId.getName(),
+ moduleId.getGuid(),
+ moduleId.getPackage().getName(),
+ moduleId.getPackage().getGuid(),
+ arch,
+ moduleId.getVersion(),
+ moduleId.getModuleType());
dbManager = null;
hAutoGenString = "";
cAutoGenString = "";
- setModuleId(moduleId);
- setArch(arch);
+ setUsageId(usageId);
setIsBuildUsedLibrary(isBuildUsedLibrary);
setPcdNameArrayInMsa(pcdNameArrayInMsa);
}
@@ -151,7 +151,7 @@ public class PCDAutoGenAction extends BuildAction {
@throws BuildActionException Bad parameter.
**/
- void checkParameter() throws BuildActionException {
+ public void checkParameter() throws BuildActionException {
}
@@ -165,7 +165,7 @@ public class PCDAutoGenAction extends BuildAction {
@throws BuildActionException Failed to execute this aciton class.
**/
- void performAction() throws BuildActionException {
+ public void performAction() throws BuildActionException {
ActionMessage.debug(this,
"Starting PCDAutoGenAction to generate autogen.h and autogen.c!...");
//
@@ -200,13 +200,13 @@ public class PCDAutoGenAction extends BuildAction {
String[] guidStringArray = null;
String guidStringCName = null;
String guidString = null;
- String moduleName = moduleId.getName();
+ String moduleName = usageId.moduleName;
UsageInstance usageInstance = null;
boolean found = false;
usageInstanceArray = null;
if (!isBuildUsedLibrary) {
- usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(moduleId, arch);
+ usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(usageId);
dbManager.UsageInstanceContext = usageInstanceArray;
dbManager.CurrentModuleName = moduleName;
} else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {
@@ -216,7 +216,7 @@ public class PCDAutoGenAction extends BuildAction {
// these library should be used to autogen.
//
if (usageContext == null) {
- usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(moduleId, arch);
+ usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(usageId);
} else {
usageInstanceArray = new ArrayList<UsageInstance>();
diff --git a/Tools/Source/PcdTools/PcdTools.msa b/Tools/Source/PcdTools/PcdTools.msa
new file mode 100644
index 0000000..3b47a92
--- /dev/null
+++ b/Tools/Source/PcdTools/PcdTools.msa
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
+ <MsaHeader>
+ <ModuleName>PcdTools</ModuleName>
+ <ModuleType>TOOL</ModuleType>
+ <GuidValue>95506773-88f3-475a-91a1-14ce0c847353</GuidValue>
+ <Version>2.0</Version>
+ <Abstract>This is the EFI/Tiano PCD Tool Resources Module</Abstract>
+ <Description>
+ This Module provdes the entity, action and exception package for PCD
+ tools, This package will be shared for building tools or wizard tools.
+ </Description>
+ <Copyright>Copyright 2005-2006, Intel Corporation</Copyright>
+ <License>
+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.
+ </License>
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
+ </MsaHeader>
+ <ModuleDefinitions>
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
+ <BinaryModule>false</BinaryModule>
+ <OutputFileBasename>NULL</OutputFileBasename>
+ </ModuleDefinitions>
+ <SourceFiles>
+ <Filename>build.xml</Filename>
+ <Filename>org/tianocore/pcd/action/ActionMessage.java</Filename>
+ <Filename>org/tianocore/pcd/action/BuildAction.java</Filename>
+ <Filename>org/tianocore/pcd/entity/DynamicTokenValue.java</Filename>
+ <Filename>org/tianocore/pcd/entity/MemoryDatabaseManager.java</Filename>
+ <Filename>org/tianocore/pcd/entity/SkuInstance.java</Filename>
+ <Filename>org/tianocore/pcd/entity/Token.java</Filename>
+ <Filename>org/tianocore/pcd/entity/UsageInstance.java</Filename>
+ <Filename>org/tianocore/pcd/exception/BuildActionException.java</Filename>
+ <Filename>org/tianocore/pcd/exception/EntityException.java</Filename>
+ <Filename>org/tianocore/pcd/exception/UIException.java</Filename>
+ </SourceFiles>
+</ModuleSurfaceArea>
diff --git a/Tools/Source/PcdTools/build.xml b/Tools/Source/PcdTools/build.xml
new file mode 100644
index 0000000..c47032e
--- /dev/null
+++ b/Tools/Source/PcdTools/build.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+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.
+-->
+<project name="PcdTools" default="PcdTools" basedir=".">
+
+ <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+ <property environment="env"/>
+ <property name="WORKSPACE" value="${env.WORKSPACE}"/>
+ <path id="classpath">
+ <fileset dir="${WORKSPACE}/Tools/Jars" includes="SurfaceArea.jar"/>
+ <fileset dir="${WORKSPACE}/Tools/Jars" includes="Common.jar"/>
+ <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
+ </path>
+ <property name="buildDir" value="build"/>
+ <property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>
+ <target name="PcdTools" depends="install"/>
+ <target name="source">
+ <mkdir dir="${buildDir}"/>
+ <javac srcdir="." destdir="${buildDir}">
+ <classpath refid="classpath"/>
+ <compilerarg value="-Xlint"/>
+ </javac>
+ </target>
+ <target name="clean">
+ <delete dir="${buildDir}"/>
+ </target>
+ <target name="cleanall">
+ <delete dir="${buildDir}"/>
+ <delete file="${installLocation}/PcdTools.jar"/>
+ <if>
+ <available file="${installLocation}/PcdTools.jar"/>
+ <then>
+ <echo message="You must manually remove the file: ${installLocation}/PcdTools.jar"/>
+ <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
+ </then>
+ </if>
+ </target>
+ <target name="install" depends="source">
+ <jar destfile="${installLocation}/PcdTools.jar"
+ basedir="${buildDir}"
+ includes="**"
+ />
+ </target>
+</project>
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/ActionMessage.java b/Tools/Source/PcdTools/org/tianocore/pcd/action/ActionMessage.java
index d993fab..2b589e5 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/ActionMessage.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/action/ActionMessage.java
@@ -14,10 +14,9 @@ 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.pcd.action;
+package org.tianocore.pcd.action;
import org.apache.tools.ant.Task;
-import org.tianocore.build.pcd.action.BuildAction;
/** ActionMessage class take over all message for loging and waning. This class
should dispatch message into different Action class according to instance
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/BuildAction.java b/Tools/Source/PcdTools/org/tianocore/pcd/action/BuildAction.java
index 3614547..98068d9 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/BuildAction.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/action/BuildAction.java
@@ -14,16 +14,16 @@ 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.pcd.action;
+package org.tianocore.pcd.action;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.Project;
-import org.tianocore.build.pcd.exception.BuildActionException;
+import org.tianocore.pcd.exception.BuildActionException;
/** BuildAction is the parent class for all action related to ant Task. This class will
define some common utility functionality, such as logMsg, warningMsg..etc.
**/
-abstract class BuildAction extends Task {
+public abstract class BuildAction extends Task {
///
/// Original message level before this action. This value will
/// be restored when quit this action.
@@ -35,14 +35,14 @@ abstract class BuildAction extends Task {
This function will be overrided by child class.
**/
- abstract void checkParameter() throws BuildActionException;
+ public abstract void checkParameter() throws BuildActionException;
/**
performAction is to execute the detail action.
This function will be overrided by child class.
**/
- abstract void performAction() throws BuildActionException;
+ public abstract void performAction() throws BuildActionException;
/**
setMessageLevel function set current message for task instance object.
diff --git a/Tools/Source/PcdTools/org/tianocore/pcd/entity/CommonDefinition.java b/Tools/Source/PcdTools/org/tianocore/pcd/entity/CommonDefinition.java
new file mode 100644
index 0000000..c16bb04
--- /dev/null
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/entity/CommonDefinition.java
@@ -0,0 +1,354 @@
+/** @file
+ CommonDefinition class.
+
+ This class is to define some common marcos and funcions, which used by AutoGen.
+
+ 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.pcd.entity;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ CommonDefinition
+
+ This class is to define some common marcos, which used by AutoGen.
+
+**/
+public class CommonDefinition {
+ public final static String spdSuffix = ".spd";
+ public final static String mbdSuffix = ".mbd";
+ public final static String msaSuffix = ".msa";
+ public final static String LibraryStr = "LIBRARY";
+ public final static String autoGenHbegin = "extern int __make_me_compile_correctly;\r\n";
+ public final static String include = "#include";
+ public final static String autoGenCLine1 = "\r\n";
+
+ public final static String autoGenCLine2 = "const UINT8 _gDebugPropertyMask "
+ + "= DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED"
+ + " | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED"
+ + " | DEBUG_PROPERTY_DEBUG_CODE_ENABLED;\r\n";
+
+ public final static String autoGenCLine3 = "const UINTN _gModuleDefaultErrorLevel"
+ + " = EFI_D_ERROR | EFI_D_LOAD;\r\n";
+
+ public final static String autoGenHLine1 = "#define EFI_SPECIFICATION_VERSION 0x00020000\r\n";
+ public final static String autoGenHVersionDefault = "#define EFI_SPECIFICATION_VERSION 0x00000000\r\n";
+ public final static String autoGenHLine2 = "#define EDK_RELEASE_VERSION 0x00090000\r\n";
+ public final static String autoGenHReleaseDefault = "#define EDK_RELEASE_VERSION 0x00000000\r\n";
+
+ public final static String includeAutogenH = "#include <AutoGen.h>\r\n" ;
+ public final static String marcDefineStr = "#define ";
+
+ public final static String gEfi = "gEfi";
+ public final static String protocolGuid = "ProtocolGuid";
+ public final static String ppiGuid = "PpiGuid";
+ public final static String guidGuid = "Guid";
+
+ public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";
+ public final static String flashMapH = "FlashMap.h";
+
+ //
+ // AutoGen.h and AutoGen.c file's header
+ //
+ public final static String autogenHNotation =
+ "/**\r\n" +
+ " DO NOT EDIT\r\n" +
+ " FILE auto-generated by GenBuild tasks\r\n" +
+ " Module name:\r\n" +
+ " AutoGen.h\r\n" +
+ " Abstract:" +
+ " Auto-generated AutoGen.h for building module or library.\r\n" +
+ "**/\r\n\r\n";
+
+ public final static String autogenCNotation =
+ "/**\r\n" +
+ " DO NOT EDIT\r\n" +
+ " FILE auto-generated by GenBuild tasks\r\n" +
+ " Module name:\r\n" +
+ " AutoGen.c\r\n" +
+ " Abstract:" +
+ " Auto-generated AutoGen.c for building module or library.\r\n" +
+ "**/\r\n\r\n";
+
+ //
+ // module type
+ //
+ public final static int ModuleTypeBase = 0;
+ public final static int ModuleTypeSec = 1;
+ public final static int ModuleTypePeiCore = 2;
+ public final static int ModuleTypePeim = 3;
+ public final static int ModuleTypeDxeCore = 4;
+ public final static int ModuleTypeDxeDriver = 5;
+ public final static int ModuleTypeDxeRuntimeDriver = 6;
+ public final static int ModuleTypeDxeSmmDriver = 7;
+ public final static int ModuleTypeDxeSalDriver = 8;
+ public final static int ModuleTypeUefiDriver = 9;
+ public final static int ModuleTypeUefiApplication = 10;
+ public final static int ModuleTypeUnknown = 11;
+
+
+ //
+ // component type
+ //
+ public final static int ComponentTypeNull = 0;
+ public final static int ComponentTypeApriori = 1;
+ public final static int ComponentTypeSec = 2;
+ public final static int ComponentTypeLibrary = 3;
+ public final static int ComponentTypeFvImageFile = 4;
+ public final static int ComponentTypeBsDriver = 5;
+ public final static int ComponentTypeRtDriver = 6;
+ public final static int ComponentTypeSalRtDriver =7;
+ public final static int ComponentTypePe32Peim = 8;
+ public final static int ComponentTypePicPeim =9;
+ public final static int ComponentTypeCombinedPeimDriver =10;
+ public final static int ComponentTypePeiCore = 11;
+ public final static int ComponentTypeDxeCore = 12;
+ public final static int ComponentTypeApplication = 13;
+ public final static int ComponentTypeBsDriverEfi = 14;
+ public final static int ComponentTypeShellApp = 15;
+ public final static int ComponentTypeBinary =16;
+ public final static int ComponentTypeLogo = 17;
+ public final static int ComponentTypeCustomBuild = 18;
+ public final static int ComponentTypeUnknown = 19;
+
+
+ //
+ // Usaged style
+ //
+ public final static String AlwaysConsumed = "ALWAYS_CONSUMED";
+ public final static String AlwaysProduced = "ALWAYS_PRODUCED";
+
+
+ public static class MyEnum {
+ String moduleTypeStr;
+ int type;
+
+ MyEnum (String str, int type) {
+ this.type = type;
+ this.moduleTypeStr = str;
+ }
+
+ int ForInt(String str) {
+ if (str.equals(this.moduleTypeStr)) {
+ return this.type;
+ } else
+ return -1;
+ }
+ }
+
+ //
+ // Module type
+ //
+ public static final MyEnum[] moduleEnum = new MyEnum[] {
+ new MyEnum("BASE", ModuleTypeBase),
+ new MyEnum("SEC", ModuleTypeSec),
+ new MyEnum("PEI_CORE", ModuleTypePeiCore),
+ new MyEnum("PEIM", ModuleTypePeim),
+ new MyEnum("DXE_CORE", ModuleTypeDxeCore),
+ new MyEnum("DXE_DRIVER", ModuleTypeDxeDriver),
+ new MyEnum("DXE_RUNTIME_DRIVER", ModuleTypeDxeRuntimeDriver),
+ new MyEnum("DXE_SAL_DRIVER", ModuleTypeDxeSalDriver),
+ new MyEnum("DXE_SMM_DRIVER", ModuleTypeDxeSmmDriver),
+ new MyEnum("UEFI_DRIVER", ModuleTypeUefiDriver),
+ new MyEnum("UEFI_APPLICATION", ModuleTypeUefiApplication) };
+
+ //
+ // Component type
+ //
+ public static final MyEnum[] componentEnum = new MyEnum[]{
+ new MyEnum("APRIORI", ComponentTypeApriori),
+ new MyEnum("SEC", ComponentTypeSec),
+ new MyEnum("LIBRARY", ComponentTypeLibrary),
+ new MyEnum("FV_IMAGE_FILE", ComponentTypeFvImageFile),
+ new MyEnum("BS_DRIVER", ComponentTypeBsDriver),
+ new MyEnum("RT_DRIVER", ComponentTypeRtDriver),
+ new MyEnum("SAL_RT_DRIVER", ComponentTypeSalRtDriver),
+ new MyEnum("PE32_PEIM", ComponentTypePe32Peim),
+ new MyEnum("PIC_PEIM", ComponentTypePicPeim),
+ new MyEnum("COMBINED_PEIM_DRIVER", ComponentTypeCombinedPeimDriver),
+ new MyEnum("PEI_CORE", ComponentTypePeiCore),
+ new MyEnum("DXE_CORE", ComponentTypeDxeCore),
+ new MyEnum("APPLICATION", ComponentTypeApplication),
+ new MyEnum("BS_DRIVER_EFI", ComponentTypeBsDriverEfi),
+ new MyEnum("SHELLAPP", ComponentTypeShellApp),
+ new MyEnum("BINARY", ComponentTypeBinary),
+ new MyEnum("LOGO", ComponentTypeLogo),
+ new MyEnum("CUSTOM_BUILD", ComponentTypeCustomBuild)
+ };
+
+ /**
+ getModuleType
+
+ This function get the module type value according module type string.
+
+ @param moduleTypeStr String of modlue type.
+ @return
+ **/
+ static public int getModuleType(String moduleTypeStr) {
+ int returnValue = -1;
+ for (int i = 0; i < CommonDefinition.moduleEnum.length; i++) {
+ returnValue = CommonDefinition.moduleEnum[i].ForInt(moduleTypeStr);
+ if (returnValue != -1) {
+ return returnValue;
+ }
+ }
+ return CommonDefinition.ModuleTypeUnknown;
+ }
+
+ /**
+ getComponentType
+
+ This function get the component type value according commponet type
+ string.
+
+ @param componentTypeStr String of component type.
+ @return
+ **/
+ static public int getComponentType (String componentTypeStr){
+ int returnValue = -1;
+ for (int i = 0; i < CommonDefinition.componentEnum.length; i++) {
+ returnValue = CommonDefinition.componentEnum[i].ForInt(componentTypeStr);
+ if (returnValue != -1) {
+ return returnValue;
+ }
+ }
+ return CommonDefinition.ComponentTypeUnknown;
+ }
+
+ /**
+ getComponentTypeString
+
+ This function get the commponet type string according component type value.
+
+ @param componentType Integer value of component type.
+ @return
+ **/
+ static public String getComponentTypeString (int componentType) {
+ if ((componentType > CommonDefinition.ComponentTypeUnknown) ||
+ (componentType < CommonDefinition.ComponentTypeNull)) {
+ return null;
+ }
+ for (int index = 0; index < CommonDefinition.componentEnum.length; index ++) {
+ if (componentType == CommonDefinition.componentEnum[index].type) {
+ return CommonDefinition.componentEnum[index].moduleTypeStr;
+ }
+ }
+ return null;
+ }
+
+ /**
+ isLibraryComponent
+
+ This function is to check does componet is library according to commponet
+ type value.
+
+ @param componentType Integer value of component type.
+ @return
+ **/
+ static public boolean isLibraryComponent (int componentType) {
+ if (ComponentTypeLibrary == componentType) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * formateGuidName
+ *
+ * This function is to formate GUID to ANSI c form.
+ *
+ * @param guidNameCon
+ * String of GUID.
+ * @return Formated GUID.
+ */
+ public static String formatGuidName(String guidNameConv) {
+ String[] strList;
+ String guid = "";
+ int index = 0;
+ if (guidNameConv
+ .matches("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}")) {
+ strList = guidNameConv.split("-");
+ guid = "0x" + strList[0] + ", ";
+ guid = guid + "0x" + strList[1] + ", ";
+ guid = guid + "0x" + strList[2] + ", ";
+ guid = guid + "{";
+ guid = guid + "0x" + strList[3].substring(0, 2) + ", ";
+ guid = guid + "0x" + strList[3].substring(2, 4);
+
+ while (index < strList[4].length()) {
+ guid = guid + ", ";
+ guid = guid + "0x" + strList[4].substring(index, index + 2);
+ index = index + 2;
+ }
+ guid = guid + "}";
+ return guid;
+ } else if (guidNameConv
+ .matches("0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?")) {
+ strList = guidNameConv.split(",");
+
+ //
+ // chang Microsoft specific form to ANSI c form
+ //
+ for (int i = 0; i < 3; i++) {
+ guid = guid + strList[i] + ",";
+ }
+ guid = guid + "{";
+
+ for (int i = 3; i < strList.length; i++) {
+ if (i == strList.length - 1) {
+ guid = guid + strList[i];
+ } else {
+ guid = guid + strList[i] + ",";
+ }
+ }
+ guid = guid + "}";
+ return guid;
+ } else {
+ System.out
+ .println("Check GUID Value, it don't conform to the schema!!!");
+ return "0";
+
+ }
+ }
+
+ /**
+ * Remove deuplicat string in list
+ *
+ * This function is to duplicat string in list
+ *
+ * @param String[]
+ * String list.
+ * @return String[] String list which remove the duplicate string.
+ */
+ public static String[] remDupString (String[] orgList){
+ Set<String> strList = new LinkedHashSet<String>();
+ String[] desList ;
+ if (orgList == null){
+ return new String[0];
+ }
+ for (int i = 0; i < orgList.length; i++){
+ strList.add(orgList[i]);
+ }
+ desList = new String[strList.size()];
+ Iterator item = strList.iterator();
+ int index = 0;
+ while (item.hasNext()){
+ desList[index] = (String)item.next();
+ index++;
+ }
+ return desList;
+ }
+
+} \ No newline at end of file
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/DynamicTokenValue.java b/Tools/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java
index 533bd51..e8fb8e8 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/DynamicTokenValue.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java
@@ -13,12 +13,12 @@ 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.pcd.entity;
+package org.tianocore.pcd.entity;
import java.util.List;
import java.util.UUID;
-import org.tianocore.build.pcd.exception.EntityException;
+import org.tianocore.pcd.exception.EntityException;
/** This class is to descript a value type of dynamic PCD.
For a dynamic or dynamicEx type PCD data, the value type can be:
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/MemoryDatabaseManager.java b/Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
index 636be3a..7a87469 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/MemoryDatabaseManager.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
@@ -13,7 +13,7 @@ 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.pcd.entity;
+package org.tianocore.pcd.entity;
import java.util.ArrayList;
import java.util.HashMap;
@@ -21,8 +21,8 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.pcd.exception.EntityException;
+import org.tianocore.pcd.entity.UsageIdentification;
+import org.tianocore.pcd.exception.EntityException;
/** Database hold all PCD information comes from SPD, MSA, FPD file in memory.
**/
@@ -224,15 +224,13 @@ public class MemoryDatabaseManager {
Get all PCD record for a module according to module's name, module's GUID,
package name, package GUID, arch, version information.
- @param moduleId the id of module.
- @param arch the architecture
+ @param usageId the id of UsageInstance.
@return all usage instance for this module in memory database.
**/
- public List<UsageInstance> getUsageInstanceArrayByModuleName(ModuleIdentification moduleId,
- String arch) {
+ public List<UsageInstance> getUsageInstanceArrayByModuleName(UsageIdentification usageId) {
- String primaryKey = UsageInstance.getPrimaryKey(moduleId, arch);
+ String primaryKey = UsageInstance.getPrimaryKey(usageId);
return getUsageInstanceArrayByKeyString(primaryKey);
}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/SkuInstance.java b/Tools/Source/PcdTools/org/tianocore/pcd/entity/SkuInstance.java
index 6df1551..181e321 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/SkuInstance.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/entity/SkuInstance.java
@@ -13,7 +13,7 @@ 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.pcd.entity;
+package org.tianocore.pcd.entity;
/** Sku instance contains ID and value, A pcd token maybe contains more than one Sku instance.
**/
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java b/Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java
index 20b4f4e..2e2a297 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java
@@ -13,7 +13,7 @@ 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.pcd.entity;
+package org.tianocore.pcd.entity;
import java.math.BigInteger;
import java.util.ArrayList;
@@ -22,8 +22,8 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.pcd.exception.EntityException;
+import org.tianocore.pcd.entity.UsageIdentification;
+import org.tianocore.pcd.exception.EntityException;
/** This class is to descript a PCD token object. The information of a token mainly
comes from MSA, SPD and setting produced by platform developer.
@@ -118,8 +118,6 @@ public class Token {
@param tokenSpaceName The name of token space, it is a guid string
**/
public Token(String cName, String tokenSpaceName) {
- UUID nullUUID = new UUID(0, 0);
-
this.cName = cName;
this.tokenSpaceName = tokenSpaceName;
this.tokenNumber = 0;
@@ -283,12 +281,12 @@ public class Token {
public boolean addUsageInstance(UsageInstance usageInstance) throws EntityException {
String exceptionStr;
- if (isUsageInstanceExist(usageInstance.moduleId, usageInstance.arch)) {
+ if (isUsageInstanceExist(usageInstance.usageId)) {
exceptionStr = String.format("[PCD Collection Tool Exception] PCD %s for module %s has already exist in database, Please check all PCD build entries "+
"in modules %s in <ModuleSA> to make sure no duplicated definitions in FPD file!",
usageInstance.parentToken.cName,
- usageInstance.moduleId.getName(),
- usageInstance.moduleId.getName());
+ usageInstance.usageId.moduleName,
+ usageInstance.usageId.moduleName);
throw new EntityException(exceptionStr);
}
@@ -303,14 +301,12 @@ public class Token {
/**
Judge whether exist an usage instance for this token
- @param moduleId The module identification for usage instance
- @param arch the architecture string
+ @param usageId The UsageInstance identification for usage instance
@return boolean whether exist an usage instance for this token.
*/
- public boolean isUsageInstanceExist(ModuleIdentification moduleId,
- String arch) {
- String keyStr = UsageInstance.getPrimaryKey(moduleId, arch);
+ public boolean isUsageInstanceExist(UsageIdentification usageId) {
+ String keyStr = UsageInstance.getPrimaryKey(usageId);
return (consumers.get(keyStr) != null);
}
diff --git a/Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageIdentification.java b/Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageIdentification.java
new file mode 100644
index 0000000..0f52b22
--- /dev/null
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageIdentification.java
@@ -0,0 +1,97 @@
+/** @file
+ UsageIdentification class.
+
+ This class an identification for a PCD UsageInstance.
+
+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.pcd.entity;
+
+/**
+
+**/
+public class UsageIdentification {
+ ///
+ /// The module CName: one key of Identification
+ ///
+ public String moduleName;
+ ///
+ /// The module Guid String: one key of Identification
+ ///
+ public String moduleGuid;
+ ///
+ /// The package CName: one key of Identification
+ ///
+ public String packageName;
+ ///
+ /// The package Guid: one key of Identification
+ ///
+ public String packageGuid;
+ ///
+ /// Module's Arch: one key of Identification
+ ///
+ public String arch;
+ ///
+ /// Module's version: one key of Identification
+ ///
+ public String version;
+ ///
+ /// Module's type
+ ///
+ public String moduleType;
+
+ /**
+ Constructor function for UsageIdentification class.
+
+ @param moduleName The key of module's name
+ @param moduleGuid The key of module's GUID string
+ @param packageName The key of package's name
+ @param packageGuid The key of package's Guid
+ @param arch The architecture string
+ @param version The version String
+ @param moduleType The module type
+ **/
+ public UsageIdentification (String moduleName,
+ String moduleGuid,
+ String packageName,
+ String packageGuid,
+ String arch,
+ String version,
+ String moduleType) {
+ this.moduleName = moduleName;
+ this.moduleGuid = moduleGuid;
+ this.packageName = packageName;
+ this.packageGuid = packageGuid;
+ this.arch = arch;
+ this.version = version;
+ this.moduleType = moduleType;
+ }
+
+ /**
+ Generate the string for UsageIdentification
+
+ @return the string value for UsageIdentification
+ **/
+ public String toString() {
+ //
+ // Because currently transition schema not require write moduleGuid, package Name, Packge GUID in
+ // <ModuleSA> section, So currently no expect all paramter must be valid.
+ // BUGBUG: Because currently we can not get version from MSA, So ignore verison.
+ //
+ return(moduleName + "_" +
+ ((moduleGuid != null) ? moduleGuid.toLowerCase() : "NullModuleGuid") + "_" +
+ ((packageName != null) ? packageName : "NullPackageName") + "_" +
+ ((packageGuid != null) ? packageGuid.toLowerCase() : "NullPackageGuid") + "_" +
+ ((arch != null) ? arch : "NullArch") + "_" +
+ "NullVersion");
+ }
+}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java b/Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java
index 2f7d5ae..a961d88 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java
@@ -15,15 +15,15 @@ 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.pcd.entity;
+package org.tianocore.pcd.entity;
import java.util.UUID;
import org.tianocore.ModuleTypeDef;
-import org.tianocore.build.autogen.CommonDefinition;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.pcd.exception.EntityException;
+import org.tianocore.pcd.entity.CommonDefinition;
+import org.tianocore.pcd.entity.UsageIdentification;
+import org.tianocore.pcd.exception.EntityException;
/**
This class indicate an usage instance for a PCD token. This instance maybe a module
@@ -39,7 +39,7 @@ public class UsageInstance {
///
/// ModuleIdentification for Usage Instance
///
- public ModuleIdentification moduleId;
+ public UsageIdentification usageId;
///
/// Arch also is a key for a UsageInstance
@@ -84,15 +84,13 @@ public class UsageInstance {
instance.
**/
public UsageInstance(Token parentToken,
- ModuleIdentification moduleId,
+ UsageIdentification usageId,
Token.PCD_TYPE modulePcdType,
- String arch,
String value,
int maxDatumSize) {
this.parentToken = parentToken;
- this.moduleId = moduleId;
+ this.usageId = usageId;
this.modulePcdType = modulePcdType;
- this.arch = arch;
this.datum = value;
this.maxDatumSize = maxDatumSize;
}
@@ -100,30 +98,12 @@ public class UsageInstance {
/**
Get the primary key for usage instance array for every token.
- @param moduleId The module Identification for generating primary key
- @param arch Arch string
+ @param usageId The identification of UsageInstance
@retval String The primary key for this usage instance
**/
- public static String getPrimaryKey(ModuleIdentification moduleId,
- String arch) {
- String moduleName = moduleId.getName();
- String moduleGuid = moduleId.getGuid();
- String packageName = moduleId.getPackage().getName();
- String packageGuid = moduleId.getPackage().getGuid();
- String version = moduleId.getVersion();
-
- //
- // Because currently transition schema not require write moduleGuid, package Name, Packge GUID in
- // <ModuleSA> section, So currently no expect all paramter must be valid.
- // BUGBUG: Because currently we can not get version from MSA, So ignore verison.
- //
- return(moduleName + "_" +
- ((moduleGuid != null) ? moduleGuid.toLowerCase() : "NullModuleGuid") + "_" +
- ((packageName != null) ? packageName : "NullPackageName") + "_" +
- ((packageGuid != null) ? packageGuid.toLowerCase() : "NullPackageGuid") + "_" +
- ((arch != null) ? arch : "NullArch") + "_" +
- "NullVersion");
+ public static String getPrimaryKey(UsageIdentification usageId) {
+ return usageId.toString();
}
/**
@@ -132,7 +112,7 @@ public class UsageInstance {
@return String primary key string
**/
public String getPrimaryKey() {
- return UsageInstance.getPrimaryKey(moduleId, arch);
+ return UsageInstance.getPrimaryKey(usageId);
}
/**
@@ -141,7 +121,7 @@ public class UsageInstance {
@return boolean whether current module is PEI driver
**/
public boolean isPeiPhaseComponent() {
- int moduleType = CommonDefinition.getModuleType(moduleId.getModuleType());
+ int moduleType = CommonDefinition.getModuleType(usageId.moduleType);
if ((moduleType == CommonDefinition.ModuleTypePeiCore) ||
(moduleType == CommonDefinition.ModuleTypePeim)) {
@@ -156,7 +136,7 @@ public class UsageInstance {
@return boolean whether current module is DXE driver
**/
public boolean isDxePhaseComponent() {
- int moduleType = CommonDefinition.getModuleType(moduleId.getModuleType());
+ int moduleType = CommonDefinition.getModuleType(usageId.moduleType);
if ((moduleType == CommonDefinition.ModuleTypeDxeDriver) ||
(moduleType == CommonDefinition.ModuleTypeDxeRuntimeDriver) ||
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/BuildActionException.java b/Tools/Source/PcdTools/org/tianocore/pcd/exception/BuildActionException.java
index 357ebf0..9cd4e63 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/BuildActionException.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/exception/BuildActionException.java
@@ -13,7 +13,7 @@ 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.pcd.exception;
+package org.tianocore.pcd.exception;
import org.apache.tools.ant.BuildException;
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/EntityException.java b/Tools/Source/PcdTools/org/tianocore/pcd/exception/EntityException.java
index 070c2db..ca25810 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/EntityException.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/exception/EntityException.java
@@ -13,7 +13,7 @@ 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.pcd.exception;
+package org.tianocore.pcd.exception;
/**
The class handle the exception throwed by entity class.
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/UIException.java b/Tools/Source/PcdTools/org/tianocore/pcd/exception/UIException.java
index 96575a1..377a8a4 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/exception/UIException.java
+++ b/Tools/Source/PcdTools/org/tianocore/pcd/exception/UIException.java
@@ -13,7 +13,7 @@ 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.pcd.exception;
+package org.tianocore.pcd.exception;
/**
The class handle the exception throwed by UI action class.