To locate module precisely in stand-alone module build. Except Module Guid, add MSA file path to consider.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1521 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
wuyizhong 2006-09-13 03:25:23 +00:00
parent 905dd497d2
commit 89e1408fde
5 changed files with 30 additions and 10 deletions

View File

@ -130,6 +130,7 @@ public class GenBuildTask extends Ant {
From module build, exception from module surface area invalid. From module build, exception from module surface area invalid.
**/ **/
public void execute() throws BuildException { public void execute() throws BuildException {
this.setTaskName("GenBuild");
try { try {
processGenBuild(); processGenBuild();
} catch (PcdAutogenException e) { } catch (PcdAutogenException e) {
@ -200,6 +201,7 @@ public class GenBuildTask extends Ant {
Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile); Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile);
saq = new SurfaceAreaQuery(doc); saq = new SurfaceAreaQuery(doc);
moduleId = saq.getMsaHeader(); moduleId = saq.getMsaHeader();
moduleId.setMsaFile(msaFile);
} }
String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED",null); String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED",null);
@ -346,7 +348,6 @@ public class GenBuildTask extends Ant {
private void prepareSingleModuleBuild() throws EdkException { private void prepareSingleModuleBuild() throws EdkException {
// //
// Find out the package which the module belongs to // Find out the package which the module belongs to
// TBD: Enhance it!!!!
// //
PackageIdentification packageId = GlobalData.getPackageForModule(moduleId); PackageIdentification packageId = GlobalData.getPackageForModule(moduleId);
GlobalData.refreshPackageIdentification(packageId); GlobalData.refreshPackageIdentification(packageId);

View File

@ -18,6 +18,7 @@ package org.tianocore.build.fpd;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -30,6 +31,7 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Ant; import org.apache.tools.ant.taskdefs.Ant;
import org.apache.tools.ant.taskdefs.Property; import org.apache.tools.ant.taskdefs.Property;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlObject;
import org.tianocore.common.definitions.EdkDefinitions; import org.tianocore.common.definitions.EdkDefinitions;
@ -277,8 +279,10 @@ public class FpdParserTask extends Task {
bw.flush(); bw.flush();
bw.close(); bw.close();
fw.close(); fw.close();
} catch (Exception e) { } catch (IOException ex) {
throw new BuildException("Generation of the FV file [" + fvFile.getPath() + "] failed!\n" + e.getMessage()); BuildException buildException = new BuildException("Generation of the FV file [" + fvFile.getPath() + "] failed!\n" + ex.getMessage());
buildException.setStackTrace(ex.getStackTrace());
throw buildException;
} }
} }
} }
@ -289,7 +293,7 @@ public class FpdParserTask extends Task {
@throws BuildException @throws BuildException
FPD file is not valid. FPD file is not valid.
**/ **/
public void parseFpdFile(File fpdFile) throws BuildException { public void parseFpdFile(File fpdFile) throws BuildException, EdkException {
this.fpdFile = fpdFile; this.fpdFile = fpdFile;
parseFpdFile(); parseFpdFile();
} }
@ -362,8 +366,18 @@ public class FpdParserTask extends Task {
// //
PlatformPcdPreprocessActionForBuilding ca = new PlatformPcdPreprocessActionForBuilding(); PlatformPcdPreprocessActionForBuilding ca = new PlatformPcdPreprocessActionForBuilding();
ca.perform(platformId.getFpdFile().getPath(), ActionMessage.NULL_MESSAGE_LEVEL); ca.perform(platformId.getFpdFile().getPath(), ActionMessage.NULL_MESSAGE_LEVEL);
} catch (Exception e) { } catch (IOException ex) {
throw new BuildException("Parsing of the FPD file [" + fpdFile.getPath() + "] failed!\n" + e.getMessage()); BuildException buildException = new BuildException("Parsing of the FPD file [" + fpdFile.getPath() + "] failed!\n" + ex.getMessage());
buildException.setStackTrace(ex.getStackTrace());
throw buildException;
} catch (XmlException ex) {
BuildException buildException = new BuildException("Parsing of the FPD file [" + fpdFile.getPath() + "] failed!\n" + ex.getMessage());
buildException.setStackTrace(ex.getStackTrace());
throw buildException;
} catch (EdkException ex) {
BuildException buildException = new BuildException("Parsing of the FPD file [" + fpdFile.getPath() + "] failed!\n" + ex.getMessage());
buildException.setStackTrace(ex.getStackTrace());
throw buildException;
} }
} }

View File

@ -271,5 +271,4 @@ public class GenBuildLogger extends DefaultLogger implements LogMethod {
public void setId(FpdModuleIdentification id) { public void setId(FpdModuleIdentification id) {
this.id = id; this.id = id;
} }
} }

View File

@ -299,9 +299,13 @@ public class GlobalData {
packageId = (PackageIdentification)iter.next(); packageId = (PackageIdentification)iter.next();
moduleId.setPackage(packageId); moduleId.setPackage(packageId);
Spd spd = spdTable.get(packageId); Spd spd = spdTable.get(packageId);
if (spd.getModuleFile(moduleId) != null ) { File tempMsaFile = null;
if ((tempMsaFile = spd.getModuleFile(moduleId)) != null ) {
if (tempMsaFile.getParent().equalsIgnoreCase(moduleId.getMsaFile().getParent())) {
break ; break ;
} }
tempMsaFile = null;
}
} }
if (packageId == null){ if (packageId == null){
throw new EdkException("Can't find Module [" + moduleId.getName() + "] in any SPD package!"); throw new EdkException("Can't find Module [" + moduleId.getName() + "] in any SPD package!");

View File

@ -1360,10 +1360,12 @@ public class SurfaceAreaQuery {
// //
PackageIdentification pkgId = new PackageIdentification(null, pkgGuid, pkgVersion); PackageIdentification pkgId = new PackageIdentification(null, pkgGuid, pkgVersion);
GlobalData.refreshPackageIdentification(pkgId); GlobalData.refreshPackageIdentification(pkgId);
ModuleIdentification saId = new ModuleIdentification(null, saGuid, saVersion); ModuleIdentification saId = new ModuleIdentification(null, saGuid, saVersion);
saId.setPackage(pkgId);
GlobalData.refreshModuleIdentification(saId); GlobalData.refreshModuleIdentification(saId);
saId.setPackage(pkgId);
// //
// Create FpdModule Identification which have class member of module // Create FpdModule Identification which have class member of module