X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2FGenBuildTask.java;h=cdccfa5c096ed929bb11f4f4bf1cda36db1ce8a6;hp=bac506abfa3f0161ff999a6c096b326474b77f2a;hb=391dbbb1c00daefe78e7e44499d048943ca866ae;hpb=196ad8d77c4a256e6a9b432541d688d2f40f4614 diff --git a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java index bac506abfa..cdccfa5c09 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java @@ -144,7 +144,7 @@ public class GenBuildTask extends Ant { String packageGuid = getProject().getProperty("PACKAGE_GUID"); String packageVersion = getProject().getProperty("PACKAGE_VERSION"); if (moduleGuid == null || packageGuid == null) { - throw new BuildException("GenBuild parameters error. "); + throw new BuildException("GenBuild parameter error."); } PackageIdentification packageId = new PackageIdentification(packageGuid, packageVersion); moduleId = new ModuleIdentification(moduleGuid, moduleVersion); @@ -194,14 +194,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. @@ -210,12 +225,13 @@ public class GenBuildTask extends Ant { if (moduleSupportedArchs != null) { for (int k = 0; k < archList.length; k++) { if ( ! moduleSupportedArchs.contains(archList[k])) { - throw new BuildException("ARCH [" + archList[k] + "] is not supported by " + moduleId + ". " + moduleId + " only supports [" + moduleSupportedArchs + "]."); + throw new BuildException("Specified architecture [" + archList[k] + "] is not supported by " + moduleId + ". The module " + moduleId + " only supports [" + moduleSupportedArchs + "] architectures."); } } } for (int k = 0; k < archList.length; k++) { + getProject().setProperty("ARCH", archList[k]); FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, archList[k]); @@ -223,10 +239,12 @@ public class GenBuildTask extends Ant { // // Whether the module is built before // - if (GlobalData.isModuleBuilt(fpdModuleId)) { - return ; - } - else { + if (moduleId.isLibrary() == false && GlobalData.hasFpdModuleSA(fpdModuleId) == false) { + System.out.println("\nWARNING: " + moduleId + " for " + archList[k] + " was not found in current platform FPD file!\n"); + continue; + } else if (GlobalData.isModuleBuilt(fpdModuleId)) { + return; + } else { GlobalData.registerBuiltModule(fpdModuleId); } @@ -247,7 +265,7 @@ public class GenBuildTask extends Ant { // 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"); + System.out.println("Warning: No build issued. No tools were found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n"); continue; } @@ -267,7 +285,6 @@ public class GenBuildTask extends Ant { // MODULE or BASE_NAME, GUID or FILE_GUID, VERSION, MODULE_TYPE // MODULE_DIR, MODULE_RELATIVE_DIR // SUBSYSTEM, ENTRYPOINT, EBC_TOOL_LIB_PATH - // LIBS, OBJECTS, SDB_FILES // setModuleCommonProperties(archList[k]); @@ -319,7 +336,7 @@ public class GenBuildTask extends Ant { String filename = getProject().getProperty("PLATFORM_FILE"); if (filename == null){ - throw new BuildException("Plese set ACTIVE_PLATFORM if you want to build a single module. "); + throw new BuildException("Please set ACTIVE_PLATFORM in the file: Tools/Conf/target.txt if you want to build a single module!"); } PlatformIdentification platformId = GlobalData.getPlatform(filename); @@ -411,12 +428,7 @@ public class GenBuildTask extends Ant { getProject().setProperty("ENTRYPOINT", "_ModuleEntryPoint"); } - // - // LIBS, OBJECTS, SDB_FILES - // getProject().setProperty("OBJECTS", ""); - getProject().setProperty("SDB_FILES", ""); - getProject().setProperty("LIBS", ""); } private void getCompilerFlags(String target, String toolchain, FpdModuleIdentification fpdModuleId) throws EdkException { @@ -596,7 +608,7 @@ public class GenBuildTask extends Ant { // then call the exist BaseName_build.xml directly. // if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) { - GlobalData.log.info("Call user-defined " + moduleId.getName() + "_build.xml"); + GlobalData.log.info("Calling user-defined " + moduleId.getName() + "_build.xml"); Ant ant = new Ant(); ant.setProject(getProject()); ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml"); @@ -626,7 +638,7 @@ public class GenBuildTask extends Ant { // then call the exist BaseName_build.xml directly. // if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) { - GlobalData.log.info("Call user-defined " + moduleId.getName() + "_build.xml"); + GlobalData.log.info("Calling user-defined " + moduleId.getName() + "_build.xml"); Ant ant = new Ant(); ant.setProject(getProject()); ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml"); @@ -700,60 +712,6 @@ public class GenBuildTask extends Ant { return result; } - /** - Generate the flags string with original format. The format is defined by - Java Regulation Expression "[^\\\\]?(\".*?[^\\\\]\")[ \t,]+".

- -

For example:

- -
-        "/nologo", "/W3", "/WX"
-        "/C", "/DSTRING_DEFINES_FILE=\"BdsStrDefs.h\""
-      
- - @param add the add flags set - @param sub the sub flags set - @return flags with original format - **/ - private String getRawFlags(Set add, Set sub) { - String result = null; - add.removeAll(sub); - Iterator iter = add.iterator(); - while (iter.hasNext()) { - String str = (String) iter.next(); - result += "\"" + str.substring(1, str.length() - 1) + "\", "; - } - return result; - } - - private String parseOptionString(String optionString, Set addSet, Set subSet) { - boolean overrideOption = false; - Pattern pattern = Pattern.compile("ADD\\.\\[(.+)\\]"); - Matcher matcher = pattern.matcher(optionString); - - while (matcher.find()) { - overrideOption = true; - String addOption = optionString.substring(matcher.start(1), matcher.end(1)).trim(); - putFlagsToSet(addSet, addOption); - - } - - pattern = Pattern.compile("SUB\\.\\[(.+)\\]"); - matcher = pattern.matcher(optionString); - - while (matcher.find()) { - overrideOption = true; - String subOption = optionString.substring(matcher.start(1), matcher.end(1)).trim(); - putFlagsToSet(subSet, subOption); - } - - if (overrideOption == true) { - return null; - } - - return optionString; - } - private void pushProperties() { backupPropertiesStack.push(getProject().getProperties()); }