0
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
package com.nokia.s60tools.appdep.core;
|
|
20 |
|
|
21 |
import java.io.File;
|
|
22 |
import java.io.FilenameFilter;
|
|
23 |
import java.io.IOException;
|
|
24 |
import java.util.ArrayList;
|
|
25 |
import java.util.Date;
|
|
26 |
import java.util.HashSet;
|
|
27 |
import java.util.Iterator;
|
|
28 |
import java.util.NoSuchElementException;
|
|
29 |
import java.util.Set;
|
|
30 |
import java.util.Vector;
|
|
31 |
import java.util.regex.Pattern;
|
|
32 |
|
|
33 |
import com.nokia.s60tools.appdep.common.ProductInfoRegistry;
|
|
34 |
import com.nokia.s60tools.appdep.core.data.CacheIndex;
|
|
35 |
import com.nokia.s60tools.appdep.core.job.AppDepJobManager;
|
|
36 |
import com.nokia.s60tools.appdep.exceptions.InvalidCmdLineToolSettingException;
|
|
37 |
import com.nokia.s60tools.appdep.resources.Messages;
|
|
38 |
import com.nokia.s60tools.appdep.util.AppDepConsole;
|
|
39 |
import com.nokia.s60tools.sdk.SdkEnvInfomationResolveFailureException;
|
|
40 |
import com.nokia.s60tools.sdk.SdkInformation;
|
|
41 |
import com.nokia.s60tools.sdk.SdkManager;
|
|
42 |
import com.nokia.s60tools.util.console.IConsolePrintUtility;
|
|
43 |
import com.nokia.s60tools.util.debug.DbgUtility;
|
|
44 |
|
|
45 |
/**
|
|
46 |
* This class stores the AppDep tool related settings that are currently
|
|
47 |
* in effect and offers services that are related to those settings.
|
|
48 |
* The class is implemented as singleton in order to make sure
|
|
49 |
* that there are no possibility to have conflicting intances
|
|
50 |
* of this class created by many parties.
|
|
51 |
*/
|
|
52 |
public class AppDepSettings {
|
|
53 |
|
|
54 |
//
|
|
55 |
// Public available constants
|
|
56 |
//
|
|
57 |
/**
|
|
58 |
* Name of the executable that is used for RVCT tool chain to resolve
|
|
59 |
* dependency information.
|
|
60 |
*/
|
|
61 |
public static final String RVCT_FROM_ELF_EXECUTABLE = "fromelf.exe"; //$NON-NLS-1$
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Abbreviated name for GNU Compiler Collection.
|
|
65 |
* Used as command line parameter, therefore DO NOT CHANGE
|
|
66 |
* unless the command line interface is changed.
|
|
67 |
*/
|
|
68 |
public static final String STR_GCC = "GCC"; //$NON-NLS-1$
|
|
69 |
/**
|
|
70 |
* Abbreviated name for Arm Toolchain.
|
|
71 |
* Used as command line parameter, therefore DO NOT CHANGE
|
|
72 |
* unless the command line interface is changed.
|
|
73 |
*/
|
|
74 |
public static final String STR_GCCE = "GCCE"; //$NON-NLS-1$
|
|
75 |
/**
|
|
76 |
* Abbreviated name for RealView Compilation Tools.
|
|
77 |
* Used as command line parameter, therefore DO NOT CHANGE
|
|
78 |
* unless the command line interface is changed.
|
|
79 |
*/
|
|
80 |
public static final String STR_RVCT = "RVCT"; //$NON-NLS-1$
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Epoc32 directory name constant.
|
|
84 |
*/
|
|
85 |
public static final String STR_EPOC32_DIR = "epoc32"; //$NON-NLS-1$
|
|
86 |
|
|
87 |
//
|
|
88 |
// Private constants
|
|
89 |
//
|
|
90 |
private static final String STR_RELEASE_DIR = "release"; //$NON-NLS-1$
|
|
91 |
|
|
92 |
//
|
|
93 |
// Constants for unsupported targets
|
|
94 |
//
|
|
95 |
|
|
96 |
// Not supporting targets that start with the following strings
|
|
97 |
private static final String STR_WILDCHARD_WIN = "WIN"; //$NON-NLS-1$
|
|
98 |
private static final String STR_WILDCHARD_TOOLS = "TOOLS"; //$NON-NLS-1$
|
|
99 |
|
|
100 |
// Not supporting targets with following exact matches
|
|
101 |
// => There are not currenly any exact math targets defined
|
|
102 |
|
|
103 |
// Constants for GCC toolchain targets
|
|
104 |
private static final String STR_ARMI = "ARMI"; //$NON-NLS-1$
|
|
105 |
private static final String STR_ARM4 = "ARM4"; //$NON-NLS-1$
|
|
106 |
private static final String STR_THUMB = "THUMB"; //$NON-NLS-1$
|
|
107 |
// Wildchards for GCC toolchain targets
|
|
108 |
private static final String STR_WILDCHARD_GCC_M = "M"; //$NON-NLS-1$
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Location relative to epoc32 directory for elftran.exe executable
|
|
112 |
* that is needed for creating cache files.
|
|
113 |
*/
|
|
114 |
private static final String STR_ELFTRAN_EXE = "elftran.exe"; //$NON-NLS-1$
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Location relative to epoc32 directory for elftran.exe executable
|
|
118 |
* that is needed for creating cache files.
|
|
119 |
*/
|
|
120 |
private static final String STR_PETRAN_EXE = "petran.exe"; //$NON-NLS-1$
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Directory where GCC toolchain tools exist.
|
|
124 |
* Directory is relative to SDK's root directory.
|
|
125 |
* @see #getGccToolsDir
|
|
126 |
*/
|
|
127 |
private static final String GCC_TOOL_REL_DIR = STR_EPOC32_DIR + "\\gcc\\bin"; //$NON-NLS-1$
|
|
128 |
|
|
129 |
/**
|
|
130 |
* When SIS file(s) is selected for analysis, Target platform type is "sis".
|
|
131 |
*/
|
|
132 |
public static final String TARGET_TYPE_ID_SIS = "sis"; //$NON-NLS-1$
|
|
133 |
|
|
134 |
private static Vector<AppDepSettings> settingInstancesVector = null;
|
|
135 |
|
|
136 |
// Supported toolchain objects...
|
|
137 |
private Toolchain toolchainGCC;
|
|
138 |
private Toolchain toolchainGCCE;
|
|
139 |
private Toolchain toolchainRVCT;
|
|
140 |
|
|
141 |
//.. are stored in vector in order to make checking easier
|
|
142 |
private Vector<Toolchain> supportedToolchainsVector = null;
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Storing also those target types that are not supported by the tool.
|
|
146 |
*/
|
|
147 |
private Vector<String> notSupportedTargetsVector = null;
|
|
148 |
|
|
149 |
/**
|
|
150 |
* And making also wildchard check for the targets starting
|
|
151 |
* with some specified string.
|
|
152 |
*/
|
|
153 |
private Vector<String> notSupportedTargetWildchardsVector = null;
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Information for currently selected
|
|
157 |
* SDK or Platform.
|
|
158 |
*/
|
|
159 |
private SdkInformation currentlyUsedSdk = null;
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Directory where GCCE toolchain tools exist.
|
|
163 |
* For example, "C:\Program Files\CSL Arm Toolchain\bin"
|
|
164 |
*/
|
|
165 |
private String gcceToolsDir = null;
|
|
166 |
|
|
167 |
/**
|
|
168 |
* Directory where RVCT toolchain tools exist.
|
|
169 |
* For example, "C:\Program Files\ARM\RVCT\Programs\2.2\503\win_32-pentium"
|
|
170 |
*/
|
|
171 |
private String rvctToolsDir = null;
|
|
172 |
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Directory where cfilt.exe is located.
|
|
176 |
*/
|
|
177 |
String externalProgramsPathName = null;
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Current user preference for the used toolchain.
|
|
181 |
* This updated automatically when the currently
|
|
182 |
* used target platform is set. The default value
|
|
183 |
* is based on the preferred toolchain choice,
|
|
184 |
* and on the fact that which toolchains are
|
|
185 |
* available in the workstation's environment.
|
|
186 |
*/
|
|
187 |
private IToolchain currentlyUsedToolChain = null;
|
|
188 |
|
|
189 |
/**
|
|
190 |
* Preferences to be used for cache generation.
|
|
191 |
*/
|
|
192 |
private CacheGenerationOptions cacheGenerOptions = null;
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Current user preference for the selected targets.
|
|
196 |
*/
|
|
197 |
private ArrayList<ITargetPlatform> currentlyUsedTargetPlatforms= null;
|
|
198 |
|
|
199 |
/**
|
|
200 |
* The name of the currently analyzed component.
|
|
201 |
*/
|
|
202 |
private String currentlyAnalyzedComponentName = null;
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Currently supported build types are
|
|
206 |
* - BuildTypeDebug, and
|
|
207 |
* - BuildTypeRelease
|
|
208 |
*/
|
|
209 |
private IBuildType buildType = null;
|
|
210 |
|
|
211 |
/**
|
|
212 |
* This is used to cache the amount of components
|
|
213 |
* for the recently queried platform. The component
|
|
214 |
* query may take a considerable long time, and therefore
|
|
215 |
* caching improves performance.
|
|
216 |
*/
|
|
217 |
private int mostRecentlyQueriedComponentCount;
|
|
218 |
|
|
219 |
/**
|
|
220 |
* Path where print report is recently exported.
|
|
221 |
* Used to set as default path when export functionality is used
|
|
222 |
* again during same session.
|
|
223 |
*/
|
|
224 |
private String exportPrintReportPath = null;
|
|
225 |
|
|
226 |
/**
|
|
227 |
* If XML report (file) is generated aswell when Exporting html report.
|
|
228 |
*/
|
|
229 |
private boolean exportXMLreport = false;
|
|
230 |
|
|
231 |
/**
|
|
232 |
* Path to resources. XSL file is located in there.
|
|
233 |
*/
|
|
234 |
private String resourcesPath = null;
|
|
235 |
|
|
236 |
/**
|
|
237 |
* XSL file name, default value "PrintReport.xsl"
|
|
238 |
*/
|
|
239 |
private String XSLFileName = null;
|
|
240 |
|
|
241 |
/**
|
|
242 |
* XSL file name, default value "IsUsedByReport.xsl"
|
|
243 |
*/
|
|
244 |
private String isUsedByXSLFileName = null;
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Listeners who want to know about the changes in the current settings.
|
|
248 |
*/
|
|
249 |
private Vector<IAppDepSettingsChangedListener> settingListenersVector;
|
|
250 |
|
|
251 |
/**
|
|
252 |
* SIS files for analysis
|
|
253 |
*/
|
|
254 |
private String[] sisFilesForAnalysis = null;
|
|
255 |
|
|
256 |
/**
|
|
257 |
* If SDK Selection Wizard is running in SIS analysis mode
|
|
258 |
*/
|
|
259 |
private boolean isInSISFileAnalysisMode = false;
|
|
260 |
|
|
261 |
/**
|
|
262 |
* Cache data loading flag.
|
|
263 |
*/
|
|
264 |
private boolean isCacheDataLoadingOngoing = false;
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Cache update flag is set to <code>true</code> when target platform is not changed
|
|
268 |
* but target cache has been updated and needs reloading.
|
|
269 |
*/
|
|
270 |
private boolean cacheUpdated;
|
|
271 |
|
|
272 |
/**
|
|
273 |
* Target platform for the currently analyzed component.
|
|
274 |
*/
|
|
275 |
private ITargetPlatform currentlyAnalyzedComponentTargetPlatform = null;
|
|
276 |
|
|
277 |
/**
|
|
278 |
* Accessor for currently active settings.
|
|
279 |
* @return Returns currently active instance.
|
|
280 |
*/
|
|
281 |
public static AppDepSettings getActiveSettings(){
|
|
282 |
|
|
283 |
AppDepSettings instance = null;
|
|
284 |
|
|
285 |
if( settingInstancesVector == null ){
|
|
286 |
settingInstancesVector = new Vector<AppDepSettings>();
|
|
287 |
instance = new AppDepSettings();
|
|
288 |
settingInstancesVector.add(instance);
|
|
289 |
}
|
|
290 |
else{
|
|
291 |
instance = (AppDepSettings) settingInstancesVector.lastElement();
|
|
292 |
}
|
|
293 |
return instance;
|
|
294 |
}
|
|
295 |
|
|
296 |
/* (non-Javadoc)
|
|
297 |
* @see java.lang.Object#clone()
|
|
298 |
*/
|
|
299 |
@SuppressWarnings("unchecked") //$NON-NLS-1$
|
|
300 |
public Object clone(){
|
|
301 |
AppDepSettings clone = new AppDepSettings();
|
|
302 |
|
|
303 |
// Doing actual cloning
|
|
304 |
clone.toolchainGCC = toolchainGCC;
|
|
305 |
clone.toolchainGCCE = toolchainGCCE;
|
|
306 |
clone.toolchainRVCT = toolchainRVCT;
|
|
307 |
clone.supportedToolchainsVector = (Vector<Toolchain>) supportedToolchainsVector.clone();
|
|
308 |
clone.notSupportedTargetsVector = (Vector<String>) notSupportedTargetsVector .clone();
|
|
309 |
clone.notSupportedTargetWildchardsVector = (Vector<String>) notSupportedTargetWildchardsVector .clone();
|
|
310 |
|
|
311 |
clone.currentlyUsedSdk = currentlyUsedSdk;
|
|
312 |
clone.gcceToolsDir = gcceToolsDir;
|
|
313 |
clone.rvctToolsDir = rvctToolsDir;
|
|
314 |
clone.externalProgramsPathName = externalProgramsPathName;
|
|
315 |
clone.currentlyUsedToolChain = currentlyUsedToolChain;
|
|
316 |
clone.cacheGenerOptions = cacheGenerOptions;
|
|
317 |
ITargetPlatform[] targetPlatformArr = getCurrentlyUsedTargetPlatforms();
|
|
318 |
for (int i = 0; i < targetPlatformArr.length; i++) {
|
|
319 |
ITargetPlatform targetPlatformId = targetPlatformArr[i];
|
|
320 |
clone.currentlyUsedTargetPlatforms.add(targetPlatformId);
|
|
321 |
|
|
322 |
}
|
|
323 |
clone.buildType = buildType;
|
|
324 |
clone.currentlyAnalyzedComponentName = currentlyAnalyzedComponentName;
|
|
325 |
clone.currentlyAnalyzedComponentTargetPlatform = currentlyAnalyzedComponentTargetPlatform;
|
|
326 |
clone.exportPrintReportPath = exportPrintReportPath;
|
|
327 |
clone.resourcesPath = resourcesPath;
|
|
328 |
clone.XSLFileName = XSLFileName;
|
|
329 |
clone.isUsedByXSLFileName = isUsedByXSLFileName;
|
|
330 |
clone.settingListenersVector = (Vector<IAppDepSettingsChangedListener>) settingListenersVector.clone();
|
|
331 |
|
|
332 |
if(sisFilesForAnalysis != null){
|
|
333 |
clone.sisFilesForAnalysis = new String[sisFilesForAnalysis.length];
|
|
334 |
for(int i = 0; i<sisFilesForAnalysis.length; i++){
|
|
335 |
clone.sisFilesForAnalysis[i] = new String( sisFilesForAnalysis[i] );
|
|
336 |
}
|
|
337 |
}else{
|
|
338 |
clone.sisFilesForAnalysis = null;
|
|
339 |
}
|
|
340 |
clone.isInSISFileAnalysisMode = isInSISFileAnalysisMode;
|
|
341 |
clone.cacheUpdated = cacheUpdated;
|
|
342 |
|
|
343 |
return clone;
|
|
344 |
}
|
|
345 |
|
|
346 |
/**
|
|
347 |
* Clones the currently active instance and sets
|
|
348 |
* clone as new active instance.
|
|
349 |
* @return Returns cloned instance.
|
|
350 |
*/
|
|
351 |
public static AppDepSettings cloneAndAddAsNewActiveInstance(){
|
|
352 |
AppDepSettings existing = null;
|
|
353 |
AppDepSettings cloned = null;
|
|
354 |
// We trust here that there is at least a single active instance
|
|
355 |
existing = (AppDepSettings) settingInstancesVector.lastElement();
|
|
356 |
cloned = (AppDepSettings) existing.clone();
|
|
357 |
settingInstancesVector.add(cloned);
|
|
358 |
return cloned;
|
|
359 |
}
|
|
360 |
|
|
361 |
/**
|
|
362 |
* Sets given settings instance as currently active settings.
|
|
363 |
* @param newActiveSettings New settings to be set as current
|
|
364 |
* active settings.
|
|
365 |
* @return Returns the settings that were just set as currently
|
|
366 |
* active settings.
|
|
367 |
*/
|
|
368 |
public static AppDepSettings setAsNewActiveInstance(AppDepSettings newActiveSettings){
|
|
369 |
settingInstancesVector.add(newActiveSettings);
|
|
370 |
return newActiveSettings;
|
|
371 |
}
|
|
372 |
|
|
373 |
/**
|
|
374 |
* Creates a new uninitialized instance and sets it
|
|
375 |
* as active instance.
|
|
376 |
* @return Returns a new instance.
|
|
377 |
*/
|
|
378 |
public static AppDepSettings newActiveInstance(){
|
|
379 |
AppDepSettings instance = null;
|
|
380 |
if( settingInstancesVector == null ){
|
|
381 |
settingInstancesVector = new Vector<AppDepSettings>();
|
|
382 |
}
|
|
383 |
instance = new AppDepSettings();
|
|
384 |
settingInstancesVector.add(instance);
|
|
385 |
return instance;
|
|
386 |
}
|
|
387 |
|
|
388 |
/**
|
|
389 |
* Check for the existence of previous active instances.
|
|
390 |
* @return Returns <code>true</code> if there is an earlier instance,
|
|
391 |
* otherwise <code>false</code>.
|
|
392 |
*/
|
|
393 |
public static boolean hasPreviousActiveInstance(){
|
|
394 |
if( settingInstancesVector != null ){
|
|
395 |
return (settingInstancesVector.size() > 1);
|
|
396 |
}
|
|
397 |
return false;
|
|
398 |
}
|
|
399 |
|
|
400 |
public static void removePreviousInstances(){
|
|
401 |
if( settingInstancesVector != null ){
|
|
402 |
if(settingInstancesVector.size() > 0){
|
|
403 |
Vector<AppDepSettings> preserveThese = new Vector<AppDepSettings>();
|
|
404 |
preserveThese.add(settingInstancesVector.lastElement());
|
|
405 |
// Deleting all the other elements than the last one
|
|
406 |
settingInstancesVector.retainAll(preserveThese);
|
|
407 |
}
|
|
408 |
}
|
|
409 |
}
|
|
410 |
|
|
411 |
/**
|
|
412 |
* Returns the previously active instance and removes the
|
|
413 |
* currently active instance.
|
|
414 |
* @return Returns the previously active instance.
|
|
415 |
*/
|
|
416 |
public static AppDepSettings restorePreviousActiveInstance(){
|
|
417 |
|
|
418 |
if(! hasPreviousActiveInstance()){
|
|
419 |
throw new RuntimeException(Messages.getString("AppDepSettings.Restore_NonExisting_Instance")); //$NON-NLS-1$
|
|
420 |
}
|
|
421 |
|
|
422 |
AppDepSettings instance = null;
|
|
423 |
Object currentlyActive = settingInstancesVector.lastElement();
|
|
424 |
settingInstancesVector.remove(currentlyActive);
|
|
425 |
instance = (AppDepSettings) settingInstancesVector.lastElement();
|
|
426 |
return instance;
|
|
427 |
}
|
|
428 |
|
|
429 |
/**
|
|
430 |
* Default constructor
|
|
431 |
*/
|
|
432 |
private AppDepSettings(){
|
|
433 |
gcceToolsDir = new String(""); //$NON-NLS-1$
|
|
434 |
rvctToolsDir = new String(""); //$NON-NLS-1$
|
|
435 |
externalProgramsPathName = new String(""); //$NON-NLS-1$
|
|
436 |
currentlyUsedTargetPlatforms = new ArrayList<ITargetPlatform>();
|
|
437 |
settingListenersVector = new Vector<IAppDepSettingsChangedListener>();
|
|
438 |
buildType = new BuildTypeRelease();
|
|
439 |
initializeSupportedToolchains();
|
|
440 |
initializeNotSupportedTargets();
|
|
441 |
}
|
|
442 |
|
|
443 |
private void initializeSupportedToolchains(){
|
|
444 |
supportedToolchainsVector = new Vector<Toolchain>();
|
|
445 |
|
|
446 |
// Creating toolchain instances
|
|
447 |
toolchainGCC = new Toolchain(STR_GCC, Messages.getString("AppDepSettings.GNU_Comp_Coll"), false, true); //$NON-NLS-1$
|
|
448 |
// GCCE is used as preferred default toolchain when it can be used
|
|
449 |
toolchainGCCE = new Toolchain(STR_GCCE, Messages.getString("AppDepSettings.CSL_Arm_Toolchain"), true); //$NON-NLS-1$
|
|
450 |
toolchainRVCT = new Toolchain(STR_RVCT, Messages.getString("AppDepSettings.RVCT_Comp_Tools"), false); //$NON-NLS-1$
|
|
451 |
|
|
452 |
supportedToolchainsVector.add(toolchainGCC);
|
|
453 |
supportedToolchainsVector.add(toolchainGCCE);
|
|
454 |
supportedToolchainsVector.add(toolchainRVCT);
|
|
455 |
}
|
|
456 |
|
|
457 |
/**
|
|
458 |
* Building here a list of not supported targets.
|
|
459 |
*/
|
|
460 |
private void initializeNotSupportedTargets(){
|
|
461 |
|
|
462 |
// Initializing exact match targets
|
|
463 |
notSupportedTargetsVector = new Vector<String>();
|
|
464 |
// => There are not currenly any exact math targets defined
|
|
465 |
|
|
466 |
// Initializing startsWith match targets
|
|
467 |
notSupportedTargetWildchardsVector = new Vector<String>();
|
|
468 |
notSupportedTargetWildchardsVector.add(STR_WILDCHARD_WIN);
|
|
469 |
notSupportedTargetWildchardsVector.add(STR_WILDCHARD_TOOLS);
|
|
470 |
}
|
|
471 |
|
|
472 |
/**
|
|
473 |
* Returns tools directory for the currently used SDK/Platform.
|
|
474 |
* @return Tools directory for the currently used SDK/Platform.
|
|
475 |
*/
|
|
476 |
private String getToolsDirForCurrentlyUsedSdk() {
|
|
477 |
return removeEndingBackslash (getCurrentlyUsedSdk().getEpoc32ToolsDir());
|
|
478 |
}
|
|
479 |
|
|
480 |
/**
|
|
481 |
* Returns path to cache directory relative to tools directory.
|
|
482 |
* The directory name MUST not contain ending backslash!!!
|
|
483 |
* @return Path to cache directory relative to tools directory.
|
|
484 |
*/
|
|
485 |
private String getCachePathRelativeToToolsDir(){
|
|
486 |
return ProductInfoRegistry.getS60RndToolsDir()
|
|
487 |
+ File.separatorChar
|
|
488 |
+ ProductInfoRegistry.getAppDepCacheDir();
|
|
489 |
}
|
|
490 |
|
|
491 |
/**
|
|
492 |
* Returns cache base directory for the currently used SDK/Platform.
|
|
493 |
* The directory name MUST not contain ending backslash!!!
|
|
494 |
* @return Cache base directory for the currently used SDK/Platform.
|
|
495 |
*/
|
|
496 |
public String getCacheBaseDirForCurrentlyUsedSdk() {
|
|
497 |
return getToolsDirForCurrentlyUsedSdk()
|
|
498 |
+ File.separatorChar
|
|
499 |
+ getCachePathRelativeToToolsDir();
|
|
500 |
}
|
|
501 |
|
|
502 |
/**
|
|
503 |
* Returns the cache directories pointed by current settings.
|
|
504 |
* @return Returns the cacheBaseDir.
|
|
505 |
*/
|
|
506 |
public String[] getCacheDirs() {
|
|
507 |
ITargetPlatform[] targets = getCurrentlyUsedTargetPlatforms();
|
|
508 |
int targetCount = targets.length;
|
|
509 |
String[] resultArr = new String[targetCount];
|
|
510 |
for (int i = 0; i < targets.length; i++) {
|
|
511 |
String targetPlatformId = targets[i].getId();
|
|
512 |
resultArr[i] = getCacheDirForTarget (targetPlatformId);
|
|
513 |
}
|
|
514 |
return resultArr;
|
|
515 |
}
|
|
516 |
|
|
517 |
/**
|
|
518 |
* Returns the cache directory for given target.
|
|
519 |
* @param targetPlatformId Id for target platform to be used in directory name.
|
|
520 |
* @return Returns the cache directory for given target.
|
|
521 |
*/
|
|
522 |
public String getCacheDirForTarget(String targetPlatformId) {
|
|
523 |
if(targetPlatformId.equalsIgnoreCase(AppDepSettings.TARGET_TYPE_ID_SIS)){
|
|
524 |
return getCacheBaseDirForCurrentlyUsedSdk()
|
|
525 |
+ File.separatorChar
|
|
526 |
+ removeEndingBackslash (targetPlatformId);
|
|
527 |
}
|
|
528 |
else{
|
|
529 |
return getCacheBaseDirForCurrentlyUsedSdk()
|
|
530 |
+ File.separatorChar
|
|
531 |
+ removeEndingBackslash (targetPlatformId)
|
|
532 |
+ File.separatorChar
|
|
533 |
+ removeEndingBackslash (getBuildType().getBuildTypeName());
|
|
534 |
}
|
|
535 |
}
|
|
536 |
|
|
537 |
/**
|
|
538 |
* Returns the cache directory for given arguments.
|
|
539 |
* @return Returns the cache directory for given arguments.
|
|
540 |
*/
|
|
541 |
private String getCacheDir(SdkInformation sdkInfo, String targetPlatformName, IBuildType buildType) {
|
|
542 |
String cacheDir = removeEndingBackslash (sdkInfo.getEpoc32ToolsDir())
|
|
543 |
+ File.separatorChar
|
|
544 |
+ getCachePathRelativeToToolsDir()
|
|
545 |
+ File.separatorChar
|
|
546 |
+ removeEndingBackslash (targetPlatformName )
|
|
547 |
+ File.separatorChar
|
|
548 |
+ removeEndingBackslash (buildType.getBuildTypeName());
|
|
549 |
return cacheDir;
|
|
550 |
}
|
|
551 |
|
|
552 |
/**
|
|
553 |
* Returns absolute pathname to the currently
|
|
554 |
* used cache file for given target.
|
|
555 |
* @param targetPlatformId Id for target platform to be used in directory name.
|
|
556 |
* @return Returns currently used cache file's path name.
|
|
557 |
*/
|
|
558 |
public String getCacheFileAbsolutePathName(String targetPlatformId) {
|
|
559 |
return getCacheDirForTarget(targetPlatformId)
|
|
560 |
+ File.separatorChar
|
|
561 |
+ ProductInfoRegistry.getCacheFileName();
|
|
562 |
}
|
|
563 |
|
|
564 |
/**
|
|
565 |
* Returns absolute pathname to the symbols table file of the
|
|
566 |
* currently used cache directory for given target.
|
|
567 |
* @param targetPlatformId Id for target platform to be used in directory name.
|
|
568 |
* @return Returns currently used symbols table file's path name.
|
|
569 |
*/
|
|
570 |
public String getCacheSymbolsTableFileAbsolutePathName(String targetPlatformId) {
|
|
571 |
return getCacheDirForTarget(targetPlatformId)
|
|
572 |
+ File.separatorChar
|
|
573 |
+ ProductInfoRegistry.getCacheSymbolsFileName();
|
|
574 |
}
|
|
575 |
|
|
576 |
/**
|
|
577 |
* Returns absolute pathname to the cache file from the
|
|
578 |
* SDK ID and Target Platform name given as parameters.
|
|
579 |
* @param sdkInfo SDK information object.
|
|
580 |
* @param targetPlatformId Target Platform Name string
|
|
581 |
* @param buildType Build type.
|
|
582 |
* @return Absolute pathname to the cache file.
|
|
583 |
*/
|
|
584 |
public String getCacheFileAbsolutePathNameForSdkAndPlatform(SdkInformation sdkInfo,
|
|
585 |
String targetPlatformId,
|
|
586 |
IBuildType buildType) {
|
|
587 |
return
|
|
588 |
getCacheDir(sdkInfo,targetPlatformId,buildType)
|
|
589 |
+ File.separatorChar
|
|
590 |
+ ProductInfoRegistry.getCacheFileName();
|
|
591 |
}
|
|
592 |
|
|
593 |
/**
|
|
594 |
* Checks is the given Target Platform is cached.
|
|
595 |
*
|
|
596 |
* @param sdkId
|
|
597 |
* SDK ID string.
|
|
598 |
* @param targetPlatformName
|
|
599 |
* Target Platform Name string
|
|
600 |
* @param buildType
|
|
601 |
* Build type.
|
|
602 |
* @return Returns <code>true</code> if the target platform is cached,
|
|
603 |
* otherwise <code>false</code>.
|
|
604 |
*/
|
|
605 |
public boolean isTargetPlatformCached(String sdkId,
|
|
606 |
String targetPlatformName, IBuildType buildType) {
|
|
607 |
SdkInformation[] infos;
|
|
608 |
|
|
609 |
try {
|
|
610 |
infos = SdkManager.getSdkInformation();
|
|
611 |
for (int i = 0; i < infos.length; i++) {
|
|
612 |
SdkInformation info = infos[i];
|
|
613 |
if (sdkId.equals(info.getSdkId())) {
|
|
614 |
return isTargetPlatformCached(info, targetPlatformName,
|
|
615 |
buildType);
|
|
616 |
}
|
|
617 |
}
|
|
618 |
|
|
619 |
} catch (SdkEnvInfomationResolveFailureException e) {
|
|
620 |
e.printStackTrace();
|
|
621 |
}
|
|
622 |
return false;
|
|
623 |
}
|
|
624 |
|
|
625 |
/**
|
|
626 |
* Checks is the given Target Platform is cached.
|
|
627 |
*
|
|
628 |
* @param sdkInfo
|
|
629 |
* SDK information object.
|
|
630 |
* @param targetPlatformName
|
|
631 |
* Target Platform Name string
|
|
632 |
* @param buildType
|
|
633 |
* Build type.
|
|
634 |
* @return Returns <code>true</code> if the target platform is cached,
|
|
635 |
* otherwise <code>false</code>.
|
|
636 |
*/
|
|
637 |
public boolean isTargetPlatformCached(SdkInformation sdkInfo,
|
|
638 |
String targetPlatformName, IBuildType buildType) {
|
|
639 |
|
|
640 |
String cacheFilePath = getCacheFileAbsolutePathNameForSdkAndPlatform(
|
|
641 |
sdkInfo, targetPlatformName, buildType);
|
|
642 |
File cacheFile = new File(cacheFilePath);
|
|
643 |
if (cacheFile.exists()) {
|
|
644 |
// There is no temporary file and cache file exists
|
|
645 |
return true;
|
|
646 |
}
|
|
647 |
|
|
648 |
// Cache file does not exist
|
|
649 |
return false;
|
|
650 |
}
|
|
651 |
|
|
652 |
|
|
653 |
/**
|
|
654 |
* Returns the absolute path pointing to cfilt program.
|
|
655 |
* @return Returns pathname to cfilt program
|
|
656 |
*/
|
|
657 |
public String getCfiltProgramPathName() {
|
|
658 |
return getExternalProgramsPathName()
|
|
659 |
+ File.separatorChar
|
|
660 |
+ ProductInfoRegistry.getCfiltBinaryName();
|
|
661 |
}
|
|
662 |
|
|
663 |
/**
|
|
664 |
* Returns the absolute path pointing to AppDep
|
|
665 |
* command line executable.
|
|
666 |
* @return Returns pathname to appdep program
|
|
667 |
*/
|
|
668 |
public String getAppDepProgramPathName() {
|
|
669 |
return getExternalProgramsPathName()
|
|
670 |
+ File.separatorChar
|
|
671 |
+ ProductInfoRegistry.getAppDepBinaryName();
|
|
672 |
}
|
|
673 |
|
|
674 |
/**
|
|
675 |
* @return Returns the externalProgramsPathName.
|
|
676 |
*/
|
|
677 |
public String getExternalProgramsPathName() {
|
|
678 |
return externalProgramsPathName;
|
|
679 |
}
|
|
680 |
|
|
681 |
/**
|
|
682 |
* @param externalProgramsPathName The externalProgramsPathName to set.
|
|
683 |
*/
|
|
684 |
public void setExternalProgramsPathName(String externalProgramsPathName) {
|
|
685 |
this.externalProgramsPathName = removeEndingBackslash(externalProgramsPathName);
|
|
686 |
}
|
|
687 |
|
|
688 |
/**
|
|
689 |
* Returns the currently used target platforms.
|
|
690 |
* @return Array of currently used target platforms.
|
|
691 |
*/
|
|
692 |
public ITargetPlatform[] getCurrentlyUsedTargetPlatforms() {
|
|
693 |
return currentlyUsedTargetPlatforms.toArray(new TargetPlatform[0]);
|
|
694 |
}
|
|
695 |
|
|
696 |
/**
|
|
697 |
* Checks if the given target platform is supported.
|
|
698 |
* @param targetPlatform Target platform to be checked.
|
|
699 |
* @return Returns <code>true</code> if the given target platform
|
|
700 |
* is supported, otherwise <code>false</code>.
|
|
701 |
*/
|
|
702 |
public boolean isSupportedTargetPlatform(String targetPlatform){
|
|
703 |
// Target is not supported if it is listed in predefined list
|
|
704 |
for (Iterator<String> iter = notSupportedTargetsVector.iterator(); iter.hasNext();) {
|
|
705 |
String str = iter.next();
|
|
706 |
if( str.compareToIgnoreCase( targetPlatform ) == 0 ){
|
|
707 |
return false;
|
|
708 |
}
|
|
709 |
}
|
|
710 |
|
|
711 |
// Target is also not supported if it is listed in predefined list of startsWith matches
|
|
712 |
for (Iterator<String> iter = notSupportedTargetWildchardsVector.iterator(); iter.hasNext();) {
|
|
713 |
String str = iter.next().toLowerCase();
|
|
714 |
if( targetPlatform.toLowerCase().startsWith(str) ){
|
|
715 |
return false;
|
|
716 |
}
|
|
717 |
}
|
|
718 |
|
|
719 |
// Not defined as unsupported, therefore supported
|
|
720 |
return true;
|
|
721 |
}
|
|
722 |
|
|
723 |
/**
|
|
724 |
* Sets new targets as currently used ones.
|
|
725 |
* Updates also currently used toolchain accordingly.
|
|
726 |
* This method must be called with targets that maps
|
|
727 |
* to the same toolchain, and all given targets
|
|
728 |
* must be supported.
|
|
729 |
* @param targetPlatformNameArr The new target set to be set as currently ised targets..
|
|
730 |
*/
|
|
731 |
public void setCurrentlyUsedTargetPlatforms(String[] targetPlatformNameArr)
|
|
732 |
throws InvalidCmdLineToolSettingException {
|
|
733 |
|
|
734 |
// Supported one ...clearing old settings
|
|
735 |
clearCurrentlyUsedTargetPlatforms();
|
|
736 |
// Temporary variable to find out correct toolchain settings
|
|
737 |
IToolchain toolchainSetting = null;
|
|
738 |
|
|
739 |
// Checking that no empty array was passed
|
|
740 |
if(targetPlatformNameArr.length > 0){
|
|
741 |
toolchainSetting = getDefaultToolchainForTarget(targetPlatformNameArr[0]);
|
|
742 |
}
|
|
743 |
else{
|
|
744 |
throw new InvalidCmdLineToolSettingException( Messages.getString("AppDepSettings.Target_Array_Is_Empty") ); //$NON-NLS-1$
|
|
745 |
}
|
|
746 |
// Checking validity of the settings and storing the given targets
|
|
747 |
for (int i = 0; i < targetPlatformNameArr.length; i++) {
|
|
748 |
String targetPlatformId = targetPlatformNameArr[i];
|
|
749 |
if(! isSupportedTargetPlatform(targetPlatformId)){
|
|
750 |
// Not found, regarded as unsupported
|
|
751 |
throw new InvalidCmdLineToolSettingException( Messages.getString("AppDepSettings.Target") //$NON-NLS-1$
|
|
752 |
+ targetPlatformNameArr
|
|
753 |
+ Messages.getString("AppDepSettings.NotSupported") ); //$NON-NLS-1$
|
|
754 |
}
|
|
755 |
// Check was OK => storing the target information
|
|
756 |
currentlyUsedTargetPlatforms.add(new TargetPlatform(targetPlatformId));
|
|
757 |
// All items must map to the same toolchain
|
|
758 |
IToolchain toolchainSettingTmp = getDefaultToolchainForTarget(targetPlatformId);
|
|
759 |
if(! toolchainSettingTmp.equals(toolchainSetting)){
|
|
760 |
throw new InvalidCmdLineToolSettingException( Messages.getString("AppDepSettings.Targets_Does_Not_Map_To_Same_Toolchain") ); //$NON-NLS-1$
|
|
761 |
}
|
|
762 |
}
|
|
763 |
// Finally setting the used toolchain accordingly
|
|
764 |
setCurrentlyUsedToolChain(toolchainSetting);
|
|
765 |
// Notifying possible listeners
|
|
766 |
notifySettingsListeners(false);
|
|
767 |
}
|
|
768 |
|
|
769 |
/**
|
|
770 |
* Returns the used toolchain.
|
|
771 |
* @return Returns the currentlyUsedToolChain.
|
|
772 |
*/
|
|
773 |
public IToolchain getCurrentlyUsedToolChain() {
|
|
774 |
return currentlyUsedToolChain;
|
|
775 |
}
|
|
776 |
|
|
777 |
/**
|
|
778 |
* Returns the used toolchain's name.
|
|
779 |
* @return Returns the currently used toolchains name.
|
|
780 |
*/
|
|
781 |
public String getCurrentlyUsedToolChainName() {
|
|
782 |
return currentlyUsedToolChain.getToolchainName();
|
|
783 |
}
|
|
784 |
|
|
785 |
/**
|
|
786 |
* Sets new toolchain as currently used one.
|
|
787 |
* @param newToolChainSetting The currentlyUsedToolChain to set.
|
|
788 |
*/
|
|
789 |
private void setCurrentlyUsedToolChain(IToolchain newToolChainSetting)
|
|
790 |
throws InvalidCmdLineToolSettingException {
|
|
791 |
// Can we found the toolchain among the supported ones
|
|
792 |
for (Iterator<Toolchain> iter = supportedToolchainsVector.iterator(); iter.hasNext();) {
|
|
793 |
Toolchain tch = iter.next();
|
|
794 |
String str = tch.getToolchainName();
|
|
795 |
if( str.compareToIgnoreCase( newToolChainSetting.getToolchainName() ) == 0 ){
|
|
796 |
this.currentlyUsedToolChain = newToolChainSetting;
|
|
797 |
return;
|
|
798 |
}
|
|
799 |
}
|
|
800 |
// Not found, regarded as unsupported
|
|
801 |
throw new InvalidCmdLineToolSettingException( Messages.getString("AppDepSettings.Toolchain") //$NON-NLS-1$
|
|
802 |
+ newToolChainSetting
|
|
803 |
+ Messages.getString("AppDepSettings.NotSupported") ); //$NON-NLS-1$
|
|
804 |
}
|
|
805 |
|
|
806 |
/**
|
|
807 |
* Returns the used directory for GCCE tools.
|
|
808 |
* @return Returns the gcceToolsDir.
|
|
809 |
*/
|
|
810 |
public String getGcceToolsDir() {
|
|
811 |
return gcceToolsDir;
|
|
812 |
}
|
|
813 |
|
|
814 |
/**
|
|
815 |
* @param gcceToolsDir The gcceToolsDir to set.
|
|
816 |
*/
|
|
817 |
public void setGcceToolsDir(String gcceToolsDir) {
|
|
818 |
this.gcceToolsDir = removeEndingBackslash(gcceToolsDir);
|
|
819 |
}
|
|
820 |
|
|
821 |
/**
|
|
822 |
* Gets GCCE toolchain installation status.
|
|
823 |
* @return Returns <code>true</code> if toolchain is installed,
|
|
824 |
* otherwise <code>false</code>.
|
|
825 |
*/
|
|
826 |
public boolean isGcceToolsInstalled() {
|
|
827 |
return toolchainGCCE.isInstalled();
|
|
828 |
}
|
|
829 |
|
|
830 |
/**
|
|
831 |
* Sets GCCE toolchain installation status.
|
|
832 |
* @param isGcceToolsInstalled The installation status to set.
|
|
833 |
*/
|
|
834 |
public void setGcceToolsInstalled(boolean isGcceToolsInstalled) {
|
|
835 |
toolchainGCCE.setIsInstalled(isGcceToolsInstalled);
|
|
836 |
}
|
|
837 |
|
|
838 |
/**
|
|
839 |
* Gets RVCT toolchain installation status.
|
|
840 |
* @return Returns <code>true</code> if toolchain is installed,
|
|
841 |
* otherwise <code>false</code>.
|
|
842 |
*/
|
|
843 |
public boolean isRvctToolsInstalled() {
|
|
844 |
return toolchainRVCT.isInstalled();
|
|
845 |
}
|
|
846 |
|
|
847 |
/**
|
|
848 |
* Sets RVCT toolchain installation status.
|
|
849 |
* @param isRvctToolsInstalled The installation status to set.
|
|
850 |
*/
|
|
851 |
public void setRvctToolsInstalled(boolean isRvctToolsInstalled) {
|
|
852 |
toolchainRVCT.setIsInstalled(isRvctToolsInstalled);
|
|
853 |
}
|
|
854 |
|
|
855 |
/**
|
|
856 |
* Returns the used root directory of SDK.
|
|
857 |
* @return Returns the sdkRootDir.
|
|
858 |
*/
|
|
859 |
public String getSdkRootDir() {
|
|
860 |
if(currentlyUsedSdk != null){
|
|
861 |
return removeEndingBackslash(currentlyUsedSdk.getEpocRootDir());
|
|
862 |
}
|
|
863 |
return null;
|
|
864 |
}
|
|
865 |
|
|
866 |
/**
|
|
867 |
* Returns the used directory for RVCT tools.
|
|
868 |
* @return Returns the rvctToolsDir.
|
|
869 |
*/
|
|
870 |
public String getRvctToolsDir() {
|
|
871 |
return rvctToolsDir;
|
|
872 |
}
|
|
873 |
|
|
874 |
/**
|
|
875 |
* Sets the used directory for RVCT tools.
|
|
876 |
* @param rvctToolsDir The rvctToolsDir to set.
|
|
877 |
*/
|
|
878 |
public void setRvctToolsDir(String rvctToolsDir) {
|
|
879 |
this.rvctToolsDir = removeEndingBackslash(rvctToolsDir);
|
|
880 |
}
|
|
881 |
|
|
882 |
/**
|
|
883 |
* @return Returns the buildType.
|
|
884 |
*/
|
|
885 |
public IBuildType getBuildType() {
|
|
886 |
return buildType;
|
|
887 |
}
|
|
888 |
|
|
889 |
/**
|
|
890 |
* Checks that given parameter referes to supported build
|
|
891 |
* type, and sets the new type if it is supported.
|
|
892 |
* @param buildTypeString The name of build type to set.
|
|
893 |
* @throws InvalidCmdLineToolSettingException If the given build type is not supported.
|
|
894 |
*/
|
|
895 |
public void setBuildType(String buildTypeString) throws InvalidCmdLineToolSettingException {
|
|
896 |
if( buildTypeString.equalsIgnoreCase(BuildTypeRelease.NAME)){
|
|
897 |
this.buildType = new BuildTypeRelease();
|
|
898 |
}
|
|
899 |
else if( buildTypeString.equalsIgnoreCase(BuildTypeDebug.NAME)){
|
|
900 |
this.buildType = new BuildTypeDebug();
|
|
901 |
}
|
|
902 |
else{
|
|
903 |
// Not found, regarded as unsupported
|
|
904 |
throw new InvalidCmdLineToolSettingException( Messages.getString("AppDepSettings.Build_Type") //$NON-NLS-1$
|
|
905 |
+ buildTypeString
|
|
906 |
+ Messages.getString("AppDepSettings.NotSupported") ); //$NON-NLS-1$
|
|
907 |
}
|
|
908 |
// Notifying possible listeners
|
|
909 |
notifySettingsListeners(false);
|
|
910 |
}
|
|
911 |
|
|
912 |
/**
|
|
913 |
* Checks that given parameter referes to supported build
|
|
914 |
* type, and sets the new type if it is supported.
|
|
915 |
* @param buildType The build type object to set.
|
|
916 |
* @throws InvalidCmdLineToolSettingException If the given build type is not supported.
|
|
917 |
*/
|
|
918 |
public void setBuildType(IBuildType buildType) throws InvalidCmdLineToolSettingException {
|
|
919 |
if( (buildType instanceof BuildTypeDebug)
|
|
920 |
||
|
|
921 |
(buildType instanceof BuildTypeRelease)
|
|
922 |
){
|
|
923 |
this.buildType = buildType;
|
|
924 |
}
|
|
925 |
else{
|
|
926 |
// Not found, regarded as unsupported
|
|
927 |
throw new InvalidCmdLineToolSettingException( Messages.getString("AppDepSettings.Build_Type") //$NON-NLS-1$
|
|
928 |
+ buildType.getBuildTypeName()
|
|
929 |
+ Messages.getString("AppDepSettings.NotSupported") ); //$NON-NLS-1$
|
|
930 |
}
|
|
931 |
// Notifying possible listeners
|
|
932 |
notifySettingsListeners(false);
|
|
933 |
}
|
|
934 |
|
|
935 |
/**
|
|
936 |
* Maps the given build type string into corresponding
|
|
937 |
* build object type if the given type is supported..
|
|
938 |
* @param buildTypeString The name of build type to set.
|
|
939 |
* @throws InvalidCmdLineToolSettingException If the given build type is not supported.
|
|
940 |
*/
|
|
941 |
public IBuildType getBuildTypeFromString(String buildTypeString) throws InvalidCmdLineToolSettingException {
|
|
942 |
if( buildTypeString.equalsIgnoreCase(BuildTypeRelease.NAME)){
|
|
943 |
return new BuildTypeRelease();
|
|
944 |
}
|
|
945 |
else if( buildTypeString.equalsIgnoreCase(BuildTypeDebug.NAME)){
|
|
946 |
return new BuildTypeDebug();
|
|
947 |
}
|
|
948 |
|
|
949 |
// Not found, regarded as unsupported
|
|
950 |
throw new InvalidCmdLineToolSettingException( Messages.getString("AppDepSettings.Build_Type") //$NON-NLS-1$
|
|
951 |
+ buildTypeString
|
|
952 |
+ Messages.getString("AppDepSettings.NotSupported") ); //$NON-NLS-1$
|
|
953 |
}
|
|
954 |
|
|
955 |
/**
|
|
956 |
* Builds release dir based on the already known directory
|
|
957 |
* components.
|
|
958 |
* @return Returns the release directory.
|
|
959 |
*/
|
|
960 |
public String getReleaseDir() {
|
|
961 |
return getSdkRootDir()
|
|
962 |
+ File.separator
|
|
963 |
+ STR_EPOC32_DIR
|
|
964 |
+ File.separator
|
|
965 |
+ STR_RELEASE_DIR;
|
|
966 |
}
|
|
967 |
|
|
968 |
/**
|
|
969 |
* Builds the build based on the already known directory
|
|
970 |
* components.
|
|
971 |
* @param targetPlatformId Target platform to get build directory for.
|
|
972 |
* @return Returns the build directory.
|
|
973 |
*/
|
|
974 |
public String getBuildDir(String targetPlatformId) {
|
|
975 |
return getReleaseDir()
|
|
976 |
+ File.separator
|
|
977 |
+ targetPlatformId
|
|
978 |
+ File.separator
|
|
979 |
+ getBuildType().getBuildTypeName();
|
|
980 |
}
|
|
981 |
|
|
982 |
/**
|
|
983 |
* Builds the build based on the already known
|
|
984 |
* directory components.
|
|
985 |
* @return Returns the build directories
|
|
986 |
* as set for currently selected target.
|
|
987 |
*/
|
|
988 |
public Set<String> getBuildDirsAsSet() {
|
|
989 |
Set<String> buildDirSet = new HashSet<String>();
|
|
990 |
ITargetPlatform[] targets = getCurrentlyUsedTargetPlatforms();
|
|
991 |
for (int i = 0; i < targets.length; i++) {
|
|
992 |
ITargetPlatform platform = targets[i];
|
|
993 |
String buildDir = getReleaseDir()
|
|
994 |
+ File.separator
|
|
995 |
+ platform.getId()
|
|
996 |
+ File.separator
|
|
997 |
+ getBuildType().getBuildTypeName();
|
|
998 |
buildDirSet.add(buildDir);
|
|
999 |
}
|
|
1000 |
return buildDirSet;
|
|
1001 |
}
|
|
1002 |
|
|
1003 |
/**
|
|
1004 |
* @return Returns the currentlyUsedSdk.
|
|
1005 |
*/
|
|
1006 |
public SdkInformation getCurrentlyUsedSdk() {
|
|
1007 |
return currentlyUsedSdk;
|
|
1008 |
}
|
|
1009 |
|
|
1010 |
/**
|
|
1011 |
* @param currentlyUsedSdk The currentlyUsedSdk to set.
|
|
1012 |
*/
|
|
1013 |
public void setCurrentlyUsedSdk(SdkInformation currentlyUsedSdk) {
|
|
1014 |
this.currentlyUsedSdk = currentlyUsedSdk;
|
|
1015 |
// Notifying possible listeners
|
|
1016 |
notifySettingsListeners(false);
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
/**
|
|
1020 |
* Returns build directory for the given Sdk information node
|
|
1021 |
* and target platform name.
|
|
1022 |
* @param sdkInfo Sdk information object.
|
|
1023 |
* @param targetPlatformName Target platform name.
|
|
1024 |
* @param buildType Build type.
|
|
1025 |
* @return Build directory string.
|
|
1026 |
*/
|
|
1027 |
public String getBuildDirectoryForSdkAndPlatform(SdkInformation sdkInfo,
|
|
1028 |
String targetPlatformName,
|
|
1029 |
IBuildType buildType) {
|
|
1030 |
return sdkInfo.getReleaseRootDir()
|
|
1031 |
+ File.separator
|
|
1032 |
+ targetPlatformName
|
|
1033 |
+ File.separator
|
|
1034 |
+ buildType.getBuildTypeName();
|
|
1035 |
}
|
|
1036 |
|
|
1037 |
public void updateCurrentlyUsedSDKAndTargetPlatforms(SdkInformation currentlyUsedSdk,
|
|
1038 |
String[] currentlyUsedTargetPlatforms,
|
|
1039 |
IBuildType currentlyUsedBuildType
|
|
1040 |
) throws InvalidCmdLineToolSettingException{
|
|
1041 |
setCurrentlyUsedSdk(currentlyUsedSdk);
|
|
1042 |
setCurrentlyUsedTargetPlatforms(currentlyUsedTargetPlatforms);
|
|
1043 |
setBuildType(currentlyUsedBuildType);
|
|
1044 |
}
|
|
1045 |
|
|
1046 |
/**
|
|
1047 |
* The method adds given target to the list of currently used ones.
|
|
1048 |
* The method checks if the toolChain of given platform maps with the
|
|
1049 |
* default toolchain (of all other platforms). If not, the method throws an exception.
|
|
1050 |
* @param targetPlatformId The new target to be added to currently used targets.
|
|
1051 |
*/
|
|
1052 |
public void addTargetPlatform(String targetPlatformId) throws InvalidCmdLineToolSettingException
|
|
1053 |
{
|
|
1054 |
if(! isSupportedTargetPlatform(targetPlatformId)){
|
|
1055 |
// Given target is not found in the list of supported targets. So, regarded as unsupported
|
|
1056 |
throw new InvalidCmdLineToolSettingException( Messages.getString("AppDepSettings.Target") //$NON-NLS-1$
|
|
1057 |
+ targetPlatformId
|
|
1058 |
+ Messages.getString("AppDepSettings.NotSupported") ); //$NON-NLS-1$
|
|
1059 |
}
|
|
1060 |
|
|
1061 |
// Check was OK => adding the target information
|
|
1062 |
currentlyUsedTargetPlatforms.add(new TargetPlatform(targetPlatformId));
|
|
1063 |
// The toolchain of given platform must match with the toolchain of all existing platforms.
|
|
1064 |
IToolchain toolchainSettingTmp = getDefaultToolchainForTarget(targetPlatformId);
|
|
1065 |
if(toolchainSettingTmp == null || !toolchainSettingTmp.getToolchainName().equalsIgnoreCase(getCurrentlyUsedToolChainName())){
|
|
1066 |
throw new InvalidCmdLineToolSettingException( Messages.getString("AppDepSettings.Targets_Does_Not_Map_To_Same_Toolchain") ); //$NON-NLS-1$
|
|
1067 |
}
|
|
1068 |
|
|
1069 |
notifySettingsListeners(false);
|
|
1070 |
}
|
|
1071 |
/**
|
|
1072 |
* @return Returns the currentlyAnalyzedComponentName.
|
|
1073 |
*/
|
|
1074 |
public String getCurrentlyAnalyzedComponentName() {
|
|
1075 |
return currentlyAnalyzedComponentName;
|
|
1076 |
}
|
|
1077 |
|
|
1078 |
/**
|
|
1079 |
* Sets currently analyzed component name and resets
|
|
1080 |
* target platform setting. Target platform can be set after this call
|
|
1081 |
* by calling method <code>setCurrentlyAnalyzedComponentTargetPlatform</code>.
|
|
1082 |
* @param currentlyAnalyzedComponentName The currentlyAnalyzedComponentName to set.
|
|
1083 |
*/
|
|
1084 |
public void setCurrentlyAnalyzedComponentName(
|
|
1085 |
String currentlyAnalyzedComponentName) {
|
|
1086 |
this.currentlyAnalyzedComponentName = currentlyAnalyzedComponentName;
|
|
1087 |
this.currentlyAnalyzedComponentTargetPlatform = null; // not set by default
|
|
1088 |
// Notifying possible listeners
|
|
1089 |
notifySettingsListeners(false);
|
|
1090 |
}
|
|
1091 |
|
|
1092 |
/**
|
|
1093 |
* Sets the target platform for the currently analyzed component.
|
|
1094 |
* Should be called after <code>setCurrentlyAnalyzedComponentName</code> is called if needed.
|
|
1095 |
* @param currentlyAnalyzedComponentTargetPlatform The target platform for the currently analyzed component.
|
|
1096 |
*/
|
|
1097 |
public void setCurrentlyAnalyzedComponentTargetPlatform(
|
|
1098 |
ITargetPlatform currentlyAnalyzedComponentTargetPlatform) {
|
|
1099 |
this.currentlyAnalyzedComponentTargetPlatform = currentlyAnalyzedComponentTargetPlatform;
|
|
1100 |
// Notifying possible listeners
|
|
1101 |
notifySettingsListeners(false);
|
|
1102 |
}
|
|
1103 |
|
|
1104 |
/**
|
|
1105 |
* Gets target platform for the currently analyzed component.
|
|
1106 |
* @return target platform for the currently analyzed component, or <code>null</code> if not set.
|
|
1107 |
*/
|
|
1108 |
public ITargetPlatform getCurrentlyAnalyzedComponentTargetPlatform() {
|
|
1109 |
return currentlyAnalyzedComponentTargetPlatform;
|
|
1110 |
}
|
|
1111 |
|
|
1112 |
/**
|
|
1113 |
* Checks if cache data loading is ongoing.
|
|
1114 |
* @return <code>true</code> if cache data loading is ongoing, otherwise <code>false</code>.
|
|
1115 |
*/
|
|
1116 |
public boolean isCacheDataLoadingOngoing(){
|
|
1117 |
return isCacheDataLoadingOngoing;
|
|
1118 |
}
|
|
1119 |
|
|
1120 |
/**
|
|
1121 |
* Checks if caching is ongoing for the given target.
|
|
1122 |
* @param sdkInfo SDK information object
|
|
1123 |
* @param targetPlatformName Target Platform Name string
|
|
1124 |
* @param buildType Build type.
|
|
1125 |
* @return Returns <code>true</code> if caching is ongoing,
|
|
1126 |
* otherwise <code>false</code>.
|
|
1127 |
*/
|
|
1128 |
public boolean isCacheGenerationOngoingForTarget(SdkInformation sdkInfo,
|
|
1129 |
String targetPlatformName,
|
|
1130 |
IBuildType buildType) {
|
|
1131 |
return AppDepJobManager.getInstance().hasCacheGenerationJobForTarget(sdkInfo.getSdkId(),
|
|
1132 |
targetPlatformName,
|
|
1133 |
buildType);
|
|
1134 |
}
|
|
1135 |
|
|
1136 |
/**
|
|
1137 |
* Checks if caching is ongoing for the given SDK.
|
|
1138 |
* @param sdkInfo SDK information object
|
|
1139 |
* @return Returns <code>true</code> if caching is ongoing,
|
|
1140 |
* otherwise <code>false</code>.
|
|
1141 |
*/
|
|
1142 |
public boolean isCacheGenerationOngoingForSdk(SdkInformation sdkInfo) {
|
|
1143 |
return AppDepJobManager.getInstance().hasCacheGenerationJobForSdk(sdkInfo.getSdkId());
|
|
1144 |
}
|
|
1145 |
|
|
1146 |
/**
|
|
1147 |
* Returns component file objects for the SDK and Target Platform
|
|
1148 |
* given as parameters.
|
|
1149 |
* @param sdkInfo SDK information object.
|
|
1150 |
* @param targetPlatformName Target Platform Name string
|
|
1151 |
* @param buildType Build type.
|
|
1152 |
* @return File object array of given components.
|
|
1153 |
*/
|
|
1154 |
private File[] getComponentsForSdkAndPlatform(SdkInformation sdkInfo,
|
|
1155 |
String targetPlatformName,
|
|
1156 |
IBuildType buildType) {
|
|
1157 |
|
|
1158 |
String releaseDirPath =
|
|
1159 |
sdkInfo.getReleaseRootDir()
|
|
1160 |
+ File.separatorChar
|
|
1161 |
+ targetPlatformName
|
|
1162 |
+ File.separatorChar
|
|
1163 |
+ buildType.getBuildTypeName();
|
|
1164 |
File releaseDir = new File(releaseDirPath);
|
|
1165 |
if(releaseDir.exists())
|
|
1166 |
return releaseDir.listFiles(new ComponentFileFilter());
|
|
1167 |
else{
|
|
1168 |
return null;
|
|
1169 |
}
|
|
1170 |
}
|
|
1171 |
|
|
1172 |
/**
|
|
1173 |
* Returns component count for the SDK and Target Platform
|
|
1174 |
* given as parameters.
|
|
1175 |
* @param sdkInfo SDK information object.
|
|
1176 |
* @param targetPlatformName Target Platform Name string
|
|
1177 |
* @param buildType Build type.
|
|
1178 |
* @return Component count
|
|
1179 |
*/
|
|
1180 |
public int getComponentCountForSdkAndPlatform(SdkInformation sdkInfo,
|
|
1181 |
String targetPlatformName,
|
|
1182 |
IBuildType buildType) {
|
|
1183 |
|
|
1184 |
mostRecentlyQueriedComponentCount = 0;
|
|
1185 |
|
|
1186 |
String releaseDirPath =
|
|
1187 |
sdkInfo.getReleaseRootDir()
|
|
1188 |
+ File.separatorChar
|
|
1189 |
+ targetPlatformName
|
|
1190 |
+ File.separatorChar
|
|
1191 |
+ buildType.getBuildTypeName();
|
|
1192 |
File releaseDir = new File(releaseDirPath);
|
|
1193 |
if(releaseDir.exists()){
|
|
1194 |
String[] fileArr = releaseDir.list(new ComponentFileFilter());
|
|
1195 |
mostRecentlyQueriedComponentCount = fileArr.length;
|
|
1196 |
return mostRecentlyQueriedComponentCount;
|
|
1197 |
}
|
|
1198 |
// Directory was not found => no components.
|
|
1199 |
return mostRecentlyQueriedComponentCount;
|
|
1200 |
}
|
|
1201 |
|
|
1202 |
/**
|
|
1203 |
* Check if cache needs to be updated i.e. there is newer
|
|
1204 |
* files existing in build directory. Note that this method returns
|
|
1205 |
* <code>true</code> whenever it meets the first target requiring update.
|
|
1206 |
* @param sdkInfo SDK information object.
|
|
1207 |
* @param targets Target to check cache update need for
|
|
1208 |
* @param buildType Build type.
|
|
1209 |
* @return <code>true</code> if cache needs update, otherwise <code>false</code>.
|
|
1210 |
*/
|
|
1211 |
public boolean cacheNeedsUpdate(SdkInformation sdkInfo,
|
|
1212 |
ITargetPlatform[] targets, IBuildType buildType){
|
|
1213 |
|
|
1214 |
// Checking through all the targets
|
|
1215 |
for (int i = 0; i < targets.length; i++) {
|
|
1216 |
ITargetPlatform platform = targets[i];
|
|
1217 |
String targetPlatformName = platform.getId();
|
|
1218 |
|
|
1219 |
if(targetPlatformName.equals(TARGET_TYPE_ID_SIS)){
|
|
1220 |
continue;
|
|
1221 |
}
|
|
1222 |
|
|
1223 |
String cacheFilePath = getCacheFileAbsolutePathNameForSdkAndPlatform(
|
|
1224 |
sdkInfo,
|
|
1225 |
targetPlatformName,
|
|
1226 |
buildType);
|
|
1227 |
File cacheFile = new File(cacheFilePath);
|
|
1228 |
if(!cacheFile.exists()){
|
|
1229 |
// We should not encounter this situation, but if there is no
|
|
1230 |
// cache file, then it surely needs update.
|
|
1231 |
return true;
|
|
1232 |
}
|
|
1233 |
|
|
1234 |
String buildDir = getBuildDirectoryForSdkAndPlatform(sdkInfo,
|
|
1235 |
targetPlatformName,
|
|
1236 |
buildType);
|
|
1237 |
|
|
1238 |
CacheIndex cacheIndx = null;
|
|
1239 |
try {
|
|
1240 |
cacheIndx = CacheIndex.getCacheIndexInstance(cacheFile,
|
|
1241 |
buildDir);
|
|
1242 |
} catch (IOException e) {
|
|
1243 |
e.printStackTrace();
|
|
1244 |
// We should no encounter in this situation, but then
|
|
1245 |
// it is better to enable the regeneration of the cache.
|
|
1246 |
return true;
|
|
1247 |
}
|
|
1248 |
|
|
1249 |
// Checking that cache is not corrupted.
|
|
1250 |
if(! cacheIndx.isCacheNonCorrupted()){
|
|
1251 |
// If corrupted, then needs update
|
|
1252 |
return true;
|
|
1253 |
}
|
|
1254 |
|
|
1255 |
// Checking that cache is of correct version
|
|
1256 |
if(! cacheIndx.getVersionInfo().equals(ProductInfoRegistry.getSupportedCacheFileVersionInfoString())){
|
|
1257 |
// If non-supported version, then needs update
|
|
1258 |
return true;
|
|
1259 |
}
|
|
1260 |
File[] fileArr = null;
|
|
1261 |
|
|
1262 |
fileArr = getComponentsForSdkAndPlatform(sdkInfo,
|
|
1263 |
targetPlatformName,
|
|
1264 |
buildType);
|
|
1265 |
// Comparing found components against cache information
|
|
1266 |
if(fileArr != null && isComponentFileArrayChangedWhenComparingWithCache(cacheIndx, fileArr)){
|
|
1267 |
return true;
|
|
1268 |
}
|
|
1269 |
|
|
1270 |
}//for
|
|
1271 |
|
|
1272 |
return false;
|
|
1273 |
}
|
|
1274 |
|
|
1275 |
/**
|
|
1276 |
* Checks if given component file array has been changed in respect to cache file.
|
|
1277 |
* @param cacheIndx Cache index used to check for timestamps stored in cache.
|
|
1278 |
* @param componentFileArr File array to be checked against cache information.
|
|
1279 |
* @return <code>true</code> if cache needs update, otherwsise <code>false</code>.
|
|
1280 |
*/
|
|
1281 |
private boolean isComponentFileArrayChangedWhenComparingWithCache(CacheIndex cacheIndx, File[] componentFileArr) {
|
|
1282 |
|
|
1283 |
File f = null;
|
|
1284 |
for (int j = 0; j < componentFileArr.length; j++) {
|
|
1285 |
f = componentFileArr[j];
|
|
1286 |
String basename = f.getName();
|
|
1287 |
try {
|
|
1288 |
long fileModifiedAsMillisecAccuracy = f.lastModified();
|
|
1289 |
// Flooring timestamp into second level accuracy. The unit is still milliseconds.
|
|
1290 |
long fileModifiedAsSecAccuracy = floorTimestampIntoSecondLevelAccuracy(fileModifiedAsMillisecAccuracy);
|
|
1291 |
// Unit for cache timestamp got from cache index is also milliseconds
|
|
1292 |
long cacheTimestamp = cacheIndx.getLastModifiedTimeForComponent(basename);
|
|
1293 |
|
|
1294 |
if (fileModifiedAsSecAccuracy != cacheTimestamp) {
|
|
1295 |
|
|
1296 |
// Absolute value of the difference in milliseconds
|
|
1297 |
long diff = Math.abs((fileModifiedAsSecAccuracy - cacheTimestamp));
|
|
1298 |
|
|
1299 |
//
|
|
1300 |
// lastModified() method of File-class does not
|
|
1301 |
// always produce correct results in Windows environment.
|
|
1302 |
// Sometimes it gives time stamps that are exactly
|
|
1303 |
// one hour wrong due to daylight savings:
|
|
1304 |
//
|
|
1305 |
// For details, see
|
|
1306 |
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4860999
|
|
1307 |
//
|
|
1308 |
// Therefore ignoring exact 1 hour differences in timestamps.
|
|
1309 |
//
|
|
1310 |
final int DL_SAVINGS_BUG_CHECK_INTERVAL = (1000 * 60 * 60);
|
|
1311 |
|
|
1312 |
// Allowing a range N seconds when identifying if the cache information of
|
|
1313 |
// a component is up-to-date. This is because if the cache file has been
|
|
1314 |
// generated with different operating system, the time stamps may not be exactly
|
|
1315 |
// same. This line declares the currently used N.
|
|
1316 |
final int DIFF_TOLERANCE = (1000 * 2); // 1000 * N
|
|
1317 |
|
|
1318 |
// Checking the timestamp, first via bug filter
|
|
1319 |
// Ignoring timestamps possibly caused due to the bug when adjusted with tolerance
|
|
1320 |
if(
|
|
1321 |
diff < (DL_SAVINGS_BUG_CHECK_INTERVAL - DIFF_TOLERANCE)
|
|
1322 |
||
|
|
1323 |
diff > (DL_SAVINGS_BUG_CHECK_INTERVAL + DIFF_TOLERANCE)
|
|
1324 |
){
|
|
1325 |
// If the bug filter was passed we can continue checking...
|
|
1326 |
|
|
1327 |
if(diff > DIFF_TOLERANCE){
|
|
1328 |
// Found component that is newer that cache
|
|
1329 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP,
|
|
1330 |
"Time stamps differ for component '" //$NON-NLS-1$
|
|
1331 |
+ basename + "' " //$NON-NLS-1$
|
|
1332 |
+ fileModifiedAsSecAccuracy
|
|
1333 |
+ " != " + cacheTimestamp); //$NON-NLS-1$
|
|
1334 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP,
|
|
1335 |
"Time stamps differ for component '" //$NON-NLS-1$
|
|
1336 |
+ basename + "' " //$NON-NLS-1$
|
|
1337 |
+ new Date(fileModifiedAsSecAccuracy).toString()
|
|
1338 |
+ " != " + new Date(cacheTimestamp).toString() ); //$NON-NLS-1$
|
|
1339 |
return true;
|
|
1340 |
}
|
|
1341 |
}
|
|
1342 |
}
|
|
1343 |
} catch (NoSuchElementException e) {
|
|
1344 |
// A new component has been added, and therefore
|
|
1345 |
// cache file needs update.
|
|
1346 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP,
|
|
1347 |
"Component not found from cache index: " + basename); //$NON-NLS-1$
|
|
1348 |
return true;
|
|
1349 |
}
|
|
1350 |
}//for
|
|
1351 |
|
|
1352 |
return false;
|
|
1353 |
}
|
|
1354 |
|
|
1355 |
/**
|
|
1356 |
* Floors milliseconds timestamp into nearest second.
|
|
1357 |
* @param millisecTimestamp Timestamp with millisecond accuracy.
|
|
1358 |
* @return Timestamp with second accuracy.
|
|
1359 |
*/
|
|
1360 |
private long floorTimestampIntoSecondLevelAccuracy(long millisecTimestamp){
|
|
1361 |
long seconds = millisecTimestamp/1000;
|
|
1362 |
return (1000 * seconds);
|
|
1363 |
}
|
|
1364 |
|
|
1365 |
/**
|
|
1366 |
* Filter filenames that are regarded as valid components
|
|
1367 |
* for static dependency analysis.
|
|
1368 |
*/
|
|
1369 |
private class ComponentFileFilter implements FilenameFilter{
|
|
1370 |
|
|
1371 |
public boolean accept(File dir, String name) {
|
|
1372 |
|
|
1373 |
// Filtering is made based on file extension.
|
|
1374 |
// Accepting the following extensions.
|
|
1375 |
String[] allowedExtensions = { "dll", //$NON-NLS-1$
|
|
1376 |
"exe", //$NON-NLS-1$
|
|
1377 |
"tsy", //$NON-NLS-1$
|
|
1378 |
"csy", //$NON-NLS-1$
|
|
1379 |
"fsy", //$NON-NLS-1$
|
|
1380 |
"dsy", //$NON-NLS-1$
|
|
1381 |
"prt", //$NON-NLS-1$
|
|
1382 |
"app", //$NON-NLS-1$
|
|
1383 |
"psy", //$NON-NLS-1$
|
|
1384 |
"fep", //$NON-NLS-1$
|
|
1385 |
"agt", //$NON-NLS-1$
|
|
1386 |
"fxt" //$NON-NLS-1$
|
|
1387 |
};
|
|
1388 |
|
|
1389 |
String regExp = Pattern.quote("."); //$NON-NLS-1$
|
|
1390 |
String[] splitArr = name.split(regExp);
|
|
1391 |
int itemCount = splitArr.length;
|
|
1392 |
if(itemCount > 1){
|
|
1393 |
String extension = splitArr[itemCount-1];
|
|
1394 |
for (int i = 0; i < allowedExtensions.length; i++) {
|
|
1395 |
String allowedExt = allowedExtensions[i];
|
|
1396 |
if(extension.equalsIgnoreCase(allowedExt)){
|
|
1397 |
return true;
|
|
1398 |
}
|
|
1399 |
}
|
|
1400 |
}
|
|
1401 |
|
|
1402 |
return false;
|
|
1403 |
}
|
|
1404 |
}
|
|
1405 |
|
|
1406 |
/**
|
|
1407 |
* Removes ending backslash from directory if such exists.
|
|
1408 |
* @param directoryStr Directory path name to be checked for removal.
|
|
1409 |
* @return Returns directory path name without ending backslash.
|
|
1410 |
*/
|
|
1411 |
private String removeEndingBackslash(String directoryStr) {
|
|
1412 |
if(directoryStr.endsWith(File.separator)){
|
|
1413 |
return directoryStr.substring(0, (directoryStr.length()-1));
|
|
1414 |
}
|
|
1415 |
// No backslash => returning string as it was
|
|
1416 |
return directoryStr;
|
|
1417 |
}
|
|
1418 |
|
|
1419 |
/**
|
|
1420 |
* Goes through the directory given in <code>File</code> object and deletes
|
|
1421 |
* all the only partially created cache files.
|
|
1422 |
* @param directoryToBeChecked
|
|
1423 |
* @param parentDirectoryPath
|
|
1424 |
*/
|
|
1425 |
private void deletePartiallyCreatedCacheFiles(File directoryToBeChecked, String parentDirectoryPath) {
|
|
1426 |
File[] fileArr = directoryToBeChecked.listFiles();
|
|
1427 |
for (int i = 0; i < fileArr.length; i++) {
|
|
1428 |
File f = fileArr[i];
|
|
1429 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP, parentDirectoryPath + f.getName());
|
|
1430 |
if(f.isDirectory()){
|
|
1431 |
// Traversing also sub directories
|
|
1432 |
deletePartiallyCreatedCacheFiles(f, parentDirectoryPath + f.getName() + File.separatorChar);
|
|
1433 |
}
|
|
1434 |
else{
|
|
1435 |
|
|
1436 |
File cacheFile = new File(f.getParent()
|
|
1437 |
+ File.separatorChar
|
|
1438 |
+ ProductInfoRegistry.getCacheFileName());
|
|
1439 |
File symbolsTableFile = new File(f.getParent()
|
|
1440 |
+ File.separatorChar
|
|
1441 |
+ ProductInfoRegistry.getCacheSymbolsFileName());
|
|
1442 |
|
|
1443 |
//
|
|
1444 |
// Cache files are considered as partially created, if
|
|
1445 |
// - either of the cache info files is of zero size
|
|
1446 |
//
|
|
1447 |
boolean cacheFileIsZeroSized = cacheFile.exists() && (cacheFile.length() == 0);
|
|
1448 |
boolean symbolsTableFileIsZeroSized = symbolsTableFile.exists() && (symbolsTableFile.length() == 0);
|
|
1449 |
|
|
1450 |
if(cacheFileIsZeroSized || symbolsTableFileIsZeroSized){
|
|
1451 |
|
|
1452 |
// Partially created cache ...
|
|
1453 |
|
|
1454 |
// Deleting cache file first
|
|
1455 |
if(cacheFile.exists()){
|
|
1456 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP, "\tDeleting cache file!!!"); //$NON-NLS-1$
|
|
1457 |
if(!cacheFile.delete()){
|
|
1458 |
AppDepConsole.getInstance().println(Messages.getString("AppDepSettings.Failed_to_Delete_Cache_File") //$NON-NLS-1$
|
|
1459 |
+ cacheFile.getAbsolutePath(), IConsolePrintUtility.MSG_ERROR);
|
|
1460 |
}
|
|
1461 |
}
|
|
1462 |
// Then deleting the symbol tables file, if it exists
|
|
1463 |
if(symbolsTableFile.exists()){
|
|
1464 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP, "\tDeleting symbol tables cache file!!!"); //$NON-NLS-1$
|
|
1465 |
if(!symbolsTableFile.delete()){
|
|
1466 |
AppDepConsole.getInstance().println(Messages.getString("AppDepSettings.Failed_to_Delete_Symbols_File") //$NON-NLS-1$
|
|
1467 |
+ f.getAbsolutePath(), IConsolePrintUtility.MSG_ERROR);
|
|
1468 |
}
|
|
1469 |
}
|
|
1470 |
}
|
|
1471 |
}
|
|
1472 |
}
|
|
1473 |
}
|
|
1474 |
|
|
1475 |
/**
|
|
1476 |
* Clean-up cache files that are only partially created.
|
|
1477 |
*/
|
|
1478 |
public void cleanupPartiallyCreatedCacheFiles(){
|
|
1479 |
|
|
1480 |
SdkInformation[] infos;
|
|
1481 |
File cacheDir;
|
|
1482 |
String strCacheDir;
|
|
1483 |
//Found all installed SDK:s, search through all of them and clean
|
|
1484 |
try {
|
|
1485 |
infos = SdkManager.getSdkInformation();
|
|
1486 |
for (int i = 0; i < infos.length; i++) {
|
|
1487 |
SdkInformation info = infos[i];
|
|
1488 |
strCacheDir =
|
|
1489 |
removeEndingBackslash (info.getEpoc32ToolsDir())
|
|
1490 |
+ File.separatorChar
|
|
1491 |
+ getCachePathRelativeToToolsDir();
|
|
1492 |
cacheDir = new File(strCacheDir);
|
|
1493 |
if(cacheDir.exists()){
|
|
1494 |
DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "cleanupPartiallyCreatedCacheFiles for '" + cacheDir.getAbsolutePath() + "'"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
1495 |
deletePartiallyCreatedCacheFiles(cacheDir, cacheDir.getName() + File.separatorChar);
|
|
1496 |
}
|
|
1497 |
}
|
|
1498 |
|
|
1499 |
} catch (SdkEnvInfomationResolveFailureException e) {
|
|
1500 |
e.printStackTrace();
|
|
1501 |
}
|
|
1502 |
|
|
1503 |
|
|
1504 |
}
|
|
1505 |
|
|
1506 |
/**
|
|
1507 |
* @return Returns the mostRecentlyQueriedComponentCount.
|
|
1508 |
*/
|
|
1509 |
public int getMostRecentlyQueriedComponentCount() {
|
|
1510 |
return mostRecentlyQueriedComponentCount;
|
|
1511 |
}
|
|
1512 |
|
|
1513 |
/**
|
|
1514 |
* @return Returns the gccToolsDir.
|
|
1515 |
*/
|
|
1516 |
public String getGccToolsDir() {
|
|
1517 |
return getCurrentlyUsedSdk().getEpocRootDir()
|
|
1518 |
+ GCC_TOOL_REL_DIR;
|
|
1519 |
}
|
|
1520 |
|
|
1521 |
/**
|
|
1522 |
* Gets array of all supported toolchains.
|
|
1523 |
* @return Array of all supported toolchains.
|
|
1524 |
*/
|
|
1525 |
public IToolchain[] getAllSupportedToolchains(){
|
|
1526 |
return (IToolchain[]) supportedToolchainsVector.toArray(new IToolchain[0]);
|
|
1527 |
}
|
|
1528 |
|
|
1529 |
/**
|
|
1530 |
* Gets array of supported toolchains for currently selected target.
|
|
1531 |
* @return Array of supported toolchains for currently selected target..
|
|
1532 |
* @throws InvalidCmdLineToolSettingException
|
|
1533 |
*/
|
|
1534 |
public IToolchain[] getSupportedToolchainsForCurrentlyUsedTargets() throws InvalidCmdLineToolSettingException{
|
|
1535 |
// In setCurrentlyUsedTargetPlatforms it is made sure that all targets
|
|
1536 |
// platforms will map to the same toolchains => therefore we can
|
|
1537 |
// safely use just the first target platform instance.
|
|
1538 |
String targetPlatformId = getCurrentlyUsedTargetPlatforms()[0].getId();
|
|
1539 |
return getSupportedToolchainsForGivenTargetPlatformId(targetPlatformId);
|
|
1540 |
}
|
|
1541 |
|
|
1542 |
|
|
1543 |
/**
|
|
1544 |
* Gets array of supported toolchains for given target platform id.
|
|
1545 |
* @param targetPlatformId Target platform id.
|
|
1546 |
* @return Array of supported toolchains for given target platform id.
|
|
1547 |
* @throws InvalidCmdLineToolSettingException
|
|
1548 |
*/
|
|
1549 |
public IToolchain[] getSupportedToolchainsForGivenTargetPlatformId(String targetPlatformId) throws InvalidCmdLineToolSettingException{
|
|
1550 |
|
|
1551 |
ArrayList<Toolchain> toolchainsForTargetArrayList = new ArrayList<Toolchain>();
|
|
1552 |
|
|
1553 |
// Checking GCC targets
|
|
1554 |
if(targetPlatformId.equalsIgnoreCase(STR_ARMI)
|
|
1555 |
||
|
|
1556 |
targetPlatformId.equalsIgnoreCase(STR_ARM4)
|
|
1557 |
||
|
|
1558 |
targetPlatformId.equalsIgnoreCase(STR_THUMB)
|
|
1559 |
||
|
|
1560 |
targetPlatformId.toLowerCase().startsWith(STR_WILDCHARD_GCC_M.toLowerCase())
|
|
1561 |
){
|
|
1562 |
toolchainsForTargetArrayList.add(toolchainGCC);
|
|
1563 |
}
|
|
1564 |
// Using these for all others
|
|
1565 |
else{
|
|
1566 |
toolchainsForTargetArrayList.add(toolchainGCCE);
|
|
1567 |
toolchainsForTargetArrayList.add(toolchainRVCT);
|
|
1568 |
}
|
|
1569 |
|
|
1570 |
return (IToolchain[]) toolchainsForTargetArrayList.toArray(new IToolchain[0]);
|
|
1571 |
}
|
|
1572 |
|
|
1573 |
/**
|
|
1574 |
* Gets default toolchain for currently the given target.
|
|
1575 |
* @param targetId Target to check for default toolchain.
|
|
1576 |
* @return Default toolchain for currently the given target.
|
|
1577 |
* @throws InvalidCmdLineToolSettingException
|
|
1578 |
*/
|
|
1579 |
public IToolchain getDefaultToolchainForTarget(String targetId) throws InvalidCmdLineToolSettingException{
|
|
1580 |
|
|
1581 |
IToolchain defaultToolchain = null;
|
|
1582 |
|
|
1583 |
// Checking for supported GCC toolchain targets
|
|
1584 |
if(targetId.equalsIgnoreCase(STR_ARMI)
|
|
1585 |
||
|
|
1586 |
targetId.equalsIgnoreCase(STR_ARM4)
|
|
1587 |
||
|
|
1588 |
targetId.equalsIgnoreCase(STR_THUMB)
|
|
1589 |
||
|
|
1590 |
targetId.toLowerCase().startsWith(STR_WILDCHARD_GCC_M.toLowerCase())
|
|
1591 |
){
|
|
1592 |
defaultToolchain = toolchainGCC;
|
|
1593 |
}
|
|
1594 |
else{
|
|
1595 |
if(isGcceToolsInstalled()){
|
|
1596 |
// This is preferred toolchain
|
|
1597 |
defaultToolchain = toolchainGCCE;
|
|
1598 |
}
|
|
1599 |
else{
|
|
1600 |
// This is alternate toolchain for same purpose
|
|
1601 |
defaultToolchain = toolchainRVCT;
|
|
1602 |
}
|
|
1603 |
}
|
|
1604 |
|
|
1605 |
return defaultToolchain;
|
|
1606 |
}
|
|
1607 |
|
|
1608 |
/**
|
|
1609 |
* @return Returns the cacheGenerOptions.
|
|
1610 |
*/
|
|
1611 |
public CacheGenerationOptions getCacheGenerOptions() {
|
|
1612 |
return cacheGenerOptions;
|
|
1613 |
}
|
|
1614 |
|
|
1615 |
/**
|
|
1616 |
* @param cacheGenerOptions The cacheGenerOptions to set.
|
|
1617 |
*/
|
|
1618 |
public void setCacheGenerOptions(CacheGenerationOptions cacheGenerOptions) {
|
|
1619 |
this.cacheGenerOptions = cacheGenerOptions;
|
|
1620 |
// Notifying possible listeners
|
|
1621 |
notifySettingsListeners(false);
|
|
1622 |
}
|
|
1623 |
|
|
1624 |
/**
|
|
1625 |
* If SDK selection wizard is launched with SIS page option.
|
|
1626 |
* @return <code>true</code> if Add SIS files page is launched and Wizard is in SIS Analysis mode.
|
|
1627 |
*/
|
|
1628 |
public boolean isInSISFileAnalysisMode() {
|
|
1629 |
return isInSISFileAnalysisMode;
|
|
1630 |
}
|
|
1631 |
/**
|
|
1632 |
* Set if SDK selection wizard is launched with SIS page option.
|
|
1633 |
* @param set Wizard to SIS analysis mode.
|
|
1634 |
*/
|
|
1635 |
public void setIsInSISFileAnalysisMode(boolean isInSISFileAnalysisMode) {
|
|
1636 |
this.isInSISFileAnalysisMode = isInSISFileAnalysisMode;
|
|
1637 |
if(!isInSISFileAnalysisMode){
|
|
1638 |
sisFilesForAnalysis = null;
|
|
1639 |
}
|
|
1640 |
}
|
|
1641 |
|
|
1642 |
/**
|
|
1643 |
* Get SIS files selected in SIS selection page.
|
|
1644 |
* @return SIS files selected in SIS selection page if this wizard is SIS wizard
|
|
1645 |
* (this.isInSISFileAnalysisMode() returns <code>true</code>, otherwise null.
|
|
1646 |
* Returned files names is absolutely file names with path.
|
|
1647 |
*/
|
|
1648 |
public String[] getSISFilesForAnalysis() {
|
|
1649 |
if(isInSISFileAnalysisMode()){
|
|
1650 |
return sisFilesForAnalysis;
|
|
1651 |
}
|
|
1652 |
else{
|
|
1653 |
return null;
|
|
1654 |
}
|
|
1655 |
}
|
|
1656 |
/**
|
|
1657 |
* Set selected SIS files for analysis
|
|
1658 |
* @param valid Symbian 9.x sisFiles (absolutely file names with path)
|
|
1659 |
*/
|
|
1660 |
public void setSISFilesForAnalysis(String[] sisFiles) {
|
|
1661 |
this.sisFilesForAnalysis = sisFiles;
|
|
1662 |
}
|
|
1663 |
|
|
1664 |
/**
|
|
1665 |
* @return Returns the exportPrintReportPath.
|
|
1666 |
*/
|
|
1667 |
public String getExportPrintReportPath() {
|
|
1668 |
return exportPrintReportPath;
|
|
1669 |
}
|
|
1670 |
|
|
1671 |
/**
|
|
1672 |
* @param exportPrintReportPath The exportPrintReportPath to set.
|
|
1673 |
*/
|
|
1674 |
public void setExportPrintReportPath(String exportPrintReportPath) {
|
|
1675 |
this.exportPrintReportPath = exportPrintReportPath;
|
|
1676 |
// Notifying possible listeners
|
|
1677 |
notifySettingsListeners(false);
|
|
1678 |
}
|
|
1679 |
|
|
1680 |
/**
|
|
1681 |
* @return Returns the exportXMLreport.
|
|
1682 |
*/
|
|
1683 |
public boolean isExportXMLreport() {
|
|
1684 |
return exportXMLreport;
|
|
1685 |
}
|
|
1686 |
|
|
1687 |
/**
|
|
1688 |
* @param exportXMLreport The exportXMLreport to set.
|
|
1689 |
*/
|
|
1690 |
public void setExportXMLreport(boolean exportXMLreport) {
|
|
1691 |
this.exportXMLreport = exportXMLreport;
|
|
1692 |
// Notifying possible listeners
|
|
1693 |
notifySettingsListeners(false);
|
|
1694 |
}
|
|
1695 |
|
|
1696 |
/**
|
|
1697 |
* @return Returns the resourcesPath.
|
|
1698 |
*/
|
|
1699 |
public String getResourcesPath() {
|
|
1700 |
return resourcesPath;
|
|
1701 |
}
|
|
1702 |
|
|
1703 |
/**
|
|
1704 |
* @param resourcesPath The resourcesPath to set.
|
|
1705 |
*/
|
|
1706 |
public void setResourcesPath(String resourcesPath) {
|
|
1707 |
this.resourcesPath = resourcesPath;
|
|
1708 |
}
|
|
1709 |
|
|
1710 |
/**
|
|
1711 |
* @return Returns the XSLFileName.
|
|
1712 |
*/
|
|
1713 |
public String getXSLFileName() {
|
|
1714 |
return XSLFileName;
|
|
1715 |
}
|
|
1716 |
|
|
1717 |
/**
|
|
1718 |
* @param fileName The XSLFileName to set.
|
|
1719 |
*/
|
|
1720 |
public void setXSLFileName(String fileName) {
|
|
1721 |
this.XSLFileName = fileName;
|
|
1722 |
}
|
|
1723 |
|
|
1724 |
/**
|
|
1725 |
* @param cacheUpdated The cacheUpdated to set.
|
|
1726 |
*/
|
|
1727 |
public void cacheWasUpdated() {
|
|
1728 |
cacheUpdated = true;
|
|
1729 |
}
|
|
1730 |
|
|
1731 |
/**
|
|
1732 |
* @return Returns the isUsedByXSLFileName.
|
|
1733 |
*/
|
|
1734 |
public String getIsUsedByXSLFileName() {
|
|
1735 |
return isUsedByXSLFileName;
|
|
1736 |
}
|
|
1737 |
|
|
1738 |
/**
|
|
1739 |
* @param isUsedByXSLFileName The isUsedByXSLFileName to set.
|
|
1740 |
*/
|
|
1741 |
public void setIsUsedByXSLFileName(String isUsedByXSLFileName) {
|
|
1742 |
this.isUsedByXSLFileName = isUsedByXSLFileName;
|
|
1743 |
}
|
|
1744 |
|
|
1745 |
/**
|
|
1746 |
* Returns currently used targets as string representation.
|
|
1747 |
* @return
|
|
1748 |
*/
|
|
1749 |
public String getCurrentlyUsedTargetPlatformsAsString() {
|
|
1750 |
ITargetPlatform[] targets = getCurrentlyUsedTargetPlatforms();
|
|
1751 |
String targetPlatformStrList = ""; //$NON-NLS-1$
|
|
1752 |
if(targets.length > 0){
|
|
1753 |
targetPlatformStrList = targets[0].getId();
|
|
1754 |
for (int i = 1; i < targets.length; i++) {
|
|
1755 |
String targetPlatformId = targets[i].getId();
|
|
1756 |
targetPlatformStrList = targetPlatformStrList + "+" + targetPlatformId; //$NON-NLS-1$
|
|
1757 |
}
|
|
1758 |
}
|
|
1759 |
return targetPlatformStrList;
|
|
1760 |
}
|
|
1761 |
|
|
1762 |
/**
|
|
1763 |
* Checks if Elftran is available for given SDK or platform.
|
|
1764 |
* @param sdkInfo SDK information object.
|
|
1765 |
* @return <code>true</code> if elftran is available, otherwise <code>false</code>.
|
|
1766 |
*/
|
|
1767 |
public boolean isElftranAvailable(SdkInformation sdkInfo){
|
|
1768 |
String absolutePath = sdkInfo.getEpoc32ToolsDir() + File.separatorChar + STR_ELFTRAN_EXE;
|
|
1769 |
File elftranFile = new File(absolutePath);
|
|
1770 |
if(elftranFile.exists()){
|
|
1771 |
return true;
|
|
1772 |
}
|
|
1773 |
return false;
|
|
1774 |
}
|
|
1775 |
|
|
1776 |
/**
|
|
1777 |
* Checks if Petran is available for given SDK or platform.
|
|
1778 |
* @param sdkInfo SDK information object.
|
|
1779 |
* @return <code>true</code> if petran is available, otherwise <code>false</code>.
|
|
1780 |
*/
|
|
1781 |
public boolean isPetranAvailable(SdkInformation sdkInfo){
|
|
1782 |
String absolutePath = sdkInfo.getEpoc32ToolsDir() + File.separatorChar + STR_PETRAN_EXE;
|
|
1783 |
File petranFile = new File(absolutePath);
|
|
1784 |
if(petranFile.exists()){
|
|
1785 |
return true;
|
|
1786 |
}
|
|
1787 |
return false;
|
|
1788 |
}
|
|
1789 |
|
|
1790 |
/**
|
|
1791 |
* Checks if Dumpsis.exe is available for given SDK or platform.
|
|
1792 |
* @param sdkInfo SDK information object.
|
|
1793 |
* @return <code>true</code> if Dumpsis.exe is available, otherwise <code>false</code>.
|
|
1794 |
*/
|
|
1795 |
public boolean isDumpsisAvailable(SdkInformation sdkInfo){
|
|
1796 |
String absolutePath = sdkInfo.getEpoc32ToolsDir() + File.separatorChar + ProductInfoRegistry.getDumpsisExeFileName();
|
|
1797 |
File dumpsisFile = new File(absolutePath);
|
|
1798 |
if(dumpsisFile.exists()){
|
|
1799 |
return true;
|
|
1800 |
}
|
|
1801 |
return false;
|
|
1802 |
}
|
|
1803 |
|
|
1804 |
/**
|
|
1805 |
* Adds a new settings change listener object.
|
|
1806 |
* @param listener Listener to be added.
|
|
1807 |
*/
|
|
1808 |
public void addSettingsListener(IAppDepSettingsChangedListener listener){
|
|
1809 |
settingListenersVector.add(listener);
|
|
1810 |
}
|
|
1811 |
|
|
1812 |
/**
|
|
1813 |
* Removes a new settings change listener object.
|
|
1814 |
* @param listener Listener to be removed.
|
|
1815 |
*/
|
|
1816 |
public void removeSettingsListener(IAppDepSettingsChangedListener listener){
|
|
1817 |
settingListenersVector.remove(listener);
|
|
1818 |
}
|
|
1819 |
|
|
1820 |
/**
|
|
1821 |
* Notifies listeners that settings has been changed.
|
|
1822 |
* @param isTargetBuildChanged Should set to <code>true</code> by the caller if, the currently
|
|
1823 |
* used target build settings has been changed, otherwise set to
|
|
1824 |
* <code>false</code> by the caller (for example, if only currently
|
|
1825 |
* analyzed component has been changed).
|
|
1826 |
*/
|
|
1827 |
private void notifySettingsListeners(boolean isTargetBuildChanged){
|
|
1828 |
for (IAppDepSettingsChangedListener listener : settingListenersVector) {
|
|
1829 |
listener.settingsChanged(isTargetBuildChanged);
|
|
1830 |
}
|
|
1831 |
}
|
|
1832 |
|
|
1833 |
/**
|
|
1834 |
* Checks if currently selected caches require update.
|
|
1835 |
* @return <code>true</code> if some of the currently selected caches
|
|
1836 |
* needs update, otherwise <code>false</code>.
|
|
1837 |
*/
|
|
1838 |
public boolean currentlySelectedCachesNeedsUpdate(){
|
|
1839 |
return cacheNeedsUpdate(getCurrentlyUsedSdk(),
|
|
1840 |
getCurrentlyUsedTargetPlatforms(),
|
|
1841 |
getBuildType());
|
|
1842 |
}
|
|
1843 |
|
|
1844 |
/**
|
|
1845 |
* Checks if two setting instances had equal target platform selection.
|
|
1846 |
* @param settingsToCompareThisTo Settings object to compare this instance against.
|
|
1847 |
* @return <code>true</code> if two setting instances had equal target platform selection, otherwise <code>false</code>.
|
|
1848 |
*/
|
|
1849 |
public boolean hasEqualTargetPlatformSelections(AppDepSettings settingsToCompareThisTo) {
|
|
1850 |
|
|
1851 |
//
|
|
1852 |
// Doing actual comparison
|
|
1853 |
//
|
|
1854 |
if(settingsToCompareThisTo.currentlyUsedSdk.getSdkId() != currentlyUsedSdk.getSdkId()) return false;
|
|
1855 |
|
|
1856 |
ITargetPlatform[] targetPlatformArrThis = getCurrentlyUsedTargetPlatforms();
|
|
1857 |
ITargetPlatform[] targetPlatformArrThisCompareTo = settingsToCompareThisTo.getCurrentlyUsedTargetPlatforms();
|
|
1858 |
|
|
1859 |
if(targetPlatformArrThisCompareTo.length != targetPlatformArrThis.length) return false;
|
|
1860 |
|
|
1861 |
for (int i = 0; i < targetPlatformArrThisCompareTo.length; i++) {
|
|
1862 |
ITargetPlatform targetPlatformIdThisCompareTo = targetPlatformArrThisCompareTo[i];
|
|
1863 |
ITargetPlatform targetPlatformIdThis = targetPlatformArrThis[i];
|
|
1864 |
// If any of the selected targets differ => no match
|
|
1865 |
if(targetPlatformIdThisCompareTo.getId() != targetPlatformIdThis.getId()) return false;
|
|
1866 |
}
|
|
1867 |
// Also build type must match
|
|
1868 |
if(settingsToCompareThisTo.buildType.getBuildTypeName() != buildType.getBuildTypeName()) return false;
|
|
1869 |
|
|
1870 |
return true;
|
|
1871 |
}
|
|
1872 |
|
|
1873 |
/**
|
|
1874 |
* @param isCacheDataLoadingOngoing the isCacheDataLoadingOngoing to set
|
|
1875 |
*/
|
|
1876 |
public void setCacheDataLoadingOngoing(boolean isCacheDataLoadingOngoing) {
|
|
1877 |
this.isCacheDataLoadingOngoing = isCacheDataLoadingOngoing;
|
|
1878 |
}
|
|
1879 |
|
|
1880 |
/**
|
|
1881 |
* @return the cacheUpdated
|
|
1882 |
*/
|
|
1883 |
public boolean isCacheUpdated() {
|
|
1884 |
return cacheUpdated;
|
|
1885 |
}
|
|
1886 |
|
|
1887 |
/**
|
|
1888 |
* Resets cache update flag back to <code>false</code>.
|
|
1889 |
*/
|
|
1890 |
public void resetCacheUpdateFlag() {
|
|
1891 |
this.cacheUpdated = false;
|
|
1892 |
}
|
|
1893 |
|
|
1894 |
/**
|
|
1895 |
* Returns string representation of currently selected SDK and target platforms.
|
|
1896 |
* @return String representation of currently selected SDK and target platforms.
|
|
1897 |
*/
|
|
1898 |
public String getCurrentlyUsedTargetsAsString() {
|
|
1899 |
return "'" //$NON-NLS-1$
|
|
1900 |
+ getCurrentlyUsedSdk().getSdkId()
|
|
1901 |
+ " - " //$NON-NLS-1$
|
|
1902 |
+ getCurrentlyUsedTargetPlatformsAsString()
|
|
1903 |
+ " " //$NON-NLS-1$
|
|
1904 |
+ getBuildType().getBuildTypeDescription()
|
|
1905 |
+ "'"; //$NON-NLS-1$;
|
|
1906 |
}
|
|
1907 |
|
|
1908 |
/**
|
|
1909 |
* Clear currently used target platforms from settings.
|
|
1910 |
*/
|
|
1911 |
public void clearCurrentlyUsedTargetPlatforms() {
|
|
1912 |
currentlyUsedTargetPlatforms.clear();
|
|
1913 |
}
|
|
1914 |
|
|
1915 |
/**
|
|
1916 |
* Check if root component has been already selected under analysis.
|
|
1917 |
* @return <code>true</code> if root component has been selected,
|
|
1918 |
*/
|
|
1919 |
public static boolean isRootComponentSelectedForAnalysis() {
|
|
1920 |
String currentRootComponent = null;
|
|
1921 |
AppDepSettings activeSettings = getActiveSettings();
|
|
1922 |
if(activeSettings != null){
|
|
1923 |
currentRootComponent = activeSettings.getCurrentlyAnalyzedComponentName();
|
|
1924 |
if(currentRootComponent != null){
|
|
1925 |
// Root component selected
|
|
1926 |
return true;
|
|
1927 |
}
|
|
1928 |
}
|
|
1929 |
// Root component not selected
|
|
1930 |
return false;
|
|
1931 |
}
|
|
1932 |
|
|
1933 |
/**
|
|
1934 |
* Sets version of the RVCT toolchain.
|
|
1935 |
* @param version string representation of toolchain version.
|
|
1936 |
*/
|
|
1937 |
public void setRvctToolsVersion(String version) {
|
|
1938 |
toolchainRVCT.setVersion(version);
|
|
1939 |
}
|
|
1940 |
|
|
1941 |
/**
|
|
1942 |
* Gets currently set RVCT tools version.
|
|
1943 |
* @return string representation of toolchain version, or <code>null</code> if version info is not available.
|
|
1944 |
*/
|
|
1945 |
public String getRvctToolsVersion() {
|
|
1946 |
return toolchainRVCT.getVersion();
|
|
1947 |
}
|
|
1948 |
|
|
1949 |
/**
|
|
1950 |
* Checks that command-line tools needed by AppDep Core are available in order
|
|
1951 |
* to run cache generation. Currently required tools include petran.exe for GCC toolchain
|
|
1952 |
* and elftran.exe for other toolchains.
|
|
1953 |
* @param sdkInfo SDK information object.
|
|
1954 |
* @param targetPlatformID Target platform id used to get matching toolchain setting.
|
|
1955 |
* @return <code>true</code> if all required tools are available, otherwise <code>false</code>.
|
|
1956 |
* @throws InvalidCmdLineToolSettingException
|
|
1957 |
*/
|
|
1958 |
public boolean areToolsRequiredByCoreAvailable(SdkInformation sdkInfo, String targetPlatformID) throws InvalidCmdLineToolSettingException {
|
|
1959 |
IToolchain[] supportedToolchainsForGivenTargetPlatformId = getSupportedToolchainsForGivenTargetPlatformId(targetPlatformID);
|
|
1960 |
if(supportedToolchainsForGivenTargetPlatformId[0].getToolchainName().equals(STR_GCC)){
|
|
1961 |
return isPetranAvailable(sdkInfo);
|
|
1962 |
}
|
|
1963 |
return isElftranAvailable(sdkInfo);
|
|
1964 |
}
|
|
1965 |
|
|
1966 |
/**
|
|
1967 |
* Gets currently used binary dump tool name based on the currently
|
|
1968 |
* used toolchain setting.
|
|
1969 |
* @param targetPlatformID Target platform id used to get matching toolchain setting.
|
|
1970 |
* @return STR_PETRAN_EXE if GCC toolchain is selected, otherwise STR_ELFTRAN_EXE.
|
|
1971 |
* @throws InvalidCmdLineToolSettingException
|
|
1972 |
*/
|
|
1973 |
public String getCurrentlyUsedCoreDumpToolName(String targetPlatformID) throws InvalidCmdLineToolSettingException{
|
|
1974 |
IToolchain[] supportedToolchainsForGivenTargetPlatformId = getSupportedToolchainsForGivenTargetPlatformId(targetPlatformID);
|
|
1975 |
if(supportedToolchainsForGivenTargetPlatformId[0].getToolchainName().equals(STR_GCC)){
|
|
1976 |
return STR_PETRAN_EXE;
|
|
1977 |
}
|
|
1978 |
return STR_ELFTRAN_EXE;
|
|
1979 |
}
|
|
1980 |
}
|