//\r
File buildFile = null;\r
if (msaFiles.size() > 1) {\r
- throw new BuildException("Having more than one MSA file in a directory is not allowed!");\r
- } else if (msaFiles.size() == 1 && activePlatform == null) {\r
- throw new BuildException("If trying to build a single module, please set ACTIVE_PLATFORM in file [Tool/Conf/target.txt]. ");\r
- } else if (msaFiles.size() == 1 && activePlatform != null) {\r
+ throw new BuildException("More than one MSA file under current directory. It is not allowd. ");\r
+ }\r
+ else if (msaFiles.size() == 1 && activePlatform == null) {\r
+ throw new BuildException("If try to build a single module, please set ACTIVE_PLATFORM in file [Tool/Conf/target.txt]. ");\r
+ }\r
+ else if (msaFiles.size() == 1 && activePlatform != null) {\r
//\r
// Build the single module\r
//\r
buildFile = msaFiles.toArray(new File[1])[0];\r
- } else if (activePlatform != null) {\r
+ }\r
+ else if (activePlatform != null) {\r
buildFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform);\r
- } else if (fpdFiles.size() == 1) {\r
+ }\r
+ else if (fpdFiles.size() == 1) {\r
buildFile = fpdFiles.toArray(new File[1])[0];\r
- } else if (fpdFiles.size() > 1) {\r
+ }\r
+ else if (fpdFiles.size() > 1) {\r
buildFile = intercommuniteWithUser();\r
}\r
//\r
// If there is no build files or FPD files or MSA files, stop build\r
//\r
else {\r
- throw new BuildException("Can't find any FPD or MSA files in the current directory. ");\r
+ throw new BuildException("Can't find any FPD files or MSA files in current directory. ");\r
}\r
\r
//\r
// Build every FPD files (PLATFORM build)\r
//\r
if (buildFile.getName().endsWith(".fpd")) {\r
- System.out.println("Processing the FPD file [" + buildFile.getPath() + "] ..>> ");\r
+ System.out.println("Start to build FPD file [" + buildFile.getPath() + "] ..>> ");\r
FpdParserTask fpdParserTask = new FpdParserTask();\r
fpdParserTask.setType(type);\r
fpdParserTask.setProject(getProject());\r
//\r
else if (buildFile.getName().endsWith(".msa")) {\r
File tmpFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform);\r
- System.out.println("Using the FPD file [" + tmpFile.getPath() + "] for the active platform. ");\r
- System.out.println("Processing the MSA file [" + buildFile.getPath() + "] ..>> ");\r
+ System.out.println("Using FPD file [" + tmpFile.getPath() + "] as active platform. ");\r
+ System.out.println("Start to build MSA file [" + buildFile.getPath() + "] ..>> ");\r
GenBuildTask genBuildTask = new GenBuildTask();\r
genBuildTask.setSingleModuleBuild(true);\r
genBuildTask.setType(type);\r
\r
private File intercommuniteWithUser(){\r
File file = null;\r
- if (fpdFiles.size() > 1) {\r
- File[] allFiles = new File[fpdFiles.size()];\r
+ if (fpdFiles.size() + msaFiles.size() > 1) {\r
+ File[] allFiles = new File[fpdFiles.size() + msaFiles.size()];\r
int index = 0;\r
Iterator<File> iter = fpdFiles.iterator();\r
while (iter.hasNext()) {\r
allFiles[index] = iter.next();\r
index++;\r
}\r
-\r
- System.out.println("Finding " + allFiles.length + " FPD files: ");\r
+ iter = msaFiles.iterator();\r
+ while (iter.hasNext()) {\r
+ allFiles[index] = iter.next();\r
+ index++;\r
+ }\r
+ System.out.println("Find " + allFiles.length + " FPD and MSA files: ");\r
for (int i = 0; i < allFiles.length; i++) {\r
System.out.println("[" + (i + 1) + "]: " + allFiles[i].getName());\r
}\r
\r
boolean flag = true;\r
- System.out.print("Please select one of the following FPD files to build:[1] ");\r
+ System.out.print("Please select one file to build:[1] ");\r
do{\r
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r
try {\r
flag = true;\r
}\r
} while (flag);\r
- } else if (fpdFiles.size() == 1) {\r
+ }\r
+ else if (fpdFiles.size() == 1) {\r
file = fpdFiles.toArray(new File[1])[0];\r
}\r
+ else if (msaFiles.size() == 1) {\r
+ file = msaFiles.toArray(new File[1])[0];\r
+ }\r
return file;\r
}\r
\r
public void setType(String type) {\r
if (type.equalsIgnoreCase("clean") || type.equalsIgnoreCase("cleanall")) {\r
this.type = type.toLowerCase();\r
- } else {\r
+ }\r
+ else {\r
this.type = "all";\r
}\r
}\r
\r
private void readTargetFile(){\r
try {\r
- String[][] targetFileInfo = ConfigReader.parse(getProject().getProperty("WORKSPACE_DIR"), "Tools" + File.separatorChar + "Conf" + File.separatorChar + targetFilename);\r
+ String targetFile = getProject().getProperty("WORKSPACE_DIR") + File.separatorChar \r
+ + "Tools" + File.separatorChar + "Conf" + File.separatorChar + targetFilename;\r
+ String[][] targetFileInfo = ConfigReader.parse(targetFile);\r
\r
//\r
// Get ToolChain Info from target.txt\r
String str = getValue("TARGET", targetFileInfo);\r
if (str == null || str.trim().equals("")) {\r
envToolChainInfo.addTargets("*");\r
- } else {\r
+ }\r
+ else {\r
envToolChainInfo.addTargets(str);\r
}\r
str = getValue("TOOL_CHAIN_TAG", targetFileInfo);\r
if (str == null || str.trim().equals("")) {\r
envToolChainInfo.addTagnames("*");\r
- } else {\r
+ }\r
+ else {\r
envToolChainInfo.addTagnames(str);\r
}\r
str = getValue("TARGET_ARCH", targetFileInfo);\r
if (str == null || str.trim().equals("")) {\r
envToolChainInfo.addArchs("*");\r
- } else {\r
+ }\r
+ else {\r
envToolChainInfo.addArchs(str);\r
}\r
GlobalData.setToolChainEnvInfo(envToolChainInfo);\r
str = getValue("ACTIVE_PLATFORM", targetFileInfo);\r
if (str != null && ! str.trim().equals("")) {\r
if ( ! str.endsWith(".fpd")) {\r
- throw new BuildException("FPD file's extension must be \".fpd\"!");\r
+ throw new BuildException("FPD file's file extension must be \".fpd\"");\r
}\r
activePlatform = str;\r
}\r