3 * Copyright 2001-2004 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
;
20 import net
.sf
.antcontrib
.cpptasks
.CCTask
;
21 import net
.sf
.antcontrib
.cpptasks
.LinkerDef
;
22 import net
.sf
.antcontrib
.cpptasks
.ProcessorDef
;
23 import net
.sf
.antcontrib
.cpptasks
.TargetDef
;
26 import org
.apache
.tools
.ant
.types
.Environment
;
28 * An abstract Linker implementation.
30 * @author Adam Murdoch
32 public abstract class AbstractLinker
extends AbstractProcessor
35 public AbstractLinker(String
[] objExtensions
, String
[] ignoredExtensions
) {
36 super(objExtensions
, ignoredExtensions
);
39 * Returns the bid of the processor for the file.
41 * A linker will bid 1 on any unrecognized file type.
44 * filename of input file
45 * @return bid for the file, 0 indicates no interest, 1 indicates that the
46 * processor recognizes the file but doesn't process it (header
47 * files, for example), 100 indicates strong interest
49 public int bid(String inputFile
) {
50 int bid
= super.bid(inputFile
);
53 // unrecognized extension, take the file
58 // discard the ignored extensions
65 public Processor
changeEnvironment(boolean newEnvironment
, Environment env
) {
68 abstract protected LinkerConfiguration
createConfiguration(CCTask task
,
69 LinkType linkType
, ProcessorDef
[] baseConfigs
,
70 LinkerDef specificConfig
, TargetDef targetPlatform
);
71 public ProcessorConfiguration
createConfiguration(CCTask task
,
72 LinkType linkType
, ProcessorDef
[] baseConfigs
,
73 ProcessorDef specificConfig
,
74 TargetDef targetPlatform
) {
75 if (specificConfig
== null) {
76 throw new NullPointerException("specificConfig");
78 return createConfiguration(task
, linkType
, baseConfigs
,
79 (LinkerDef
) specificConfig
, targetPlatform
);
81 public String
getLibraryKey(File libfile
) {
82 return libfile
.getName();
84 public abstract String
getOutputFileName(String fileName
);