X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2FGenBuildTask.java;h=ec2fd1ad2f167f17156bc8920d6fbba7876077a4;hp=0e807f8abbe07fc6c3bcc9671f24186413858bcd;hb=3c696250f53e857cb54293e90b9e8e10ef4d18b7;hpb=a29c47e01d9689fad735bbeccfaef67676a425d1
diff --git a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
index 0e807f8abb..ec2fd1ad2f 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
@@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
package org.tianocore.build;
import java.io.File;
+import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -32,8 +33,9 @@ import org.apache.tools.ant.taskdefs.Ant;
import org.apache.tools.ant.taskdefs.Property;
import org.apache.xmlbeans.XmlObject;
-import org.tianocore.build.exception.EdkException;
+import org.tianocore.build.autogen.AutoGen;
import org.tianocore.build.fpd.FpdParserTask;
+import org.tianocore.build.global.GenBuildLogger;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.global.OutputManager;
import org.tianocore.build.global.SurfaceAreaQuery;
@@ -42,6 +44,8 @@ import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.build.id.PackageIdentification;
import org.tianocore.build.id.PlatformIdentification;
import org.tianocore.build.tools.ModuleItem;
+import org.tianocore.exception.EdkException;
+import org.tianocore.logger.EdkLog;
/**
@@ -97,11 +101,10 @@ public class GenBuildTask extends Ant {
private ModuleIdentification moduleId;
private Vector properties = new Vector();
-
+
private static Stack backupPropertiesStack = new Stack();
-
- private static Hashtable backupProperties;
+ private boolean isSingleModuleBuild = false;
/**
Public construct method. It is necessary for ANT task.
@@ -115,7 +118,14 @@ public class GenBuildTask extends Ant {
From module build, exception from module surface area invalid.
**/
public void execute() throws BuildException {
- try{
+ //
+ // set Logger
+ //
+ GenBuildLogger logger = new GenBuildLogger(getProject());
+ EdkLog.setLogLevel(getProject().getProperty("env.LOGLEVEL"));
+ EdkLog.setLogger(logger);
+ // remove !!
+ try {
pushProperties();
//
// Enable all specified properties
@@ -149,7 +159,7 @@ public class GenBuildTask extends Ant {
SurfaceAreaQuery.setDoc(doc);
moduleId = SurfaceAreaQuery.getMsaHeader();
}
- String[] producedLibraryClasses = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED");
+ String[] producedLibraryClasses = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED",null);
if (producedLibraryClasses.length == 0) {
moduleId.setLibrary(false);
}
@@ -160,7 +170,7 @@ public class GenBuildTask extends Ant {
//
// Judge whether it is single module build or not
//
- if (getProject().getProperty("PLATFORM") == null) {
+ if (isSingleModuleBuild) {
//
// Single Module build
//
@@ -170,8 +180,8 @@ public class GenBuildTask extends Ant {
//
// Platform build. Restore the platform related info
//
- String platformName = getProject().getProperty("PLATFORM");
- PlatformIdentification platformId = GlobalData.getPlatform(platformName);
+ String filename = getProject().getProperty("PLATFORM_FILE");
+ PlatformIdentification platformId = GlobalData.getPlatform(filename);
getProject().setProperty("PLATFORM_DIR", platformId.getFpdFile().getParent().replaceAll("(\\\\)", "/"));
getProject().setProperty("PLATFORM_RELATIVE_DIR", platformId.getPlatformRelativeDir().replaceAll("(\\\\)", "/"));
@@ -185,14 +195,29 @@ public class GenBuildTask extends Ant {
// If single module : intersection MSA supported ARCHs and tools def!!
// else, get arch from pass down
//
- String[] archList = new String[0];
- if ( getProject().getProperty("ARCH") != null ) {
- archList = getProject().getProperty("ARCH").split(" ");
+ Set archListSupByToolChain = new LinkedHashSet();
+ String[] archs = GlobalData.getToolChainInfo().getArchs();
+
+ for (int i = 0; i < archs.length; i ++) {
+ archListSupByToolChain.add(archs[i]);
+ }
+
+ Set archSet = new LinkedHashSet();
+
+ if ( getProject().getProperty("ARCH") != null) {
+ String[] fpdArchList = getProject().getProperty("ARCH").split(" ");
+
+ for (int i = 0; i < fpdArchList.length; i++) {
+ if (archListSupByToolChain.contains(fpdArchList[i])) {
+ archSet.add(fpdArchList[i]);
+ }
+ }
}
else {
- archList = GlobalData.getToolChainInfo().getArchs();
+ archSet = archListSupByToolChain;
}
-
+
+ String[] archList = archSet.toArray(new String[archSet.size()]);
//
// Judge if arch is all supported by current module. If not, throw Exception.
@@ -207,6 +232,7 @@ public class GenBuildTask extends Ant {
}
for (int k = 0; k < archList.length; k++) {
+
getProject().setProperty("ARCH", archList[k]);
FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, archList[k]);
@@ -233,6 +259,15 @@ public class GenBuildTask extends Ant {
getProject().setProperty("TARGET", targetList[i]);
String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
for(int j = 0; j < toolchainList.length; j ++){
+ //
+ // check if any tool is defined for current target + toolchain + arch
+ // don't do anything if no tools found
+ //
+ if (GlobalData.isCommandSet(targetList[i], toolchainList[j], archList[k]) == false) {
+ System.out.println("Warning: No build issued. No tools found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");
+ continue;
+ }
+
//
// Prepare for toolchain related common properties
// TOOLCHAIN
@@ -273,7 +308,6 @@ public class GenBuildTask extends Ant {
}
popProperties();
}catch (Exception e){
- e.printStackTrace();
throw new BuildException(e.getMessage());
}
}
@@ -299,13 +333,13 @@ public class GenBuildTask extends Ant {
//
// Read ACTIVE_PLATFORM's FPD file (Call FpdParserTask's method)
//
- String activePlatformName = getProject().getProperty("ACTIVE_PLATFORM");
+ String filename = getProject().getProperty("PLATFORM_FILE");
- if (activePlatformName == null){
+ if (filename == null){
throw new BuildException("Plese set ACTIVE_PLATFORM if you want to build a single module. ");
}
- PlatformIdentification platformId = GlobalData.getPlatform(activePlatformName);
+ PlatformIdentification platformId = GlobalData.getPlatform(filename);
//
// Read FPD file
@@ -318,7 +352,7 @@ public class GenBuildTask extends Ant {
// Prepare for Platform related common properties
// PLATFORM, PLATFORM_DIR, PLATFORM_RELATIVE_DIR
//
- getProject().setProperty("PLATFORM", activePlatformName);
+ getProject().setProperty("PLATFORM", platformId.getName());
getProject().setProperty("PLATFORM_DIR", platformId.getFpdFile().getParent().replaceAll("(\\\\)", "/"));
getProject().setProperty("PLATFORM_RELATIVE_DIR", platformId.getPlatformRelativeDir().replaceAll("(\\\\)", "/"));
}
@@ -414,7 +448,6 @@ public class GenBuildTask extends Ant {
key[4] = "NAME";
String cmdName = GlobalData.getCommandSetting(key, fpdModuleId);
File cmdFile = new File(cmdPath + File.separatorChar + cmdName);
-// GlobalData.log.info("PATH: " + cmdFile.getPath());
getProject().setProperty(cmd[m], cmdFile.getPath().replaceAll("(\\\\)", "/"));
//
@@ -422,7 +455,6 @@ public class GenBuildTask extends Ant {
//
key[4] = "FLAGS";
String cmdFlags = GlobalData.getCommandSetting(key, fpdModuleId);
-// GlobalData.log.info("Flags: " + cmdFlags);
Set addset = new LinkedHashSet();
Set subset = new LinkedHashSet();
putFlagsToSet(addset, cmdFlags);
@@ -433,7 +465,6 @@ public class GenBuildTask extends Ant {
//
key[4] = "EXT";
String extName = GlobalData.getCommandSetting(key, fpdModuleId);
-// GlobalData.log.info("Ext: " + extName);
if ( extName != null && ! extName.equalsIgnoreCase("")) {
getProject().setProperty(cmd[m] + "_EXT", extName);
}
@@ -446,7 +477,6 @@ public class GenBuildTask extends Ant {
//
key[4] = "FAMILY";
String toolChainFamily = GlobalData.getCommandSetting(key, fpdModuleId);
-// GlobalData.log.info("FAMILY: " + toolChainFamily);
if (toolChainFamily != null) {
getProject().setProperty(cmd[m] + "_FAMILY", toolChainFamily);
}
@@ -456,7 +486,6 @@ public class GenBuildTask extends Ant {
//
key[4] = "SPATH";
String spath = GlobalData.getCommandSetting(key, fpdModuleId);
-// GlobalData.log.info("SPATH: " + spath);
if (spath != null) {
getProject().setProperty(cmd[m] + "_SPATH", spath.replaceAll("(\\\\)", "/"));
}
@@ -469,7 +498,6 @@ public class GenBuildTask extends Ant {
//
key[4] = "DPATH";
String dpath = GlobalData.getCommandSetting(key, fpdModuleId);
-// GlobalData.log.info("DPATH: " + dpath);
if (dpath != null) {
getProject().setProperty(cmd[m] + "_DPATH", dpath.replaceAll("(\\\\)", "/"));
}
@@ -524,8 +552,9 @@ public class GenBuildTask extends Ant {
//
// AutoGen
//
-// AutoGen autogen = new AutoGen(getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId);
-// autogen.genAutogen();
+
+ AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch());
+ autogen.genAutogen();
//
@@ -755,4 +784,8 @@ public class GenBuildTask extends Ant {
getProject().setProperty(item, (String)backupProperties.get(item));
}
}
+
+ public void setSingleModuleBuild(boolean isSingleModuleBuild) {
+ this.isSingleModuleBuild = isSingleModuleBuild;
+ }
}