]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*\r |
2 | * \r | |
3 | * Copyright 2001-2005 The Ant-Contrib project\r | |
4 | *\r | |
5 | * Licensed under the Apache License, Version 2.0 (the "License");\r | |
6 | * you may not use this file except in compliance with the License.\r | |
7 | * You may obtain a copy of the License at\r | |
8 | *\r | |
9 | * http://www.apache.org/licenses/LICENSE-2.0\r | |
10 | *\r | |
11 | * Unless required by applicable law or agreed to in writing, software\r | |
12 | * distributed under the License is distributed on an "AS IS" BASIS,\r | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r | |
14 | * See the License for the specific language governing permissions and\r | |
15 | * limitations under the License.\r | |
16 | */\r | |
17 | package net.sf.antcontrib.cpptasks.compiler;\r | |
18 | \r | |
19 | import java.io.File;\r | |
20 | \r | |
21 | import org.apache.tools.ant.BuildException;\r | |
22 | \r | |
23 | import net.sf.antcontrib.cpptasks.CCTask;\r | |
24 | import net.sf.antcontrib.cpptasks.ProcessorParam;\r | |
25 | \r | |
26 | /**\r | |
27 | * A configuration for an ASL compiler\r | |
28 | * \r | |
29 | */\r | |
30 | public final class CommandLineAslcompilerConfiguration implements\r | |
31 | AslcompilerConfiguration {\r | |
32 | \r | |
33 | private String[] args;\r | |
34 | \r | |
35 | private CommandLineAslcompiler acpi;\r | |
36 | \r | |
37 | private String[] endArgs;\r | |
38 | \r | |
39 | private boolean rebuild;\r | |
40 | \r | |
41 | public CommandLineAslcompilerConfiguration (CommandLineAslcompiler acpi,\r | |
42 | String[] args, boolean rebuild, String[] endArgs) {\r | |
43 | if (acpi == null) {\r | |
44 | throw new NullPointerException("acpi");\r | |
45 | }\r | |
46 | if (args == null) {\r | |
47 | this.args = new String[0];\r | |
48 | } else {\r | |
49 | this.args = (String[]) args.clone();\r | |
50 | }\r | |
51 | this.acpi = acpi;\r | |
52 | this.rebuild = rebuild;\r | |
53 | this.endArgs = (String[]) endArgs.clone();\r | |
54 | }\r | |
55 | \r | |
56 | public int bid (String inputFile) {\r | |
57 | int acpiBid = acpi.bid(inputFile);\r | |
58 | return acpiBid;\r | |
59 | }\r | |
60 | \r | |
61 | public void aslcompiler (CCTask task, File outputDir, String[] sourceFiles)\r | |
62 | throws BuildException {\r | |
63 | try {\r | |
64 | acpi.aslcompiler(task, outputDir, sourceFiles, args, endArgs);\r | |
65 | } catch (BuildException ex) {\r | |
66 | throw ex;\r | |
67 | }\r | |
68 | }\r | |
69 | \r | |
70 | public String getIdentifier () {\r | |
71 | return acpi.getCommand();\r | |
72 | }\r | |
73 | \r | |
74 | public ProcessorParam[] getParams () {\r | |
75 | return new ProcessorParam[0];\r | |
76 | }\r | |
77 | \r | |
78 | public boolean getRebuild () {\r | |
79 | return rebuild;\r | |
80 | }\r | |
81 | \r | |
82 | public String[] getPreArguments () {\r | |
83 | return (String[]) args.clone();\r | |
84 | }\r | |
85 | \r | |
86 | public String[] getEndArguments () {\r | |
87 | return (String[]) endArgs.clone();\r | |
88 | }\r | |
89 | \r | |
90 | public String getOutputFileName (String inputFile) {\r | |
91 | return acpi.getOutputFileName(inputFile);\r | |
92 | }\r | |
93 | }\r |