From 12e17a0aee55f17840745b0f6c1a15cd47a4aded Mon Sep 17 00:00:00 2001 From: jlin16 Date: Thu, 13 Jul 2006 03:36:11 +0000 Subject: [PATCH] Fixes: 1.SpdHeader, FpdHeader not save specification. 2. PackageSurfaceArea.LibraryClassDeclarations Show Recommended Library Instance UiName, not the GUID. PackageSurfaceArea.MsaFiles - make table fill the window. 3. PlatformSurfaceArea.PlatformDefinitions.IntermediateDirectories Do NOT create EMPTY 4. Do NOT create EMPTY 5. When adding a module, pop up the module settings to let you know that you have added the module. 6. PlatformSurfaceArea.BuildOptions.Options.Option Do not require ToolFamily - default should be not specified. 7. PlatformSurfaceArea.BuildOptions.UserDefinedAntTasks Ant Task File should have a browse button Id column should only be width of 8 characters. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@944 6f19259b-4bc3-4df7-8a09-765794883524 --- .../packaging/ui/SpdHeader.java | 2 +- .../packaging/ui/SpdLibClassDecls.java | 46 +++++- .../platform/ui/FpdFileContents.java | 30 ++-- .../platform/ui/FpdFrameworkModules.java | 13 +- .../platform/ui/FpdHeader.java | 2 +- .../platform/ui/global/GlobalData.java | 114 --------------- .../platform/ui/global/Spd.java | 138 +----------------- 7 files changed, 72 insertions(+), 273 deletions(-) diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java index 36395bda28..7781a3d7c8 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java @@ -502,7 +502,7 @@ public class SpdHeader extends IInternalFrame { if (sfc.getSpdHdrSpec() != null) { jTextFieldSpecification.setText(sfc.getSpdHdrSpec()); } - + sfc.setSpdHdrSpec(jTextFieldSpecification.getText()); } /** diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java index 1eb8a8e166..eca4073408 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java @@ -270,7 +270,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen String lib = m.getValueAt(row, 0) + ""; String hdr = m.getValueAt(row, 1) + ""; String hlp = m.getValueAt(row, 2) + ""; - String guid = m.getValueAt(row, 3) + ""; + String name = m.getValueAt(row, 3) + ""; String ver = m.getValueAt(row, 4) + ""; String arch = null; if (m.getValueAt(row, 5) != null) { @@ -285,6 +285,10 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen return; } docConsole.setSaved(false); + + getLibInstances(lib); + String guid = nameToGuid(name); + sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module); } } @@ -389,6 +393,11 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen sfc.getSpdLibClassDeclarations(saa); int i = 0; while (i < saa.length) { + if (saa[i][3] != null && saa[i][3].length() > 0) { + getLibInstances(saa[i][0]); + saa[i][3] = guidToName(saa[i][3]); + } + model.addRow(saa[i]); i++; } @@ -528,7 +537,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen if (arg0.getSource() == jButtonAdd) { //ToDo: check before add - String[] row = {null, null, null, jTextField1.getText(), jTextField2.getText(), null, null}; + String[] row = {null, null, null, jComboBox.getSelectedItem()+"", jTextField2.getText(), null, null}; row[0] = jTextFieldAdd.getText(); row[1] = jTextField.getText().replace('\\', '/'); row[2] = jTextFieldHelp.getText(); @@ -546,7 +555,12 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen model.addRow(row); jTable.changeSelection(model.getRowCount()-1, 0, false, false); docConsole.setSaved(false); - sfc.genSpdLibClassDeclarations(row[0], row[3], row[1], row[2], row[5], null, null, row[4], null, row[6]); + // + //convert to GUID before storing recommended lib instance. + // + getLibInstances(row[0]); + String recommendGuid = nameToGuid(row[3]); + sfc.genSpdLibClassDeclarations(row[0], recommendGuid, row[1], row[2], row[5], null, null, row[4], null, row[6]); } // @@ -847,6 +861,32 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen } + private String nameToGuid(String name) { + String s = ""; + if (!libNameGuidMap.containsKey(name)) { + return s; + } + + s = libNameGuidMap.get(name); + return s; + } + + private String guidToName(String guid){ + String s = ""; + if (!libNameGuidMap.containsValue(guid)) { + return s; + } + Set key = libNameGuidMap.keySet(); + Iterator is = key.iterator(); + while(is.hasNext()) { + s = is.next(); + if (libNameGuidMap.get(s).equals(guid)) { + break; + } + } + return s; + } + } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index 0fbffe0837..1fcece4a37 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -213,26 +213,16 @@ public class FpdFileContents { while(li.hasNext()) { ModuleSADocument.ModuleSA msa = (ModuleSADocument.ModuleSA)li.next(); if (msa.getModuleGuid().equals(s[0]) && msa.getPackageGuid().equals(s[2])) { -// if (msa.getModuleVersion() != null) { -// if (!msa.getModuleVersion().equals(s[1])) { -// continue; -// } -// } -// else{ -// if (s[1] != null) { -// continue; -// } -// } -// if (msa.getPackageVersion() != null) { -// if (!msa.getPackageVersion().equals(s[3])) { -// continue; -// } -// } -// else{ -// if (s[3] != null) { -// continue; -// } -// } + if (msa.getModuleVersion() != null) { + if (!msa.getModuleVersion().equals(s[1])) { + continue; + } + } + if (msa.getPackageVersion() != null) { + if (!msa.getPackageVersion().equals(s[3])) { + continue; + } + } return msa; } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index cb2a5aa420..c2d9985c34 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -442,15 +442,24 @@ public class FpdFrameworkModules extends IInternalFrame { while(ispi.hasNext()) { PackageIdentification pi = (PackageIdentification)ispi.next(); if ( !pi.getGuid().equals(keyPart[2])){ -// || !pi.getVersion().equals(keyPart[3])){ + + continue; + } + if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){ + if(!pi.getVersion().equals(keyPart[3])){ continue; } + } Set smi = GlobalData.getModules(pi); Iterator ismi = smi.iterator(); while(ismi.hasNext()) { ModuleIdentification mi = (ModuleIdentification)ismi.next(); if (mi.getGuid().equals(keyPart[0])){ -// && mi.getVersion().equals(keyPart[1])){ + if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){ + if(!mi.getVersion().equals(keyPart[1])){ + continue; + } + } return mi; } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java index 21eb70cffb..73791fe691 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java @@ -508,7 +508,7 @@ public class FpdHeader extends IInternalFrame { if (ffc.getFpdHdrSpec() != null) { jTextFieldSpecification.setText(ffc.getFpdHdrSpec()); } - + ffc.setFpdHdrSpec(jTextFieldSpecification.getText()); } /** diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java index fe565d97ed..bdb278c570 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java @@ -406,120 +406,6 @@ public class GlobalData { } } - /** - The header file path is relative to workspace dir - **/ - public static String[] getLibraryClassHeaderFiles(PackageIdentification[] packages, String name) { - if (packages == null ){ - // throw Exception or not???? - return new String[0]; - } - String[] result = null; - for (int i = 0; i < packages.length; i++){ - Spd spd = spdTable.get(packages[i]); - // - // If find one package defined the library class - // - if( (result = spd.getLibClassIncluder(name)) != null){ - return result; - } - } - return null; - - } - - /** - The header file path is relative to workspace dir - **/ - public static String getPackageHeaderFiles(PackageIdentification packages, String moduleType) throws Exception { - if (packages == null ){ - return new String(""); - } - Spd spd = spdTable.get(packages); - // - // If can't find package header file, skip it - // - String temp = null; - if (spd != null){ - if( (temp = spd.getPackageIncluder(moduleType)) != null){ - return temp; - }else { - temp = ""; - return temp; - } - }else { - return null; - } - } - - /** - return two values: {cName, GuidValue} - **/ - public static String[] getGuid(PackageIdentification[] packages, String name) throws Exception { - if (packages == null ){ - // throw Exception or not???? - return new String[0]; - } - String[] result = null; - for (int i = 0; i < packages.length; i++){ - Spd spd = spdTable.get(packages[i]); - // - // If find one package defined the GUID - // - if( (result = spd.getGuid(name)) != null){ - return result; - } - } - return null; - } - - /** - return two values: {cName, GuidValue} - **/ - public static String[] getPpiGuid(PackageIdentification[] packages, String name) throws Exception { - if (packages == null ){ - return new String[0]; - } - String[] result = null; - for (int i = 0; i < packages.length; i++){ - Spd spd = spdTable.get(packages[i]); - // - // If find one package defined the Ppi GUID - // - if( (result = spd.getPpi(name)) != null){ - return result; - } - } - return null; - - } - - /** - return two values: {cName, GuidValue} - **/ - public static String[] getProtocolGuid(PackageIdentification[] packages, String name) throws Exception { - if (packages == null ){ - return new String[0]; - } - String[] result = null; - for (int i = 0; i < packages.length; i++){ - Spd spd = spdTable.get(packages[i]); - // - // If find one package defined the protocol GUID - // - if( (result = spd.getProtocol(name)) != null){ - return result; - } - } - return null; - - } - - /////////////////////////// Update!! Update!! Update!! -// public synchronized static MemoryDatabaseManager getPCDMemoryDBManager() { -// return pcdDbManager; -// } - /////////////////////////// public synchronized static PlatformIdentification getPlatform(String name) throws Exception { Iterator iter = platformList.iterator(); while(iter.hasNext()){ diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/Spd.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/Spd.java index 11b0e073f2..914c5bf1cd 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/Spd.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/Spd.java @@ -17,7 +17,6 @@ package org.tianocore.frameworkwizard.platform.ui.global; import java.io.File; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -35,42 +34,7 @@ public class Spd { /// /// Map msaInfo = new HashMap(); - - /// - /// Map of module info. - /// Key : moduletype - /// Value: moduletype related include file - /// - Map packageHeaderInfo = new HashMap(); - - /// - /// Map of PPI info. - /// Key : PPI name - /// value: String[] a. PPI C_NAME; b. PPI GUID; - /// - Map ppiInfo = new HashMap(); - - /// - /// Map of Protocol info. - /// Key : Protocol name - /// value: String[] a. Protocol C_NAME; b. Protocol GUID; - /// - Map protocolInfo = new HashMap(); - - /// - /// Map of Guid info. - /// Key : Guid name - /// value: String[] a. Guid C_NAME; b. Guid's GUID; - /// - Map guidInfo = new HashMap(); - - /// - /// Map of library class and its exposed header file. - /// Key : library class name - /// value : library class corresponding header file - /// - Map libClassHeaderList = new HashMap(); - + // // Xml Doc of Spd file, Msa file // @@ -112,6 +76,9 @@ public class Spd { String[] msaFilenames = SurfaceAreaQuery.getSpdMsaFile(); for (int i = 0; i < msaFilenames.length; i++){ File msaFile = new File(packageId.getPackageDir() + File.separatorChar + msaFilenames[i]); + if (!msaFile.exists()) { + continue; + } Map msaDoc = GlobalData.getNativeMsa( msaFile ); SurfaceAreaQuery.push(msaDoc); ModuleIdentification moduleId = SurfaceAreaQuery.getMsaHeader(); @@ -120,57 +87,10 @@ public class Spd { msaInfo.put(moduleId, msaFile); msaDocMap.put(moduleId, msaDoc.get("ModuleSurfaceArea")); } - // - // initialize Package header files - // -// Map packageHeaders = SurfaceAreaQuery.getSpdPackageHeaderFiles(); -// Set keys = packageHeaders.keySet(); -// Iterator iter = keys.iterator(); -// while (iter.hasNext()){ -// String moduleType = (String)iter.next(); -// String header = packageId.getPackageRelativeDir() + File.separatorChar + packageHeaders.get(moduleType); -// // -// // Change path seperator to system-dependent path separator -// // -// File file = new File (header); -// header = file.getParent(); -// packageHeaderInfo.put(moduleType, header); -// } - // - // initialize Guid Info - // - guidInfo.putAll(SurfaceAreaQuery.getSpdGuid()); - // - // initialize PPI info - // - ppiInfo.putAll(SurfaceAreaQuery.getSpdPpi()); - // - // initialize Protocol info - // - protocolInfo.putAll(SurfaceAreaQuery.getSpdProtocol()); - // - // initialize library class declaration - // - Map libraryClassHeaders = SurfaceAreaQuery.getSpdLibraryClasses(); - Set keys = libraryClassHeaders.keySet(); - Iterator iter = keys.iterator(); - while (iter.hasNext()){ - String libraryClassName = (String)iter.next(); - String[] headerFiles = libraryClassHeaders.get(libraryClassName); - for (int i = 0; i < headerFiles.length; i++){ - headerFiles[i] = packageId.getPackageRelativeDir() + File.separatorChar + headerFiles[i]; - - // - // Change path separator to system system-dependent path separator. - // - File file = new File (headerFiles[i]); - headerFiles[i] = file.getPath(); - } - libClassHeaderList.put(libraryClassName, headerFiles); - } + } catch (Exception e) { - e.setStackTrace(e.getStackTrace()); + throw new Exception("Parse package description file [" + packageId.getSpdFile() + "] Error.\n" + e.getMessage()); } @@ -187,51 +107,5 @@ public class Spd { public Set getModules(){ return msaInfo.keySet(); } - - /** - return two value {CName, Guid}. If not found, return null. - **/ - public String[] getPpi(String ppiName) { - return ppiInfo.get(ppiName); - } - - /** - return two value {CName, Guid}. If not found, return null. - **/ - public String[] getProtocol(String protocolName) { - return protocolInfo.get(protocolName); - } - - /** - return two value {CName, Guid}. If not found, return null. - **/ - public String[] getGuid(String guidName) { - return guidInfo.get(guidName); - } - - /** - getLibClassInclude - - This function is to get the library exposed header file name according - library class name. - - @param libName Name of library class - @return Name of header file - **/ - String[] getLibClassIncluder(String libName) { - return libClassHeaderList.get(libName); - } - - /** - getModuleTypeIncluder - This function is to get the header file name from module info map - according to module type. - - @param moduleType Module type. - @return Name of header file. - **/ - String getPackageIncluder(String moduleType) { - return packageHeaderInfo.get(moduleType); - } } -- 2.39.2