sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/builder/AnalyzeToolBuilder.java
changeset 6 f65f740e69f9
parent 1 1050670c6980
child 15 0367d2db2c06
equal deleted inserted replaced
5:844b047e260d 6:f65f740e69f9
     1 /*
     1 /*
     2  * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   200 	 * Cancels AnalyzeTool build.
   200 	 * Cancels AnalyzeTool build.
   201 	 *
   201 	 *
   202 	 * @param monitor
   202 	 * @param monitor
   203 	 *            Currently running progress monitor
   203 	 *            Currently running progress monitor
   204 	 * @param continueBuild
   204 	 * @param continueBuild
   205 	 *            Stop the whole build chain (including Carbide other builders)
   205 	 *            False stops the whole build chain (including Carbide and other builders)
   206 	 *            or not
   206 	 *            otherwise other than AnalyzeTool builds are executed normally.
   207 	 */
   207 	 */
   208 	public final void buildCancelled(final IProgressMonitor monitor,
   208 	public final void buildCancelled(final IProgressMonitor monitor,
   209 			final boolean continueBuild) {
   209 			final boolean continueBuild) {
   210 
   210 
   211 		IPreferenceStore store = Activator.getPreferences();
   211 		IPreferenceStore store = Activator.getPreferences();
   276 									.getINFWorkingDirectory());
   276 									.getINFWorkingDirectory());
   277 					cmdLauncher.showCommand(true);
   277 					cmdLauncher.showCommand(true);
   278 
   278 
   279 					// run pre steps for the build
   279 					// run pre steps for the build
   280 					if (!runPreSteps(cmdLauncher, monitor, cpi)) {
   280 					if (!runPreSteps(cmdLauncher, monitor, cpi)) {
   281 						return new Status(IStatus.ERROR, Constants.ANALYZE_TOOL_TITLE,
   281 						return new Status(IStatus.OK, Constants.ANALYZE_TOOL_TITLE,
   282 								IStatus.ERROR, Constants.CANCELLED, null);
   282 								IStatus.OK, Constants.CANCELLED, null);
   283 					}
   283 					}
   284 
   284 
   285 					// build selected components
   285 					// build selected components
   286 					runBuild(Constants.ATOOL_INST, monitor, cpi, selectedFiles);
   286 					runBuild(Constants.ATOOL_INST, monitor, cpi, selectedFiles);
   287 
   287 
   372 		// if "verbose atool.exe output" is enabled
   372 		// if "verbose atool.exe output" is enabled
   373 		if (verbose) {
   373 		if (verbose) {
   374 			usedArguments.add(Constants.ATOOL_SHOW_DEBUG);
   374 			usedArguments.add(Constants.ATOOL_SHOW_DEBUG);
   375 		}
   375 		}
   376 
   376 
       
   377 		// get callstack size
   377 		IPreferenceStore store = Activator.getPreferences();
   378 		IPreferenceStore store = Activator.getPreferences();
   378 		if( store.getBoolean(Constants.USE_CALLSTACK_SIZE) ) {
   379 		if( store.getBoolean(Constants.USE_CALLSTACK_SIZE) ) {
   379 			int callstackSize = store.getInt(Constants.CALLSTACK_SIZE);
   380 			int callstackSize = store.getInt(Constants.CALLSTACK_SIZE);
   380 			usedArguments.add(Constants.CALLSTACK_SIZE_OPTION);
   381 			usedArguments.add(Constants.CALLSTACK_SIZE_OPTION);
   381 			usedArguments.add(Integer.toString(callstackSize));
   382 			usedArguments.add(Integer.toString(callstackSize));
   391 			buildCommand.append(platform);
   392 			buildCommand.append(platform);
   392 			buildCommand.append('_');
   393 			buildCommand.append('_');
   393 			buildCommand.append(buildTarget);
   394 			buildCommand.append(buildTarget);
   394 			usedArguments.add(buildCommand.toString());
   395 			usedArguments.add(buildCommand.toString());
   395 		}
   396 		}
   396 		else
   397 		else //use abld 
   397 		{
   398 		{
   398 			usedArguments.add("abld");
   399 			usedArguments.add("abld");
   399 			usedArguments.add("build");
   400 			usedArguments.add("build");
   400 			usedArguments.add(platform);
   401 			usedArguments.add(platform);
   401 			usedArguments.add(buildTarget);
   402 			usedArguments.add(buildTarget);
   527 		return errorCode;
   528 		return errorCode;
   528 	}
   529 	}
   529 
   530 
   530 	/**
   531 	/**
   531 	 * Parses mmp file from the entered path
   532 	 * Parses mmp file from the entered path
   532 	 * @param fileLocation MMP file location
   533 	 * @param fileLocation MMP file location with path.
   533 	 * @param sbsBuild IS sbsv2 build system activated
   534 	 * @param sbsBuild Is sbsv2 build system activated
   534 	 * @return MMP file name without path
   535 	 * @return MMP file name without path. If SBSv2 is not activated the MMP 
       
   536 	 * 		 file is returned without file extension.
   535 	 */
   537 	 */
   536 	public String getMMPFileName(IPath fileLocation, boolean sbsBuild)
   538 	public String getMMPFileName(IPath fileLocation, boolean sbsBuild)
   537 	{
   539 	{
   538 		// because mmp file contains project related path
   540 		// because mmp file contains project related path
   539 		// we need to parse mmp file name
   541 		// we need to parse mmp file name
   546 
   548 
   547 		// parse mmp file name
   549 		// parse mmp file name
   548 		mmpFileName = fileLocation.toString().substring(
   550 		mmpFileName = fileLocation.toString().substring(
   549 				index + 1, fileLocation.toString().length());
   551 				index + 1, fileLocation.toString().length());
   550 
   552 
   551 		//if not using the SBS2 builds => nees to remove mmp file name extension
   553 		//if not using the SBS2 builds => needs to remove mmp file name extension
   552 		if( !sbsBuild && mmpFileName.endsWith(".mmp")) {
   554 		if( !sbsBuild && mmpFileName.endsWith(".mmp")) {
   553 			mmpFileName = mmpFileName.substring(0, mmpFileName.length()-4);
   555 			mmpFileName = mmpFileName.substring(0, mmpFileName.length()-4);
   554 		}
   556 		}
   555 		return mmpFileName;
   557 		return mmpFileName;
   556 	}
   558 	}
   734 	 *            Command launcher
   736 	 *            Command launcher
   735 	 * @param monitor
   737 	 * @param monitor
   736 	 *            Progress monitor
   738 	 *            Progress monitor
   737 	 * @param cpi
   739 	 * @param cpi
   738 	 *            Carbide project info
   740 	 *            Carbide project info
   739 	 * @return True is all checks are OK, otherwise False
   741 	 * @return True if all checks are OK, otherwise False
   740 	 */
   742 	 */
   741 	protected final boolean runPreSteps(final CarbideCommandLauncher launcher,
   743 	protected final boolean runPreSteps(final CarbideCommandLauncher launcher,
   742 			final IProgressMonitor monitor, final ICarbideProjectInfo cpi) {
   744 			final IProgressMonitor monitor, final ICarbideProjectInfo cpi) {
   743 
   745 
   744 
   746 
   752 			Util.showErrorMessage(Constants.ERROR_ATOOL_NOT_AVAILABLE);
   754 			Util.showErrorMessage(Constants.ERROR_ATOOL_NOT_AVAILABLE);
   753 			return false;
   755 			return false;
   754 		}
   756 		}
   755 		
   757 		
   756 		// check AnalyzeTool version, 1.6.0 and forward versions is supported
   758 		// check AnalyzeTool version, 1.6.0 and forward versions is supported
   757 		int compared = Util.compareVersionNumber(Util.getAtoolVersionNumber(Util.getAtoolInstallFolder()), Constants.MIN_VERSION);
   759 		String atoolVersion = Util.getAtoolVersionNumber(Util.getAtoolInstallFolder());
       
   760 		int compared = Util.compareVersionNumber(atoolVersion, Constants.MIN_VERSION);
   758 		if( compared == Constants.VERSION_NUMBERS_SECOND || compared == Constants.VERSION_NUMBERS_INVALID ) {
   761 		if( compared == Constants.VERSION_NUMBERS_SECOND || compared == Constants.VERSION_NUMBERS_INVALID ) {
   759 			buildCancelled(monitor, false);
   762 			buildCancelled(monitor, false);
   760 			Util.showMessage(Constants.TOO_OLD_ENGINE);
   763 			Util.showMessage(Constants.TOO_OLD_ENGINE);
   761 			return false;
   764 			return false;
   762 		}
   765 		}
   763 
   766 
       
   767 		/**
       
   768 		 *
       
   769 		 * Below is code a sample which are related to the AT-682,
       
   770 		 * but it is decided to let out from current release.
       
   771 		String coreVersion = Util.getAtoolCoreVersion(cpi.getProject());
       
   772 		compared = Util.compareVersionNumber(coreVersion, atoolVersion);
       
   773 		if( compared != Constants.VERSION_NUMBERS_EQUALS ) 
       
   774 		{
       
   775 			boolean retValue = Util.openConfirmationDialog("AnalyzeTool command line engine and AnalyzeTool core version mismatch.\n" +
       
   776 					"This usually leads to problems.\n\nDo you want to continue?");
       
   777 			if( !retValue ) {
       
   778 				buildCancelled(monitor, false);
       
   779 				return false;	
       
   780 			}
       
   781 		}
       
   782 		*/
   764 		// remove existing error markers
   783 		// remove existing error markers
   765 		try {
   784 		try {
   766 			CarbideCPPBuilder.removeAllMarkers(cpi.getProject());
   785 			CarbideCPPBuilder.removeAllMarkers(cpi.getProject());
   767 		}catch (CoreException ce) {
   786 		}catch (CoreException ce) {
   768 			ce.printStackTrace();
   787 			ce.printStackTrace();