View Javadoc

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 java.io.File;
23  import java.io.IOException;
24  
25  import com.github.maven_nar.cpptasks.TargetMatcher;
26  import com.github.maven_nar.cpptasks.VersionInfo;
27  import com.github.maven_nar.cpptasks.types.LibraryTypeEnum;
28  
29  /**
30   * A linker for executables, and static and dynamic libraries.
31   *
32   * @author Adam Murdoch
33   */
34  public interface Linker extends Processor {
35    /**
36     * Adds source or object files to the bidded fileset to
37     * support version information.
38     * 
39     * @param versionInfo
40     *          version information
41     * @param linkType
42     *          link type
43     * @param isDebug
44     *          true if debug build
45     * @param outputFile
46     *          name of generated executable
47     * @param objDir
48     *          directory for generated files
49     * @param matcher
50     *          bidded fileset
51     */
52    void addVersionFiles(final VersionInfo versionInfo, final LinkType linkType, final File outputFile,
53        final boolean isDebug, final File objDir, final TargetMatcher matcher) throws IOException;
54  
55    /**
56     * Extracts the significant part of a library name to ensure there aren't
57     * collisions
58     */
59    String getLibraryKey(File libname);
60  
61    /**
62     * returns the library path for the linker
63     */
64    File[] getLibraryPath();
65  
66    /**
67     * Returns a set of filename patterns corresponding to library names.
68     * 
69     * For example, "advapi32" would be expanded to "advapi32.dll" by
70     * MsvcLinker and to "libadvapi32.a" and "libadvapi32.so" by
71     * GccLinker.
72     * 
73     * @param libnames
74     *          array of library names
75     */
76    String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libraryType);
77  
78    /**
79     * Gets the linker for the specified link type.
80     * 
81     * @return appropriate linker or null, will return this if this linker can
82     *         handle the specified link type
83     */
84    @Override
85    Linker getLinker(LinkType linkType);
86  
87    /**
88     * Returns true if the linker is case-sensitive
89     */
90    boolean isCaseSensitive();
91  }