X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FJava%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2Fglobal%2FSpd.java;fp=Tools%2FJava%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2Fglobal%2FSpd.java;h=0000000000000000000000000000000000000000;hp=951817f64c9aa373da383fc1db0911044e21f244;hb=808def96aa4589fba9c2d0ea55837754a3b7a4f7;hpb=9216450d1143056a50a5f916984a2d7faf590488 diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/Spd.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/Spd.java deleted file mode 100644 index 951817f64c..0000000000 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/Spd.java +++ /dev/null @@ -1,273 +0,0 @@ -/** @file - Spd class. - - This class is to generate a global table for the content of spd file. - - 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.global; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.apache.xmlbeans.XmlException; -import org.apache.xmlbeans.XmlObject; -import org.tianocore.build.id.ModuleIdentification; -import org.tianocore.build.id.PackageIdentification; -import org.tianocore.common.exception.EdkException; - -/** - - This class is to generate a global table for the content of spd file. - -**/ -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 Guid info - /// Key: GuidCName - /// value: String Guid's GUID - /// - Map guidCnameInfo = 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(); - - /// - /// Package path. - /// - PackageIdentification packageId; - - /** - Constructor function - - This function mainly initialize some member variables. - **/ - Spd(File packageFile) throws EdkException { - // - // If specified package file not exists - // - if ( ! packageFile.exists()) { - throw new EdkException("Package file [" + packageFile.getPath() + "] does not exist!"); - } - try { - XmlObject spdDoc = GlobalData.parseXmlFile(packageFile); - // - // We can change Map to XmlObject - // - Map spdDocMap = new HashMap(); - spdDocMap.put("PackageSurfaceArea", spdDoc); - SurfaceAreaQuery saq = new SurfaceAreaQuery(spdDocMap); - - packageId = saq.getSpdHeader(); - packageId.setSpdFile(packageFile); - - // - // initialize Msa Files - // MSA file is absolute file path - // - String[] msaFilenames = saq.getSpdMsaFile(); - for (int i = 0; i < msaFilenames.length; i++){ - File msaFile = new File(packageId.getPackageDir() + File.separatorChar + msaFilenames[i]); - Map msaDoc = GlobalData.getNativeMsa( msaFile ); - saq.push(msaDoc); - ModuleIdentification moduleId = saq.getMsaHeader(); - saq.pop(); - moduleId.setPackage(packageId); - moduleId.setMsaFile(msaFile); - if (msaInfo.containsKey(moduleId)) { - throw new EdkException("Found two modules with the same GUID and Version in package " + packageId + ".\nThey are module [" + msaInfo.get(moduleId) + "] and MSA file [" + msaFile + "]!"); - } - msaInfo.put(moduleId, msaFile); - } - - // - // initialize Package header files - // - Map packageHeaders = saq.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.getPath(); - packageHeaderInfo.put(moduleType, header); - } - - // - // initialize Guid Info - // - guidInfo.putAll(saq.getSpdGuid()); - - // - // For Pcd get TokenSpaceGuid - // - Set key = guidInfo.keySet(); - Iterator item = key.iterator(); - String [] nameValue = new String[2]; - while(item.hasNext()){ - nameValue = guidInfo.get(item.next()); - guidCnameInfo.put(nameValue[0], nameValue[1]); - } - - // - // initialize PPI info - // - ppiInfo.putAll(saq.getSpdPpi()); - - // - // initialize Protocol info - // - protocolInfo.putAll(saq.getSpdProtocol()); - - // - // initialize library class declaration - // - Map libraryClassHeaders = saq.getSpdLibraryClasses(); - keys = libraryClassHeaders.keySet(); - 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 (IOException ex) { - EdkException edkException = new EdkException("Parse of the package description file [" + packageFile.getPath() + "] failed!\n" + ex.getMessage()); - edkException.setStackTrace(ex.getStackTrace()); - throw edkException; - } catch (XmlException ex) { - EdkException edkException = new EdkException("Parse of the package description file [" + packageFile.getPath() + "] failed!\n" + ex.getMessage()); - edkException.setStackTrace(ex.getStackTrace()); - throw edkException; - } - } - - public PackageIdentification getPackageId() { - return packageId; - } - - public File getModuleFile(ModuleIdentification moduleId) { - return msaInfo.get(moduleId); - } - - 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); - } - - /** - * return Guid Value. - */ - public String getGuidFromCname(String cName){ - return guidCnameInfo.get(cName); - } - - /** - 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); - } - - -}