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=2265d6ba05cbf2135505727ab0ff75a92b7f62e1;hp=389b8f12b1006d3751c74da1d7b0177f6d855097;hb=98840b104906f4c811868722e6a4bf6ffe102ca1;hpb=b69bb9ba72ebb7341bce97eec1a499d8258a3272
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java
index 389b8f12b1..2265d6ba05 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])) {
@@ -253,6 +257,10 @@ public class GenBuildTask extends Ant {
}
}
+ if (archList.length == 0) {
+ 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++) {
getProject().setProperty("ARCH", archList[k]);
@@ -421,8 +429,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 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
@@ -638,10 +649,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 ;
@@ -653,7 +665,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);
//
@@ -804,4 +816,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 "";
+ }
}