]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAssemblerConfiguration.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / compiler / CommandLineAssemblerConfiguration.java
1 /*
2 *
3 * Copyright 2001-2005 The Ant-Contrib project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package net.sf.antcontrib.cpptasks.compiler;
18
19 import java.io.File;
20
21 import org.apache.tools.ant.BuildException;
22
23 import net.sf.antcontrib.cpptasks.CCTask;
24 import net.sf.antcontrib.cpptasks.ProcessorParam;
25
26 /**
27 * A configuration for an assember
28 *
29 */
30 public final class CommandLineAssemblerConfiguration implements
31 AssemblerConfiguration {
32
33 private String[] args;
34
35 private CommandLineAssembler assembler;
36
37 private String[] endArgs;
38
39 //
40 // include path from environment variable
41 // not explicitly stated in Ant script
42 //
43 private File[] envIncludePath;
44
45 private String[] exceptFiles;
46
47 private File[] includePath;
48
49 private boolean rebuild;
50
51 private File[] sysIncludePath;
52
53 public CommandLineAssemblerConfiguration (CommandLineAssembler assembler,
54 File[] includePath, File[] sysIncludePath,
55 File[] envIncludePath, String[] args, boolean rebuild,
56 String[] endArgs, String[] exceptFiles) {
57 if (assembler == null) {
58 throw new NullPointerException("assembler");
59 }
60 if (args == null) {
61 this.args = new String[0];
62 } else {
63 this.args = (String[]) args.clone();
64 }
65 if (includePath == null) {
66 this.includePath = new File[0];
67 } else {
68 this.includePath = (File[]) includePath.clone();
69 }
70 if (sysIncludePath == null) {
71 this.sysIncludePath = new File[0];
72 } else {
73 this.sysIncludePath = (File[]) sysIncludePath.clone();
74 }
75 if (envIncludePath == null) {
76 this.envIncludePath = new File[0];
77 } else {
78 this.envIncludePath = (File[]) envIncludePath.clone();
79 }
80 this.assembler = assembler;
81 this.rebuild = rebuild;
82 this.endArgs = (String[]) endArgs.clone();
83 this.exceptFiles = (String[]) exceptFiles.clone();
84 }
85
86 public int bid(String inputFile) {
87 int assembleBid = assembler.bid(inputFile);
88 return assembleBid;
89 }
90
91 public void assembler(CCTask task, File outputDir, String[] sourceFiles)
92 throws BuildException {
93 try {
94 assembler.assembler(task, outputDir, sourceFiles, args, endArgs);
95 } catch (BuildException ex) {
96 throw ex;
97 }
98 }
99
100 public String getOutputFileName(String inputFile) {
101 return assembler.getOutputFileName(inputFile);
102 }
103
104 public String getIdentifier() {
105 return assembler.getCommand();
106 }
107
108 public ProcessorParam[] getParams() {
109 return new ProcessorParam[0];
110 }
111
112 public boolean getRebuild() {
113 return rebuild;
114 }
115
116 public String[] getPreArguments() {
117 return (String[]) args.clone();
118 }
119
120 public String[] getEndArguments() {
121 return (String[]) endArgs.clone();
122 }
123 }