3 * Copyright 2001-2005 The Ant-Contrib project
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package net
.sf
.antcontrib
.cpptasks
.compiler
;
21 import org
.apache
.tools
.ant
.BuildException
;
23 import net
.sf
.antcontrib
.cpptasks
.CCTask
;
24 import net
.sf
.antcontrib
.cpptasks
.ProcessorParam
;
27 * A configuration for an assember
30 public final class CommandLineAssemblerConfiguration
implements
31 AssemblerConfiguration
{
33 private String
[] args
;
35 private CommandLineAssembler assembler
;
37 private String
[] endArgs
;
40 // include path from environment variable
41 // not explicitly stated in Ant script
43 private File
[] envIncludePath
;
45 private String
[] exceptFiles
;
47 private File
[] includePath
;
49 private boolean rebuild
;
51 private File
[] sysIncludePath
;
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");
61 this.args
= new String
[0];
63 this.args
= (String
[]) args
.clone();
65 if (includePath
== null) {
66 this.includePath
= new File
[0];
68 this.includePath
= (File
[]) includePath
.clone();
70 if (sysIncludePath
== null) {
71 this.sysIncludePath
= new File
[0];
73 this.sysIncludePath
= (File
[]) sysIncludePath
.clone();
75 if (envIncludePath
== null) {
76 this.envIncludePath
= new File
[0];
78 this.envIncludePath
= (File
[]) envIncludePath
.clone();
80 this.assembler
= assembler
;
81 this.rebuild
= rebuild
;
82 this.endArgs
= (String
[]) endArgs
.clone();
83 this.exceptFiles
= (String
[]) exceptFiles
.clone();
86 public int bid(String inputFile
) {
87 int assembleBid
= assembler
.bid(inputFile
);
91 public void assembler(CCTask task
, File outputDir
, String
[] sourceFiles
)
92 throws BuildException
{
94 assembler
.assembler(task
, outputDir
, sourceFiles
, args
, endArgs
);
95 } catch (BuildException ex
) {
100 public String
getOutputFileName(String inputFile
) {
101 return assembler
.getOutputFileName(inputFile
);
104 public String
getIdentifier() {
105 return assembler
.getCommand();
108 public ProcessorParam
[] getParams() {
109 return new ProcessorParam
[0];
112 public boolean getRebuild() {
116 public String
[] getPreArguments() {
117 return (String
[]) args
.clone();
120 public String
[] getEndArguments() {
121 return (String
[]) endArgs
.clone();