import java.util.List;\r
import java.util.Map;\r
import java.util.Set;\r
+import java.util.regex.Matcher;\r
+import java.util.regex.Pattern;\r
\r
import org.apache.xmlbeans.XmlException;\r
import org.apache.xmlbeans.XmlObject;\r
// CONF dir + tools definition file name\r
//\r
File toolsDefFile = new File(workspaceDir + File.separatorChar + toolsDefFilename);\r
- EdkLog.log("Init", "Using tool definition file [" + toolsDefFile.getPath() + "].");\r
+ EdkLog.log("Init", EdkLog.EDK_ALWAYS, "Using tool definition file [" + toolsDefFile.getPath() + "].");\r
toolsDef = new ToolChainConfig(toolsDefFile);\r
\r
-\r
//\r
// Parse Framework Database\r
//\r
packageId = (PackageIdentification)iter.next();\r
moduleId.setPackage(packageId);\r
Spd spd = spdTable.get(packageId);\r
- if (spd.getModuleFile(moduleId) != null ) {\r
- break ;\r
+ File tempMsaFile = null;\r
+ if ((tempMsaFile = spd.getModuleFile(moduleId)) != null ) {\r
+ if (tempMsaFile.getParent().equalsIgnoreCase(moduleId.getMsaFile().getParent())) {\r
+ break ;\r
+ }\r
+ tempMsaFile = null;\r
}\r
}\r
if (packageId == null){\r
///\r
/// Tool Chain Related, try to refine and put some logic process to ToolChainFactory\r
///\r
- public static ToolChainInfo getToolChainInfo() {\r
+ public synchronized static ToolChainInfo getToolChainInfo() {\r
if (toolChainInfo == null) {\r
toolChainInfo = toolsDef.getConfigInfo().intersection(toolChainEnvInfo);\r
if (toolChainPlatformInfo != null) {\r
}\r
toolChainInfo.addCommands(toolsDef.getConfigInfo().getCommands());\r
toolChainInfo.normalize();\r
- EdkLog.log("Init", "Current build tool chain information summary: ");\r
- EdkLog.log("Init", toolChainInfo + "");\r
+ EdkLog.log("Init", EdkLog.EDK_ALWAYS, "Current build tool chain information summary: ");\r
+ EdkLog.log("Init", EdkLog.EDK_ALWAYS, toolChainInfo + "");\r
}\r
return toolChainInfo;\r
}\r
return false;\r
}\r
\r
- public static String getCommandSetting(String[] commandDescription, FpdModuleIdentification fpdModuleId) throws EdkException {\r
+ public synchronized static String getCommandSetting(String[] commandDescription, FpdModuleIdentification fpdModuleId) throws EdkException {\r
ToolChainKey toolChainKey = new ToolChainKey(commandDescription);\r
ToolChainMap toolChainConfig = toolsDef.getConfig();\r
String setting = null;\r
\r
+ setting = toolChainConfig.get(toolChainKey);\r
+ if (setting == null) {\r
+ setting = "";\r
+ }\r
if (!commandDescription[ToolChainElement.ATTRIBUTE.value].equals(ToolChainAttribute.FLAGS.toString())) {\r
- setting = toolChainConfig.get(toolChainKey);\r
- if (setting == null) {\r
- setting = "";\r
- }\r
return setting;\r
}\r
\r
ToolChainMap option = moduleToolChainOption.get(fpdModuleId);\r
ToolChainKey toolChainFamilyKey = null;\r
\r
- if ((option == null) || (option != null && (setting = option.get(toolChainKey)) == null)) {\r
+ if (option != null && option.get(toolChainKey) != null) \r
+ {\r
+ String str = option.get(toolChainKey);\r
+\r
+ Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");\r
+ Matcher matcher = myPattern.matcher(str + " ");\r
+ while (matcher.find()) \r
+ {\r
+ setting = setting + " " + str.substring(matcher.start(1), matcher.end(1));\r
+ }\r
+ } \r
+// else \r
+// {\r
+ if (toolChainFamilyKey == null) \r
+ {\r
+ toolChainFamilyKey = new ToolChainKey(commandDescription);\r
+ toolChainFamilyKey.setKey(ToolChainAttribute.FAMILY.toString(), ToolChainElement.ATTRIBUTE.value);\r
+ String family = toolChainConfig.get(toolChainFamilyKey);\r
+ toolChainFamilyKey.setKey(family, ToolChainElement.TOOLCHAIN.value);\r
+ toolChainFamilyKey.setKey(ToolChainAttribute.FLAGS.toString(), ToolChainElement.ATTRIBUTE.value);\r
+ }\r
+\r
+ option = moduleToolChainFamilyOption.get(fpdModuleId);\r
+ if (option != null && option.get(toolChainFamilyKey) != null) \r
+ {\r
+ String str = option.get(toolChainFamilyKey);\r
+\r
+ Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");\r
+ Matcher matcher = myPattern.matcher(str + " ");\r
+ while (matcher.find()) \r
+ {\r
+ setting = setting + " " + str.substring(matcher.start(1), matcher.end(1));\r
+ }\r
+ }\r
+// }\r
+\r
+ //\r
+ // get platform options, if any\r
+ //\r
+ // tool tag first\r
+// if (platformToolChainOption != null && platformToolChainOption.get(toolChainKey) != null) \r
+ if (platformToolChainOption.get(toolChainKey) != null) \r
+ {\r
+ String str = platformToolChainOption.get(toolChainKey);\r
+\r
+ Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");\r
+ Matcher matcher = myPattern.matcher(str + " ");\r
+ while (matcher.find()) \r
+ {\r
+ setting = setting + " " + str.substring(matcher.start(1), matcher.end(1));\r
+ }\r
+ } \r
+// else \r
+// {\r
+ // then tool chain family\r
+ if (toolChainFamilyKey == null) \r
+ {\r
+ toolChainFamilyKey = new ToolChainKey(commandDescription);\r
+ toolChainFamilyKey.setKey(ToolChainAttribute.FAMILY.toString(), ToolChainElement.ATTRIBUTE.value);\r
+ String family = toolChainConfig.get(toolChainFamilyKey);\r
+ toolChainFamilyKey.setKey(family, ToolChainElement.TOOLCHAIN.value);\r
+ toolChainFamilyKey.setKey(ToolChainAttribute.FLAGS.toString(), ToolChainElement.ATTRIBUTE.value);\r
+ }\r
+\r
+// if (platformToolChainFamilyOption != null && platformToolChainFamilyOption.get(toolChainFamilyKey) != null) \r
+ if (platformToolChainFamilyOption.get(toolChainFamilyKey) != null) \r
+ {\r
+ String str = platformToolChainFamilyOption.get(toolChainFamilyKey);\r
+\r
+ setting = setting + " " + str;\r
+\r
+// Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");\r
+// Matcher matcher = myPattern.matcher(str + " ");\r
+// while (matcher.find()) \r
+// {\r
+// setting = setting + " " + str.substring(matcher.start(1), matcher.end(1));\r
+// }\r
+ }\r
+// }\r
+\r
+ return setting;\r
+\r
+/*\r
+ //\r
+ // get module specific options, if any\r
+ //\r
+ // tool tag first\r
+ ToolChainMap option = moduleToolChainOption.get(fpdModuleId);\r
+ ToolChainKey toolChainFamilyKey = null;\r
+ \r
+ if ((option == null) || (option != null && (setting = option.get(toolChainKey)) == null)) \r
+ {\r
//\r
// then tool chain family\r
//\r
}\r
\r
return setting;\r
+*/\r
}\r
\r
public static void setToolChainEnvInfo(ToolChainInfo envInfo) {\r