--- /dev/null
+/*\r
+ * \r
+ * Copyright 2001-2005 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
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.BuildException;\r
+\r
+import net.sf.antcontrib.cpptasks.CCTask;\r
+import net.sf.antcontrib.cpptasks.ProcessorParam;\r
+\r
+/**\r
+ * A configuration for an assember\r
+ * \r
+ */\r
+public final class CommandLineAssemblerConfiguration implements\r
+ AssemblerConfiguration {\r
+\r
+ private String[] args;\r
+\r
+ private CommandLineAssembler assembler;\r
+\r
+ private String[] endArgs;\r
+\r
+ //\r
+ // include path from environment variable\r
+ // not explicitly stated in Ant script\r
+ //\r
+ private File[] envIncludePath;\r
+\r
+ private String[] exceptFiles;\r
+\r
+ private File[] includePath;\r
+\r
+ private boolean rebuild;\r
+\r
+ private File[] sysIncludePath;\r
+\r
+ public CommandLineAssemblerConfiguration (CommandLineAssembler assembler,\r
+ File[] includePath, File[] sysIncludePath,\r
+ File[] envIncludePath, String[] args, boolean rebuild,\r
+ String[] endArgs, String[] exceptFiles) {\r
+ if (assembler == null) {\r
+ throw new NullPointerException("assembler");\r
+ }\r
+ if (args == null) {\r
+ this.args = new String[0];\r
+ } else {\r
+ this.args = (String[]) args.clone();\r
+ }\r
+ if (includePath == null) {\r
+ this.includePath = new File[0];\r
+ } else {\r
+ this.includePath = (File[]) includePath.clone();\r
+ }\r
+ if (sysIncludePath == null) {\r
+ this.sysIncludePath = new File[0];\r
+ } else {\r
+ this.sysIncludePath = (File[]) sysIncludePath.clone();\r
+ }\r
+ if (envIncludePath == null) {\r
+ this.envIncludePath = new File[0];\r
+ } else {\r
+ this.envIncludePath = (File[]) envIncludePath.clone();\r
+ }\r
+ this.assembler = assembler;\r
+ this.rebuild = rebuild;\r
+ this.endArgs = (String[]) endArgs.clone();\r
+ this.exceptFiles = (String[]) exceptFiles.clone();\r
+ }\r
+\r
+ public int bid(String inputFile) {\r
+ int assembleBid = assembler.bid(inputFile);\r
+ return assembleBid;\r
+ }\r
+\r
+ public void assembler(CCTask task, File outputDir, String[] sourceFiles)\r
+ throws BuildException {\r
+ try {\r
+ assembler.assembler(task, outputDir, sourceFiles, args, endArgs);\r
+ } catch (BuildException ex) {\r
+ throw ex;\r
+ }\r
+ }\r
+\r
+ public String getOutputFileName(String inputFile) {\r
+ return assembler.getOutputFileName(inputFile);\r
+ }\r
+\r
+ public String getIdentifier() {\r
+ return assembler.getCommand();\r
+ }\r
+\r
+ public ProcessorParam[] getParams() {\r
+ return new ProcessorParam[0];\r
+ }\r
+\r
+ public boolean getRebuild() {\r
+ return rebuild;\r
+ }\r
+\r
+ public String[] getPreArguments() {\r
+ return (String[]) args.clone();\r
+ }\r
+\r
+ public String[] getEndArguments() {\r
+ return (String[]) endArgs.clone();\r
+ }\r
+}\r