sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/builder/AnalyzeToolBuilder.java
author Matti Laitinen <matti.t.laitinen@nokia.com>
Tue, 24 Aug 2010 12:16:27 +0300
changeset 15 0367d2db2c06
parent 6 f65f740e69f9
permissions -rw-r--r--
AnalyzeTool Carbide extension 1.10.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     1
/*
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
     2
 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     8
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    11
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    12
 * Contributors:
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    13
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    14
 * Description:  Definitions for the class AnalyzeToolBuilder
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    15
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    16
 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    17
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    18
package com.nokia.s60tools.analyzetool.builder;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    19
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    20
import java.text.MessageFormat;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    21
import java.util.AbstractList;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    22
import java.util.ArrayList;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    23
import java.util.Iterator;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    24
import java.util.List;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    25
import java.util.Locale;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    26
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    27
import org.eclipse.core.resources.IFile;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    28
import org.eclipse.core.resources.IProject;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    29
import org.eclipse.core.runtime.CoreException;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    30
import org.eclipse.core.runtime.IPath;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    31
import org.eclipse.core.runtime.IProgressMonitor;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    32
import org.eclipse.core.runtime.IStatus;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    33
import org.eclipse.core.runtime.Path;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    34
import org.eclipse.core.runtime.Status;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    35
import org.eclipse.core.runtime.jobs.Job;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    36
import org.eclipse.jface.preference.IPreferenceStore;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    37
import org.eclipse.swt.SWT;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    38
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    39
import com.nokia.carbide.cdt.builder.BuildArgumentsInfo;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    40
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    41
import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    42
import com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    43
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    44
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    45
import com.nokia.s60tools.analyzetool.Activator;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    46
import com.nokia.s60tools.analyzetool.global.Constants;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    47
import com.nokia.s60tools.analyzetool.global.Util;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    48
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    49
/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    50
 * Base class for AnalyzeTool builders.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    51
 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    52
 * This class modifies Carbide builder settings during the AnalyzeTool build.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    53
 * This class can be used to built whole project or selected components with
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    54
 * AnalyzeTool
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    55
 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    56
 * @author kihe
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    57
 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    58
 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    59
public class AnalyzeToolBuilder extends CarbideCPPBuilder {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    60
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    61
	/** Pre-builder id. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    62
	public static final String AT_BUILDER_ID = "com.nokia.s60tools.analyzetool.analyzeToolPreBuilder";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    63
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    64
	/** CarbideCommandLauncher reference. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    65
	protected static CarbideCommandLauncher cmdLauncher = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    66
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    67
	/** Used mmp files. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    68
	protected List<String> mmpFiles;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    69
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    70
	/** Verbose atool.exe output? */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    71
	private boolean verbose;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    72
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    73
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    74
	 * Gets shared instance of CarbideCommandLauncher.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    75
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    76
	 * @return CarbideCommandLauncher reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    77
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    78
	protected static CarbideCommandLauncher getCarbideCommandLauncher() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    79
		return cmdLauncher;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    80
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    81
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    82
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    83
	 * Checks is SBS v2 build activated for the project.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    84
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    85
	 * @param cpi
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    86
	 *            ICarbideProjectInfo
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    87
	 * @return True if SBS v2 build is activated otherwise False
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    88
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    89
	public static boolean isSBSBuildActivated(final ICarbideProjectInfo cpi) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    90
		try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    91
			final Class<?> buildManagerClass = Class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    92
					.forName("com.nokia.carbide.cdt.builder.ICarbideBuildManager");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    93
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    94
			java.lang.reflect.Method[] methods = buildManagerClass.getMethods();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    95
			for (int i = 0; i < methods.length; i++) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    96
				java.lang.reflect.Method oneMethod = methods[i];
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    97
				if (oneMethod.toString().contains("isCarbideSBSv2Project")) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    98
					IProject project = cpi.getProject();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    99
					if (project == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   100
						return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   101
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   102
					Object[] objs = new Object[1];
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   103
					objs[0] = project;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   104
					Boolean obj = (Boolean) oneMethod.invoke(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   105
							CarbideBuilderPlugin.getBuildManager(), objs);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   106
					return obj.booleanValue();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   107
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   108
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   109
		} catch (ClassNotFoundException cnfe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   110
			cnfe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   111
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   112
		} catch (SecurityException se) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   113
			se.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   114
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   115
		} catch (IllegalAccessException iae) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   116
			iae.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   117
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   118
		} catch (IllegalArgumentException iare) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   119
			iare.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   120
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   121
		} catch (java.lang.reflect.InvocationTargetException ite) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   122
			ite.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   123
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   124
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   125
		return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   126
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   127
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   128
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   129
	 * Cancels AnalyzeTool build.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   130
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   131
	 * @param monitor
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   132
	 *            Currently running progress monitor
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   133
	 * @param continueBuild
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   134
	 *            False stops the whole build chain (including Carbide and other
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   135
	 *            builders) otherwise other than AnalyzeTool builds are executed
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   136
	 *            normally.
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   137
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   138
	public final void buildCancelled(final IProgressMonitor monitor,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   139
			final boolean continueBuild) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   140
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   141
		IPreferenceStore store = Activator.getPreferences();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   142
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   143
		store.setValue(Constants.PREFS_BUILD_CANCELLED, true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   144
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   145
		// if user wants to continue build
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   146
		if (!continueBuild) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   147
			// write info to the Carbide console view
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   148
			getCarbideCommandLauncher().writeToConsole(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   149
					Constants.BUILD_CANCELLED);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   150
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   151
			// update monitor state
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   152
			monitor.setCanceled(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   153
			monitor.done();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   154
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   155
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   156
		boolean promptMPPChange = store.getBoolean(Constants.PREFS_PROMPT_MMP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   157
		boolean manageDeps = store.getBoolean(Constants.PREFS_MANAGE_DEPS);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   158
		boolean useConcBuild = store.getBoolean(Constants.PREFS_CONC_BUILD);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   159
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   160
		// build canceled set project preference back to normal
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   161
		IPreferenceStore cStore = CarbideBuilderPlugin.getDefault()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   162
				.getPreferenceStore();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   163
		cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   164
				.setValue(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   165
						com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   166
						promptMPPChange);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   167
		cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   168
				.setValue(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   169
						com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MANAGE_DEPENDENCIES,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   170
						manageDeps);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   171
		cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   172
				.setValue(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   173
						com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_USE_CONCURRENT_BUILDING,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   174
						useConcBuild);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   175
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   176
		// CarbideCPPBuilder to forgot build state
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   177
		super.forgetLastBuiltState();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   178
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   179
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   180
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   181
	 * Builds user selected components.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   182
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   183
	 * Normally this method is called from the CompileSymbianComponent
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   184
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   185
	 * @param selectedFiles
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   186
	 *            User selected files
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   187
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   188
	public final void buildComponents(final List<IFile> selectedFiles) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   189
		// create new job
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   190
		Job buildJob = new Job(Constants.BUILD_AND_INSTRUMENT) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   191
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   192
			protected IStatus run(final IProgressMonitor monitor) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   193
				try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   194
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   195
					// get project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   196
					IProject lastProject = selectedFiles.get(0).getProject();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   197
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   198
					// get CarbideProjectInfo
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   199
					ICarbideProjectInfo cpi = CarbideBuilderPlugin
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   200
							.getBuildManager().getProjectInfo(lastProject);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   201
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   202
					// get command launcher
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   203
					cmdLauncher = new CarbideCommandLauncher(lastProject,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   204
							monitor, Constants.atoolParserIds, cpi
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   205
									.getINFWorkingDirectory());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   206
					cmdLauncher.showCommand(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   207
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   208
					// run pre steps for the build
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   209
					if (!runPreSteps(cmdLauncher, monitor, cpi)) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   210
						return new Status(IStatus.OK,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   211
								Constants.ANALYZE_TOOL_TITLE, IStatus.OK,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   212
								Constants.CANCELLED, null);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   213
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   214
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   215
					// build selected components
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   216
					runBuild(Constants.ATOOL_INST, monitor, cpi, selectedFiles);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   217
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   218
					// run post steps
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   219
					runPostSteps(cpi);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   220
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   221
					// after the build is finished => open the console view
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   222
					Util.openConsoleView();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   223
				} finally {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   224
					monitor.done();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   225
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   226
				return new Status(IStatus.OK, Constants.ANALYZE_TOOL_TITLE,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   227
						IStatus.OK, Constants.COMPLETE, null);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   228
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   229
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   230
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   231
		buildJob.setPriority(Job.BUILD);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   232
		buildJob.schedule();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   233
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   234
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   235
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   236
	 * Checks that platform is ARMV5, GCEE or WINSCW
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   237
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   238
	 * @param cpi
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   239
	 *            ICarbideProjectInfo
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   240
	 * @return True if platform is set to ARMV5, GCCE or WINSCW otherwise False
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   241
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   242
	public final boolean checkPlatform(final ICarbideProjectInfo cpi) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   243
		String platform = cpi.getDefaultConfiguration().getPlatformString();
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   244
		if (platform.equals(Constants.BUILD_TARGET_ARMV5)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   245
				|| platform.equals(Constants.BUILD_TARGET_WINSCW)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   246
				|| platform.equals(Constants.BUILD_TARGET_GCEE)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   247
			return true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   248
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   249
		return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   250
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   251
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   252
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   253
	 * Executes atool.exe with options.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   254
	 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   255
	 * @param path
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   256
	 *            log path
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   257
	 * @param fileName
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   258
	 *            log file name
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   259
	 * @param type
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   260
	 *            Type of execution. Possible types ATOOL_INST or ATOOL_UNINST
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   261
	 * @param loggingModeCommand
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   262
	 *            Used logging mode
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   263
	 * @param userSelectedMmpFiles
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   264
	 *            List of user selected mmp files
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   265
	 * @param cpi
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   266
	 *            ICarbideProjectInfo reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   267
	 * @param monitor
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   268
	 *            Progress monitor reference
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   269
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   270
	 * @return COMMAND_LINE_ERROR_CODE.OK if no errors, otherwise error code
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   271
	 */
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   272
	protected final int executeAtool(final String path, final String fileName,
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   273
			final String type, final String loggingModeCommand,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   274
			final List<IFile> userSelectedMmpFiles,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   275
			final ICarbideProjectInfo cpi, final IProgressMonitor monitor) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   276
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   277
		// get used platform
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   278
		String platform = cpi.getDefaultConfiguration().getPlatformString()
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   279
				.toLowerCase(Locale.US);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   280
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   281
		// get build target
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   282
		String buildTarget = cpi.getDefaultConfiguration().getTargetString()
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   283
				.toLowerCase(Locale.US);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   284
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   285
		// used arguments to atool.exe
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   286
		AbstractList<String> usedArguments = new ArrayList<String>();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   287
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   288
		// which logging mode is used
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   289
		if (loggingModeCommand.equalsIgnoreCase(Constants.LOGGING_EXT_FAST)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   290
			usedArguments.add(Constants.ATOOL_INST_EF);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   291
		} else {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   292
			usedArguments.add(Constants.ATOOL_INST_I);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   293
			// if path is set
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   294
			if (path != null && !("").equals(path)) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   295
				usedArguments.add("-fp");
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   296
				usedArguments.add(path);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   297
			}
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   298
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   299
			// if file name is set
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   300
			if (fileName != null && !("").equals(fileName)) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   301
				usedArguments.add("-f");
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   302
				usedArguments.add(fileName);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   303
			}
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   304
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   305
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   306
		// if "verbose atool.exe output" is enabled
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   307
		if (verbose) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   308
			usedArguments.add(Constants.ATOOL_SHOW_DEBUG);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   309
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   310
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   311
		// get callstack size
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   312
		IPreferenceStore store = Activator.getPreferences();
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   313
		if (store.getBoolean(Constants.USE_CALLSTACK_SIZE)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   314
			int callstackSize = store.getInt(Constants.CALLSTACK_SIZE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   315
			usedArguments.add(Constants.CALLSTACK_SIZE_OPTION);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   316
			usedArguments.add(Integer.toString(callstackSize));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   317
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   318
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   319
		// add build command
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   320
		// if project using SBSv2 build system
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   321
		boolean sbsBuild = isSBSBuildActivated(cpi);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   322
		if (sbsBuild) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   323
			usedArguments.add("sbs");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   324
			usedArguments.add("-c");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   325
			StringBuffer buildCommand = new StringBuffer();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   326
			buildCommand.append(platform);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   327
			buildCommand.append('_');
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   328
			buildCommand.append(buildTarget);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   329
			usedArguments.add(buildCommand.toString());
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   330
		} else // use abld
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   331
		{
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   332
			usedArguments.add("abld");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   333
			usedArguments.add("build");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   334
			usedArguments.add(platform);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   335
			usedArguments.add(buildTarget);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   336
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   337
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   338
		int errorCode = Constants.COMMAND_LINE_ERROR_CODE.OK.getCode();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   339
		// if user has selected custom setup of components =>build them
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   340
		// this means that call is come from CompileSymbianComponent class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   341
		if (userSelectedMmpFiles != null && !userSelectedMmpFiles.isEmpty()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   342
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   343
			// get atool.exe command
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   344
			Iterator<IFile> files = userSelectedMmpFiles.iterator();
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   345
			while (files.hasNext()) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   346
				IFile file = files.next();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   347
				IPath location = file.getLocation();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   348
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   349
				String mmpFileName = getMMPFileName(location, true);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   350
				if (mmpFileName == null || ("").equals(mmpFileName)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   351
					continue;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   352
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   353
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   354
				// if this is first mmp file add it parameter list
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   355
				usedArguments.add("-p");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   356
				usedArguments.add(mmpFileName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   357
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   358
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   359
			// now the command is ready
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   360
			// execute command
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   361
			// execute atool.exe via CommandLauncher class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   362
			cmdLauncher.showCommand(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   363
			String[] arguments = new String[usedArguments.size()];
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   364
			usedArguments.toArray(arguments);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   365
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   366
			errorCode = cmdLauncher.executeCommand(new Path(Util
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   367
					.getAtoolInstallFolder()), arguments, CarbideCPPBuilder
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   368
					.getResolvedEnvVars(cpi.getDefaultConfiguration()), cpi
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   369
					.getINFWorkingDirectory());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   370
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   371
			// if user press "Cancel"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   372
			if (monitor.isCanceled()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   373
				buildCancelled(monitor, false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   374
				monitor.done();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   375
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   376
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   377
			// thru selected files and build with the Carbide builder
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   378
			for (int i = 0; i < userSelectedMmpFiles.size(); i++) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   379
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   380
				// get one file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   381
				IFile file = userSelectedMmpFiles.get(i);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   382
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   383
				// get file location
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   384
				IPath fileLocation = file.getLocation();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   385
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   386
				// invoke normal Carbide build
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   387
				try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   388
					CarbideCPPBuilder.invokeSymbianComponenetAction(cpi
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   389
							.getDefaultConfiguration(),
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   390
							CarbideCPPBuilder.BUILD_COMPONENT_ACTION,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   391
							fileLocation, cmdLauncher, monitor, true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   392
				} catch (CoreException e) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   393
					e.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   394
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   395
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   396
				// if user press "Cancel"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   397
				if (monitor.isCanceled()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   398
					buildCancelled(monitor, false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   399
					monitor.done();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   400
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   401
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   402
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   403
			// Carbide build is finished
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   404
			// now remove AnalyzeTool made modifications
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   405
			// if project contains build erros => only uninstrument mmp
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   406
			// file
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   407
			if (CarbideCPPBuilder.projectHasBuildErrors(cpi.getProject())) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   408
				usedArguments.set(0, Constants.ATOOL_UNINST_FAILED);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   409
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   410
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   411
			// project succesfully build => uninstrumet project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   412
			runUninstrument(Constants.ATOOL_UNINST, cpi, monitor);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   413
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   414
		// if build from bld.inf file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   415
		else if (cpi.isBuildingFromInf()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   416
			cmdLauncher.showCommand(true);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   417
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   418
			String[] arguments = new String[usedArguments.size()];
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   419
			usedArguments.toArray(arguments);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   420
			errorCode = cmdLauncher.executeCommand(new Path(Util
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   421
					.getAtoolInstallFolder()), arguments, CarbideCPPBuilder
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   422
					.getResolvedEnvVars(cpi.getDefaultConfiguration()), cpi
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   423
					.getINFWorkingDirectory());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   424
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   425
			if (mmpFiles != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   426
				mmpFiles.clear();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   427
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   428
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   429
			// if user press "Cancel"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   430
			if (monitor.isCanceled()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   431
				buildCancelled(monitor, false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   432
				monitor.done();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   433
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   434
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   435
		} else { // instrument only defined components
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   436
			// get build components
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   437
			mmpFiles = cpi.getInfBuildComponents();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   438
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   439
			for (int i = 0; i < mmpFiles.size(); i++) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   440
				usedArguments.add("-p");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   441
				usedArguments.add(mmpFiles.get(i));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   442
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   443
			cmdLauncher.showCommand(true);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   444
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   445
			String[] arguments = new String[usedArguments.size()];
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   446
			usedArguments.toArray(arguments);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   447
			errorCode = cmdLauncher.executeCommand(new Path(Util
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   448
					.getAtoolInstallFolder()), arguments, CarbideCPPBuilder
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   449
					.getResolvedEnvVars(cpi.getDefaultConfiguration()), cpi
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   450
					.getINFWorkingDirectory());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   451
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   452
			// if user press "Cancel"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   453
			if (monitor.isCanceled()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   454
				buildCancelled(monitor, false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   455
				monitor.done();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   456
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   457
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   458
		return errorCode;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   459
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   460
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   461
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   462
	 * Parses mmp file from the entered path
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   463
	 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   464
	 * @param fileLocation
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   465
	 *            MMP file location with path.
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   466
	 * @param sbsBuild
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   467
	 *            Is sbsv2 build system activated
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   468
	 * @return MMP file name without path. If SBSv2 is not activated the MMP
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   469
	 *         file is returned without file extension.
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   470
	 */
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   471
	public String getMMPFileName(IPath fileLocation, boolean sbsBuild) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   472
		// because mmp file contains project related path
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   473
		// we need to parse mmp file name
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   474
		int index = Util.getLastSlashIndex(fileLocation.toString());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   475
		String mmpFileName = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   476
		if (index == -1) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   477
			// mmp file is incorrect => skip this file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   478
			return mmpFileName;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   479
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   480
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   481
		// parse mmp file name
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   482
		mmpFileName = fileLocation.toString().substring(index + 1,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   483
				fileLocation.toString().length());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   484
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   485
		// if not using the SBS2 builds => needs to remove mmp file name
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   486
		// extension
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   487
		if (!sbsBuild && mmpFileName.endsWith(".mmp")) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   488
			mmpFileName = mmpFileName.substring(0, mmpFileName.length() - 4);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   489
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   490
		return mmpFileName;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   491
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   492
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   493
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   494
	 * Runs AnalyzeTool build.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   495
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   496
	 * @param type
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   497
	 *            Type of execution. Possible types ATOOL_INST or ATOOL_UNINST
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   498
	 * @param monitor
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   499
	 *            Progress monitor reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   500
	 * @param cpi
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   501
	 *            ICarbideProjectInfo reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   502
	 * @param files
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   503
	 *            List of user selected mmp files
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   504
	 * @return True is no errors otherwise False
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   505
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   506
	protected final boolean runBuild(final String type,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   507
			final IProgressMonitor monitor, final ICarbideProjectInfo cpi,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   508
			final List<IFile> files) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   509
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   510
		// get preference store
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   511
		IPreferenceStore store = Activator.getPreferences();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   512
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   513
		// get active logging mode
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   514
		String loggingMode = store.getString(Constants.LOGGING_MODE);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   515
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   516
		verbose = store.getBoolean(Constants.ATOOL_VERBOSE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   517
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   518
		// possible error code from command line engine
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   519
		int errorCode = Constants.COMMAND_LINE_ERROR_CODE.OK.getCode();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   520
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   521
		// if logging mode is set to "ask always"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   522
		// ask for user used logging mode
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   523
		if (Constants.LOGGING_ASK_ALLWAYS.equals(loggingMode)) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   524
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   525
			String[] outputMode = Util.openOutputModeDialog();
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   526
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   527
			// user press "Cancel"
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   528
			if (outputMode == null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   529
				buildCancelled(monitor, true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   530
				return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   531
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   532
			// if user selects S60 log file and mode
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   533
			// and data file must ask for user
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   534
			else if (Constants.LOGGING_S60.equals(outputMode[0])) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   535
				String logPath = outputMode[1];
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   536
				String logFileName = outputMode[2];
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   537
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   538
				errorCode = executeAtool(logPath, logFileName, type,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   539
						outputMode[0], files, cpi, monitor);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   540
			} else { // no need to ask data file for the user => just build
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   541
				// with
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   542
				// user selected logging mode
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   543
				errorCode = executeAtool(null, null, type, outputMode[0],
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   544
						files, cpi, monitor);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   545
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   546
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   547
		// if used logging mode is s60
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   548
		// and data file name must ask for the user
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   549
		else if (Constants.LOGGING_S60.equals(loggingMode)) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   550
			String path = store.getString(Constants.DEVICE_LOG_FILE_PATH);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   551
			String fileName = store.getString(Constants.DEVICE_LOG_FILE_NAME);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   552
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   553
			errorCode = executeAtool(path, fileName, type, loggingMode, files,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   554
					cpi, monitor);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   555
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   556
		// build with selected mode
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   557
		else {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   558
			errorCode = executeAtool(null, null, type, loggingMode, files, cpi,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   559
					monitor);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   560
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   561
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   562
		// no errors from command line engine
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   563
		if (errorCode == Constants.COMMAND_LINE_ERROR_CODE.OK.getCode()) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   564
			return true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   565
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   566
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   567
		// if some error code is returned from command line engine display it to
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   568
		// user and cancel build
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   569
		Constants.COMMAND_LINE_ERROR_CODE error = Util.getErrorCode(errorCode);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   570
		Util.displayCommandLineError(error);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   571
		buildCancelled(monitor, false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   572
		return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   573
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   574
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   575
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   576
	 * After the built is finished set preferences back to normal.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   577
	 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   578
	 * @param cpi
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   579
	 *            ICarbideProjectInfo refernece
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   580
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   581
	public final void runPostSteps(ICarbideProjectInfo cpi) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   582
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   583
		IPreferenceStore store = Activator.getPreferences();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   584
		boolean keepFilesSync = store.getBoolean(Constants.PREFS_KEEP_IN_SYNC);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   585
		boolean promptMPPChange = store.getBoolean(Constants.PREFS_PROMPT_MMP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   586
		boolean manageDeps = store.getBoolean(Constants.PREFS_MANAGE_DEPS);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   587
		boolean useConcBuild = store.getBoolean(Constants.PREFS_CONC_BUILD);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   588
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   589
		// try to load ProjectUIPlugin class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   590
		try {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   591
			Class
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   592
					.forName("com.nokia.carbide.cpp.project.ui.utils.ProjectUIUtils");
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   593
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   594
			// no need to keep project files in sync
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   595
			// this should fix the mmp selection dialog prompt
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   596
			com.nokia.carbide.cpp.project.ui.utils.ProjectUIUtils
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   597
					.setKeepProjectsInSync(keepFilesSync);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   598
		} catch (ClassNotFoundException cnte) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   599
			// Do nothing by design
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   600
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   601
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   602
		// set builder preference to not prompt mmp file change dialog
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   603
		IPreferenceStore cStore = CarbideBuilderPlugin.getDefault()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   604
				.getPreferenceStore();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   605
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   606
		// add existing/default values of Carbide builder settings
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   607
		cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   608
				.setValue(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   609
						com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   610
						promptMPPChange);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   611
		cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   612
				.setValue(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   613
						com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MANAGE_DEPENDENCIES,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   614
						manageDeps);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   615
		cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   616
				.setValue(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   617
						com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_USE_CONCURRENT_BUILDING,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   618
						useConcBuild);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   619
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   620
		// try to remove -debug parameter from the build arguments list
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   621
		try {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   622
			// get build configuration
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   623
			ICarbideBuildConfiguration config = cpi.getDefaultConfiguration();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   624
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   625
			// get build arguments info
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   626
			BuildArgumentsInfo info = config.getBuildArgumentsInfoCopy();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   627
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   628
			// get used platform
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   629
			String platform = config.getPlatformString();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   630
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   631
			String debug = "-debug";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   632
			String abldArgs = info.abldBuildArgs;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   633
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   634
			// if platform is set to ARMV5 or GCCE
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   635
			if (platform.contains(Constants.BUILD_TARGET_ARMV5)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   636
					|| platform.contains(Constants.BUILD_TARGET_GCEE)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   637
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   638
				// get "-debug" string index
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   639
				int index = abldArgs.indexOf(debug);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   640
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   641
				// if abld build arguments contains only "-debug" parameter
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   642
				if (abldArgs.equals(debug)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   643
					info.abldBuildArgs = "";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   644
					config.setBuildArgumentsInfo(info);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   645
				}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   646
				// remove just "-debug" word
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   647
				else if (abldArgs.contains(debug) && index != -1) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   648
					info.abldBuildArgs = abldArgs.substring(0, index)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   649
							+ abldArgs.substring(index + debug.length(),
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   650
									abldArgs.length());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   651
					config.setBuildArgumentsInfo(info);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   652
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   653
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   654
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   655
		} catch (java.lang.NoSuchMethodError nsme) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   656
			// Do nothing by design
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   657
			// user might run AT with too old Carbide version
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   658
		} catch (Exception e) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   659
			e.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   660
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   661
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   662
		// after the build is finished => open the console view
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   663
		Util.openConsoleView();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   664
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   665
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   666
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   667
	 * Checks is atool.exe available and modifies Carbide preferences.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   668
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   669
	 * @param launcher
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   670
	 *            Command launcher
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   671
	 * @param monitor
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   672
	 *            Progress monitor
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   673
	 * @param cpi
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   674
	 *            Carbide project info
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   675
	 * @return True if all checks are OK, otherwise False
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   676
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   677
	protected final boolean runPreSteps(final CarbideCommandLauncher launcher,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   678
			final IProgressMonitor monitor, final ICarbideProjectInfo cpi) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   679
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   680
		// set command launchers
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   681
		cmdLauncher = launcher;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   682
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   683
		// check is atool.exe available
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   684
		if (!Util.isAtoolAvailable()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   685
			launcher.writeToConsole(Constants.INFO_ATOOL_NOT_AVAILABLE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   686
			buildCancelled(monitor, false);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   687
			Util.showMessageDialog(Constants.CLE_VERSION_MISMATCH,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   688
					Constants.ERROR_ATOOL_NOT_AVAILABLE, SWT.ICON_ERROR);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   689
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   690
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   691
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   692
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   693
		// check supported AnalyzeTool version
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   694
		String atoolVersion = Util.getAtoolVersionNumber(Util
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   695
				.getAtoolInstallFolder());
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   696
		int compared = Util.compareVersionNumber(atoolVersion,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   697
				Constants.MIN_CLE_SUPPORTED);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   698
		if (compared == Constants.VERSION_NUMBERS_SECOND
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   699
				|| compared == Constants.VERSION_NUMBERS_INVALID) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   700
			launcher.writeToConsole(MessageFormat.format(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   701
					Constants.CLE_OLDER_THAN_MIN, Constants.MIN_CLE_SUPPORTED));
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   702
			buildCancelled(monitor, false);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   703
			Util.showMessageDialog(Constants.CLE_VERSION_MISMATCH,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   704
					MessageFormat.format(Constants.CLE_OLDER_THAN_MIN,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   705
							Constants.MIN_CLE_SUPPORTED), SWT.ICON_ERROR);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   706
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   707
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   708
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   709
		/**
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   710
		 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   711
		 * Below is code a sample which are related to the AT-682, but it is
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   712
		 * decided to let out from current release. String coreVersion =
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   713
		 * Util.getAtoolCoreVersion(cpi.getProject()); compared =
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   714
		 * Util.compareVersionNumber(coreVersion, atoolVersion); if( compared !=
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   715
		 * Constants.VERSION_NUMBERS_EQUALS ) { boolean retValue =
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   716
		 * Util.openConfirmationDialog(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   717
		 * "AnalyzeTool command line engine and AnalyzeTool core version mismatch.\n"
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   718
		 * + "This usually leads to problems.\n\nDo you want to continue?"); if(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   719
		 * !retValue ) { buildCancelled(monitor, false); return false; } }
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   720
		 */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   721
		// remove existing error markers
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   722
		try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   723
			CarbideCPPBuilder.removeAllMarkers(cpi.getProject());
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   724
		} catch (CoreException ce) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   725
			ce.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   726
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   727
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   728
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   729
		// check used platform
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   730
		if (!checkPlatform(cpi)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   731
			buildCancelled(monitor, Util
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   732
					.openConfirmationDialog(Constants.PLATFORM_NOT_SUPPORTED));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   733
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   734
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   735
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   736
		// check AnalyzeTool libraries
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   737
		final String libsCheck = Util.checkAtoolLibs(cpi);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   738
		if (!libsCheck.equals(Constants.ATOOL_LIBS_OK)) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   739
			Util.showMessageDialog(Constants.DIALOG_TITLE, libsCheck,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   740
					SWT.ICON_ERROR);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   741
			buildCancelled(monitor, false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   742
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   743
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   744
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   745
		// use CarbideCPPBuilder to bldmake bldfiles for selected project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   746
		String[] bldmakeArgs = { "bldfiles" };
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   747
		CarbideCPPBuilder.invokeBldmakeCommand(cpi.getDefaultConfiguration(),
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   748
				launcher, bldmakeArgs, true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   749
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   750
		IPreferenceStore store = Activator.getPreferences();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   751
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   752
		// try to load ProjectUIPlugin class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   753
		try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   754
			Class.forName("com.nokia.carbide.cpp.project.ui.ProjectUIPlugin");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   755
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   756
			// get keep project files in sync flag
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   757
			boolean keepFilesSync = com.nokia.carbide.cpp.project.ui.utils.ProjectUIUtils
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   758
					.keepProjectsInSync();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   759
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   760
			store.setValue(Constants.PREFS_KEEP_IN_SYNC, keepFilesSync);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   761
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   762
			// no need to keep project files in sync
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   763
			// this should fix the mmp selection dialog prompt
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   764
			com.nokia.carbide.cpp.project.ui.utils.ProjectUIUtils
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   765
					.setKeepProjectsInSync(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   766
		} catch (ClassNotFoundException cnfe) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   767
			// Do nothing by design
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   768
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   769
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   770
		// set builder preference to not prompt mmp file change dialog
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   771
		IPreferenceStore cStore = CarbideBuilderPlugin.getDefault()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   772
				.getPreferenceStore();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   773
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   774
		// get existing values
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   775
		boolean promptMPPChange = cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   776
				.getBoolean(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   777
		boolean manageDeps = cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   778
				.getBoolean(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MANAGE_DEPENDENCIES);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   779
		boolean useConcBuild = cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   780
				.getBoolean(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_USE_CONCURRENT_BUILDING);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   781
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   782
		// store existing values
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   783
		store.setValue(Constants.PREFS_PROMPT_MMP, promptMPPChange);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   784
		store.setValue(Constants.PREFS_MANAGE_DEPS, manageDeps);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   785
		store.setValue(Constants.PREFS_CONC_BUILD, useConcBuild);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   786
		// add custom values for AnalyzeTool build
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   787
		cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   788
				.setValue(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   789
						com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   790
						false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   791
		cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   792
				.setValue(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   793
						com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MANAGE_DEPENDENCIES,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   794
						false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   795
		cStore
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   796
				.setValue(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   797
						com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_USE_CONCURRENT_BUILDING,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   798
						false);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   799
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   800
		// try to add -debug parameter to the build arguments list
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   801
		try {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   802
			// get selected build configuration
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   803
			ICarbideBuildConfiguration config = cpi.getDefaultConfiguration();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   804
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   805
			// get build arguments info
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   806
			BuildArgumentsInfo info = config.getBuildArgumentsInfoCopy();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   807
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   808
			// get selected platform
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   809
			String platform = cpi.getDefaultConfiguration().getPlatformString();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   810
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   811
			// if platform is ARMV5 or GCCE and the "-debug" parameter is not
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   812
			// set => we need set the parameter
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   813
			if ((platform.contains(Constants.BUILD_TARGET_ARMV5) || platform
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   814
					.contains(Constants.BUILD_TARGET_GCEE))
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   815
					&& !info.abldBuildArgs.contains("-debug")) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   816
				if (info.abldBuildArgs.length() > 0
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   817
						&& !info.abldBuildArgs.endsWith(" ")) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   818
					info.abldBuildArgs += " ";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   819
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   820
				info.abldBuildArgs += "-debug";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   821
				config.setBuildArgumentsInfo(info);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   822
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   823
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   824
		// catch NoSuchMethodError because is it possible to use older versions
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   825
		// where this method is not available
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   826
		catch (java.lang.NoSuchMethodError nsme) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   827
			// Do nothing by design
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   828
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   829
		return true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   830
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   831
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   832
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   833
	 * Executes uninstrument for the project.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   834
	 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   835
	 * @param command
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   836
	 *            Uninstrument command
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   837
	 * @param cpi
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   838
	 *            ICarbideProjectInfo reference
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   839
	 * @param monitor
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   840
	 *            IProgressMonitor reference
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   841
	 */
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   842
	public void runUninstrument(String command, ICarbideProjectInfo cpi,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   843
			IProgressMonitor monitor) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   844
		cmdLauncher.showCommand(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   845
		String[] arguments = new String[1];
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   846
		arguments[0] = command;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   847
		int error = cmdLauncher.executeCommand(new Path(Util
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   848
				.getAtoolInstallFolder()), arguments, CarbideCPPBuilder
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   849
				.getResolvedEnvVars(cpi.getDefaultConfiguration()), cpi
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   850
				.getINFWorkingDirectory());
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   851
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   852
		// if some occurs => display it to user
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   853
		if (error != Constants.COMMAND_LINE_ERROR_CODE.OK.getCode()) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   854
			Constants.COMMAND_LINE_ERROR_CODE errorCode = Util
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   855
					.getErrorCode(error);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   856
			Util.displayCommandLineError(errorCode);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   857
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   858
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   859
}