View Javadoc
1   package org.codehaus.mojo.natives.linker;
2   
3   /*
4    * The MIT License
5    *
6    * Copyright (c) 2004, The Codehaus
7    *
8    * Permission is hereby granted, free of charge, to any person obtaining a copy of
9    * this software and associated documentation files (the "Software"), to deal in
10   * the Software without restriction, including without limitation the rights to
11   * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12   * of the Software, and to permit persons to whom the Software is furnished to do
13   * so, subject to the following conditions:
14   *
15   * The above copyright notice and this permission notice shall be included in all
16   * copies or substantial portions of the Software.
17   *
18   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24   * SOFTWARE.
25   */
26  
27  import java.io.File;
28  import java.util.ArrayList;
29  import java.util.List;
30  
31  import org.codehaus.mojo.natives.ConfigurationBase;
32  
33  /*
34   * CompilerConfiguration contains inputs by the user +
35   * DependencyMangement for dependecies analysis
36   */
37  public class LinkerConfiguration
38      extends ConfigurationBase
39  {
40  
41      private File workingDirectory;
42  
43      /**
44       * Must be in your path
45       */
46      private String executable;
47  
48      /**
49       * Will be passed to linker executable
50       */
51      private String[] startOptions;
52  
53      private String[] middleOptions;
54  
55      private String[] endOptions;
56  
57      private File outputDirectory;
58  
59      private String outputFileExtension;
60  
61      private String outputFileName; /* should not have extension */
62  
63      /**
64       * Single location that the client must place library files to be linked with
65       */
66      private File externalLibDirectory;
67  
68      /**
69       * Library file names in externalLibDirectory
70       */
71      private List externalLibFileNames;
72  
73      /**
74       * For project with lots of object files on windows, turn this flag to resolve Windows command line length limit
75       */
76      private boolean usingLinkerResponseFile;
77  
78      /**
79       * Enable this option to speed up linkage for large project with no dependencies changes
80       * 
81       * @since 1.0-alpha-8
82       */
83      private boolean checkStaleLinkage;
84  
85      public File getOutputDirectory()
86      {
87          return this.outputDirectory;
88      }
89  
90      public void setOutputDirectory( File dir )
91      {
92          this.outputDirectory = dir;
93      }
94  
95      public String getOutputFileExtension()
96      {
97          return this.outputFileExtension;
98      }
99  
100     public void setOutputFileExtension( String ext )
101     {
102         this.outputFileExtension = ext;
103     }
104 
105     public File getWorkingDirectory()
106     {
107         return this.workingDirectory;
108     }
109 
110     public void setWorkingDirectory( File dir )
111     {
112         this.workingDirectory = dir;
113     }
114 
115     public String[] getStartOptions()
116     {
117         return this.startOptions;
118     }
119 
120     public void setStartOptions( String[] options )
121     {
122         this.startOptions = options;
123     }
124 
125     public String[] getMiddleOptions()
126     {
127         return this.middleOptions;
128     }
129 
130     public void setMiddleOptions( String[] options )
131     {
132         this.middleOptions = options;
133     }
134 
135     public String[] getEndOptions()
136     {
137         return this.endOptions;
138     }
139 
140     public void setEndOptions( String[] options )
141     {
142         this.endOptions = options;
143     }
144 
145     public String getExecutable()
146     {
147         return this.executable;
148     }
149 
150     public void setExecutable( String executable )
151     {
152         this.executable = executable;
153     }
154 
155     public String getOutputFileName()
156     {
157         return this.outputFileName;
158     }
159 
160     public void setOutputFileName( String name )
161     {
162         this.outputFileName = name;
163     }
164 
165     /**
166      * convenient method to get linker output file
167      * 
168      * @return
169      */
170     public File getOutputFile()
171     {
172         File out = new File( this.outputDirectory, this.outputFileName + "." + this.outputFileExtension );
173 
174         return out;
175     }
176 
177     public List getExternalLibFileNames()
178     {
179         if ( this.externalLibFileNames == null )
180         {
181             return new ArrayList( 0 );
182         }
183 
184         return this.externalLibFileNames;
185     }
186 
187     public void setExternalLibFileNames( List list )
188     {
189         this.externalLibFileNames = list;
190     }
191 
192     public void setExternalLibDirectory( File dir )
193     {
194         this.externalLibDirectory = dir;
195     }
196 
197     public File getExternalLibDirectory()
198     {
199         return this.externalLibDirectory;
200     }
201 
202     public boolean isUsingLinkerResponseFile()
203     {
204         return usingLinkerResponseFile;
205     }
206 
207     public void setUsingLinkerResponseFile( boolean useObjectsFile )
208     {
209         this.usingLinkerResponseFile = useObjectsFile;
210     }
211 
212     public boolean isCheckStaleLinkage()
213     {
214         return checkStaleLinkage;
215     }
216 
217     public void setCheckStaleLinkage( boolean checkStaleLinkage )
218     {
219         this.checkStaleLinkage = checkStaleLinkage;
220     }
221 
222 }