From 2c9b03f219d7ebececf0a8e86019fe622ac0cc42 Mon Sep 17 00:00:00 2001 From: jwang36 Date: Mon, 29 Jan 2007 04:41:58 +0000 Subject: [PATCH] - Move global declarations from AutoGen.c to AutoGen.h - Stop building AutoGen.c for binary module git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2331 6f19259b-4bc3-4df7-8a09-765794883524 --- .../org/tianocore/build/GenBuildTask.java | 1 + .../build/ModuleBuildFileGenerator.java | 2 +- .../org/tianocore/build/autogen/AutoGen.java | 26 ++++++++++--------- .../build/global/SurfaceAreaQuery.java | 23 ++++++++++++++-- .../build/id/ModuleIdentification.java | 16 ++++++++++++ 5 files changed, 53 insertions(+), 15 deletions(-) diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java index 5aa717fbdd..a849530109 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java @@ -207,6 +207,7 @@ public class GenBuildTask extends Ant { } else { moduleId.setLibrary(true); } + moduleId.setBinary(saq.getBinaryModule()); // // Judge whether it is single module build or not diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java b/Tools/Java/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java index 9c65d673d9..4f038ae25b 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java @@ -424,7 +424,7 @@ public class ModuleBuildFileGenerator { // Parse AutoGen.c & AutoGen.h // if (!fpdModuleId.getModule().isLibrary() - && !fpdModuleId.getModule().getName().equalsIgnoreCase("Shell")) { + && !fpdModuleId.getModule().isBinary()) { fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", null, root, false); } diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java index 98737ba2bf..2d9178cfdf 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java @@ -120,6 +120,7 @@ public class AutoGen { private List exitBootServiceList = new ArrayList(); private StringBuffer functionDeclarations = new StringBuffer(10240); + private StringBuffer globalDeclarations = new StringBuffer(10240); // // flag of PcdComponentNameDisable, PcdDriverDiagnosticDisable @@ -384,6 +385,7 @@ public class AutoGen { fileBuffer.append(this.myPcdAutogen.getHAutoGenString()); } + fileBuffer.append(globalDeclarations); fileBuffer.append(functionDeclarations); // // Append the #endif at AutoGen.h @@ -1798,9 +1800,9 @@ public class AutoGen { // for (int i = 0; i < driverBindingGroup.length; i++) { if (driverBindingGroup[i][0] != null) { - fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL "); - fileBuffer.append(driverBindingGroup[i][0]); - fileBuffer.append(";\r\n"); + globalDeclarations.append("extern EFI_DRIVER_BINDING_PROTOCOL "); + globalDeclarations.append(driverBindingGroup[i][0]); + globalDeclarations.append(";\r\n"); } } @@ -1812,9 +1814,9 @@ public class AutoGen { if (driverBindingGroup[i][1]!= null) { if (driverBindingGroup[i][0] != null) { BitMask |= 0x01; - fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL "); - fileBuffer.append(driverBindingGroup[i][1]); - fileBuffer.append(";\r\n"); + globalDeclarations.append("extern EFI_COMPONENT_NAME_PROTOCOL "); + globalDeclarations.append(driverBindingGroup[i][1]); + globalDeclarations.append(";\r\n"); } else { throw new AutoGenException("DriverBinding can't be empty!!"); } @@ -1829,9 +1831,9 @@ public class AutoGen { if (driverBindingGroup[i][2] != null) { if (driverBindingGroup[i][0] != null) { BitMask |= 0x02; - fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL "); - fileBuffer.append(driverBindingGroup[i][2]); - fileBuffer.append(";\r\n"); + globalDeclarations.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL "); + globalDeclarations.append(driverBindingGroup[i][2]); + globalDeclarations.append(";\r\n"); } else { throw new AutoGenException("DriverBinding can't be empty!!"); } @@ -1846,9 +1848,9 @@ public class AutoGen { if (driverBindingGroup[i][3] != null) { if (driverBindingGroup[i][0] != null) { BitMask |= 0x04; - fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL "); - fileBuffer.append(driverBindingGroup[i][3]); - fileBuffer.append(";\r\n"); + globalDeclarations.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL "); + globalDeclarations.append(driverBindingGroup[i][3]); + globalDeclarations.append(";\r\n"); } else { throw new AutoGenException("DriverBinding can't be empty!!"); } diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java index b95c389592..933b5d4e0d 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java @@ -23,11 +23,12 @@ import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.tianocore.ExternsDocument.Externs.Extern; import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlString; import org.tianocore.*; +import org.tianocore.ExternsDocument.Externs.Extern; import org.tianocore.FilenameDocument.Filename; +import org.tianocore.ModuleDefinitionsDocument.ModuleDefinitions; import org.tianocore.MsaHeaderDocument.MsaHeader; import org.tianocore.ProtocolsDocument.Protocols.Protocol; import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify; @@ -37,8 +38,8 @@ import org.tianocore.build.id.ModuleIdentification; import org.tianocore.build.id.PackageIdentification; import org.tianocore.build.id.PlatformIdentification; import org.tianocore.build.toolchain.ToolChainInfo; -import org.tianocore.common.exception.EdkException; import org.tianocore.common.definitions.EdkDefinitions; +import org.tianocore.common.exception.EdkException; import org.w3c.dom.Node; /** @@ -543,6 +544,24 @@ public class SurfaceAreaQuery { return null; } + /** + * Retrieve / + * + * @returns The module type name if elements are found at the known xpath + * @returns null if nothing is there + */ + public boolean getBinaryModule() { + String[] xPath = new String[] { "/" }; + + Object[] returns = get("ModuleDefinitions", xPath); + if (returns != null && returns.length > 0) { + ModuleDefinitionsDocument.ModuleDefinitions def = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0]; + return def.getBinaryModule(); + } + + return false; + } + /** * Retrieve PackageDependencies/Package * diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/id/ModuleIdentification.java b/Tools/Java/Source/GenBuild/org/tianocore/build/id/ModuleIdentification.java index dc5f87bab4..7082184dfd 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/id/ModuleIdentification.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/id/ModuleIdentification.java @@ -31,6 +31,8 @@ public class ModuleIdentification extends Identification { private boolean isLibrary = false; + private boolean isBinary = false; + private String constructor = ""; private String destructor = ""; @@ -87,6 +89,20 @@ public class ModuleIdentification extends Identification { this.isLibrary = isLibrary; } + /** + @return boolean is this module is binary + **/ + public boolean isBinary() { + return isBinary; + } + + /** + @param isBinary + **/ + public void setBinary(boolean isBinary) { + this.isBinary = isBinary; + } + /** @return MSA File **/