String packageGuid = getProject().getProperty("PACKAGE_GUID");\r
String packageVersion = getProject().getProperty("PACKAGE_VERSION");\r
if (moduleGuid == null || packageGuid == null) {\r
- throw new BuildException("GenBuild parameters error. ");\r
+ throw new BuildException("GenBuild parameter error.");\r
}\r
PackageIdentification packageId = new PackageIdentification(packageGuid, packageVersion);\r
moduleId = new ModuleIdentification(moduleGuid, moduleVersion);\r
// If single module : intersection MSA supported ARCHs and tools def!!\r
// else, get arch from pass down\r
//\r
- String[] archList = new String[0];\r
- if ( getProject().getProperty("ARCH") != null ) {\r
- archList = getProject().getProperty("ARCH").split(" ");\r
+ Set<String> archListSupByToolChain = new LinkedHashSet<String>(); \r
+ String[] archs = GlobalData.getToolChainInfo().getArchs(); \r
+ \r
+ for (int i = 0; i < archs.length; i ++) {\r
+ archListSupByToolChain.add(archs[i]);\r
+ }\r
+ \r
+ Set<String> archSet = new LinkedHashSet<String>();\r
+ \r
+ if ( getProject().getProperty("ARCH") != null) {\r
+ String[] fpdArchList = getProject().getProperty("ARCH").split(" ");\r
+ \r
+ for (int i = 0; i < fpdArchList.length; i++) {\r
+ if (archListSupByToolChain.contains(fpdArchList[i])) {\r
+ archSet.add(fpdArchList[i]);\r
+ }\r
+ }\r
}\r
else {\r
- archList = GlobalData.getToolChainInfo().getArchs();\r
+ archSet = archListSupByToolChain; \r
}\r
- \r
+ \r
+ String[] archList = archSet.toArray(new String[archSet.size()]);\r
\r
//\r
// Judge if arch is all supported by current module. If not, throw Exception.\r
if (moduleSupportedArchs != null) {\r
for (int k = 0; k < archList.length; k++) {\r
if ( ! moduleSupportedArchs.contains(archList[k])) {\r
- throw new BuildException("ARCH [" + archList[k] + "] is not supported by " + moduleId + ". " + moduleId + " only supports [" + moduleSupportedArchs + "].");\r
+ throw new BuildException("Specified architecture [" + archList[k] + "] is not supported by " + moduleId + ". The module " + moduleId + " only supports [" + moduleSupportedArchs + "] architectures.");\r
}\r
}\r
}\r
\r
for (int k = 0; k < archList.length; k++) {\r
+ \r
getProject().setProperty("ARCH", archList[k]);\r
\r
FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, archList[k]);\r
//\r
// Whether the module is built before\r
//\r
- if (GlobalData.isModuleBuilt(fpdModuleId)) {\r
- return ;\r
- }\r
- else {\r
+ if (moduleId.isLibrary() == false && GlobalData.hasFpdModuleSA(fpdModuleId) == false) {\r
+ System.out.println("\nWARNING: " + moduleId + " for " + archList[k] + " was not found in current platform FPD file!\n");\r
+ continue;\r
+ } else if (GlobalData.isModuleBuilt(fpdModuleId)) {\r
+ return;\r
+ } else {\r
GlobalData.registerBuiltModule(fpdModuleId);\r
}\r
\r
// don't do anything if no tools found\r
// \r
if (GlobalData.isCommandSet(targetList[i], toolchainList[j], archList[k]) == false) {\r
- System.out.println("!!!Warning: No build issued. No tools found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");\r
+ System.out.println("Warning: No build issued. No tools were found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");\r
continue;\r
}\r
\r
// MODULE or BASE_NAME, GUID or FILE_GUID, VERSION, MODULE_TYPE\r
// MODULE_DIR, MODULE_RELATIVE_DIR\r
// SUBSYSTEM, ENTRYPOINT, EBC_TOOL_LIB_PATH\r
- // LIBS, OBJECTS, SDB_FILES\r
//\r
setModuleCommonProperties(archList[k]);\r
\r
}\r
popProperties();\r
}catch (Exception e){\r
- e.printStackTrace();\r
throw new BuildException(e.getMessage());\r
}\r
}\r
String filename = getProject().getProperty("PLATFORM_FILE");\r
\r
if (filename == null){\r
- throw new BuildException("Plese set ACTIVE_PLATFORM if you want to build a single module. ");\r
+ throw new BuildException("Please set ACTIVE_PLATFORM in the file: Tools/Conf/target.txt if you want to build a single module!");\r
}\r
\r
PlatformIdentification platformId = GlobalData.getPlatform(filename);\r
getProject().setProperty("ENTRYPOINT", "_ModuleEntryPoint");\r
}\r
\r
- //\r
- // LIBS, OBJECTS, SDB_FILES\r
- //\r
getProject().setProperty("OBJECTS", "");\r
- getProject().setProperty("SDB_FILES", "");\r
- getProject().setProperty("LIBS", "");\r
}\r
\r
private void getCompilerFlags(String target, String toolchain, FpdModuleIdentification fpdModuleId) throws EdkException {\r
key[4] = "NAME";\r
String cmdName = GlobalData.getCommandSetting(key, fpdModuleId);\r
File cmdFile = new File(cmdPath + File.separatorChar + cmdName);\r
-// GlobalData.log.info("PATH: " + cmdFile.getPath());\r
getProject().setProperty(cmd[m], cmdFile.getPath().replaceAll("(\\\\)", "/"));\r
\r
//\r
//\r
key[4] = "FLAGS";\r
String cmdFlags = GlobalData.getCommandSetting(key, fpdModuleId);\r
-// GlobalData.log.info("Flags: " + cmdFlags);\r
Set<String> addset = new LinkedHashSet<String>();\r
Set<String> subset = new LinkedHashSet<String>();\r
putFlagsToSet(addset, cmdFlags);\r
//\r
key[4] = "EXT";\r
String extName = GlobalData.getCommandSetting(key, fpdModuleId);\r
-// GlobalData.log.info("Ext: " + extName);\r
if ( extName != null && ! extName.equalsIgnoreCase("")) {\r
getProject().setProperty(cmd[m] + "_EXT", extName);\r
}\r
//\r
key[4] = "FAMILY";\r
String toolChainFamily = GlobalData.getCommandSetting(key, fpdModuleId);\r
-// GlobalData.log.info("FAMILY: " + toolChainFamily);\r
if (toolChainFamily != null) {\r
getProject().setProperty(cmd[m] + "_FAMILY", toolChainFamily);\r
}\r
//\r
key[4] = "SPATH";\r
String spath = GlobalData.getCommandSetting(key, fpdModuleId);\r
-// GlobalData.log.info("SPATH: " + spath);\r
if (spath != null) {\r
getProject().setProperty(cmd[m] + "_SPATH", spath.replaceAll("(\\\\)", "/"));\r
}\r
//\r
key[4] = "DPATH";\r
String dpath = GlobalData.getCommandSetting(key, fpdModuleId);\r
-// GlobalData.log.info("DPATH: " + dpath);\r
if (dpath != null) {\r
getProject().setProperty(cmd[m] + "_DPATH", dpath.replaceAll("(\\\\)", "/"));\r
}\r
// AutoGen\r
//\r
\r
- AutoGen autogen = new AutoGen(getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch());\r
+ AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch());\r
autogen.genAutogen();\r
\r
\r
// then call the exist BaseName_build.xml directly.\r
//\r
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r
- GlobalData.log.info("Call user-defined " + moduleId.getName() + "_build.xml");\r
+ GlobalData.log.info("Calling user-defined " + moduleId.getName() + "_build.xml");\r
Ant ant = new Ant();\r
ant.setProject(getProject());\r
ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");\r
// then call the exist BaseName_build.xml directly.\r
//\r
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r
- GlobalData.log.info("Call user-defined " + moduleId.getName() + "_build.xml");\r
+ GlobalData.log.info("Calling user-defined " + moduleId.getName() + "_build.xml");\r
Ant ant = new Ant();\r
ant.setProject(getProject());\r
ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");\r
return result;\r
}\r
\r
- /**\r
- Generate the flags string with original format. The format is defined by \r
- Java Regulation Expression "[^\\\\]?(\".*?[^\\\\]\")[ \t,]+". </p>\r
- \r
- <p>For example: </p>\r
- \r
- <pre>\r
- "/nologo", "/W3", "/WX"\r
- "/C", "/DSTRING_DEFINES_FILE=\"BdsStrDefs.h\""\r
- </pre>\r
- \r
- @param add the add flags set\r
- @param sub the sub flags set\r
- @return flags with original format\r
- **/\r
- private String getRawFlags(Set<String> add, Set<String> sub) {\r
- String result = null;\r
- add.removeAll(sub);\r
- Iterator iter = add.iterator();\r
- while (iter.hasNext()) {\r
- String str = (String) iter.next();\r
- result += "\"" + str.substring(1, str.length() - 1) + "\", ";\r
- }\r
- return result;\r
- }\r
-\r
- private String parseOptionString(String optionString, Set<String> addSet, Set<String> subSet) {\r
- boolean overrideOption = false;\r
- Pattern pattern = Pattern.compile("ADD\\.\\[(.+)\\]");\r
- Matcher matcher = pattern.matcher(optionString);\r
-\r
- while (matcher.find()) {\r
- overrideOption = true;\r
- String addOption = optionString.substring(matcher.start(1), matcher.end(1)).trim();\r
- putFlagsToSet(addSet, addOption);\r
- \r
- }\r
-\r
- pattern = Pattern.compile("SUB\\.\\[(.+)\\]");\r
- matcher = pattern.matcher(optionString);\r
-\r
- while (matcher.find()) {\r
- overrideOption = true;\r
- String subOption = optionString.substring(matcher.start(1), matcher.end(1)).trim();\r
- putFlagsToSet(subSet, subOption);\r
- }\r
-\r
- if (overrideOption == true) {\r
- return null;\r
- }\r
-\r
- return optionString;\r
- }\r
- \r
private void pushProperties() {\r
backupPropertiesStack.push(getProject().getProperties());\r
}\r