]> git.proxmox.com Git - mirror_edk2.git/commitdiff
add ContextTool to workspace/Tools
authorjjin9 <jjin9@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 1 Sep 2006 09:21:38 +0000 (09:21 +0000)
committerjjin9 <jjin9@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 1 Sep 2006 09:21:38 +0000 (09:21 +0000)
In directory: workspace/Tools/bin
please type: ContextTool to see the usage help

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1427 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/ContextTool/build.xml [new file with mode: 0644]
Tools/Source/ContextTool/org/tianocore/context/ContextMain.java [new file with mode: 0644]
Tools/Source/ContextTool/org/tianocore/context/HelpInfo.java [new file with mode: 0644]
Tools/Source/ContextTool/org/tianocore/context/ParseParameter.java [new file with mode: 0644]
Tools/Source/ContextTool/org/tianocore/context/TargetFile.java [new file with mode: 0644]
Tools/bin/ContextTool [new file with mode: 0644]
Tools/bin/ContextTool.bat [new file with mode: 0644]
Tools/build.xml

diff --git a/Tools/Source/ContextTool/build.xml b/Tools/Source/ContextTool/build.xml
new file mode 100644 (file)
index 0000000..1356779
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>\r
+<!--\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+-->\r
+<project name="ContextTool" default="ContextTool" basedir=".">\r
+\r
+  <taskdef resource="net/sf/antcontrib/antlib.xml"/>\r
+  <property environment="env"/>\r
+  <property name="WORKSPACE" value="${env.WORKSPACE}"/>\r
+  <path id="classpath">\r
+    <fileset dir="${WORKSPACE}/Tools/Jars" includes="SurfaceArea.jar"/>\r
+    <fileset dir="${WORKSPACE}/Tools/Jars" includes="Common.jar"/>\r
+    <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>\r
+  </path>\r
+  <property name="buildDir" value="build"/>\r
+  <property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>\r
+  <target name="ContextTool" depends="install"/>\r
+  <target name="source">\r
+    <mkdir dir="${buildDir}"/>\r
+    <javac srcdir="." destdir="${buildDir}">\r
+      <classpath refid="classpath"/>\r
+      <compilerarg value="-Xlint"/>\r
+    </javac>\r
+  </target>\r
+  <target name="clean">\r
+    <delete dir="${buildDir}"/>\r
+  </target>\r
+  <target name="cleanall">\r
+    <delete dir="${buildDir}"/>\r
+    <delete file="${installLocation}/ContextTool.jar"/>\r
+    <if>\r
+      <available file="${installLocation}/ContextTool.jar"/>\r
+      <then>\r
+        <echo message="You must manually remove the file: ${installLocation}/ContextTool.jar"/>\r
+        <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>\r
+      </then>\r
+    </if>\r
+  </target>\r
+  <target name="install" depends="source">\r
+    <jar destfile="${installLocation}/ContextTool.jar"\r
+      basedir="${buildDir}"\r
+      includes="**"\r
+    />\r
+  </target>\r
+</project>\r
+\r
diff --git a/Tools/Source/ContextTool/org/tianocore/context/ContextMain.java b/Tools/Source/ContextTool/org/tianocore/context/ContextMain.java
new file mode 100644 (file)
index 0000000..991d81a
--- /dev/null
@@ -0,0 +1,17 @@
+package org.tianocore.context;\r
+\r
+public class ContextMain {\r
+    \r
+    public static void main(String[] args) {\r
+\r
+        if(ParseParameter.checkParameter(args) == false){\r
+            System.exit(0);\r
+        }\r
+\r
+        if (TargetFile.parsePath("target.txt") == false) {\r
+            System.exit(0);\r
+        }\r
+        \r
+        System.out.printf("%n%s", "Target.txt generate successfully!");\r
+    }\r
+}\r
diff --git a/Tools/Source/ContextTool/org/tianocore/context/HelpInfo.java b/Tools/Source/ContextTool/org/tianocore/context/HelpInfo.java
new file mode 100644 (file)
index 0000000..09daf02
--- /dev/null
@@ -0,0 +1,109 @@
+package org.tianocore.context;\r
+\r
+public class HelpInfo {\r
+\r
+    \r
+    /** \r
+     * output the tools usage guide\r
+     * @param no input parameter\r
+     * @return no return value\r
+     **/\r
+    public static void outputUsageInfo() {\r
+        System.out.printf("\n%s", UsageInfoString);\r
+        System.out.printf("\n%s", DetailOfOptionString);\r
+\r
+        for (int i = 0; i < 6; i++) {\r
+            outputSubUsageInfo(UsageString[i], UsageStringInfo[i]);\r
+        }\r
+    }\r
+\r
+    /** \r
+     * output the usage info which bases on cmd option \r
+     * @param String str1 : the cmd option\r
+     *         String str2 : the detail of cmd option\r
+     * @return no return value\r
+     **/\r
+    private static void outputSubUsageInfo(String str1, String str2) {\r
+        splitString(str2);\r
+        if (substrnum > 0) {\r
+            System.out.printf("\n%4s %-30s %s", "", str1, substr[0]);\r
+            for (int i = 1; i < substrnum; i++) {\r
+                if (substr[i] != null)\r
+                    System.out.printf("\n%4s %-30s %s", "", "", substr[i]);\r
+            }\r
+            substrnum = 0;\r
+        } else {\r
+            System.out.printf("\n%4s %-30s %s", "", str1, str2);\r
+        }\r
+    }\r
+\r
+    /** \r
+     * according to the output width, split the detail info  \r
+     * @param String str :the detail info\r
+     * @return no return value\r
+     **/\r
+    private static void splitString(String str) {\r
+        int strlength = str.length();\r
+        if (strlength > MaxSrtingLength) {\r
+            \r
+            //we should modify the array to list, for it is strange to + 2\r
+            substrnum = strlength / MaxSrtingLength + 2;\r
+            String[] tokens = str.split("[ ]", 0);\r
+            substr = new String[substrnum];\r
+            int templength = 0;\r
+            int j = 0;\r
+            int start = 0;\r
+            int end = 0;\r
+            for (int i = 0; i < tokens.length; i++) {\r
+                if ((templength = end + tokens[i].length() + 1) < (MaxSrtingLength + start)) {\r
+                    end = templength;\r
+                } else {\r
+                    substr[j++] = str.substring(start, end);\r
+                    start = end;\r
+                    i = i - 1;\r
+                }\r
+            }\r
+            substr[j] = str.substring(start, end - 1);\r
+        }\r
+    }\r
+\r
+    private static String[] substr = null;\r
+\r
+    private static int substrnum = 0;\r
+\r
+    private static final int MaxSrtingLength = 40;\r
+\r
+    private static final String UsageInfoString = "Usage: context [-option1] [args] [-option2] [args] ...";\r
+\r
+    private static final String DetailOfOptionString = "Where options include:";\r
+\r
+    private static final String HString = "-h";\r
+\r
+    private static final String HStringInfo = "print this help message";\r
+\r
+    private static final String AString = "-a  <list of Arch>";\r
+\r
+    private static final String AStringInfo = "what kind of architechure is the binary target, such as IA32, IA64, X64, EBC, or ARM. Multiple values can be specified on a single line, using space to separate the values.";\r
+\r
+    private static final String CString = "-c  <tool_definition_file.txt>";\r
+\r
+    private static final String CStringInfo = "Assign a txt file, which specify the tools to use for the build and must be located in the path: WORKSPACE/Tools/Conf/. If no file is specified, the default filename is \"tools_def.txt\"";\r
+\r
+    private static final String NString = "-n  <list of TagNames>";\r
+\r
+    private static final String NStringInfo = "Specify the TagName, such as GCC, MSFT, which are defined in the \"tool_definition_file.txt\"";\r
+\r
+    private static final String PString = "-p  <*.fpd>";\r
+\r
+    private static final String PStringInfo = "Specify the WORKSPACE relative Path and Filename of platform FPD file that will be used for the build.";\r
+\r
+    private static final String TString = "-t  <list of Build Targets>";\r
+\r
+    private static final String TStringInfo = "What kind of the version is the binary target, such as DEBUG, RELEASE. Multiple values can be specified on a single line, using space to separate the values.";\r
+\r
+    private static final String[] UsageString = { HString, AString, CString,\r
+            NString, PString, TString };\r
+\r
+    private static final String[] UsageStringInfo = { HStringInfo, AStringInfo,\r
+            CStringInfo, NStringInfo, PStringInfo, TStringInfo };\r
+}\r
diff --git a/Tools/Source/ContextTool/org/tianocore/context/ParseParameter.java b/Tools/Source/ContextTool/org/tianocore/context/ParseParameter.java
new file mode 100644 (file)
index 0000000..d74801e
--- /dev/null
@@ -0,0 +1,86 @@
+package org.tianocore.context;\r
+\r
+public class ParseParameter {\r
+\r
+    \r
+    /** \r
+     * check the validity of user's input args\r
+     * @param args -- user's input\r
+     * @return true or false\r
+     **/\r
+    public static boolean checkParameter(String[] args) {\r
+        \r
+        if(args.length == 0){\r
+            HelpInfo.outputUsageInfo();\r
+            return false;\r
+        } else {\r
+            if( args[0].charAt(0) != '-' ){\r
+                HelpInfo.outputUsageInfo();\r
+                return false;\r
+            }\r
+            for(int i=0; i<args.length; i++){\r
+                if( (args[i].compareToIgnoreCase("-h") == 0) || \r
+                    (args[i].startsWith("-") && ((args[i].charAt(1) != 'a') && (args[i].charAt(1) != 'c') \r
+                    && (args[i].charAt(1) != 'n') && (args[i].charAt(1) != 'p') && (args[i].charAt(1) != 't')))){\r
+                    HelpInfo.outputUsageInfo();\r
+                    return false;\r
+                }\r
+            }\r
+        }\r
+        \r
+        standardizeParameter(args);\r
+        return true; \r
+    }\r
+    \r
+    /** \r
+     * standardize user's input args\r
+     * @param args -- user's input\r
+     * @return no return value\r
+     **/\r
+    private static void standardizeParameter(String[] args) {\r
+        \r
+        length  = pstr.length();\r
+        \r
+        StringBuffer InputData = new StringBuffer();\r
+        for (int i = 0; i < args.length; i++) {\r
+            InputData.append(args[i]);\r
+            InputData.append(" ");\r
+        }\r
+\r
+        int i = 0;\r
+        while (i < InputData.length()) {\r
+            int j = InputData.indexOf("-", i + 1);\r
+            if (j == -1)\r
+                j = InputData.length();\r
+\r
+            String argstr = InputData.substring(i, j);\r
+\r
+            if (argstr.charAt(1) == 'p') {\r
+                pstr += argstr.substring(2);\r
+ //               pstr += "\n";\r
+            } else if (argstr.charAt(1) == 't') {\r
+                tstr += argstr.substring(2);\r
+ //               tstr += "\n";\r
+            } else if (argstr.charAt(1) == 'a') {\r
+                astr += argstr.substring(2);\r
+//                astr += "\n";\r
+            } else if (argstr.charAt(1) == 'c') {\r
+                cstr += argstr.substring(2);\r
+//                cstr += "\n";\r
+            } else if (argstr.charAt(1) == 'n') {\r
+                nstr += argstr.substring(2);\r
+//                nstr += "\n";\r
+            }\r
+            i = j;\r
+        }\r
+\r
+    }\r
+     \r
+    public static int length  = 0;\r
+    public static String pstr = new String("ACTIVE_PLATFORM       = ");\r
+    public static String tstr = new String("TARGET                = ");\r
+    public static String astr = new String("TARGET_ARCH           = ");\r
+    public static String cstr = new String("TOOL_CHAIN_CONF       = ");\r
+    public static String nstr = new String("TOOL_CHAIN_TAG        = ");\r
+\r
+}\r
diff --git a/Tools/Source/ContextTool/org/tianocore/context/TargetFile.java b/Tools/Source/ContextTool/org/tianocore/context/TargetFile.java
new file mode 100644 (file)
index 0000000..2374c1b
--- /dev/null
@@ -0,0 +1,322 @@
+package org.tianocore.context;\r
+\r
+import java.io.BufferedReader;\r
+import java.io.BufferedWriter;\r
+import java.io.File;\r
+import java.io.FileNotFoundException;\r
+import java.io.FileOutputStream;\r
+import java.io.FileReader;\r
+import java.io.FileWriter;\r
+import java.io.IOException;\r
+import java.nio.ByteBuffer;\r
+import java.nio.channels.FileChannel;\r
+\r
+public class TargetFile {\r
+\r
+    /** \r
+     * check the validity of path and file\r
+     * @param String filename : the name of target file\r
+     * @return true or false\r
+     **/\r
+    public static boolean parsePath(String filename) {\r
+\r
+        String workspacePath = System.getenv("WORKSPACE");\r
+        \r
+        Fd = new File(workspacePath + File.separator + "Tools" + File.separator + "Conf" + File.separator + filename);\r
+\r
+        if (Fd.exists() == true) {\r
+            if (createTempFile(filename + "tmp") == false) {\r
+                return false;\r
+            }\r
+            if (readwriteFile() == false) {\r
+                return false;\r
+            }\r
+            return true;\r
+        } else {\r
+            try {\r
+                Fd.createNewFile();\r
+            } catch (IOException e) {\r
+                System.out.printf("%n%s", "Create the file:target.txt failed!");\r
+                return false;\r
+            }\r
+        }\r
+        TargetFile.writeFile(Fd);\r
+        return true;\r
+    }\r
+\r
+    /**\r
+     * create a empty temp file, which is located at the same directory with target file\r
+     * @param String filename : the name of target temp file\r
+     * @return true or false\r
+     **/\r
+    private static boolean createTempFile(String filename) {\r
+\r
+        String workspacePath = System.getenv("WORKSPACE");\r
+        \r
+        TempFd = new File(workspacePath + File.separator + "Tools" + File.separator + "Conf" + File.separator + filename);\r
+\r
+        if (TempFd.exists() == true) {\r
+            if (TempFd.delete() == false) {\r
+                System.out.println("\n#  delete file failed !");\r
+                return false;\r
+            }\r
+        }\r
+        try {\r
+            TempFd.createNewFile();\r
+        } catch (IOException e) {\r
+            System.out.printf("%n%s",\r
+                    "Create the temp file:target.txttmp failed!");\r
+            return false;\r
+        }\r
+\r
+        return true;\r
+    }\r
+\r
+    /**\r
+     * read from target.txt and write to target.txttmp, del target.txt, rename\r
+     * @param no paremeter\r
+     * @return true or false\r
+     **/\r
+    private static boolean readwriteFile() {\r
+\r
+        if (Fd.canRead() != true)\r
+            return false;\r
+\r
+        BufferedReader br = null;\r
+        BufferedWriter bw = null;\r
+        String textLine = null;\r
+\r
+        try {\r
+            br = new BufferedReader(new FileReader(Fd));\r
+        } catch (FileNotFoundException e) {\r
+            System.out\r
+                    .println("\n# create the BufferedReader failed, because can't find the file:target.txt!");\r
+            return false;\r
+        }\r
+        try {\r
+            bw = new BufferedWriter(new FileWriter(TempFd));\r
+        } catch (IOException e) {\r
+            System.out.println("\n# create the BufferedWriter failed!");\r
+            return false;\r
+        }\r
+        \r
+        //\r
+        //TARGET_ARCH must be in front of TARGET!!! according to the target.txt\r
+        //\r
+        try {\r
+            while ((textLine = br.readLine()) != null) {\r
+                if (textLine.trim().compareToIgnoreCase("") == 0) {\r
+                    bw.write(textLine);\r
+                    bw.newLine();\r
+                } else if ((textLine.trim().charAt(0) == '#') && (textLine.indexOf("=") == -1)){\r
+                    bw.write(textLine);\r
+                    bw.newLine();\r
+                } else {\r
+                    if (textLine.indexOf("ACTIVE_PLATFORM") != -1) {\r
+                        if(ParseParameter.pstr.length() > ParseParameter.length) {\r
+                            bw.write(ParseParameter.pstr);\r
+                        } else {\r
+                            bw.write(textLine);\r
+                        }\r
+                        bw.newLine();\r
+                    } else if (textLine.indexOf("TARGET_ARCH") != -1) {\r
+                        if(ParseParameter.astr.length() > ParseParameter.length) {\r
+                            bw.write(ParseParameter.astr);\r
+                        } else {\r
+                            bw.write(textLine);\r
+                        }\r
+                        bw.newLine();\r
+                    } else if (textLine.indexOf("TARGET") != -1) {\r
+                        if(ParseParameter.tstr.length() > ParseParameter.length) {\r
+                            bw.write(ParseParameter.tstr);\r
+                        } else {\r
+                            bw.write(textLine);\r
+                        }\r
+                        bw.newLine();\r
+                    } else if (textLine.indexOf("TOOL_CHAIN_CONF") != -1) {\r
+                        if(ParseParameter.cstr.length() > ParseParameter.length) {\r
+                            bw.write(ParseParameter.cstr);\r
+                        } else {\r
+                            bw.write(textLine);\r
+                        }\r
+                        bw.newLine();\r
+                    } else if (textLine.indexOf("TOOL_CHAIN_TAG") != -1) {\r
+                        if(ParseParameter.nstr.length() > ParseParameter.length) {\r
+                            bw.write(ParseParameter.nstr);\r
+                        } else {\r
+                            bw.write(textLine);\r
+                        }\r
+                        bw.newLine();\r
+                    }\r
+                }\r
+            }\r
+        } catch (IOException e) {\r
+            System.out.println("\n#  read or write file error!");\r
+            return false;\r
+        }\r
+\r
+        try {\r
+            br.close();\r
+            bw.close();\r
+        } catch (IOException e) {\r
+            System.out\r
+                    .println("\n#  close BufferedReader&BufferedWriter error");\r
+            return false;\r
+        }\r
+\r
+        if (Fd.delete() == false) {\r
+            System.out.println("\n#  delete file failed !");\r
+            return false;\r
+        }\r
+        if (TempFd.renameTo(Fd) == false) {\r
+            System.out.println("\n#  rename file failed !");\r
+            return false;\r
+        }\r
+\r
+        return true;\r
+    }\r
+\r
+    /**\r
+     * according to user's input args, write the file directly\r
+     * @param File fd : the File of the target file\r
+     * @return true or false\r
+     **/\r
+    private static boolean writeFile(File fd) {\r
+\r
+        if (fd.canWrite() != true)\r
+            return false;\r
+\r
+        FileOutputStream outputFile = null;\r
+        try {\r
+            outputFile = new FileOutputStream(fd);\r
+        } catch (FileNotFoundException e) {\r
+            System.out\r
+                    .println("\n#  can't find the file when open the output stream !");\r
+            return false;\r
+        }\r
+        FileChannel outputChannel = outputFile.getChannel();\r
+\r
+        ByteBuffer[] buffers = new ByteBuffer[5];\r
+        buffers[0] = ByteBuffer.allocate(ParseParameter.pstr.toString().length());\r
+        buffers[1] = ByteBuffer.allocate(ParseParameter.tstr.toString().length());\r
+        buffers[2] = ByteBuffer.allocate(ParseParameter.astr.toString().length());\r
+        buffers[3] = ByteBuffer.allocate(ParseParameter.cstr.toString().length());\r
+        buffers[4] = ByteBuffer.allocate(ParseParameter.nstr.toString().length());\r
+\r
+        buffers[0].put(ParseParameter.pstr.toString().getBytes()).flip();\r
+        buffers[1].put(ParseParameter.tstr.toString().getBytes()).flip();\r
+        buffers[2].put(ParseParameter.astr.toString().getBytes()).flip();\r
+        buffers[3].put(ParseParameter.cstr.toString().getBytes()).flip();\r
+        buffers[4].put(ParseParameter.nstr.toString().getBytes()).flip();\r
+\r
+        try {\r
+            ByteBuffer bufofCP = ByteBuffer.allocate(Copyright.length());\r
+            bufofCP.put(Copyright.getBytes()).flip();\r
+            outputChannel.write(bufofCP);\r
+            \r
+            ByteBuffer bufofFI = ByteBuffer.allocate(Fileinfo.length());\r
+            bufofFI.put(Fileinfo.getBytes()).flip();\r
+            outputChannel.write(bufofFI);\r
+            \r
+            ByteBuffer buffer0 = ByteBuffer.allocate(pusage.length());\r
+            buffer0.put(pusage.getBytes()).flip();\r
+            outputChannel.write(buffer0);\r
+            outputChannel.write(buffers[0]);\r
+            \r
+            ByteBuffer buffer1 = ByteBuffer.allocate(tusage.length());\r
+            buffer1.put(tusage.getBytes()).flip();\r
+            outputChannel.write(buffer1);\r
+            outputChannel.write(buffers[1]);\r
+            \r
+            ByteBuffer buffer2 = ByteBuffer.allocate(ausage.length());\r
+            buffer2.put(ausage.getBytes()).flip();\r
+            outputChannel.write(buffer2);\r
+            outputChannel.write(buffers[2]);\r
+            \r
+            ByteBuffer buffer3 = ByteBuffer.allocate(cusage.length());\r
+            buffer3.put(cusage.getBytes()).flip();\r
+            outputChannel.write(buffer3);\r
+            outputChannel.write(buffers[3]);\r
+            \r
+            ByteBuffer buffer4 = ByteBuffer.allocate(nusage.length());\r
+            buffer4.put(nusage.getBytes()).flip();\r
+            outputChannel.write(buffer4);\r
+            outputChannel.write(buffers[4]);\r
+            \r
+            outputFile.close();\r
+        } catch (IOException e) {\r
+            System.out.println("\n# The operations of file failed !");\r
+            return false;\r
+        }\r
+        return true;\r
+    }\r
+\r
+    ///\r
+    /// point to target.txttmp, a temp file, which is created and deleted during the tool's runtime.\r
+    ///\r
+    private static File TempFd;\r
+    \r
+    ///\r
+    /// point to target.txt.\r
+    ///\r
+    private static File Fd;\r
+\r
+    private static final String Copyright = "#\n"\r
+            + "#  Copyright (c) 2006, Intel Corporation\n"\r
+            + "#\n"\r
+            + "#  All rights reserved. This program and the accompanying materials\n"\r
+            + "#  are licensed and made available under the terms and conditions of the BSD License\n"\r
+            + "#  which accompanies this distribution.  The full text of the license may be found at\n"\r
+            + "#  http://opensource.org/licenses/bsd-license.php\n"\r
+            + "\n"\r
+            + "#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN \"AS IS\" BASIS,\n"\r
+            + "#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\n";\r
+\r
+    private static final String Fileinfo = "#\n"\r
+            + "#  Filename: target.template\n"\r
+            + "#\n"\r
+            + "#  ALL Paths are Relative to WORKSPACE\n"\r
+            + "\n"\r
+            + "#  Separate multiple LIST entries with a SINGLE SPACE character, do not use comma characters.\n"\r
+            + "#  Un-set an option by either commenting out the line, or not setting a value.\n";\r
+\r
+    private static final String pusage = "#\n"\r
+            + "#  PROPERTY              Type       Use         Description\n"\r
+            + "#  ----------------      --------   --------    -----------------------------------------------------------\n"\r
+            + "#  ACTIVE_PLATFORM       Filename   Recommended Specify the WORKSPACE relative Path and Filename\n"\r
+            + "#                                               of the platform FPD file that will be used for the build\n"\r
+            + "#                                               This line is required if and only if the current working\n"\r
+            + "#                                               directory does not contain one or more FPD files.\n";\r
+\r
+    private static final String tusage = "\n\n"\r
+            + "#  TARGET                List       Optional    Zero or more of the following: DEBUG, RELEASE, \n"\r
+            + "#                                               UserDefined; separated by a space character.  \n"\r
+            + "#                                               If the line is missing or no value is specified, all\n"\r
+            + "#                                               valid targets specified in the FPD file will attempt \n"\r
+            + "#                                               to be built.  The following line will build all platform\n"\r
+            + "#                                               targets.\n";\r
+\r
+    private static final String ausage = "\n\n"\r
+            + "#  TARGET_ARCH           List       Optional    What kind of architecture is the binary being target for.\n"\r
+            + "#                                               One, or more, of the following, IA32, IA64, X64, EBC or ARM.\n"\r
+            + "#                                               Multiple values can be specified on a single line, using \n"\r
+            + "#                                               space charaters to separate the values.  These are used \n"\r
+            + "#                                               during the parsing of an FPD file, restricting the build\n"\r
+            + "#                                               output target(s.)\n"\r
+            + "#                                               The Build Target ARCH is determined by a logical AND of:\n"\r
+            + "#                                               FPD BuildOptions: <SupportedArchitectures> tag\n"\r
+            + "#                                               If not specified, then all valid architectures specified \n"\r
+            + "#                                               in the FPD file, for which tools are available, will be \n"\r
+            + "#                                               built.\n";\r
+\r
+    private static final String cusage = "\n\n"\r
+            + "#  TOOL_DEFINITION_FILE  Filename  Optional   Specify the name of the filename to use for specifying \n"\r
+            + "#                                             the tools to use for the build.  If not specified, \n"\r
+            + "#                                             tools_def.txt will be used for the build.  This file \n"\r
+            + "#                                             MUST be located in the WORKSPACE/Tools/Conf directory.\n";\r
+\r
+    private static final String nusage = "\n\n"\r
+            + "#  TAGNAME               List      Optional   Specify the name(s) of the tools_def.txt TagName to use.\n"\r
+            + "#                                             If not specified, all applicable TagName tools will be \n"\r
+            + "#                                             used for the build.  The list uses space character separation.\n";\r
+}\r
diff --git a/Tools/bin/ContextTool b/Tools/bin/ContextTool
new file mode 100644 (file)
index 0000000..3bd2311
--- /dev/null
@@ -0,0 +1,15 @@
+#\r
+# Copyright (c) 2006, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# \r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+\r
+export CLASSPATH=$CLASSPATH:$WORKSPACE/Tools/bin/ContextTool.jar\r
+\r
+# Run Framework Wizard\r
+java org.tianocore.context.ContextMain\r
diff --git a/Tools/bin/ContextTool.bat b/Tools/bin/ContextTool.bat
new file mode 100644 (file)
index 0000000..69ca4fc
--- /dev/null
@@ -0,0 +1,73 @@
+@REM\r
+@REM Copyright (c) 2006, Intel Corporation\r
+@REM All rights reserved. This program and the accompanying materials\r
+@REM are licensed and made available under the terms and conditions of the BSD License\r
+@REM which accompanies this distribution.  The full text of the license may be found at\r
+@REM http://opensource.org/licenses/bsd-license.php\r
+@REM \r
+@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+@REM\r
+\r
+@echo off\r
+\r
+:check_java\r
+if "%JAVA_HOME%"=="" goto no_jdk\r
+:check_wks\r
+if "%WORKSPACE%"=="" goto no_wks\r
+:check_ant\r
+if "%ANT_HOME%"=="" goto no_ant\r
+:check_xmlbeans\r
+if "%XMLBEANS_HOME%"=="" goto no_xmlbeans\r
+:check_surfacearea\r
+if not exist %WORKSPACE%\Tools\Jars\SurfaceArea.jar (\r
+  goto no_surfacearea\r
+)\r
+:check_ContextTool\r
+if not exist %WORKSPACE%\Tools\Jars\ContextTool.jar (\r
+  goto no_ContextTool\r
+)\r
+\r
+@REM Run Framework Wizard\r
+call "java" -cp %CLASSPATH%;%WORKSPACE%\Tools\Jars\ContextTool.jar org.tianocore.context.ContextMain %*\r
+\r
+goto end\r
+\r
+:no_jdk\r
+@echo.\r
+@echo !!! Please set JAVA_HOME !!!\r
+@echo.\r
+goto check_wks\r
+\r
+:no_wks\r
+@echo.\r
+@echo !!! Please set WORKSPACE !!!\r
+@echo.\r
+goto check_ant\r
+\r
+:no_ant\r
+@echo.\r
+@echo !!! Please set ANT_HOME !!!\r
+@echo.\r
+goto check_xmlbeans\r
+\r
+:no_xmlbeans\r
+@echo.\r
+@echo !!! Please set XMLBEANS_HOME !!!\r
+@echo.\r
+goto end\r
+\r
+:no_surfacearea\r
+@echo.\r
+@echo !!! Please run edksetup.bat to build SurfaceArea.jar !!!\r
+@echo.\r
+goto end\r
+\r
+:no_ContextTool\r
+@echo.\r
+@echo !!! Please run edksetup.bat to build ContextTool.jar !!!\r
+@echo.\r
+goto end\r
+\r
+:end\r
+@echo on\r
index 9e07a3d5e38d4b313b91b8895912d44bbc73d8df..06cc9211d7ce516afec7e37432ee275ffe82d87a 100644 (file)
@@ -39,6 +39,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
           Source/Cpptasks/build.xml\r
           Source/FrameworkWizard/build.xml\r
           Source/MigrationTools/build.xml\r
           Source/Cpptasks/build.xml\r
           Source/FrameworkWizard/build.xml\r
           Source/MigrationTools/build.xml\r
+          Source/ContextTool/build.xml\r
           "/>\r
     </subant>\r
     <echo message="The EDK II Java Tools build has completed!"/>\r
           "/>\r
     </subant>\r
     <echo message="The EDK II Java Tools build has completed!"/>\r
@@ -99,6 +100,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
           Source/SurfaceArea/build.xml \r
           Source/TianoTools/build.xml\r
           Source/MigrationTools/build.xml\r
           Source/SurfaceArea/build.xml \r
           Source/TianoTools/build.xml\r
           Source/MigrationTools/build.xml\r
+          Source/ContextTool/build.xml\r
         "/>\r
     </subant>\r
   </target>\r
         "/>\r
     </subant>\r
   </target>\r
@@ -131,6 +133,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
           Source/SurfaceArea/build.xml \r
           Source/TianoTools/build.xml\r
           Source/MigrationTools/build.xml\r
           Source/SurfaceArea/build.xml \r
           Source/TianoTools/build.xml\r
           Source/MigrationTools/build.xml\r
+          Source/ContextTool/build.xml\r
         "/>\r
     </subant>\r
   </target>\r
         "/>\r
     </subant>\r
   </target>\r