]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/ContextTool/org/tianocore/context/TargetFile.java
Retiring the ANT/JAVA build and removing the older EDK II packages that required...
[mirror_edk2.git] / Tools / Java / Source / ContextTool / org / tianocore / context / TargetFile.java
diff --git a/Tools/Java/Source/ContextTool/org/tianocore/context/TargetFile.java b/Tools/Java/Source/ContextTool/org/tianocore/context/TargetFile.java
deleted file mode 100644 (file)
index 122adf0..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-/** @file\r
-  File is TargetFile class which is used to generate the new target.txt. \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
-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.FileReader;\r
-import java.io.FileWriter;\r
-import java.io.IOException;\r
-\r
-public class TargetFile {\r
-\r
-   \r
-    \r
-    /** \r
-     * validate the filename\r
-     * @param String filename : the name of target file\r
-     * \r
-     * @return true or false\r
-     **/\r
-    public static boolean validateFilename(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 && Fd.canRead() == true)\r
-            return true;\r
-        else\r
-            return false;\r
-    }\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
-    public 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 + "tmp");\r
-\r
-        if (TempFd.exists() == true) {\r
-            if (TempFd.delete() == false) {\r
-                System.out.printf("%n%s%n", "target.txttmp has been existed, and failed in deletion!");\r
-                return false;\r
-            }\r
-        }\r
-        try {\r
-            TempFd.createNewFile();\r
-        } catch (IOException e) {\r
-            System.out.printf("%n%s%n", "Failed in creation of the temp file:target.txttmp!");\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
-    public 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# Creating BufferedReader fail!");\r
-            return false;\r
-        }\r
-        try {\r
-            bw = new BufferedWriter(new FileWriter(TempFd));\r
-        } catch (IOException e) {\r
-            System.out.println("\n# Creating the BufferedWriter fail!");\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
-                //\r
-                // the line is composed of Space\r
-                //\r
-                if (textLine.trim().compareToIgnoreCase("") == 0) {\r
-                    bw.write(textLine);\r
-                    bw.newLine();\r
-                } \r
-                //\r
-                // the line starts with "#", and no "="\r
-                //\r
-                else if ((textLine.trim().charAt(0) == '#') && (textLine.indexOf("=") == -1)){\r
-                    bw.write(textLine);\r
-                    bw.newLine();\r
-                } else {\r
-                    //\r
-                    //modify at the first time, and there should be "*ACTIVE_PLATFORM*=*" in the line\r
-                    //\r
-                    if (textLine.indexOf("ACTIVE_PLATFORM") != -1) {\r
-                        if(pflag == true){\r
-                            if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.npflag == true) {\r
-                                    bw.write(ParseParameter.curpstr);\r
-                                }else{\r
-                                    bw.write(textLine);\r
-                                }\r
-                                bw.newLine();\r
-                                pflag = false;\r
-                                continue;\r
-                            }\r
-                            if(ParseParameter.npflag == true) {\r
-                                bw.write(ParseParameter.curpstr);\r
-                            } else {\r
-                                bw.write(textLine);\r
-                            }\r
-                            bw.newLine();\r
-                            pflag = false;\r
-                        }\r
-                    } else if (textLine.indexOf("TARGET_ARCH") != -1) {\r
-                        if(aflag == true){\r
-                            if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.naflag == true) {\r
-                                    bw.write(ParseParameter.curastr);\r
-                                }else{\r
-                                    bw.write(textLine);\r
-                                }\r
-                                bw.newLine();\r
-                                aflag = false;\r
-                                continue;\r
-                            }\r
-                            if(ParseParameter.naflag == true) {\r
-                                bw.write(ParseParameter.curastr);\r
-                            } else {\r
-                                bw.write(textLine);\r
-                            }\r
-                            bw.newLine();\r
-                            aflag = false;\r
-                        }\r
-                    } else if (textLine.indexOf("TARGET") != -1) {\r
-                        if(tflag == true){\r
-                            if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.ntflag == true) {\r
-                                    bw.write(ParseParameter.curtstr);\r
-                                }else{\r
-                                    bw.write(textLine);\r
-                                }\r
-                                bw.newLine();\r
-                                tflag = false;\r
-                                continue;\r
-                            }\r
-                            if(ParseParameter.ntflag == true) {\r
-                                bw.write(ParseParameter.curtstr);\r
-                            } else {\r
-                                bw.write(textLine);\r
-                            }\r
-                            bw.newLine();\r
-                            tflag = false;\r
-                        }\r
-                    } else if (textLine.indexOf("TOOL_CHAIN_CONF") != -1) {\r
-                        if(cflag == true){\r
-                            if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.ncflag == true) {\r
-                                    bw.write(ParseParameter.curcstr);\r
-                                }else{\r
-                                    bw.write(textLine);\r
-                                }\r
-                                bw.newLine();\r
-                                cflag = false;\r
-                                continue;\r
-                            }\r
-                            if(ParseParameter.ncflag == true) {\r
-                                bw.write(ParseParameter.curcstr);\r
-                            } else {\r
-                                bw.write(textLine);\r
-                            }\r
-                            bw.newLine();\r
-                            cflag = false;\r
-                        }\r
-                    } else if (textLine.indexOf("TOOL_CHAIN_TAG") != -1) {\r
-                        if(nflag == true){\r
-                            if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.nnflag == true) {\r
-                                    bw.write(ParseParameter.curnstr);\r
-                                }else{\r
-                                    bw.write(textLine);\r
-                                }\r
-                                bw.newLine();\r
-                                nflag = false;\r
-                                continue;\r
-                            }\r
-                            if(ParseParameter.nnflag == true) {\r
-                                bw.write(ParseParameter.curnstr);\r
-                            } else {\r
-                                bw.write(textLine);\r
-                            }\r
-                            bw.newLine();\r
-                            nflag = false;\r
-                        }\r
-                    } else if (textLine.indexOf("MAX_CONCURRENT_THREAD_NUMBER") != -1) {\r
-                        if(mflag == true){\r
-                            if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.nmflag == true) {\r
-                                    bw.write(ParseParameter.curmstr);\r
-                                }else{\r
-                                    bw.write(textLine);\r
-                                }\r
-                                bw.newLine();\r
-                                mflag = false;\r
-                                continue;\r
-                            }\r
-                            if(ParseParameter.nmflag == true) {\r
-                                bw.write(ParseParameter.curmstr);\r
-                            } else {\r
-                                bw.write(textLine);\r
-                            }\r
-                            bw.newLine();\r
-                            mflag = false;\r
-                        }\r
-                    }else if (textLine.indexOf("MULTIPLE_THREAD") != -1) {\r
-                        if(meflag == true){\r
-                            if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.nmeflag == true) {\r
-                                    bw.write(ParseParameter.curmestr);\r
-                                }else{\r
-                                    bw.write(textLine);\r
-                                }\r
-                                bw.newLine();\r
-                                meflag = false;\r
-                                continue;\r
-                            }\r
-                            if(ParseParameter.nmeflag == true) {\r
-                                bw.write(ParseParameter.curmestr);\r
-                            } else {\r
-                                bw.write(textLine);\r
-                            }\r
-                            bw.newLine();\r
-                            meflag = false;\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-            //\r
-            //user maybe delete the line *ACTIVE_PLATFORM*=*\r
-            //\r
-            if( (pflag == true) && (ParseParameter.npflag == true) ){\r
-                bw.write(ParseParameter.curpstr);\r
-                bw.newLine();\r
-            } else if ( (tflag == true) && (ParseParameter.ntflag == true) ){\r
-                bw.write(ParseParameter.curtstr);\r
-                bw.newLine();\r
-            } else if ( (aflag == true) && (ParseParameter.naflag == true) ){\r
-                bw.write(ParseParameter.curastr);\r
-                bw.newLine();\r
-            } else if ( (cflag == true) && (ParseParameter.ncflag == true) ){\r
-                bw.write(ParseParameter.curcstr);\r
-                bw.newLine();\r
-            } else if ( (nflag == true) && (ParseParameter.nnflag == true) ){\r
-                bw.write(ParseParameter.curnstr);\r
-                bw.newLine();\r
-            } else if ( (meflag == true) && (ParseParameter.nmeflag == true) ){\r
-                bw.write(ParseParameter.curmestr);\r
-                bw.newLine();\r
-            } else if ( (mflag == true) && (ParseParameter.nmflag == true) ){\r
-                bw.write(ParseParameter.curmstr);\r
-                bw.newLine();\r
-            }\r
-        } catch (IOException e) {\r
-            System.out.println("\n# Reading or Writing file fail!");\r
-            return false;\r
-        }\r
-\r
-        try {\r
-            br.close();\r
-            bw.close();\r
-        } catch (IOException e) {\r
-            System.out\r
-                    .println("\n# Closing BufferedReader&BufferedWriter fail!");\r
-            return false;\r
-        }\r
-\r
-        if (Fd.delete() == false) {\r
-            System.out.println("\n# Deleting file fail!");\r
-            return false;\r
-        }\r
-        if (TempFd.renameTo(Fd) == false) {\r
-            System.out.println("\n#  Renaming file failed!");\r
-            return false;\r
-        }\r
-\r
-        return true;\r
-    }\r
-    \r
-    /**\r
-     * read the file and output the lines which include setting\r
-     * @param File fd : the File of the target file\r
-     * @return String: the current setting\r
-     **/\r
-    public static boolean readFile() {\r
-        \r
-        BufferedReader br = 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# Creating BufferedReader fail!");\r
-            return false;\r
-        }\r
-        try {\r
-            while ((textLine = br.readLine()) != null) {\r
-                //\r
-                // the line is composed of Space\r
-                //\r
-                if (textLine.trim().compareToIgnoreCase("") == 0) {\r
-                    continue;\r
-                } \r
-                //\r
-                // the line starts with "#"\r
-                //\r
-                else if ((textLine.trim().charAt(0) == '#')){\r
-                    continue;\r
-                } else {\r
-                    if (textLine.indexOf("ACTIVE_PLATFORM") != -1) {\r
-                        ParseParameter.curpstr = textLine;\r
-                    } else if (textLine.indexOf("TARGET_ARCH") != -1) {\r
-                        ParseParameter.curastr = textLine;\r
-                    } else if (textLine.indexOf("TARGET") != -1) {\r
-                        ParseParameter.curtstr = textLine;\r
-                    } else if (textLine.indexOf("TOOL_CHAIN_CONF") != -1) {\r
-                        ParseParameter.curcstr = textLine;\r
-                    } else if (textLine.indexOf("TOOL_CHAIN_TAG") != -1) {\r
-                        ParseParameter.curnstr = textLine;\r
-                    } else if (textLine.indexOf("MAX_CONCURRENT_THREAD_NUMBER") != -1) {\r
-                        ParseParameter.curmstr = textLine;\r
-                    } else if (textLine.indexOf("MULTIPLE_THREAD") != -1) {\r
-                        ParseParameter.curmestr = textLine;\r
-                    }\r
-                }\r
-            }\r
-        } catch (IOException e) {\r
-            System.out.println("\n# Reading file fail!");\r
-            return false;\r
-        }\r
-\r
-        try {\r
-            br.close();\r
-        } catch (IOException e) {\r
-            System.out\r
-                    .println("\n# Closing BufferedReader fail!");\r
-            return false;\r
-        }\r
-        return true;\r
-    }\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
-    ///\r
-    /// when the flag is true, the corresponding str should be add at the end of file.\r
-    ///\r
-    private static boolean pflag = true;\r
-    private static boolean tflag = true;\r
-    private static boolean aflag = true;\r
-    private static boolean cflag = true;\r
-    private static boolean nflag = true;\r
-    private static boolean mflag = true;\r
-    private static boolean meflag = true;\r
-\r
-\r
-}\r