X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FJava%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2FGenBuildTask.java;h=5aa717fbdd05882ddb58efde7afddf6b7e45471a;hp=249ca8328dc84730a18a06fd70b0d5e32ffd5a74;hb=e3cc406130b14c020c75e3a169f94ba001bf2128;hpb=c340a28e277f524698ff42ce631f277583772b65
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java
index 249ca8328d..5aa717fbdd 100644
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java
+++ b/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java
@@ -26,14 +26,11 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Location;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Ant;
import org.apache.tools.ant.taskdefs.Property;
import org.apache.xmlbeans.XmlObject;
-
-import org.tianocore.common.definitions.ToolDefinitions;
-import org.tianocore.common.exception.EdkException;
-import org.tianocore.common.logger.EdkLog;
import org.tianocore.build.autogen.AutoGen;
import org.tianocore.build.exception.AutoGenException;
import org.tianocore.build.exception.GenBuildException;
@@ -48,6 +45,9 @@ 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.common.definitions.ToolDefinitions;
+import org.tianocore.common.exception.EdkException;
+import org.tianocore.common.logger.EdkLog;
/**
@@ -151,6 +151,10 @@ public class GenBuildTask extends Ant {
BuildException buildException = new BuildException(e.getMessage());
buildException.setStackTrace(e.getStackTrace());
throw buildException;
+ } catch (Exception e) {
+ BuildException buildException = new BuildException(e.getMessage());
+ buildException.setStackTrace(e.getStackTrace());
+ throw buildException;
}
}
@@ -197,7 +201,7 @@ public class GenBuildTask extends Ant {
moduleId.setMsaFile(msaFile);
}
- String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED",null);
+ String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED", null, null);
if (producedLibraryClasses.length == 0) {
moduleId.setLibrary(false);
} else {
@@ -226,9 +230,9 @@ public class GenBuildTask extends Ant {
}
Set archSet = new LinkedHashSet();
-
- if ( getProject().getProperty("ARCH") != null) {
- String[] fpdArchList = getProject().getProperty("ARCH").split(" ");
+ String archString = getProject().getProperty("ARCH");
+ if (archString != null) {
+ String[] fpdArchList = archString.split(" ");
for (int i = 0; i < fpdArchList.length; i++) {
if (archListSupByToolChain.contains(fpdArchList[i])) {
@@ -254,7 +258,7 @@ public class GenBuildTask extends Ant {
}
if (archList.length == 0) {
- EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: " + moduleId + " was not found in current platform FPD file!\n");
+ EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: " + "[" + archString + "] is not supported for " + moduleId + " in this build!\n");
}
for (int k = 0; k < archList.length; k++) {
@@ -323,10 +327,8 @@ public class GenBuildTask extends Ant {
if (type.equalsIgnoreCase("all") || type.equalsIgnoreCase("build")) {
applyBuild(targetList[i], toolchainList[j], fpdModuleId);
- } else if (type.equalsIgnoreCase("clean")) {
- applyClean(fpdModuleId);
- } else if (type.equalsIgnoreCase("cleanall")) {
- applyCleanall(fpdModuleId);
+ } else {
+ applyNonBuildTarget(fpdModuleId);
}
}
}
@@ -425,8 +427,11 @@ public class GenBuildTask extends Ant {
getProject().setProperty("FILE_GUID", moduleId.getGuid());
getProject().setProperty("VERSION", moduleId.getVersion());
getProject().setProperty("MODULE_TYPE", moduleId.getModuleType());
- getProject().setProperty("MODULE_DIR", moduleId.getMsaFile().getParent().replaceAll("(\\\\)", "/"));
- getProject().setProperty("MODULE_RELATIVE_DIR", moduleId.getModuleRelativePath().replaceAll("(\\\\)", "/") + File.separatorChar + moduleId.getName());
+ File msaFile = moduleId.getMsaFile();
+ String msaFileName = msaFile.getName();
+ getProject().setProperty("MODULE_DIR", msaFile.getParent().replaceAll("(\\\\)", "/"));
+ getProject().setProperty("MODULE_RELATIVE_DIR", moduleId.getModuleRelativePath().replaceAll("(\\\\)", "/")
+ + File.separatorChar + msaFileName.substring(0, msaFileName.lastIndexOf('.')));
//
// SUBSYSTEM
@@ -642,10 +647,11 @@ public class GenBuildTask extends Ant {
// if it is CUSTOM_BUILD
// then call the exist BaseName_build.xml directly.
//
- if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
- EdkLog.log(this, "Call user-defined " + moduleId.getName() + "_build.xml");
+ String buildFilename = "";
+ if ((buildFilename = GetCustomizedBuildFile(fpdModuleId.getArch())) != "") {
+ EdkLog.log(this, "Call user-defined " + buildFilename);
- String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
+ String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + buildFilename;
antCall(antFilename, null);
return ;
@@ -657,7 +663,7 @@ public class GenBuildTask extends Ant {
//
String ffsKeyword = saq.getModuleFfsKeyword();
ModuleBuildFileGenerator fileGenerator = new ModuleBuildFileGenerator(getProject(), ffsKeyword, fpdModuleId, includes, saq);
- String buildFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
+ buildFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
fileGenerator.genBuildFile(buildFilename);
//
@@ -667,6 +673,24 @@ public class GenBuildTask extends Ant {
antCall(antFilename, null);
}
+ private void applyNonBuildTarget(FpdModuleIdentification fpdModuleId){
+ //
+ // if it is CUSTOM_BUILD
+ // then call the exist BaseName_build.xml directly.
+ //
+ if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
+ EdkLog.log(this, "Calling user-defined " + moduleId.getName() + "_build.xml");
+
+ String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
+ antCall(antFilename, this.type);
+
+ return ;
+ }
+
+ String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
+ antCall(antFilename, this.type);
+ }
+
private void applyClean(FpdModuleIdentification fpdModuleId){
//
// if it is CUSTOM_BUILD
@@ -808,4 +832,15 @@ public class GenBuildTask extends Ant {
public void setExternalProperties(Vector v) {
this.properties = v;
}
+
+ private String GetCustomizedBuildFile(String arch) {
+ String[][] files = saq.getSourceFiles(arch);
+ for (int i = 0; i < files.length; ++i) {
+ if (files[i][1].endsWith("build.xml")) {
+ return files[i][1];
+ }
+ }
+
+ return "";
+ }
}