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
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