]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinkerConfiguration.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / compiler / CommandLineLinkerConfiguration.java
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinkerConfiguration.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinkerConfiguration.java
new file mode 100644 (file)
index 0000000..b3a7290
--- /dev/null
@@ -0,0 +1,119 @@
+/*\r
+ * \r
+ * Copyright 2002-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.compiler;\r
+import net.sf.antcontrib.cpptasks.CCTask;\r
+import net.sf.antcontrib.cpptasks.LinkerParam;\r
+import net.sf.antcontrib.cpptasks.ProcessorParam;\r
+import net.sf.antcontrib.cpptasks.TargetInfo;\r
+\r
+import org.apache.tools.ant.BuildException;\r
+/**\r
+ * A configuration for a command line linker\r
+ * \r
+ * @author Curt Arnold\r
+ */\r
+public final class CommandLineLinkerConfiguration\r
+        implements\r
+            LinkerConfiguration {\r
+    private/* final */String[][] args;\r
+    private/* final */String identifier;\r
+    private String[] libraryNames;\r
+    private/* final */CommandLineLinker linker;\r
+    private/* final */boolean map;\r
+    private/* final */ProcessorParam[] params;\r
+    private/* final */boolean rebuild;\r
+    private String startupObject;\r
+    public CommandLineLinkerConfiguration(CommandLineLinker linker,\r
+            String identifier, String[][] args, ProcessorParam[] params,\r
+            boolean rebuild, boolean map, String[] libraryNames,\r
+            String startupObject) {\r
+        if (linker == null) {\r
+            throw new NullPointerException("linker");\r
+        }\r
+        if (args == null) {\r
+            throw new NullPointerException("args");\r
+        } else {\r
+            this.args = (String[][]) args.clone();\r
+        }\r
+        this.linker = linker;\r
+        this.params = (ProcessorParam[]) params.clone();\r
+        this.rebuild = rebuild;\r
+        this.identifier = identifier;\r
+        this.map = map;\r
+        if (libraryNames == null) {\r
+            this.libraryNames = new String[0];\r
+        } else {\r
+            this.libraryNames = (String[]) libraryNames.clone();\r
+        }\r
+        this.startupObject = startupObject;\r
+    }\r
+    public int bid(String filename) {\r
+        return linker.bid(filename);\r
+    }\r
+    public String[] getEndArguments() {\r
+        String[] clone = (String[]) args[1].clone();\r
+        return clone;\r
+    }\r
+    /**\r
+     * Returns a string representation of this configuration. Should be\r
+     * canonical so that equivalent configurations will have equivalent string\r
+     * representations\r
+     */\r
+    public String getIdentifier() {\r
+        return identifier;\r
+    }\r
+    public String[] getLibraryNames() {\r
+        String[] clone = (String[]) libraryNames.clone();\r
+        return clone;\r
+    }\r
+    public boolean getMap() {\r
+        return map;\r
+    }\r
+    public String getOutputFileName(String inputFile) {\r
+        return linker.getOutputFileName(inputFile);\r
+    }\r
+    public LinkerParam getParam(String name) {\r
+        for (int i = 0; i < params.length; i++) {\r
+            if (name.equals(params[i].getName()))\r
+                return (LinkerParam) params[i];\r
+        }\r
+        return null;\r
+    }\r
+    public ProcessorParam[] getParams() {\r
+        return params;\r
+    }\r
+    public String[] getPreArguments() {\r
+        String[] clone = (String[]) args[0].clone();\r
+        return clone;\r
+    }\r
+    public boolean getRebuild() {\r
+        return rebuild;\r
+    }\r
+    public String getStartupObject() {\r
+        return startupObject;\r
+    }\r
+    public void link(CCTask task, TargetInfo linkTarget) throws BuildException {\r
+        //\r
+        //  AllSourcePath's include any syslibsets\r
+        //\r
+        String[] sourcePaths = linkTarget.getAllSourcePaths();\r
+        linker.link(task, linkTarget.getOutput(), sourcePaths, this);\r
+    }\r
+    public String toString() {\r
+        return identifier;\r
+    }\r
+}\r