From 548ce97a813956f85c379aae88599e4c19ef1bb9 Mon Sep 17 00:00:00 2001 From: klu2 Date: Sat, 1 Jul 2006 10:39:42 +0000 Subject: [PATCH] After change token space guid from guid value to Guid's CName, change code to support that. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@707 6f19259b-4bc3-4df7-8a09-765794883524 --- .../tianocore/build/global/GlobalData.java | 11 +++-- .../build/pcd/action/CollectPCDAction.java | 48 +++++++++++++++---- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java index e843362c29..195f2e93aa 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java @@ -768,13 +768,18 @@ public class GlobalData { String guid = null; Set set = spdTable.keySet(); Iterator iter = set.iterator(); - + + if (iter == null) { + return null; + } + while (iter.hasNext()){ Spd spd = (Spd) spdTable.get(iter.next()); guid = spd.getGuidFromCname(cName); if (guid != null){ - cNameGuid[0] = new String(cName); - cNameGuid[1] = new String(guid); + cNameGuid = new String[2]; + cNameGuid[0] = cName; + cNameGuid[1] = guid; break; } } 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 37f74713d6..63d494f0cf 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java +++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java @@ -2077,12 +2077,12 @@ public class CollectPCDAction { boolean isDuplicate = false; Token.PCD_TYPE pcdType = Token.PCD_TYPE.UNKNOWN; Token.DATUM_TYPE datumType = Token.DATUM_TYPE.UNKNOWN; - long tokenNumber = 0; + long tokenNumber = 0; String moduleName = null; String datum = null; int maxDatumSize = 0; - String tokenSpaceGuidString = null; - + String[] tokenSpaceStrRet = null; + // // ---------------------------------------------- // 1), Get all from FPD file. @@ -2145,11 +2145,20 @@ public class CollectPCDAction { // ---------------------------------------------------------------------- // for (pcdIndex = 0; pcdIndex < pcdBuildDataArray.size(); pcdIndex ++) { - //tokenSpaceGuidString = GlobalData.getGuidInfoFromCname(pcdBuildData.getTokenSpaceGuidCName())[1]; - tokenSpaceGuidString = null; pcdBuildData = pcdBuildDataArray.get(pcdIndex); + + try { + tokenSpaceStrRet = GlobalData.getGuidInfoFromCname(pcdBuildData.getTokenSpaceGuidCName()); + } catch ( Exception e ) { + throw new EntityException ("Faile get Guid for token " + pcdBuildData.getCName() + ":" + e.getMessage()); + } + + if (tokenSpaceStrRet == null) { + throw new EntityException ("Fail to get Token space guid for token" + pcdBuildData.getCName()); + } + primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(), - translateSchemaStringToUUID(tokenSpaceGuidString)); + translateSchemaStringToUUID(tokenSpaceStrRet[1])); pcdType = Token.getpcdTypeFromString(pcdBuildData.getItemType().toString()); datumType = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString()); tokenNumber = Long.decode(pcdBuildData.getToken().toString()); @@ -2278,10 +2287,18 @@ public class CollectPCDAction { // If the token is not in database, create a new token instance and add // a usage instance into this token in database. // - //String tokenSpaceString = GlobalData.getGuidInfoFromCname(pcdBuildData.getTokenSpaceGuidCName())[1]; - String tokenSpaceString = null; + try { + tokenSpaceStrRet = GlobalData.getGuidInfoFromCname(pcdBuildData.getTokenSpaceGuidCName()); + } catch (Exception e) { + throw new EntityException("Fail to get token space guid for token " + token.cName); + } + + if (tokenSpaceStrRet == null) { + throw new EntityException("Fail to get token space guid for token " + token.cName); + } + token = new Token(pcdBuildData.getCName(), - translateSchemaStringToUUID(tokenSpaceString)); + translateSchemaStringToUUID(tokenSpaceStrRet[1])); token.datumType = datumType; token.tokenNumber = tokenNumber; @@ -2674,6 +2691,7 @@ public class CollectPCDAction { String dynamicPrimaryKey = null; DynamicPcdBuildDefinitions dynamicPcdBuildDefinitions = null; List dynamicPcdBuildDataArray = null; + String[] tokenSpaceStrRet = null; // // If FPD document is not be opened, open and initialize it. @@ -2701,8 +2719,18 @@ public class CollectPCDAction { for (index = 0; index < dynamicPcdBuildDataArray.size(); index ++) { //String tokenSpaceGuidString = GlobalData.getGuidInfoFromCname(dynamicPcdBuildDataArray.get(index).getTokenSpaceGuidCName())[1]; String tokenSpaceGuidString = null; + try { + tokenSpaceStrRet = GlobalData.getGuidInfoFromCname(dynamicPcdBuildDataArray.get(index).getTokenSpaceGuidCName()); + } catch (Exception e) { + throw new EntityException ("Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName()); + } + + if (tokenSpaceStrRet == null) { + throw new EntityException ("Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName()); + } + dynamicPrimaryKey = Token.getPrimaryKeyString(dynamicPcdBuildDataArray.get(index).getCName(), - translateSchemaStringToUUID(tokenSpaceGuidString)); + translateSchemaStringToUUID(tokenSpaceStrRet[1])); if (dynamicPrimaryKey.equalsIgnoreCase(token.getPrimaryKeyString())) { return dynamicPcdBuildDataArray.get(index); }