]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / gcc / AbstractArLibrarian.java
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java
new file mode 100644 (file)
index 0000000..f7bb2ea
--- /dev/null
@@ -0,0 +1,106 @@
+/*\r
+ * \r
+ * Copyright 2001-2004 The Ant-Contrib project\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+package net.sf.antcontrib.cpptasks.gcc;\r
+import java.io.File;\r
+import java.util.Vector;\r
+\r
+import net.sf.antcontrib.cpptasks.CCTask;\r
+import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;\r
+import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;\r
+import net.sf.antcontrib.cpptasks.compiler.LinkType;\r
+import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;\r
+\r
+import org.apache.tools.ant.BuildException;\r
+/**\r
+ * Adapter for the "ar" tool\r
+ * \r
+ * @author Adam Murdoch\r
+ * @author Curt Arnold\r
+ */\r
+public abstract class AbstractArLibrarian extends CommandLineLinker {\r
+    private/* final */\r
+    String outputPrefix;\r
+    private static String[] defaultflags = new String[]{};\r
+    protected AbstractArLibrarian(String command, String identificationArg,\r
+            String[] inputExtensions, String[] ignoredExtensions,\r
+            String outputPrefix, String outputExtension, boolean isLibtool,\r
+            AbstractArLibrarian libtoolLibrarian) {\r
+        super(command, identificationArg, inputExtensions, ignoredExtensions,\r
+                outputExtension, isLibtool, libtoolLibrarian);\r
+        this.outputPrefix = outputPrefix;\r
+    }\r
+    public void addBase(long base, Vector args) {\r
+    }\r
+    public void addFixed(Boolean fixed, Vector args) {\r
+    }\r
+    public void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {\r
+        if(defaultflag != null && defaultflag.booleanValue()){\r
+            for (int i = 0; i < defaultflags.length; i++) {\r
+                args.addElement(defaultflags[i]);\r
+            }\r
+        }\r
+    }\r
+    public void addIncremental(boolean incremental, Vector args) {\r
+    }\r
+    public void addMap(boolean map, Vector args) {\r
+    }\r
+    public void addStack(int stack, Vector args) {\r
+    }\r
+    /* (non-Javadoc)\r
+     * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)\r
+     */\r
+    protected void addEntry(String entry, Vector args) {\r
+    }\r
+    \r
+    public String getCommandFileSwitch(String commandFile) {\r
+        return null;\r
+    }\r
+    public File[] getLibraryPath() {\r
+        return new File[0];\r
+    }\r
+    public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {\r
+       return new String[0];\r
+    }\r
+    public int getMaximumCommandLength() {\r
+        return Integer.MAX_VALUE;\r
+    }\r
+    public String getOutputFileName(String baseName) {\r
+        return outputPrefix + super.getOutputFileName(baseName);\r
+    }\r
+    public String[] getOutputFileSwitch(String outputFile) {\r
+        return GccProcessor.getOutputFileSwitch("rvs", outputFile);\r
+    }\r
+    public boolean isCaseSensitive() {\r
+        return true;\r
+    }\r
+    public void link(CCTask task, File outputFile, String[] sourceFiles,\r
+            CommandLineLinkerConfiguration config) throws BuildException {\r
+        //\r
+        //   if there is an existing library then\r
+        //      we must delete it before executing "ar"\r
+        if (outputFile.exists()) {\r
+            if (!outputFile.delete()) {\r
+                throw new BuildException("Unable to delete "\r
+                        + outputFile.getAbsolutePath());\r
+            }\r
+        }\r
+        //\r
+        //   delegate to CommandLineLinker\r
+        //\r
+        super.link(task, outputFile, sourceFiles, config);\r
+    }\r
+}\r