X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Tools%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2FFrameworkBuildTask.java;h=d236c5b5bb586df335950045a0554e798e9dfae6;hb=5f907e4a5b747377513bb772e8fc87add4233ab0;hp=286fd69490d5b4bb46d42358552a9cf78e131f0c;hpb=196ad8d77c4a256e6a9b432541d688d2f40f4614;p=mirror_edk2.git diff --git a/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java index 286fd69490..d236c5b5bb 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java @@ -96,8 +96,10 @@ public class FrameworkBuildTask extends Task{ // // Global Data initialization // + File workspacePath = new File(getProject().getProperty("WORKSPACE")); + getProject().setProperty("WORKSPACE_DIR", workspacePath.getPath().replaceAll("(\\\\)", "/")); GlobalData.initInfo("Tools" + File.separatorChar + "Conf" + File.separatorChar + "FrameworkDatabase.db", - getProject().getProperty("WORKSPACE_DIR"), toolsDefFilename); + workspacePath.getPath(), toolsDefFilename); @@ -110,38 +112,33 @@ public class FrameworkBuildTask extends Task{ // File buildFile = null; if (msaFiles.size() > 1) { - throw new BuildException("More than one MSA file under current directory. It is not allowd. "); - } - else if (msaFiles.size() == 1 && activePlatform == null) { - throw new BuildException("If try to build a single module, please set ACTIVE_PLATFORM in file [Tool/Conf/target.txt]. "); - } - else if (msaFiles.size() == 1 && activePlatform != null) { + throw new BuildException("Having more than one MSA file in a directory is not allowed!"); + } else if (msaFiles.size() == 1 && activePlatform == null) { + throw new BuildException("If trying to build a single module, please set ACTIVE_PLATFORM in file [Tool/Conf/target.txt]. "); + } else if (msaFiles.size() == 1 && activePlatform != null) { // // Build the single module // buildFile = msaFiles.toArray(new File[1])[0]; - } - else if (activePlatform != null) { + } else if (activePlatform != null) { buildFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform); - } - else if (fpdFiles.size() == 1) { + } else if (fpdFiles.size() == 1) { buildFile = fpdFiles.toArray(new File[1])[0]; - } - else if (fpdFiles.size() > 1) { + } else if (fpdFiles.size() > 1) { buildFile = intercommuniteWithUser(); } // // If there is no build files or FPD files or MSA files, stop build // else { - throw new BuildException("Can't find any FPD files or MSA files in current directory. "); + throw new BuildException("Can't find any FPD or MSA files in the current directory. "); } // // Build every FPD files (PLATFORM build) // if (buildFile.getName().endsWith(".fpd")) { - System.out.println("Start to build FPD file [" + buildFile.getPath() + "] ..>> "); + System.out.println("Processing the FPD file [" + buildFile.getPath() + "] ..>> "); FpdParserTask fpdParserTask = new FpdParserTask(); fpdParserTask.setType(type); fpdParserTask.setProject(getProject()); @@ -153,7 +150,9 @@ public class FrameworkBuildTask extends Task{ // Build every MSA files (SINGLE MODULE BUILD) // else if (buildFile.getName().endsWith(".msa")) { - System.out.println("Start to build MSA file [" + buildFile.getPath() + "] ..>> "); + File tmpFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform); + System.out.println("Using the FPD file [" + tmpFile.getPath() + "] for the active platform. "); + System.out.println("Processing the MSA file [" + buildFile.getPath() + "] ..>> "); GenBuildTask genBuildTask = new GenBuildTask(); genBuildTask.setSingleModuleBuild(true); genBuildTask.setType(type); @@ -187,26 +186,22 @@ public class FrameworkBuildTask extends Task{ private File intercommuniteWithUser(){ File file = null; - if (fpdFiles.size() + msaFiles.size() > 1) { - File[] allFiles = new File[fpdFiles.size() + msaFiles.size()]; + if (fpdFiles.size() > 1) { + File[] allFiles = new File[fpdFiles.size()]; int index = 0; Iterator iter = fpdFiles.iterator(); while (iter.hasNext()) { allFiles[index] = iter.next(); index++; } - iter = msaFiles.iterator(); - while (iter.hasNext()) { - allFiles[index] = iter.next(); - index++; - } - System.out.println("Find " + allFiles.length + " FPD and MSA files: "); + + System.out.println("Finding " + allFiles.length + " FPD files: "); for (int i = 0; i < allFiles.length; i++) { System.out.println("[" + (i + 1) + "]: " + allFiles[i].getName()); } boolean flag = true; - System.out.print("Please select one file to build:[1] "); + System.out.print("Please select one of the following FPD files to build:[1] "); do{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { @@ -230,13 +225,9 @@ public class FrameworkBuildTask extends Task{ flag = true; } } while (flag); - } - else if (fpdFiles.size() == 1) { + } else if (fpdFiles.size() == 1) { file = fpdFiles.toArray(new File[1])[0]; } - else if (msaFiles.size() == 1) { - file = msaFiles.toArray(new File[1])[0]; - } return file; } @@ -244,8 +235,7 @@ public class FrameworkBuildTask extends Task{ public void setType(String type) { if (type.equalsIgnoreCase("clean") || type.equalsIgnoreCase("cleanall")) { this.type = type.toLowerCase(); - } - else { + } else { this.type = "all"; } } @@ -261,22 +251,19 @@ public class FrameworkBuildTask extends Task{ String str = getValue("TARGET", targetFileInfo); if (str == null || str.trim().equals("")) { envToolChainInfo.addTargets("*"); - } - else { + } else { envToolChainInfo.addTargets(str); } str = getValue("TOOL_CHAIN_TAG", targetFileInfo); if (str == null || str.trim().equals("")) { envToolChainInfo.addTagnames("*"); - } - else { + } else { envToolChainInfo.addTagnames(str); } str = getValue("TARGET_ARCH", targetFileInfo); if (str == null || str.trim().equals("")) { envToolChainInfo.addArchs("*"); - } - else { + } else { envToolChainInfo.addArchs(str); } GlobalData.setToolChainEnvInfo(envToolChainInfo); @@ -289,7 +276,7 @@ public class FrameworkBuildTask extends Task{ str = getValue("ACTIVE_PLATFORM", targetFileInfo); if (str != null && ! str.trim().equals("")) { if ( ! str.endsWith(".fpd")) { - throw new BuildException("FPD file's file extension must be \".fpd\""); + throw new BuildException("FPD file's extension must be \".fpd\"!"); } activePlatform = str; }