mirror of https://github.com/acidanthera/audk.git
Introduce a new property INCLUDE_PATHS. This property can used by customized build file. For example <includepath path="${INCLUDE_PATHS}"/>. INCLUDE_PATHS contains all required include paths based on MSA file.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1347 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
778d35c92a
commit
bf3a7173e3
|
@ -76,58 +76,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
<target name="sourcefiles">
|
||||
<Build_AUTOGEN FILEEXT="c" FILENAME="AutoGen" FILEPATH=".">
|
||||
<EXTRA.INC>
|
||||
<includepath path="${WORKSPACE_DIR}"/>
|
||||
<includepath path="${MODULE_DIR}"/>
|
||||
<includepath path="${MODULE_DIR}\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\MdePkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\MdePkg\Include\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkModulePkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkModulePkg\Include\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkNt32Pkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkNt32Pkg\Include\${ARCH}"/>
|
||||
<includepath path="${DEST_DIR_DEBUG}"/>
|
||||
<includepath path="${INCLUDE_PATHS}"/>
|
||||
</EXTRA.INC>
|
||||
</Build_AUTOGEN>
|
||||
<Build_CCode FILEEXT="c" FILENAME="FwVol" FILEPATH=".">
|
||||
<EXTRA.INC>
|
||||
<includepath path="${WORKSPACE_DIR}"/>
|
||||
<includepath path="${MODULE_DIR}"/>
|
||||
<includepath path="${MODULE_DIR}\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\MdePkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\MdePkg\Include\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkModulePkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkModulePkg\Include\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkNt32Pkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkNt32Pkg\Include\${ARCH}"/>
|
||||
<includepath path="${DEST_DIR_DEBUG}"/>
|
||||
<includepath path="${INCLUDE_PATHS}"/>
|
||||
</EXTRA.INC>
|
||||
</Build_CCode>
|
||||
<Build_CCode FILEEXT="c" FILENAME="WinNtThunk" FILEPATH=".">
|
||||
<EXTRA.INC>
|
||||
<includepath path="${WORKSPACE_DIR}"/>
|
||||
<includepath path="${MODULE_DIR}"/>
|
||||
<includepath path="${MODULE_DIR}\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\MdePkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\MdePkg\Include\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkModulePkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkModulePkg\Include\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkNt32Pkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkNt32Pkg\Include\${ARCH}"/>
|
||||
<includepath path="${DEST_DIR_DEBUG}"/>
|
||||
<includepath path="${INCLUDE_PATHS}"/>
|
||||
</EXTRA.INC>
|
||||
</Build_CCode>
|
||||
<Build_CCode FILEEXT="c" FILENAME="SecMain" FILEPATH=".">
|
||||
<EXTRA.INC>
|
||||
<includepath path="${WORKSPACE_DIR}"/>
|
||||
<includepath path="${MODULE_DIR}"/>
|
||||
<includepath path="${MODULE_DIR}\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\MdePkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\MdePkg\Include\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkModulePkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkModulePkg\Include\${ARCH}"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkNt32Pkg\Include"/>
|
||||
<includepath path="${WORKSPACE_DIR}\EdkNt32Pkg\Include\${ARCH}"/>
|
||||
<includepath path="${DEST_DIR_DEBUG}"/>
|
||||
<includepath path="${INCLUDE_PATHS}"/>
|
||||
</EXTRA.INC>
|
||||
</Build_CCode>
|
||||
</target>
|
||||
|
|
|
@ -14,7 +14,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
package org.tianocore.build;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
@ -84,7 +83,7 @@ public class FileProcess {
|
|||
///
|
||||
/// Current module's include pathes
|
||||
///
|
||||
private Set<String> includes;
|
||||
private String[] includes;
|
||||
|
||||
///
|
||||
/// Xml Document.
|
||||
|
@ -109,7 +108,7 @@ public class FileProcess {
|
|||
@param sourceFiles Modules source files
|
||||
@param document XML document
|
||||
**/
|
||||
public void init(Project project, Set<String> includes, Document document) {
|
||||
public void init(Project project, String[] includes, Document document) {
|
||||
this.document = document;
|
||||
this.includes = includes;
|
||||
this.project = project;
|
||||
|
@ -252,11 +251,10 @@ public class FileProcess {
|
|||
ele.setAttribute("FILEPATH", sourceFilepath);
|
||||
ele.setAttribute("FILENAME", sourceFilename);
|
||||
ele.setAttribute("FILEEXT", sourceFileext.substring(1));
|
||||
String[] includePaths = includes.toArray(new String[includes.size()]);
|
||||
Element includesEle = document.createElement("EXTRA.INC");
|
||||
for (int i = 0; i < includePaths.length; i++) {
|
||||
for (int i = 0; i < includes.length; i++) {
|
||||
Element includeEle = document.createElement("includepath");
|
||||
includeEle.setAttribute("path", project.replaceProperties(includePaths[i]));
|
||||
includeEle.setAttribute("path", project.replaceProperties(includes[i]));
|
||||
includesEle.appendChild(includeEle);
|
||||
}
|
||||
ele.appendChild(includesEle);
|
||||
|
|
|
@ -16,13 +16,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
package org.tianocore.build;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.Vector;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -109,8 +107,6 @@ public class GenBuildTask extends Ant {
|
|||
|
||||
private Vector<Property> properties = new Vector<Property>();
|
||||
|
||||
private static Stack<Hashtable> backupPropertiesStack = new Stack<Hashtable>();
|
||||
|
||||
private boolean isSingleModuleBuild = false;
|
||||
|
||||
/**
|
||||
|
@ -569,6 +565,11 @@ public class GenBuildTask extends Ant {
|
|||
}
|
||||
PropertyManager.setProperty("LIBS", propertyLibs.replaceAll("(\\\\)", "/"));
|
||||
|
||||
//
|
||||
// Get all includepath and set to INCLUDE_PATHS
|
||||
//
|
||||
String[] includes = prepareIncludePaths(fpdModuleId);
|
||||
|
||||
//
|
||||
// if it is CUSTOM_BUILD
|
||||
// then call the exist BaseName_build.xml directly.
|
||||
|
@ -587,7 +588,7 @@ public class GenBuildTask extends Ant {
|
|||
// TBD
|
||||
//
|
||||
String ffsKeyword = SurfaceAreaQuery.getModuleFfsKeyword();
|
||||
ModuleBuildFileGenerator fileGenerator = new ModuleBuildFileGenerator(getProject(), ffsKeyword, fpdModuleId);
|
||||
ModuleBuildFileGenerator fileGenerator = new ModuleBuildFileGenerator(getProject(), ffsKeyword, fpdModuleId, includes);
|
||||
String buildFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
|
||||
fileGenerator.genBuildFile(buildFilename);
|
||||
|
||||
|
@ -697,4 +698,89 @@ public class GenBuildTask extends Ant {
|
|||
public void setSingleModuleBuild(boolean isSingleModuleBuild) {
|
||||
this.isSingleModuleBuild = isSingleModuleBuild;
|
||||
}
|
||||
|
||||
private String[] prepareIncludePaths(FpdModuleIdentification fpdModuleId) {
|
||||
//
|
||||
// Prepare the includes: PackageDependencies and Output debug direactory
|
||||
//
|
||||
Set<String> includes = new LinkedHashSet<String>();
|
||||
String arch = fpdModuleId.getArch();
|
||||
|
||||
//
|
||||
// WORKSPACE
|
||||
//
|
||||
includes.add("${WORKSPACE_DIR}" + File.separatorChar);
|
||||
|
||||
//
|
||||
// Module iteself
|
||||
//
|
||||
includes.add("${MODULE_DIR}");
|
||||
includes.add("${MODULE_DIR}" + File.separatorChar + archDir(arch));
|
||||
|
||||
//
|
||||
// Packages in PackageDenpendencies
|
||||
//
|
||||
PackageIdentification[] packageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch());
|
||||
for (int i = 0; i < packageDependencies.length; i++) {
|
||||
GlobalData.refreshPackageIdentification(packageDependencies[i]);
|
||||
File packageFile = packageDependencies[i].getSpdFile();
|
||||
includes.add(packageFile.getParent() + File.separatorChar + "Include");
|
||||
includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));
|
||||
}
|
||||
|
||||
//
|
||||
// All Dependency Library Instance's PackageDependencies
|
||||
//
|
||||
ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());
|
||||
for (int i = 0; i < libinstances.length; i++) {
|
||||
SurfaceAreaQuery.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch()));
|
||||
PackageIdentification[] libraryPackageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch());
|
||||
for (int j = 0; j < libraryPackageDependencies.length; j++) {
|
||||
GlobalData.refreshPackageIdentification(libraryPackageDependencies[j]);
|
||||
File packageFile = libraryPackageDependencies[j].getSpdFile();
|
||||
includes.add(packageFile.getParent() + File.separatorChar + "Include");
|
||||
includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));
|
||||
}
|
||||
SurfaceAreaQuery.pop();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// The package which the module belongs to
|
||||
// TBD
|
||||
includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include");
|
||||
includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));
|
||||
|
||||
//
|
||||
// Debug files output directory
|
||||
//
|
||||
includes.add("${DEST_DIR_DEBUG}");
|
||||
|
||||
//
|
||||
// set to INCLUDE_PATHS property
|
||||
//
|
||||
Iterator<String> iter = includes.iterator();
|
||||
StringBuffer includePaths = new StringBuffer();
|
||||
while (iter.hasNext()) {
|
||||
includePaths.append(iter.next());
|
||||
includePaths.append("; ");
|
||||
}
|
||||
PropertyManager.setProperty("INCLUDE_PATHS", getProject().replaceProperties(includePaths.toString()).replaceAll("(\\\\)", "/"));
|
||||
|
||||
return includes.toArray(new String[includes.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
Return the name of the directory that corresponds to the architecture.
|
||||
This is a translation from the XML Schema tag to a directory that
|
||||
corresponds to our directory name coding convention.
|
||||
|
||||
**/
|
||||
private String archDir(String arch) {
|
||||
return arch.replaceFirst("X64", "x64")
|
||||
.replaceFirst("IPF", "Ipf")
|
||||
.replaceFirst("IA32", "Ia32")
|
||||
.replaceFirst("ARM", "Arm")
|
||||
.replaceFirst("EBC", "Ebc");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,7 @@ package org.tianocore.build;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
|
@ -32,7 +30,6 @@ import javax.xml.transform.stream.StreamResult;
|
|||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.tianocore.build.fpd.FpdParserTask;
|
||||
import org.tianocore.build.global.GlobalData;
|
||||
import org.tianocore.build.global.SurfaceAreaQuery;
|
||||
import org.tianocore.build.global.PropertyManager;
|
||||
import org.tianocore.build.id.FpdModuleIdentification;
|
||||
|
@ -66,10 +63,13 @@ public class ModuleBuildFileGenerator {
|
|||
|
||||
private String ffsKeyword;
|
||||
|
||||
public ModuleBuildFileGenerator(Project project, String ffsKeyword, FpdModuleIdentification fpdModuleId) {
|
||||
private String[] includes;
|
||||
|
||||
public ModuleBuildFileGenerator(Project project, String ffsKeyword, FpdModuleIdentification fpdModuleId, String[] includes) {
|
||||
this.project = project;
|
||||
this.fpdModuleId = fpdModuleId;
|
||||
this.ffsKeyword = ffsKeyword;
|
||||
this.includes = includes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -330,20 +330,6 @@ public class ModuleBuildFileGenerator {
|
|||
root.appendChild(ele);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Return the name of the directory that corresponds to the architecture.
|
||||
This is a translation from the XML Schema tag to a directory that
|
||||
corresponds to our directory name coding convention.
|
||||
|
||||
**/
|
||||
private String archDir(String arch) {
|
||||
return arch.replaceFirst("X64", "x64")
|
||||
.replaceFirst("IPF", "Ipf")
|
||||
.replaceFirst("IA32", "Ia32")
|
||||
.replaceFirst("ARM", "Arm")
|
||||
.replaceFirst("EBC", "Ebc");
|
||||
}
|
||||
|
||||
/**
|
||||
Generate the build source files elements for BaseName_build.xml.
|
||||
|
@ -352,62 +338,6 @@ public class ModuleBuildFileGenerator {
|
|||
@param root Root element for current
|
||||
**/
|
||||
private void applyCompileElement(Document document, Node root) {
|
||||
//
|
||||
// Prepare the includes: PackageDependencies and Output debug direactory
|
||||
//
|
||||
Set<String> includes = new LinkedHashSet<String>();
|
||||
String arch = project.getProperty("ARCH");
|
||||
|
||||
//
|
||||
// WORKSPACE
|
||||
//
|
||||
includes.add("${WORKSPACE_DIR}" + File.separatorChar);
|
||||
|
||||
//
|
||||
// Module iteself
|
||||
//
|
||||
includes.add("${MODULE_DIR}");
|
||||
includes.add("${MODULE_DIR}" + File.separatorChar + archDir(arch));
|
||||
|
||||
//
|
||||
// Packages in PackageDenpendencies
|
||||
//
|
||||
PackageIdentification[] packageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch());
|
||||
for (int i = 0; i < packageDependencies.length; i++) {
|
||||
GlobalData.refreshPackageIdentification(packageDependencies[i]);
|
||||
File packageFile = packageDependencies[i].getSpdFile();
|
||||
includes.add(packageFile.getParent() + File.separatorChar + "Include");
|
||||
includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));
|
||||
}
|
||||
|
||||
//
|
||||
// All Dependency Library Instance's PackageDependencies
|
||||
//
|
||||
ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());
|
||||
for (int i = 0; i < libinstances.length; i++) {
|
||||
SurfaceAreaQuery.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch()));
|
||||
PackageIdentification[] libraryPackageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch());
|
||||
for (int j = 0; j < libraryPackageDependencies.length; j++) {
|
||||
GlobalData.refreshPackageIdentification(libraryPackageDependencies[j]);
|
||||
File packageFile = libraryPackageDependencies[j].getSpdFile();
|
||||
includes.add(packageFile.getParent() + File.separatorChar + "Include");
|
||||
includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));
|
||||
}
|
||||
SurfaceAreaQuery.pop();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// The package which the module belongs to
|
||||
// TBD
|
||||
includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include");
|
||||
includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));
|
||||
|
||||
//
|
||||
// Debug files output directory
|
||||
//
|
||||
includes.add("${DEST_DIR_DEBUG}");
|
||||
|
||||
//
|
||||
// sourceFiles[][0] is FileType, [][1] is File name relative to Module_Dir
|
||||
//
|
||||
|
@ -447,11 +377,10 @@ public class ModuleBuildFileGenerator {
|
|||
Element ele = document.createElement("Build_Unicode_Database");
|
||||
ele.setAttribute("FILEPATH", ".");
|
||||
ele.setAttribute("FILENAME", "${BASE_NAME}");
|
||||
String[] includePaths = includes.toArray(new String[includes.size()]);
|
||||
Element includesEle = document.createElement("EXTRA.INC");
|
||||
for (int i = 0; i < includePaths.length; i++) {
|
||||
for (int i = 0; i < includes.length; i++) {
|
||||
Element includeEle = document.createElement("includepath");
|
||||
includeEle.setAttribute("path", includePaths[i]);
|
||||
includeEle.setAttribute("path", includes[i]);
|
||||
includesEle.appendChild(includeEle);
|
||||
}
|
||||
ele.appendChild(includesEle);
|
||||
|
|
Loading…
Reference in New Issue