1 /*
2 * #%L
3 * Native ARchive plugin for Maven
4 * %%
5 * Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
6 * %%
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * #L%
19 */
20 package com.github.maven_nar.cpptasks.compiler;
21
22 import org.apache.tools.ant.types.Environment;
23
24 import com.github.maven_nar.cpptasks.CCTask;
25 import com.github.maven_nar.cpptasks.ProcessorDef;
26 import com.github.maven_nar.cpptasks.TargetDef;
27 import com.github.maven_nar.cpptasks.VersionInfo;
28
29 /**
30 * A processor. Base interface for Compiler and Linker
31 *
32 * @author Curt Arnold
33 */
34 public interface Processor {
35 /**
36 * Returns a bid indicating the desire of this compiler to process the
37 * file.
38 *
39 * @param inputFile
40 * input file
41 * @return 0 = no interest, 100 = high interest
42 */
43 int bid(String inputFile);
44
45 Processor changeEnvironment(boolean newEnvironment, Environment env);
46
47 /**
48 * Returns the compiler configuration for <cc>or <compiler>element.
49 *
50 * @param defaultProviders
51 * When specificConfig corresponds to a <compiler>or linker
52 * element, defaultProvider will be a zero to two element array.
53 * If there is an extends attribute, the first element will be
54 * the referenced ProcessorDef, unless inherit = false, the last
55 * element will be the containing <cc>element
56 * @param specificConfig
57 * A <cc>or <compiler>element.
58 * @return resulting configuration
59 */
60 ProcessorConfiguration createConfiguration(CCTask task, LinkType linkType, ProcessorDef[] defaultProviders,
61 ProcessorDef specificConfig, TargetDef targetPlatform, VersionInfo versionInfo);
62
63 /**
64 * Retrieve an identifier that identifies the specific version of the
65 * compiler. Compilers with the same identifier should produce the same
66 * output files for the same input files and command line switches.
67 */
68 String getIdentifier();
69
70 /**
71 * Gets the linker that is associated with this processors
72 */
73 Linker getLinker(LinkType type);
74
75 /**
76 * Output file name (no path components) corresponding to source file
77 *
78 * @param inputFile
79 * input file
80 * @return output file name or null if no output file or name not
81 * determined by input file
82 */
83 String[] getOutputFileNames(String inputFile, VersionInfo versionInfo);
84 }