builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java
author timkelly
Wed, 04 Aug 2010 16:39:47 -0500
branchC3_BUILDER_WORK
changeset 1764 df8e072f8f71
parent 1739 5f659a59d04a
child 1770 fa990cb697f7
permissions -rw-r--r--
refactoring sbsv2 configuration specific data under ISBSv2BuildContext interfaces (fixes some glitches with prior attempt)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     1
/*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     3
* All rights reserved.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     8
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    11
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    12
* Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    13
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    14
* Description: 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    15
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    16
*/
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    17
package com.nokia.carbide.cdt.builder;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    18
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    19
import java.io.File;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    20
import java.io.FilenameFilter;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    21
import java.io.IOException;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    22
import java.util.ArrayList;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    23
import java.util.Collection;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    24
import java.util.Collections;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    25
import java.util.HashMap;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    26
import java.util.HashSet;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    27
import java.util.LinkedHashSet;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    28
import java.util.List;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    29
import java.util.Map;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    30
import java.util.Set;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    31
import java.util.regex.Matcher;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    32
import java.util.regex.Pattern;
238
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
    33
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
    34
import org.eclipse.cdt.core.CCorePlugin;
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
    35
import org.eclipse.core.resources.IProject;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    36
import org.eclipse.core.runtime.CoreException;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    37
import org.eclipse.core.runtime.IPath;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    38
import org.eclipse.core.runtime.IProgressMonitor;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    39
import org.eclipse.core.runtime.IStatus;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    40
import org.eclipse.core.runtime.Path;
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
    41
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
    42
import org.eclipse.core.runtime.preferences.InstanceScope;
238
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
    43
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    44
import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    45
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    46
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    47
import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    48
import com.nokia.carbide.cpp.epoc.engine.BldInfDataRunnableAdapter;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    49
import com.nokia.carbide.cpp.epoc.engine.BldInfViewRunnableAdapter;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    50
import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    51
import com.nokia.carbide.cpp.epoc.engine.ImageMakefileDataRunnableAdapter;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    52
import com.nokia.carbide.cpp.epoc.engine.MMPDataRunnableAdapter;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    53
import com.nokia.carbide.cpp.epoc.engine.MMPViewRunnableAdapter;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    54
import com.nokia.carbide.cpp.epoc.engine.PKGViewRunnableAdapter;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    55
import com.nokia.carbide.cpp.epoc.engine.image.IBitmapSource;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    56
import com.nokia.carbide.cpp.epoc.engine.image.IImageSource;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    57
import com.nokia.carbide.cpp.epoc.engine.image.IMultiImageSource;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    58
import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfData;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    59
import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfView;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    60
import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExport;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    61
import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExtension;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    62
import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMMPReference;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    63
import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakMakeReference;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    64
import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakefileReference;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    65
import com.nokia.carbide.cpp.epoc.engine.model.makefile.image.IImageMakefileData;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    66
import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPLanguage;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    67
import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    68
import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPAIFInfo;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    69
import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPBitmap;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    70
import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    71
import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPResource;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    72
import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPView;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    73
import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPViewConfiguration;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    74
import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    75
import com.nokia.carbide.cpp.epoc.engine.preprocessor.AllNodesViewFilter;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    76
import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1;
1739
5f659a59d04a refactoring ISBSv2BuildContext, ISBSv1BuildContext, ISBSv2ConfigQueryData from public to internal package.
timkelly
parents: 1709
diff changeset
    77
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1420
diff changeset
    78
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo;
1764
df8e072f8f71 refactoring sbsv2 configuration specific data under ISBSv2BuildContext interfaces (fixes some glitches with prior attempt)
timkelly
parents: 1739
diff changeset
    79
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildConfigInfo;
1739
5f659a59d04a refactoring ISBSv2BuildContext, ISBSv1BuildContext, ISBSv2ConfigQueryData from public to internal package.
timkelly
parents: 1709
diff changeset
    80
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    81
import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContextDataCache;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    82
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1420
diff changeset
    83
import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    84
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    85
import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.EPKGLanguage;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    86
import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGEmbeddedSISFile;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    87
import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGInstallFile;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    88
import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGView;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    89
import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.PKGModelHelper;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    90
import com.nokia.cpp.internal.api.utils.core.CommonPathFinder;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    91
import com.nokia.cpp.internal.api.utils.core.FileUtils;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    92
import com.nokia.cpp.internal.api.utils.core.Logging;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    93
import com.nokia.cpp.internal.api.utils.core.PathUtils;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
    94
import com.nokia.cpp.internal.api.utils.core.TextUtils;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    95
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    96
public class EpocEngineHelper {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    97
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    98
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    99
	 * Get the file system path to a project-relative path.  Uses the view's
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   100
	 * parser configuration to resolve the project location, thus can
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   101
	 * work even in views created outside the workspace.  This tries to correct
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   102
	 * any case discrepancies between the file system and the model.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   103
	 * <p>
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   104
	 * <b>Don't use this for MMP IPath resolution -- use 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   105
	 * {@link MMPViewPathHelper} instead!</b>
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   106
	 * @param data
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   107
	 * @param relativePath
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   108
	 * @return path, never null
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   109
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   110
	private static IPath getFullPath(IBldInfData data, IPath relativePath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   111
		String absolutePath = data.getProjectPath().addTrailingSeparator().append(relativePath).toOSString();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   112
		try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   113
			absolutePath = new File(absolutePath).getCanonicalPath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   114
		} catch (IOException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   115
		}
684
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 673
diff changeset
   116
		return PathUtils.createPath(absolutePath);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   117
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   118
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   119
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   120
	 * Return list of filesystem paths to all MMPs and makefiles referenced by the given
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   121
	 * bld.inf full path.  This function differentiates between PRJ_TESTMMPFILES and PRJ_MMPFILES.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   122
	 * Note that this does not include PRJ_EXTENSIONS or PRJ_TESTEXTENSIONS as they are a special
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   123
	 * case.  See {@link #getExtensions(IPath, List, List, List, IProgressMonitor)}.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   124
	 * @param bldInfFilePath - The IPath to the bld.inf file that is to be preprocessed.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   125
	 * @param buildConfigs - List of build configuration to parse for.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   126
	 * @param normalMakMakePaths - The list of PRJ_MMPFILES IPath objects for the bld.inf
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   127
	 * @param testMakMakePaths - The list of PRJ_TESTMMPFILES IPath objects for the bld.inf.  Those
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   128
	 * with the "ignore" attribute are not returned.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   129
	 * @param monitor
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   130
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   131
	public static void getMakMakeFiles(final IPath bldInfFilePath, List<ISymbianBuildContext> buildConfigs, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   132
		List<IPath> normalMakMakePaths, List<IPath> testMakMakePaths, IProgressMonitor monitor) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   133
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   134
		// get a bld.inf view for each build target.  take the union of all mmp and make files for each view
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   135
		// of the bld.inf file.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   136
		final Set<IPath> normalFiles = new LinkedHashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   137
		final Set<IPath> testFiles = new LinkedHashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   138
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   139
		monitor.beginTask("Scanning bld.inf for mmp and make files", buildConfigs.size());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   140
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   141
		try {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   142
			// let cache know we're iterating a lot
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   143
			SymbianBuildContextDataCache.startProjectOperation();
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   144
			
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   145
			for (final ISymbianBuildContext context : buildConfigs) {
798
14f323806705 Allow cancellation of long project scanning processes (found when looking at #10318 and #10533)
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   146
				if (monitor.isCanceled())
14f323806705 Allow cancellation of long project scanning processes (found when looking at #10318 and #10533)
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   147
					break;
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   148
				EpocEnginePlugin.runWithBldInfData(bldInfFilePath, 
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   149
						new DefaultViewConfiguration(context, bldInfFilePath, new AcceptedNodesViewFilter()), 
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   150
						new BldInfDataRunnableAdapter() {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   151
							public Object run(IBldInfData data) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   152
								for (IMakMakeReference ref : data.getMakMakeReferences()) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   153
									normalFiles.add(getFullPath(data, ref.getPath()));
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   154
								}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   155
								for (IMakMakeReference ref : data.getTestMakMakeReferences()) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   156
									boolean ignore = false;
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   157
									for (String att : ref.getAttributes()) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   158
										if (att.equalsIgnoreCase("ignore")) { //$NON-NLS-1$
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   159
											ignore = true;
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   160
											break;
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   161
										}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   162
									}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   163
									if (!ignore) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   164
										testFiles.add(getFullPath(data, ref.getPath()));
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   165
									}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   166
								}
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   167
								return null;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   168
							}
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   169
					});
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   170
	
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   171
				monitor.worked(1);
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   172
			}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   173
				
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   174
			monitor.done();
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   175
		} finally {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   176
			SymbianBuildContextDataCache.endProjectOperation();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   177
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   178
		for (IPath normalPath : normalFiles){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   179
			normalMakMakePaths.add(normalPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   180
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   181
		for (IPath testPath : testFiles){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   182
			testMakMakePaths.add(testPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   183
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   184
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   185
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   186
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   187
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   188
	 * Return list of file system paths to all project extensions referenced by the given
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   189
	 * bld.inf full path.  This function differentiates between PRJ_EXTENSIONS and PRJ_TESTEXTENSIONS
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   190
	 * @param bldInfFilePath - The IPath to the bld.inf file that is to be preprocessed.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   191
	 * @param buildConfigs - List of build configuration to parse for.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   192
	 * @param normalExtensionPaths - The list of PRJ_EXTENSIONS IPath objects for the bld.inf
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   193
	 * @param testExtensionPaths - The list of PRJ_TESTEXTENSIONS IPath objects for the bld.inf
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   194
	 * @param monitor
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   195
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   196
	public static void getExtensions(final IPath bldInfFilePath, List<ISymbianBuildContext> buildConfigs, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   197
		List<IPath> normalExtensionPaths, List<IPath> testExtensionPaths, IProgressMonitor monitor) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   198
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   199
		// get a bld.inf view for each build target.  take the union of all extensions for each view
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   200
		// of the bld.inf file.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   201
		final Set<IPath> normalFiles = new LinkedHashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   202
		final Set<IPath> testFiles = new LinkedHashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   203
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   204
		monitor.beginTask("Scanning bld.inf project extensions", buildConfigs.size());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   205
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   206
		try {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   207
			// let cache know we're iterating a lot
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   208
			SymbianBuildContextDataCache.startProjectOperation();
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   209
			
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   210
			for (final ISymbianBuildContext context : buildConfigs) {
798
14f323806705 Allow cancellation of long project scanning processes (found when looking at #10318 and #10533)
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   211
				if (monitor.isCanceled())
14f323806705 Allow cancellation of long project scanning processes (found when looking at #10318 and #10533)
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   212
					break;
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   213
				EpocEnginePlugin.runWithBldInfData(bldInfFilePath, 
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   214
						new DefaultViewConfiguration(context, bldInfFilePath, new AcceptedNodesViewFilter()), 
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   215
						new BldInfDataRunnableAdapter() {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   216
							public Object run(IBldInfData data) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   217
								BldInfViewPathHelper helper = new BldInfViewPathHelper(data, context);
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   218
								for (IExtension extension : data.getExtensions()) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   219
									IPath extensionMakefileBase = helper.convertExtensionTemplateToFilesystem(extension.getTemplatePath());
1577
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   220
									IPath makefile = getControllingFile(extensionMakefileBase);
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   221
									normalFiles.add(makefile);
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   222
								}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   223
								for (IExtension extension : data.getTestExtensions()) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   224
									IPath extensionMakefileBase = helper.convertExtensionTemplateToFilesystem(extension.getTemplatePath());
1577
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   225
									IPath makefile = getControllingFile(extensionMakefileBase);
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   226
									testFiles.add(makefile);
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   227
								}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   228
								return null;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   229
							}
1577
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   230
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   231
							private IPath getControllingFile(
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   232
									IPath extensionMakefileBase) {
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   233
								IPath candidate = extensionMakefileBase.addFileExtension("mk"); //$NON-NLS-1$
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   234
								if (candidate.toFile().exists())
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   235
									return candidate;
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   236
								if ("export".equals(extensionMakefileBase.getFileExtension())) //$NON-NLS-1$
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   237
									candidate = extensionMakefileBase.removeFileExtension().addFileExtension("flm"); //$NON-NLS-1$
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   238
								else
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   239
									candidate = extensionMakefileBase.addFileExtension("flm"); //$NON-NLS-1$
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   240
								return candidate;
d3829d713a38 Fix bug 11324. Prefer *.flm over *.mk/*.meta for the actual extension makefile driver files
Ed Swartz <ed.swartz@nokia.com>
parents: 1512
diff changeset
   241
							}
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   242
					});
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   243
	
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   244
				monitor.worked(1);
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   245
			}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   246
		} finally {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   247
			SymbianBuildContextDataCache.endProjectOperation();
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   248
			monitor.done();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   249
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   250
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   251
		for (IPath normalPath : normalFiles){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   252
			normalExtensionPaths.add(normalPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   253
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   254
		for (IPath testPath : testFiles){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   255
			testExtensionPaths.add(testPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   256
		}
74
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   257
	}
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   258
	
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   259
	/**
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   260
	 * Return list of all named project extensions referenced by the given
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   261
	 * bld.inf full path.  This function differentiates between PRJ_EXTENSIONS and PRJ_TESTEXTENSIONS
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   262
	 * @param bldInfFilePath - The IPath to the bld.inf file that is to be preprocessed.
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   263
	 * @param buildConfigs - List of build configuration to parse for.
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   264
	 * @param normalExtensions - The list of named PRJ_EXTENSIONS for the bld.inf
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   265
	 * @param testExtensions - The list of named PRJ_TESTEXTENSIONS for the bld.inf
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   266
	 * @param monitor
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   267
	 */
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   268
	public static void getNamedExtensions(final IPath bldInfFilePath, List<ISymbianBuildContext> buildConfigs, 
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   269
		List<IExtension> normalExtensions, List<IExtension> testExtensions, IProgressMonitor monitor) {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   270
		
74
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   271
		// get a bld.inf view for each build target.  take the union of all extensions for each view
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   272
		// of the bld.inf file.
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   273
		final Set<IExtension> normalFiles = new LinkedHashSet<IExtension>();
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   274
		final Set<IExtension> testFiles = new LinkedHashSet<IExtension>();
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   275
		
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   276
		monitor.beginTask("Scanning bld.inf project extensions", buildConfigs.size());
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   277
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   278
		try {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   279
			// let cache know we're iterating a lot
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   280
			SymbianBuildContextDataCache.startProjectOperation();
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   281
			
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   282
			for (final ISymbianBuildContext context : buildConfigs) {
798
14f323806705 Allow cancellation of long project scanning processes (found when looking at #10318 and #10533)
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   283
				if (monitor.isCanceled())
14f323806705 Allow cancellation of long project scanning processes (found when looking at #10318 and #10533)
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   284
					break;
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   285
				EpocEnginePlugin.runWithBldInfData(bldInfFilePath, 
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   286
						new DefaultViewConfiguration(context, bldInfFilePath, new AcceptedNodesViewFilter()), 
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   287
						new BldInfDataRunnableAdapter() {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   288
							public Object run(IBldInfData data) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   289
								for (IExtension extension : data.getExtensions()) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   290
									if (extension.getName() != null) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   291
										normalFiles.add(extension);
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   292
									}
74
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   293
								}
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   294
								for (IExtension extension : data.getTestExtensions()) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   295
									if (extension.getName() != null) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   296
										testFiles.add(extension);
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   297
									}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   298
								}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   299
								return null;
74
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   300
							}
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   301
					});
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   302
	
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   303
				monitor.worked(1);
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   304
			}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   305
		} finally {		
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   306
			monitor.done();
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   307
			
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   308
			SymbianBuildContextDataCache.endProjectOperation();
74
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   309
		}
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   310
		
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   311
		for (IExtension normal : normalFiles){
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   312
			normalExtensions.add(normal);
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   313
		}
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   314
		for (IExtension test : testFiles){
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   315
			testExtensions.add(test);
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   316
		}
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   317
	}
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   318
	
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   319
	/**
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   320
	 * Determines if the given bld.inf file contains any unnamed project extensions
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   321
	 * @param bldInfFilePath - The IPath to the bld.inf file that is to be preprocessed.
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   322
	 * @param buildConfigs - List of build configuration to parse for.
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   323
	 * @param monitor
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   324
	 * @return
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   325
	 */
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   326
	public static boolean hasUnnamedExtensions(final IPath bldInfFilePath, List<ISymbianBuildContext> buildConfigs, IProgressMonitor monitor) {
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   327
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   328
		final Set<IExtension> extensions = new LinkedHashSet<IExtension>();
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   329
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   330
		monitor.beginTask("Scanning bld.inf project extensions", buildConfigs.size());
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   331
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   332
		try {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   333
			// let cache know we're iterating a lot
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   334
			SymbianBuildContextDataCache.startProjectOperation();
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   335
			
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   336
			for (final ISymbianBuildContext context : buildConfigs) {
798
14f323806705 Allow cancellation of long project scanning processes (found when looking at #10318 and #10533)
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   337
				if (monitor.isCanceled())
14f323806705 Allow cancellation of long project scanning processes (found when looking at #10318 and #10533)
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   338
					break;
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   339
				EpocEnginePlugin.runWithBldInfData(bldInfFilePath, 
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   340
						new DefaultViewConfiguration(context, bldInfFilePath, new AcceptedNodesViewFilter()), 
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   341
						new BldInfDataRunnableAdapter() {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   342
							public Object run(IBldInfData data) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   343
								for (IExtension extension : data.getExtensions()) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   344
									if (extension.getName() == null) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   345
										extensions.add(extension);
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   346
									}
74
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   347
								}
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   348
								for (IExtension extension : data.getTestExtensions()) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   349
									if (extension.getName() == null) {
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   350
										extensions.add(extension);
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   351
									}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   352
								}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   353
								return null;
74
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   354
							}
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   355
					});
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   356
	
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   357
				monitor.worked(1);
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   358
			}
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   359
		} finally {		
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   360
			monitor.done();
74
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   361
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   362
			SymbianBuildContextDataCache.endProjectOperation();
74
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   363
		}
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   364
560850c1ef5e fixed bug #8282
wpaul
parents: 0
diff changeset
   365
		return extensions.size() > 0;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   366
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   367
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   368
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   369
	 * Returns two paths in a list - the first is the suggested root directory
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   370
	 * for the project.  This is calculated by taking the shortest common path
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   371
	 * containing the bld.inf, mmp and make files, exports, source, resource, and include paths.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   372
	 * <p>
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   373
	 * The second path is the "minimum" root directory for the project.  This is
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   374
	 * the shortest common source path containing the bld.inf, mmp and make files.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   375
	 * <p>
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   376
	 * The third path is the "desired" root directory for the project.  This is 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   377
	 * the shortest common source path containing the bld.inf, mmp and make files,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   378
	 * and the sources and resources.  (added as of 1.3)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   379
	 * @param bldInfFilePath full path to bld.inf
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   380
	 * @param contexts the list of selected SDKs
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   381
	 * @param monitor the progress monitor for this operation
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   382
	 * @return list of exactly 3 IPaths
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   383
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   384
	public static List<IPath> getProjectRoots(final IPath bldInfFilePath, List<ISymbianBuildContext> contexts, final IProgressMonitor monitor) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   385
		// Get the "all" view of the bld.inf/mmp files.  We want to find the true
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   386
		// project root here.  It may be more narrow
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   387
		// for the selected set of build configs, but if they later add other
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   388
		// build configs then those files may not be
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   389
		// under the project root.  Find the shortest common path from the
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   390
		// bld.inf, mmp files, sourcepaths, user includes,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   391
		// resources, bitmaps, etc. and use that as the project root.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   392
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   393
		// We track the required paths -- to find the MMPs and makefiles --
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   394
		// the desired paths -- to find sources and resources --
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   395
		// and the optional paths -- sources and includes.  The optional paths
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   396
		// may diverge to something crazy like the drive root if an include
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   397
		// or source path is on a different drive or is an absolute path,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   398
		// so revert to the desired paths in that case.  If those path still
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   399
		// diverge, revert to the required root.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   400
		final Set<IPath> requiredPaths = new LinkedHashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   401
		final Set<IPath> optionalPaths = new LinkedHashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   402
		final Set<IPath> desiredPaths = new LinkedHashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   403
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   404
		// Get a default SDK for use in resolving SDK-relative #includes
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   405
		// (e.g. for *.mmh or *.h files).  Try to get one whose directory exists
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   406
		// and which has a variant.mmh file, to cover the greediest import scenario.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   407
		//
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   408
		// This doesn't affect the path calculation since SDK-relative paths are
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   409
		// filtered out by our use of MMPViewPathHelper,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   410
		// but it avoids a lot of errors about missing #includes showing up in
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   411
		// the error log.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   412
		ISymbianBuildContext defaultContext = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   413
		for (ISymbianBuildContext context : contexts) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   414
			if (context.getSDK() != null 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   415
					&& context.getSDK().getEPOCROOT() != null
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   416
					&& new File(context.getSDK().getEPOCROOT()).exists()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   417
				defaultContext = context;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1420
diff changeset
   418
				ISymbianSDK sdk = defaultContext.getSDK();
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   419
				if (context instanceof ISBSv2BuildContext){
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   420
					if (sdk.getPrefixFile(ISymbianBuilderID.SBSV2_BUILDER) != null)
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1420
diff changeset
   421
						break;
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   422
				} else {
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   423
					if (sdk.getPrefixFile(ISymbianBuilderID.SBSV1_BUILDER) != null)
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1420
diff changeset
   424
						break;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1420
diff changeset
   425
				}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   426
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   427
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   428
		final ISymbianBuildContext defaultContextToUse = defaultContext;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   429
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   430
		requiredPaths.add(bldInfFilePath.removeLastSegments(1));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   431
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   432
		EpocEnginePlugin.runWithBldInfData(bldInfFilePath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   433
				new DefaultViewConfiguration(defaultContextToUse, bldInfFilePath, new AllNodesViewFilter()), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   434
				new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   435
					public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   436
						IMMPReference[] refs = data.getAllMMPReferences();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   437
						IMakefileReference[] makeRefs = data.getAllMakefileReferences();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   438
						IExtension[] extensions = data.getAllExtensions();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   439
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   440
						monitor.beginTask("Calculating root directory and default name for project", refs.length + makeRefs.length + extensions.length);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   441
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   442
						try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   443
							for (IMMPReference ref : refs) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   444
								IPath path = ref.getPath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   445
								path = getFullPath(data, path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   446
								
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   447
								// add the path to the mmp file
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   448
								requiredPaths.add(path.removeLastSegments(1));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   449
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   450
								getMMPPathReferences(bldInfFilePath, defaultContextToUse, path, optionalPaths, desiredPaths);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   451
								monitor.worked(1);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   452
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   453
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   454
							for (IMakefileReference ref : makeRefs) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   455
								IPath path = ref.getPath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   456
								path = getFullPath(data, path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   457
								
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   458
								// add the Makefile's path
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   459
								requiredPaths.add(path.removeLastSegments(1));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   460
								
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   461
								getMakefilePathReferences(bldInfFilePath, defaultContextToUse, path, optionalPaths);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   462
								monitor.worked(1);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   463
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   464
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   465
							// note, all extension makefiles are in EPOCROOT,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   466
							// so it's futile to force the project root to include them
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   467
							/*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   468
							BldInfViewPathHelper helper = new BldInfViewPathHelper(view, defaultContextToUse);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   469
							for (IExtension extension : extensions) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   470
								IPath path = extension.getTemplatePath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   471
								path = helper.convertExtensionTemplateToFilesystem(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   472
								
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   473
								// add the extension's path, optionally, since it's in EPOCROOT
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   474
								optionalPaths.add(path.removeLastSegments(1));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   475
								
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   476
								getMakefilePathReferences(bldInfFilePath, defaultContextToUse, path, optionalPaths, desiredPaths);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   477
								monitor.worked(1);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   478
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   479
							*/
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   480
							monitor.worked(extensions.length);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   481
							
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   482
							// check the export paths
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   483
							for (IExport export : data.getExports()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   484
								IPath path = getFullPath(data, export.getSourcePath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   485
								optionalPaths.add(path.removeLastSegments(1));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   486
								monitor.worked(1);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   487
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   488
							
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   489
							// check the test export paths
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   490
							for (IExport testExport : data.getTestExports()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   491
								IPath path = getFullPath(data, testExport.getSourcePath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   492
								optionalPaths.add(path.removeLastSegments(1));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   493
								monitor.worked(1);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   494
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   495
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   496
						} catch (CoreException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   497
							CarbideBuilderPlugin.log(e);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   498
						} finally {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   499
							monitor.done();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   500
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   501
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   502
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   503
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   504
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   505
		IPath root = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   506
		IPath desiredRoot = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   507
		IPath requiredRoot = null;
210
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   508
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   509
		if (requiredPaths.size() > 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   510
			// requiredPaths contains a list of required paths
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   511
			// (for MMPs).  Take the shortest common source path of all.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   512
			CommonPathFinder finder = new CommonPathFinder();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   513
			for (IPath path : requiredPaths) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   514
				finder.addDirectory(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   515
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   516
			requiredRoot = finder.getCommonPath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   517
			root = requiredRoot;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   518
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   519
		if (desiredPaths.size() > 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   520
			// desiredPaths contains a list of source paths.  
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   521
			// Take the shortest common source path of all.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   522
			CommonPathFinder finder = new CommonPathFinder();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   523
			finder.addDirectory(root);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   524
			for (IPath path : desiredPaths) {
210
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   525
				// boog 9221, bad root can be chosen for non-existent sourcepaths in MMPs
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   526
				// so ingore those
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   527
				if (path.toFile().exists()){
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   528
					finder.addDirectory(path);
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   529
				} 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   530
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   531
			desiredRoot = finder.getCommonPath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   532
			root = finder.getCommonPath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   533
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   534
		if (optionalPaths.size() > 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   535
			// optionalPaths contains a list of source and include paths.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   536
			// Take the shortest common source path of all.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   537
			CommonPathFinder finder = new CommonPathFinder();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   538
			finder.addDirectory(root);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   539
			for (IPath path : optionalPaths) {
210
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   540
				// boog 9221, bad root can be chosen for non-existent sourcepaths in MMPs
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   541
				// so ingore those
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   542
				if (path.toFile().exists()){
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   543
					finder.addDirectory(path);
7fe2a8c8e309 fix bug 9221. When calculating the project root, don't use sourcepaths that don't exist
timkelly
parents: 179
diff changeset
   544
				} 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   545
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   546
			root = finder.getCommonPath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   547
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   548
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   549
		if (root != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   550
			// Ensure the root is sane
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   551
			if (root.segmentCount() == 0 && desiredRoot != null && desiredRoot.segmentCount() > 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   552
				CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   553
						IStatus.WARNING,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   554
						"Project appears to reference the drive's root directory or another drive (" + root + "); reverting to desired root: " + desiredRoot));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   555
				root = desiredRoot;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   556
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   557
			if (root.segmentCount() == 0 && requiredRoot != null && requiredRoot.segmentCount() > 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   558
				CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   559
						IStatus.WARNING,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   560
						"Project appears to reference the drive's root directory or another drive (" + root + "); reverting to required root: " + requiredRoot));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   561
				root = requiredRoot;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   562
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   563
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   564
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   565
		if (root == null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   566
			// try something else
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   567
			root = bldInfFilePath.removeLastSegments(1);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   568
	        if (root.segmentCount() > 0 && root.lastSegment().compareToIgnoreCase("group") == 0) { //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   569
	        	root = root.removeLastSegments(1);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   570
	        }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   571
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   572
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   573
		List<IPath> pathsToReturn = new ArrayList<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   574
		pathsToReturn.add(root);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   575
		pathsToReturn.add(requiredRoot);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   576
		pathsToReturn.add(desiredRoot);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   577
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   578
		return pathsToReturn;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   579
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   580
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   581
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   582
	 * Get the paths referenced from MMP
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   583
	 * @param optionalPaths the paths referenced, excluding those for sources and resources
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   584
	 * @param desiredPaths the paths referenced for sources and resources
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   585
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   586
	private static void getMMPPathReferences(IPath bldInfFilePath,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   587
			ISymbianBuildContext defaultContext,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   588
			final IPath mmpPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   589
			final Set<IPath> optionalPaths, final Set<IPath> desiredPaths) throws CoreException {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   590
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   591
		EpocEnginePlugin.runWithMMPData(mmpPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   592
				new DefaultMMPViewConfiguration(defaultContext, bldInfFilePath, new AllNodesViewFilter()), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   593
				new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   594
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   595
				public Object run(IMMPData mmpData) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   596
					// no EPOCROOT here, since we want to weed out these paths
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   597
					MMPViewPathHelper helper = new MMPViewPathHelper(mmpData, null);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   598
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   599
					// this covers sources, resource lists, and documents
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   600
					IPath[] sourcePaths = mmpData.getEffectiveSourcePaths();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   601
					for (IPath path : sourcePaths) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   602
						IPath fullPath = helper.convertMMPToFilesystem(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   603
								EMMPPathContext.SOURCEPATH, path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   604
						if (fullPath != null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   605
							desiredPaths.add(fullPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   606
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   607
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   608
					List<IPath> includePaths = mmpData.getUserIncludes();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   609
					for (IPath includePath : includePaths) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   610
						IPath fullPath = helper.convertMMPToFilesystem(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   611
								EMMPPathContext.USERINCLUDE, includePath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   612
						if (fullPath != null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   613
							optionalPaths.add(fullPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   614
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   615
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   616
					includePaths = mmpData.getSystemIncludes();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   617
					for (IPath includePath : includePaths) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   618
						IPath fullPath = helper.convertMMPToFilesystem(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   619
								EMMPPathContext.SYSTEMINCLUDE, includePath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   620
						if (fullPath != null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   621
							optionalPaths.add(fullPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   622
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   623
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   624
					List<IMMPResource> resources = mmpData.getResourceBlocks();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   625
					for (IMMPResource resource : resources) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   626
						IPath fullPath = helper.convertMMPToFilesystem(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   627
								EMMPPathContext.START_RESOURCE, resource.getSource());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   628
						if (fullPath != null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   629
							desiredPaths.add(fullPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   630
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   631
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   632
					// images may come from strange places thus are optional
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   633
					List<IMMPBitmap> bitmaps = mmpData.getBitmaps();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   634
					for (IMMPBitmap bitmap : bitmaps) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   635
						for (IBitmapSource source : bitmap.getBitmapSources()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   636
							IPath fullPath = helper.convertMMPToFilesystem(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   637
									EMMPPathContext.START_BITMAP_SOURCE, source.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   638
							if (fullPath != null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   639
								optionalPaths.add(fullPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   640
							fullPath = helper.convertMMPToFilesystem(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   641
									EMMPPathContext.START_BITMAP_SOURCE, source.getMaskPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   642
							if (fullPath != null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   643
								optionalPaths.add(fullPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   644
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   645
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   646
					return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   647
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   648
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   649
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   650
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   651
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   652
	 * Get the paths referenced from icon makefiles
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   653
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   654
	private static void getMakefilePathReferences(IPath bldInfFilePath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   655
			final ISymbianBuildContext defaultContext,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   656
			final IPath makefilePath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   657
			final Set<IPath> paths) throws CoreException {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   658
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   659
		// We don't know if it's an image makefile or not, but the presence
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   660
		// of detected image compilation commands will give us IMultiImageSources to look at.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   661
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   662
		EpocEnginePlugin.runWithImageMakefileData(makefilePath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   663
				new DefaultImageMakefileViewConfiguration(defaultContext, bldInfFilePath, new AllNodesViewFilter()), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   664
				new ImageMakefileDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   665
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   666
				public Object run(IImageMakefileData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   667
					ImageMakefileViewPathHelper helper = new ImageMakefileViewPathHelper(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   668
							data, new ISymbianBuildContext[] { defaultContext });
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   669
					List<IMultiImageSource> multiImageSources = data.getMultiImageSources();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   670
					for (IMultiImageSource multiImageSource : multiImageSources) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   671
						for (IImageSource source : multiImageSource.getSources()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   672
							IPath imgPath = helper.findCandidateImagePath(source.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   673
							if (imgPath != null && !imgPath.isAbsolute())
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   674
								paths.add(imgPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   675
							imgPath = helper.findCandidateMaskPath(source);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   676
							if (imgPath != null && !imgPath.isAbsolute())
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   677
								paths.add(imgPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   678
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   679
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   680
					return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   681
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   682
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   683
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   684
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   685
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   686
	 * Get full filesystem paths to all MMPs and makefiles (including test targets) accessible from the given
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   687
	 * project's bld.inf.  Note that this does not include PRJ_EXTENSIONS or PRJ_TESTEXTENSIONS as they are a special
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   688
	 * case.  See {@link #getExtensions(IPath, List, List, List, IProgressMonitor)}.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   689
	 * @param project - The IProject for the project in question
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   690
	 * @param makMakeRefs - The list of IPath entries for all the mmp and makefiles (PRJ_MMPFILES contents). List will be added to.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   691
	 * @param testMakMakeReferences - The list of IPath entries for all the test mmp and makefiles(PRJ_TESTMMPFILES contents). List will be added to.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   692
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   693
	public static void getAllMakMakeFiles(IProject project, List<IPath>makMakeRefs, List<IPath>testMakMakeReferences) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   694
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   695
        final ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   696
        if (cpi == null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   697
        	return;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   698
        
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   699
		List<ICarbideBuildConfiguration> buildConfigs = cpi.getBuildConfigurations();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   700
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   701
		final Set<IPath> tempTestProjects = new LinkedHashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   702
		final Set<IPath> tempNormalProjects = new LinkedHashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   703
		for (final ICarbideBuildConfiguration buildConfig : buildConfigs) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   704
			EpocEnginePlugin.runWithBldInfData(cpi.getWorkspaceRelativeBldInfPath(), 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
   705
					new DefaultViewConfiguration(project, buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   706
					new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   707
						public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   708
							for (IMakMakeReference normalRef : data.getMakMakeReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   709
								tempNormalProjects.add(getFullPath(data, normalRef.getPath()));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   710
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   711
							for (IMakMakeReference testRef : data.getTestMakMakeReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   712
								tempTestProjects.add(getFullPath(data, testRef.getPath()));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   713
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   714
							return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   715
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   716
				});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   717
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   718
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   719
		for (IPath normalPath : tempNormalProjects){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   720
			makMakeRefs.add(normalPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   721
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   722
		for (IPath testPath : tempTestProjects){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   723
			testMakMakeReferences.add(testPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   724
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   725
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   726
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   727
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   728
	 * Find the full file system path to the main executable.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   729
	 * @return full path or blank for error
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   730
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   731
	 * @deprecated In 1.3, there is no longer a debug mmp, hence no "main" executable.  When launching,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   732
	 * if there is more than one mmp, the user will be asked which executable to target.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   733
	 * Use {@link #getHostPathForExecutable(ICarbideBuildConfiguration, IPath)} instead.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   734
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   735
	 * This method will only work now if there is one and only one mmp.  Otherwise it will return
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   736
	 * an empty string.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   737
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   738
	public static String getPathToMainExecutable(final ICarbideBuildConfiguration buildConfig) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   739
		final ICarbideProjectInfo info = buildConfig.getCarbideProject();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   740
		String exePath = ""; //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   741
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   742
		if (buildConfig == null){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   743
			return ""; //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   744
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   745
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   746
		exePath = (String)EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(), 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
   747
				new DefaultViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   748
				new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   749
					public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   750
						String exePath  = ""; //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   751
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   752
						IMMPReference[] mmps = data.getAllMMPReferences();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   753
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   754
						if (mmps.length == 1) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   755
							final IPath workspaceRelativeMMPPath = new Path(info.getProject().getName()).append(mmps[0].getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   756
							exePath = (String)EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
   757
									new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()),
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   758
									new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   759
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   760
									public Object run(IMMPData mmpData) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   761
										// get the executable name and then prepend it with the epocroot + platform + target
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   762
										String exePath = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGET);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   763
										if (exePath == null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   764
											// not likely but possible
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   765
											return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   766
										}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   767
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1420
diff changeset
   768
										ISymbianSDK sdk = buildConfig.getSDK();
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1479
diff changeset
   769
										ISymbianBuildContext context = buildConfig.getBuildContext();
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   770
										IPath path;
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1479
diff changeset
   771
										if (context instanceof ISBSv2BuildContext) {
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1479
diff changeset
   772
											path = new Path(((ISBSv2BuildContext)context).getConfigQueryData().getOutputPathString());
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   773
										} else {
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   774
											ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1479
diff changeset
   775
											String releasePlatform = sbsv1BuildInfo.getBSFCatalog().getReleasePlatform(buildConfig.getPlatformString());
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   776
											path = sdk.getReleaseRoot().append(releasePlatform.toLowerCase()).append(buildConfig.getTargetString().toLowerCase());
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   777
										}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   778
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   779
										// adapt to variant, if needed
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   780
										IPath targetPath = path.append(exePath);
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
   781
										if (isVariantBldInf(buildConfig.getCarbideProject().getAbsoluteBldInfPath()) || isFeatureVariantMMP(mmpData, info.getProject())) {
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
   782
											targetPath = getBinaryVariantTargetName(mmpData, targetPath, info.getProject());
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
   783
											if (targetPath == null){
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
   784
												return null; 
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
   785
											}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   786
										}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   787
										
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   788
										exePath = targetPath.toOSString();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   789
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   790
										return exePath;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1420
diff changeset
   791
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   792
									}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   793
							});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   794
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   795
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   796
						return exePath;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   797
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   798
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   799
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   800
		if (exePath == null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   801
			exePath = ""; //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   802
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   803
		return exePath;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   804
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   805
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   806
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   807
	 * Find the full file system path to the main executable.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   808
	 * @return full path or blank for error 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   809
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   810
	 * @deprecated In 1.3, there is no longer a debug mmp, hence no "main" executable.  When launching,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   811
	 * if there is more than one mmp, the user will be asked which executable to target.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   812
	 * Use {@link #getHostPathForExecutable(ICarbideBuildConfiguration, IPath)} instead.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   813
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   814
	 * This method will only work now if there is one and only one mmp.  Otherwise it will return
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   815
	 * an empty string.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   816
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   817
	public static String getPathToMainExecutable(final ICarbideProjectInfo info) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   818
		return getPathToMainExecutable(info.getDefaultConfiguration());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   819
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   820
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   821
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   822
	 * Find the full file system path to the main executable.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   823
	 * @return full path or null for error
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   824
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   825
	 * @deprecated In 1.3, there is no longer a debug mmp, hence no "main" executable.  When launching,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   826
	 * if there is more than one mmp, the user will be asked which executable to target.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   827
	 * Use {@link #getTargetPathForExecutable(ICarbideBuildConfiguration, IPath)} instead.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   828
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   829
	 * This method will only work now if there is one and only one mmp.  Otherwise it will return
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   830
	 * an empty string.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   831
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   832
	public static IPath getTargetPathForMainExecutable(final ICarbideProjectInfo info) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   833
		IPath exePath = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   834
		final ICarbideBuildConfiguration buildConfig = info.getDefaultConfiguration();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   835
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   836
		exePath = (IPath)EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(), 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
   837
				new DefaultViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   838
				new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   839
					public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   840
						IPath exePath  = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   841
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   842
						IMMPReference[] mmps = data.getAllMMPReferences();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   843
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   844
						if (mmps.length == 1) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   845
							final IPath workspaceRelativeMMPPath = new Path(info.getProject().getName()).append(mmps[0].getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   846
							exePath = (IPath)EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
   847
									new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()),
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   848
									new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   849
									public Object run(IMMPData mmpData) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   850
										IPath exePath = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   851
										// get the executable name and then prepend it with the epoc release root + platform + target
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   852
										IPath path = mmpData.getTargetFilePath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   853
										if (path != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   854
											exePath = path.makeAbsolute().setDevice("C:"); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   855
										} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   856
											// if the target path is not set then by default it will usually
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   857
											// be left blank.  for EKA2 though binaries need to go in \sys\bin\
657
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
   858
											exePath = Path.ROOT.setDevice("C:"); //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   859
											if (buildConfig.getSDK().getOSVersion().getMajor() > 8) {
657
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
   860
												exePath = exePath.append("sys/bin/"); //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   861
											}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   862
											String targetName = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGET);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   863
											if  (targetName != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   864
												exePath = exePath.append(targetName);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   865
											}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   866
										}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   867
										
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   868
										// note: this does not need to account for variant targets,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   869
										// since they have the same name on the target side.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   870
										
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   871
										return exePath;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   872
									}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   873
							});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   874
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   875
						return exePath;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   876
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   877
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   878
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   879
		return exePath;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   880
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   881
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   882
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   883
	 * Find the full host file system path to the executable built by the given mmp for the given build configuration.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   884
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   885
	 * @param buildConfig
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   886
	 * @param workspaceRelativeMMPPath
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   887
	 * @return full path or null if the path cannot be determined.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   888
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   889
	public static IPath getHostPathForExecutable(final ICarbideBuildConfiguration buildConfig, IPath workspaceRelativeMMPPath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   890
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   891
		final ICarbideProjectInfo cpi = buildConfig.getCarbideProject();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   892
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   893
		return (IPath)EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   894
				new DefaultMMPViewConfiguration(buildConfig, new AcceptedNodesViewFilter()),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   895
				new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   896
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   897
				public Object run(IMMPData mmpData) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   898
					// get the executable name and then prepend it with the epocroot + platform + target
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   899
					String exePath = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGET);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   900
					if (exePath == null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   901
						// not likely but possible
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   902
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   903
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   904
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   905
					// some target types aren't executables
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   906
					String targetType = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   907
					if (targetType != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   908
						if (targetType.toUpperCase().matches("LIB|KLIB|IMPLIB|NONE|STDLIB")) { //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   909
							return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   910
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   911
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   912
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   913
					// adapt the exe filename to the variant, if any
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
   914
					IPath tempPath = null;
1680
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   915
					if ((isVariantBldInf(cpi.getAbsoluteBldInfPath()) || isFeatureVariantMMP(mmpData, cpi.getProject()))
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   916
							&& !CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject())) {
684
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 673
diff changeset
   917
						tempPath = getBinaryVariantTargetName(mmpData, PathUtils.createPath(exePath), cpi.getProject());
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
   918
						if (tempPath == null){
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
   919
							return null; 
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
   920
						}
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
   921
						exePath = tempPath.lastSegment();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   922
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   923
					
1680
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   924
					IPath path = null;
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   925
					if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject()) && 
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   926
							isFeatureVariantMMP(mmpData, cpi.getProject())){
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   927
						
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   928
						path = buildConfig.getTargetOutputDirectory();
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   929
						
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   930
					} else {
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   931
						// Not a variant
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   932
						path = buildConfig.getTargetOutputDirectory();
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   933
						if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject())){
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   934
							// For SBSv2, it's not a variant, so it goes under the standard output dir
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   935
							path = stripVariationFolder(path);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   936
						}
1680
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   937
						
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   938
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   939
					path = path.append(exePath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   940
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   941
					return path;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   942
				}
1680
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   943
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   944
				private IPath stripVariationFolder(IPath path) {
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   945
					if (!path.toOSString().contains(".")){
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   946
						return path;
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   947
					}
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   948
					String[] segments = path.segments();
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   949
					int segmentCount = path.segmentCount();
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   950
					path = path.removeFirstSegments(segmentCount);
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   951
					int count = 0;
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   952
					path = path.addTrailingSeparator();
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   953
					for (String segment : segments){
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   954
						if (count == segmentCount - 2 && segment.contains(".")){
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   955
							path = path.append(segment.split("\\.")[0]);
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   956
						} else {
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   957
							path = path.append(segment);
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   958
						}
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   959
						count ++;
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   960
					}
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   961
					return path;
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   962
					
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   963
				}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   964
		});								
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   965
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   966
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   967
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   968
	 * Find the full target file system path to the executable built by the mmp for the given build configuration.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   969
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   970
	 * @param buildConfig
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   971
	 * @param workspaceRelativeMMPPath
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   972
	 * @return full path or null if the path cannot be determined.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   973
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   974
	public static IPath getTargetPathForExecutable(final ICarbideBuildConfiguration buildConfig, IPath workspaceRelativeMMPPath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   975
		IPath exePath = (IPath)EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   976
				new DefaultMMPViewConfiguration(buildConfig, new AcceptedNodesViewFilter()),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   977
				new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   978
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   979
				public Object run(IMMPData mmpData) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   980
					// some target types aren't executables
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   981
					String targetType = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   982
					if (targetType != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   983
						if (targetType.toUpperCase().matches("LIB|KLIB|IMPLIB|NONE|STDLIB")) { //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   984
							return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   985
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   986
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   987
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   988
					IPath exePath = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   989
					// get the executable name and then prepend it with the epoc release root + platform + target
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   990
					IPath path = mmpData.getTargetFilePath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   991
					if (path != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   992
						exePath = path.makeAbsolute().setDevice("C:"); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   993
					} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   994
						// if the target path is not set then by default it will usually
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   995
						// be left blank.  for EKA2 though binaries need to go in \sys\bin\
657
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
   996
						exePath = Path.ROOT.setDevice("C:"); //$NON-NLS-1$
1680
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
   997
						exePath = exePath.append("sys/bin/"); //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   998
						String targetName = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGET);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   999
						if  (targetName != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1000
							exePath = exePath.append(targetName);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1001
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1002
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1003
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1004
					// note: this does not need to account for variant targets,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1005
					// since they have the same name on the target side.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1006
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1007
					return exePath;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1008
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1009
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1010
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1011
		return exePath;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1012
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1013
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1014
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1015
	 * Add a generated file -> target path mapping for each generated file per language.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1016
	 * In a START RESOURCE block, any LANG statement overrides global languages.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1017
	 * @param resources map to update
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1018
	 * @param data the MMP view containing the resource definition
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1019
	 * @param resource if a block resource, an IMMPResource, else null
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1020
	 * @param baseGeneratedPath full path to base .rsc file, without extension
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1021
	 * @param targetPath full path to device-side .rsc directory
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1022
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1023
	private static void addResourceLanguageTargets(Map<String, String> resources, IMMPData data, IMMPResource resource, 
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1024
			IPath baseGeneratedPath, IPath targetPath) {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1025
		List<EMMPLanguage> languages = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1026
		// block resource can override languages (entirely)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1027
		if (resource != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1028
			languages = resource.getLanguages();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1029
			if (languages.size() == 0)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1030
				languages = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1031
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1032
		if (languages == null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1033
			languages = data.getLanguages();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1034
			if (languages.size() == 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1035
				// default is non-localize
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1036
				languages = Collections.singletonList(EMMPLanguage.SC_NonLocalized);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1037
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1038
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1039
		for (EMMPLanguage language : languages) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1040
			String extension = ".R" + language.getCodeString(); //$NON-NLS-1$
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1041
			resources.put(baseGeneratedPath.toOSString() + extension.toLowerCase(), 
684
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 673
diff changeset
  1042
					PathUtils.convertPathToWindows(targetPath));
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1043
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1044
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1045
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1046
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1047
	 * Get a map of the generated resources for the project. 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1048
	 * @param info project info
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1049
	 * @return map of local full paths to target full paths
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1050
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1051
	 * @deprecated In 1.3, there is no longer a debug mmp, hence no "main" executable.  When launching,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1052
	 * if there is more than one mmp, the user will be asked which executable to target.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1053
	 * Use {@link #getHostAndTargetResources(ICarbideBuildConfiguration, IPath)} instead.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1054
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1055
	 * This method will only work now if there is one and only one mmp.  Otherwise it will return
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1056
	 * an empty map.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1057
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1058
	public static HashMap<String, String> getHostAndTargetResources(final ICarbideProjectInfo info) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1059
		final HashMap<String, String> resources = new HashMap<String, String>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1060
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1061
		final ICarbideBuildConfiguration buildConfig = info.getDefaultConfiguration();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1062
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1063
		EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(), 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  1064
				new DefaultViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1065
				new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1066
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1067
				public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1068
					IMMPReference[] mmps = data.getAllMMPReferences();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1069
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1070
					if (mmps.length == 1) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1071
						final IPath workspaceRelativeMMPPath = new Path(info.getProject().getName()).append(mmps[0].getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1072
						EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  1073
								new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()),
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1074
								new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1075
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1076
								public Object run(IMMPData mmpData) {
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1077
									gatherMMPResourceMappings(buildConfig, resources, mmpData);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1078
									return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1079
								}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1080
						});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1081
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1082
					return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1083
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1084
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1085
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1086
		return resources;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1087
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1088
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1089
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1090
	 * Get a map of the generated resources for the project. 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1091
	 * @param buildConfig the build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1092
	 * @param workspaceRelativeMMPPath the workspace relative path to the mmp file to get the resources for
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1093
	 * @return map of local full paths to target full paths
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1094
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1095
	public static HashMap<String, String> getHostAndTargetResources(final ICarbideBuildConfiguration buildConfig, IPath workspaceRelativeMMPPath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1096
		// TODO: at some point we could maybe use the sis file (if any) for the current config to build this list
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1097
		final HashMap<String, String> resources = new HashMap<String, String>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1098
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1099
		EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1100
				new DefaultMMPViewConfiguration(buildConfig, new AcceptedNodesViewFilter()),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1101
				new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1102
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1103
				public Object run(IMMPData mmpData) {
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1104
					gatherMMPResourceMappings(buildConfig, resources, mmpData);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1105
					return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1106
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1107
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1108
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1109
		return resources;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1110
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1111
	
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1112
	private static void gatherMMPResourceMappings(
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1113
			final ICarbideBuildConfiguration buildConfig,
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1114
			final HashMap<String, String> resources, IMMPData mmpData) {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1115
		// read the project-wide target path
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1116
		String targetPathStr = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETPATH);
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1117
		
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1118
		// the target path, should always be absolute and deviceless
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1119
		IPath targetPath;
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1120
		
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1121
		if (targetPathStr != null) {
684
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 673
diff changeset
  1122
			targetPath = PathUtils.createPath(targetPathStr).makeAbsolute();
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1123
		} else {
1707
ddfcc3a97d22 clean up code by remove EKA1 functionality. Essentially removing dead code as there is no pre-os 9 functionality supported.
timkelly
parents: 1680
diff changeset
  1124
			//for EKA2 use sys\bin\
ddfcc3a97d22 clean up code by remove EKA1 functionality. Essentially removing dead code as there is no pre-os 9 functionality supported.
timkelly
parents: 1680
diff changeset
  1125
			targetPath = new Path("/sys/bin/"); //$NON-NLS-1$
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1126
		}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1127
	
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1128
		IPath dataZDir = buildConfig.getSDK().getReleaseRoot().removeLastSegments(1).append("/data/z/"); //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1129
		
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1130
		// get the aifs
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1131
		List<IMMPAIFInfo> aifs = mmpData.getAifs();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1132
		for (IMMPAIFInfo aif : aifs) {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1133
			IPath aifPath = aif.getTarget().makeAbsolute();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1134
			resources.put(dataZDir.append(targetPath).append(aifPath.lastSegment()).toOSString(), 
684
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 673
diff changeset
  1135
					PathUtils.convertPathToWindows(targetPath.setDevice("C:"))); //$NON-NLS-1$
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1136
		}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1137
	
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1138
		///////////
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1139
		
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1140
		// for resources and bitmaps, the target path may be based on the target type if not explicitly
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1141
		// set for the resource or bitmap.
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1142
		String targetType = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE);
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1143
		if (targetType != null) {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1144
			// could be PLUGIN or PLUGIN3
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1145
			if (targetType.toUpperCase().startsWith("PLUGIN")) { //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1146
				targetPath = new Path("/resource/plugins"); //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1147
			} else if (targetType.compareToIgnoreCase("PDL") == 0) { //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1148
				targetPath = new Path("/resource/printers"); //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1149
			}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1150
		}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1151
	
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1152
		// get the bitmaps
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1153
		List<IMMPBitmap> bmps = mmpData.getBitmaps();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1154
		for (IMMPBitmap bmp : bmps) {
1512
8731dc95fb5a fixed bug #11462.
wpaul
parents: 1234
diff changeset
  1155
			IPath mbmPath = bmp.getTargetFilePath().makeAbsolute();
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1156
			// if there's no target path then use the main target path
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1157
			if (mbmPath.segmentCount() == 1) {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1158
				mbmPath = targetPath.append(mbmPath);
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1159
			}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1160
			IPath mbmDir = mbmPath.removeLastSegments(1).addTrailingSeparator().setDevice("C:"); //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1161
			resources.put(dataZDir.append(mbmPath).toOSString(), 
684
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 673
diff changeset
  1162
					PathUtils.convertPathToWindows(mbmDir.toOSString()));
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1163
		}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1164
	
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1165
		// get the user resources
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1166
		List<IPath> userResources = mmpData.getUserResources();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1167
		for (IPath userRes : userResources) {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1168
			addResourceLanguageTargets(resources, mmpData, null, 
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1169
					dataZDir.append(targetPath).append(userRes.removeFileExtension().lastSegment().toLowerCase()), 
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1170
					targetPath.setDevice("C:")); //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1171
		}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1172
	
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1173
		// get the system resources
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1174
		List<IPath> systemResources = mmpData.getSystemResources();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1175
		for (IPath systemRes : systemResources) {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1176
			addResourceLanguageTargets(resources, mmpData, null,
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1177
					dataZDir.append(targetPath).append(systemRes.removeFileExtension().lastSegment().toLowerCase()), 
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1178
					targetPath.setDevice("C:")); //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1179
		}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1180
	
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1181
		// get the resource blocks
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1182
		List<IMMPResource> resourceBlocks = mmpData.getResourceBlocks();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1183
		for (IMMPResource resourceBlock : resourceBlocks) {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1184
			IPath resPath = resourceBlock.getTargetPath();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1185
			if (resPath == null) {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1186
				// not specified in the resource block so use existing
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1187
				resPath = targetPath;
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1188
			}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1189
	
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1190
			String filename = resourceBlock.getTargetFile();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1191
			if (filename == null) {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1192
				filename = resourceBlock.getSource().removeFileExtension().lastSegment();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1193
			} else {
684
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 673
diff changeset
  1194
				filename = PathUtils.createPath(filename).removeFileExtension().toOSString();
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1195
			}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1196
			filename = filename.toLowerCase();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1197
			
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1198
			if (resPath != null) {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1199
				resPath = resPath.makeAbsolute().addTrailingSeparator();
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1200
				// adjust the path if necessary as it's different on the phone for the *_.reg file
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1201
				IPath adjustedTargetPath = resPath;
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1202
				if ((adjustedTargetPath.toPortableString()).equalsIgnoreCase("/private/10003a3f/apps/")) { //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1203
					adjustedTargetPath = new Path("/private/10003a3f/import/apps/"); //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1204
				}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1205
				addResourceLanguageTargets(resources, mmpData, resourceBlock,
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1206
						dataZDir.append(resPath).append(filename), 
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1207
						adjustedTargetPath.setDevice("C:")); //$NON-NLS-1$
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1208
			} else {
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1209
				CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(), 
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1210
						IStatus.WARNING,
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1211
						"No TARGETPATH specified for resource " + filename + ".  Skipping..."));
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1212
			}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1213
		}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1214
	}
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1215
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1216
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1217
	 * Get a map of the generated images from image makefiles for the project. 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1218
	 * @param buildConfig the build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1219
	 * @return map of local full paths to target full paths
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1220
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1221
	public static HashMap<String, String> getHostAndTargetImages(final ICarbideBuildConfiguration buildConfig) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1222
		final HashMap<String, String> resources = new HashMap<String, String>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1223
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1224
		final ICarbideProjectInfo cpi = buildConfig.getCarbideProject();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1225
		EpocEnginePlugin.runWithBldInfView(cpi.getWorkspaceRelativeBldInfPath(),
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  1226
				new DefaultViewConfiguration(cpi.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1227
				new BldInfViewRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1228
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1229
					public Object run(IBldInfView view) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1230
						EpocEnginePathHelper helper = new EpocEnginePathHelper(buildConfig);
657
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
  1231
						final String dataZDir = buildConfig.getSDK().getReleaseRoot().removeLastSegments(1).toOSString() + "\\data\\z\\"; //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1232
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1233
						for (IMakefileReference ref : view.getAllMakefileReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1234
							final IPath workspaceRelativeMakefilePath = helper.convertToWorkspace(ref.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1235
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1236
							EpocEnginePlugin.runWithImageMakefileData(workspaceRelativeMakefilePath,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1237
									new DefaultImageMakefileViewConfiguration(cpi, new AcceptedNodesViewFilter()),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1238
									new ImageMakefileDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1239
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1240
										public Object failedLoad(CoreException exception) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1241
											// not an image make file
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1242
											return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1243
										}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1244
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1245
										public Object run(IImageMakefileData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1246
											// if we get here then it is an image make file
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1247
											for (IMultiImageSource imgSrc : data.getMultiImageSources()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1248
												IPath targetPath = imgSrc.getTargetFilePath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1249
												
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1250
												// it can start with /epoc32/data/z/.  if so, remove it.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1251
												if (targetPath != null && targetPath.segment(0).equalsIgnoreCase("epoc32")) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1252
													targetPath = targetPath.removeFirstSegments(3);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1253
												}
684
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 673
diff changeset
  1254
												resources.put(PathUtils.convertPathToNative(dataZDir + targetPath.toOSString()), 
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 673
diff changeset
  1255
														PathUtils.convertPathToWindows("C:\\" + targetPath.toOSString())); //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1256
											}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1257
											
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1258
											return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1259
										}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1260
								});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1261
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1262
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1263
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1264
				});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1265
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1266
		return resources;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1267
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1268
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1269
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1270
	 * Get the user and system include paths referenced by MMPs in the
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1271
	 * given project and configuration.  The configuration may be null
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1272
	 * to get all the paths for all configurations.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1273
	 * @param projectInfo the project info
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1274
	 * @param buildConfiguration the build configuration to check, or null for all
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1275
	 * @param userPaths list to which paths are added
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1276
	 * @param systemPaths list to which paths are added
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1277
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1278
	public static void getProjectIncludePaths(ICarbideProjectInfo projectInfo,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1279
			ICarbideBuildConfiguration buildConfiguration,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1280
			final List<File> userPaths, final List<File> systemPaths) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1281
		if (projectInfo == null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1282
			return;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1283
		IMMPReference[] mmps = (IMMPReference[])
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1284
			EpocEnginePlugin.runWithBldInfData(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1285
				projectInfo.getWorkspaceRelativeBldInfPath(),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1286
				new DefaultViewConfiguration(projectInfo),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1287
				new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1288
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1289
					public Object failedLoad(CoreException exception) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1290
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1291
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1292
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1293
					public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1294
						return data.getAllMMPReferences();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1295
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1296
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1297
				});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1298
		if (mmps == null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1299
			return;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1300
		
289
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1301
		// get the list of all mmp files selected for the build configuration
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1302
		// a null buildComponents list means all MMPs are included - so leave it null when indexing all files
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1303
		List<String> buildComponents = null;
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1304
		if (buildConfiguration != null && !EpocEngineHelper.getIndexAllPreference())
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1305
			buildComponents = buildConfiguration.getCarbideProject().isBuildingFromInf() ? null : buildConfiguration.getCarbideProject().getInfBuildComponents();
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1306
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1307
		for (IMMPReference mmp : mmps) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1308
			if (buildConfiguration != null) {
293
66f0aa64d141 move string utility function into utils class
dadubrow
parents: 289
diff changeset
  1309
				if (buildComponents == null || TextUtils.listContainsIgnoreCase(buildComponents, mmp.getPath().lastSegment())) { 
289
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1310
					getMMPIncludePaths(projectInfo.getProject(), 
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1311
							mmp.getPath(), buildConfiguration, userPaths, systemPaths);
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1312
				}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1313
			} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1314
				for (ICarbideBuildConfiguration buildConfig : projectInfo.getBuildConfigurations()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1315
					getMMPIncludePaths(projectInfo.getProject(), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1316
							mmp.getPath(), buildConfig, userPaths, systemPaths);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1317
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1318
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1319
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1320
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1321
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1322
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1323
	 * Gets the list of source files for one MMP file.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1324
	 * @param info the project info of the project to get the source roots for
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1325
	 * @param mmpFile - The full path to the MMP file whose SOURCE files are to be retrieved
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1326
	 * @return list of workspace relative source files
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1327
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1328
	public static List<IPath> getSourceFilesForConfiguration(final ICarbideBuildConfiguration buildConfig, IPath inMMPPath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1329
		final List<IPath> sourcePaths = new ArrayList<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1330
		final ICarbideProjectInfo  info = buildConfig.getCarbideProject();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1331
		IMMPReference[] mmps = (IMMPReference[])EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1332
			new DefaultViewConfiguration(info),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1333
			new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1334
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1335
				public Object failedLoad(CoreException exception) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1336
					return new IMMPReference[0];
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1337
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1338
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1339
				public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1340
					return data.getAllMMPReferences();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1341
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1342
				
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1343
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1344
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1345
		for (IMMPReference mmp : mmps) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1346
			EpocEnginePathHelper helper = new EpocEnginePathHelper(info.getProject());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1347
			final IPath workspaceRelativeMMPPath = helper.convertToWorkspace(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1348
			IPath fullMMPPath = helper.convertToFilesystem(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1349
			String mmpName = inMMPPath.toOSString();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1350
			String mmpName2 = fullMMPPath.toOSString();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1351
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1352
			if (mmpName.toUpperCase().equals(mmpName2.toUpperCase())){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1353
				EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  1354
						new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1355
						new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1356
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1357
						public Object run(IMMPData mmpData) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1358
							MMPViewPathHelper helper = new MMPViewPathHelper(buildConfig);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1359
							
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1360
							Set<IPath> topLevelSourcePaths = new HashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1361
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1362
							for (IPath path : mmpData.getSources()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1363
								IPath fullPath = helper.convertMMPToFilesystem(EMMPPathContext.SOURCE, path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1364
								if (fullPath != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1365
									// add the absolute source path
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1366
									topLevelSourcePaths.add(fullPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1367
								}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1368
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1369
							
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1370
							// Now actually add the values to pass back
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1371
							for (IPath path : topLevelSourcePaths) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1372
								if (!sourcePaths.contains(path)) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1373
									sourcePaths.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1374
								}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1375
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1376
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1377
							return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1378
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1379
				});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1380
				
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1381
				break; // found MMP, no more work...
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1382
				
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1383
			} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1384
				continue;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1385
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1386
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1387
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1388
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1389
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1390
		return sourcePaths;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1391
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1392
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1393
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1394
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1395
	 * Gets the list of source roots for a project.  This is any folder that is a direct
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1396
	 * child of the project that contains (directly or indirectly) any source, resource, or
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1397
	 * header file.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1398
	 * @param info the project info of the project to get the source roots for
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1399
	 * @return list of workspace relative source root paths
251
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1400
	 * @deprecated This method is now deprecated and the new getPreferredSourceRootsForProject() should be used since it honors several new preferences.
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1401
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1402
	public static List<IPath> getSourceRootsForProject(final ICarbideProjectInfo info) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1403
		final List<IPath> sourceRoots = new ArrayList<IPath>();
251
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1404
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1405
		IMMPReference[] mmps = (IMMPReference[])EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(),
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1406
			new DefaultViewConfiguration(info),
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1407
			new BldInfDataRunnableAdapter() {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1408
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1409
				public Object failedLoad(CoreException exception) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1410
					return new IMMPReference[0];
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1411
				}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1412
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1413
				public Object run(IBldInfData data) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1414
					return data.getAllMMPReferences();
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1415
				}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1416
				
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1417
			});
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1418
		
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1419
		for (IMMPReference mmp : mmps) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1420
			EpocEnginePathHelper helper = new EpocEnginePathHelper(info.getProject());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1421
			final IPath workspaceRelativeMMPPath = helper.convertToWorkspace(mmp.getPath());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1422
			EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, 
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1423
					new DefaultMMPViewConfiguration(info, new AllNodesViewFilter()), 
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1424
					new MMPDataRunnableAdapter() {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1425
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1426
					public Object run(IMMPData mmpData) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1427
						MMPViewPathHelper helper = new MMPViewPathHelper(info.getProject(), null);
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1428
						
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1429
						Set<IPath> topLevelSourcePaths = new HashSet<IPath>();
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1430
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1431
						// this covers sources, resource lists, and documents
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1432
						for (IPath path : mmpData.getEffectiveSourcePaths()) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1433
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.SOURCEPATH, path);
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1434
							if (fullPath != null) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1435
								// add the absolute workspace path to the folder directly under the project.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1436
								// ideally we'd be more precise but then CDT creates a C folder named Foo\Bar,
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1437
								// rather than just expanding Foo and then seeing bar a C source folder.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1438
								topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1439
							}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1440
						}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1441
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1442
						// add potential sourcepaths for which source entries may not yet exist
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1443
						for (IPath path : mmpData.getRealSourcePaths()) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1444
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.SOURCEPATH, path);
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1445
							if (fullPath != null) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1446
								// add the absolute workspace path to the folder directly under the project.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1447
								// ideally we'd be more precise but then CDT creates a C folder named Foo\Bar,
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1448
								// rather than just expanding Foo and then seeing bar a C source folder.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1449
								topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1450
							}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1451
						}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1452
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1453
						for (IPath path : mmpData.getUserIncludes()) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1454
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.USERINCLUDE, path);
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1455
							if (fullPath != null) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1456
								// add the absolute workspace path to the folder directly under the project.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1457
								topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1458
							}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1459
						}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1460
						
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1461
						for (IPath path : mmpData.getSystemIncludes()) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1462
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.SYSTEMINCLUDE, path);
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1463
							if (fullPath != null) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1464
								// add the absolute workspace path to the folder directly under the project.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1465
								topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1466
							}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1467
						}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1468
						
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1469
						for (IMMPResource resource : mmpData.getResourceBlocks()) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1470
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.START_RESOURCE, resource.getSource());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1471
							if (fullPath != null) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1472
								// add the absolute workspace path to the folder directly under the project.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1473
								topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1474
							}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1475
						}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1476
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1477
						for (IMMPAIFInfo aif : mmpData.getAifs()) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1478
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.AIF_SOURCE, aif.getResource());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1479
							if (fullPath != null) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1480
								// add the absolute workspace path to the folder directly under the project.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1481
								topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1482
							}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1483
						}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1484
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1485
						for (IPath path : topLevelSourcePaths) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1486
							if (!sourceRoots.contains(path)) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1487
								sourceRoots.add(path);
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1488
							}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1489
						}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1490
						
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1491
						return null;
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1492
					}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1493
			});
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1494
		}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1495
	
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1496
		return sourceRoots;
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1497
	}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1498
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1499
	
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1500
	/**
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1501
	 * Gets the list of source roots for a project. Depending on several preferences, this can have different behavior.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1502
	 * If the CDT preference "Show source roots at top of project" is unset (default in Carbide),
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1503
	 * then the source roots will be nested as deeply as possible to avoid indexing more than specified by the project itself,
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1504
	 * otherwise, they will always be direct children of the project.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1505
	 * If the Carbide preference "Index only source files from mmp files being built" then the source roots will only be
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1506
	 * determined by the build components of the project, otherwise they will be determined by all mmps regardless of which
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1507
	 * are selected for building by the project.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1508
	 * @param info the project info of the project to get the source roots for
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1509
	 * @return list of workspace relative source root paths
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1510
	 */
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1511
	public static List<IPath> getPreferredSourceRootsForProject(final ICarbideProjectInfo info) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1512
		final List<IPath> sourceRoots = new ArrayList<IPath>();
178
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1513
		final boolean showSourceRootsAtTopOfProject = CCorePlugin.showSourceRootsAtTopOfProject();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1514
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1515
		IMMPReference[] mmps = (IMMPReference[])EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1516
			new DefaultViewConfiguration(info),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1517
			new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1518
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1519
				public Object failedLoad(CoreException exception) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1520
					return new IMMPReference[0];
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1521
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1522
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1523
				public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1524
					return data.getAllMMPReferences();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1525
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1526
				
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1527
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1528
		
289
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1529
		// get the list of all mmp files selected for the build configuration
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1530
		// a null buildComponents list means all MMPs are included - so leave it null when indexing all files
238
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1531
		List<String> buildComponents = null;
289
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1532
		if (!getIndexAllPreference())
238
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1533
			buildComponents = info.isBuildingFromInf() ? null : info.getInfBuildComponents();
289
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1534
	
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1535
		for (IMMPReference mmp : mmps) {
293
66f0aa64d141 move string utility function into utils class
dadubrow
parents: 289
diff changeset
  1536
			if (buildComponents != null && !TextUtils.listContainsIgnoreCase(buildComponents, mmp.getPath().lastSegment()))
238
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1537
				continue;
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1538
			
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1539
			EpocEnginePathHelper helper = new EpocEnginePathHelper(info.getProject());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1540
			final IPath workspaceRelativeMMPPath = helper.convertToWorkspace(mmp.getPath());
430
147ef5f224c4 makmake error parser regression tests (reference data). Fix bug 9620, NPE when adding bogus path to PRJ_MMPFILES in bld.inf.
timkelly
parents: 293
diff changeset
  1541
			if (workspaceRelativeMMPPath == null){
147ef5f224c4 makmake error parser regression tests (reference data). Fix bug 9620, NPE when adding bogus path to PRJ_MMPFILES in bld.inf.
timkelly
parents: 293
diff changeset
  1542
				continue;
147ef5f224c4 makmake error parser regression tests (reference data). Fix bug 9620, NPE when adding bogus path to PRJ_MMPFILES in bld.inf.
timkelly
parents: 293
diff changeset
  1543
			}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1544
			EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1545
					new DefaultMMPViewConfiguration(info, new AllNodesViewFilter()), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1546
					new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1547
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1548
					public Object run(IMMPData mmpData) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1549
						MMPViewPathHelper helper = new MMPViewPathHelper(info.getProject(), null);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1550
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1551
						Set<IPath> topLevelSourcePaths = new HashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1552
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1553
						// this covers sources, resource lists, and documents
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1554
						for (IPath path : mmpData.getEffectiveSourcePaths()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1555
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.SOURCEPATH, path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1556
							if (fullPath != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1557
								// add the absolute workspace path to the folder directly under the project.
178
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1558
								if (showSourceRootsAtTopOfProject) {
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1559
									// ideally we'd be more precise but then CDT creates a C folder named Foo\Bar,
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1560
									// rather than just expanding Foo and then seeing bar a C source folder.
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1561
									topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1562
								}
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1563
								else // ideal
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1564
									topLevelSourcePaths.add(fullPath.makeAbsolute());
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1565
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1566
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1567
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1568
						// add potential sourcepaths for which source entries may not yet exist
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1569
						for (IPath path : mmpData.getRealSourcePaths()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1570
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.SOURCEPATH, path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1571
							if (fullPath != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1572
								// add the absolute workspace path to the folder directly under the project.
178
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1573
								if (showSourceRootsAtTopOfProject) {
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1574
									// ideally we'd be more precise but then CDT creates a C folder named Foo\Bar,
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1575
									// rather than just expanding Foo and then seeing bar a C source folder.
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1576
									topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1577
								}
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1578
								else // ideal
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1579
									topLevelSourcePaths.add(fullPath.makeAbsolute());
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1580
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1581
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1582
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1583
						for (IPath path : mmpData.getUserIncludes()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1584
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.USERINCLUDE, path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1585
							if (fullPath != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1586
								// add the absolute workspace path to the folder directly under the project.
178
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1587
								if (showSourceRootsAtTopOfProject) {
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1588
									// ideally we'd be more precise but then CDT creates a C folder named Foo\Bar,
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1589
									// rather than just expanding Foo and then seeing bar a C source folder.
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1590
									topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1591
								}
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1592
								else // ideal
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1593
									topLevelSourcePaths.add(fullPath.makeAbsolute());
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1594
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1595
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1596
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1597
						for (IPath path : mmpData.getSystemIncludes()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1598
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.SYSTEMINCLUDE, path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1599
							if (fullPath != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1600
								// add the absolute workspace path to the folder directly under the project.
178
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1601
								if (showSourceRootsAtTopOfProject) {
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1602
									// ideally we'd be more precise but then CDT creates a C folder named Foo\Bar,
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1603
									// rather than just expanding Foo and then seeing bar a C source folder.
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1604
									topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1605
								}
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1606
								else // ideal
333b05116a29 [Bug 9031] set source roots at actual source root based on new cdt pref
Chad Peckham <chad.peckham@nokia.com>
parents: 172
diff changeset
  1607
									topLevelSourcePaths.add(fullPath.makeAbsolute());
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1608
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1609
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1610
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1611
						for (IMMPResource resource : mmpData.getResourceBlocks()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1612
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.START_RESOURCE, resource.getSource());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1613
							if (fullPath != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1614
								// add the absolute workspace path to the folder directly under the project.
251
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1615
								if (showSourceRootsAtTopOfProject) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1616
									// ideally we'd be more precise but then CDT creates a C folder named Foo\Bar,
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1617
									// rather than just expanding Foo and then seeing bar a C source folder.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1618
									topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1619
								}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1620
								else // ideal
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1621
									topLevelSourcePaths.add(fullPath.removeLastSegments(1).makeAbsolute());
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1622
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1623
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1624
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1625
						for (IMMPAIFInfo aif : mmpData.getAifs()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1626
							IPath fullPath = helper.convertMMPToWorkspace(EMMPPathContext.AIF_SOURCE, aif.getResource());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1627
							if (fullPath != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1628
								// add the absolute workspace path to the folder directly under the project.
251
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1629
								if (showSourceRootsAtTopOfProject) {
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1630
									// ideally we'd be more precise but then CDT creates a C folder named Foo\Bar,
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1631
									// rather than just expanding Foo and then seeing bar a C source folder.
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1632
									topLevelSourcePaths.add(fullPath.uptoSegment(2).makeAbsolute());
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1633
								}
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1634
								else // ideal
fff928c91e29 [Bug 9230] Get parent folder of rss/aif and not top level so we can still honor the index only build mmps pref + restore and deprecate original source root method since it was API and create a new one to use with pref behavior
dadubrow
parents: 238
diff changeset
  1635
									topLevelSourcePaths.add(fullPath.removeLastSegments(1).makeAbsolute());
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1636
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1637
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1638
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1639
						for (IPath path : topLevelSourcePaths) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1640
							if (!sourceRoots.contains(path)) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1641
								sourceRoots.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1642
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1643
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1644
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1645
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1646
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1647
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1648
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1649
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1650
		return sourceRoots;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1651
	}
238
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1652
	
289
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  1653
	public static boolean getIndexAllPreference() {
238
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1654
		// Can't access this pref from the project ui plugin because it would cause a circular dependency
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1655
		IEclipsePreferences prefs = new InstanceScope().getNode("com.nokia.carbide.cpp.project.ui");
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1656
		if (prefs == null) {
238
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1657
			CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(), 
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1658
					IStatus.WARNING, "Could not find project UI plugin!"));
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1659
			return true;
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1660
		}
673
bc9a74f8e67b Refactor the *.pkg file resourceset gathering to avoid fixing the same bug 12 times
Ed Swartz <ed.swartz@nokia.com>
parents: 657
diff changeset
  1661
		return prefs.getBoolean("indexAll", false); //$NON-NLS-1$
238
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1662
	}
0f7a3f55e6fe [Bug 9230] Only create source roots for build components, overridable by pref
dadubrow
parents: 210
diff changeset
  1663
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1664
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1665
	 * Get the list of all mmp file paths for any and all build configurations of a project.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1666
	 * @param projectInfo
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1667
	 * @return list of full filesystem mmp paths, may be empty
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1668
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1669
	public static List<IPath> getMMPFilesForProject(final ICarbideProjectInfo projectInfo) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1670
		final List<IPath> mmps = new ArrayList<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1671
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1672
		final IPath workspaceRelativeldInfPath = projectInfo.getWorkspaceRelativeBldInfPath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1673
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1674
		EpocEnginePlugin.runWithBldInfData(workspaceRelativeldInfPath,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1675
			new DefaultViewConfiguration(projectInfo.getProject(), null, new AllNodesViewFilter()), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1676
			new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1677
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1678
				public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1679
					EpocEnginePathHelper helper = new EpocEnginePathHelper(projectInfo.getProject());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1680
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1681
					for (IMMPReference mmp : data.getAllMMPReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1682
						IPath fullPath = helper.convertToFilesystem(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1683
						mmps.add(fullPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1684
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1685
					return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1686
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1687
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1688
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1689
		return mmps;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1690
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1691
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1692
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1693
	 * Get the list of all mmp file paths that are applicable to the given build configuration.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1694
	 * @param buildConfig
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1695
	 * @return list of workspace relative mmp paths, may be empty
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1696
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1697
	public static List<IPath> getMMPFilesForBuildConfiguration(final ICarbideBuildConfiguration buildConfig) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1698
		final List<IPath> mmps = new ArrayList<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1699
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1700
		final IPath workspaceRelativeldInfPath = buildConfig.getCarbideProject().getWorkspaceRelativeBldInfPath();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1701
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1702
		EpocEnginePlugin.runWithBldInfData(workspaceRelativeldInfPath,
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  1703
			new DefaultViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1704
			new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1705
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1706
				public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1707
					EpocEnginePathHelper helper = new EpocEnginePathHelper(buildConfig.getCarbideProject().getProject());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1708
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1709
					for (IMMPReference mmp : data.getAllMMPReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1710
						IPath workspaceRelativeMMPPath = helper.convertToWorkspace(mmp.getPath());
430
147ef5f224c4 makmake error parser regression tests (reference data). Fix bug 9620, NPE when adding bogus path to PRJ_MMPFILES in bld.inf.
timkelly
parents: 293
diff changeset
  1711
						if (workspaceRelativeMMPPath != null){
147ef5f224c4 makmake error parser regression tests (reference data). Fix bug 9620, NPE when adding bogus path to PRJ_MMPFILES in bld.inf.
timkelly
parents: 293
diff changeset
  1712
							mmps.add(workspaceRelativeMMPPath);
147ef5f224c4 makmake error parser regression tests (reference data). Fix bug 9620, NPE when adding bogus path to PRJ_MMPFILES in bld.inf.
timkelly
parents: 293
diff changeset
  1713
						}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1714
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1715
					return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1716
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1717
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1718
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1719
		return mmps;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1720
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1721
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1722
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1723
	 * Get the list of all macros defined in the specified mmp file supported by specified
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1724
	 * build configuration.  These are found in MACRO statements in the mmp files.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1725
	 * @param mmpPath The workspace relative path of the mmp file to get the macros for.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1726
	 * @param buildConfig The build config context.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1727
	 * @return List of macro strings which may be empty.  There is no macro value, only a
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1728
	 * string like "FOO".
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1729
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1730
	public static List<String> getMMPMacrosForBuildConfiguration(final IPath workspaceRelativeMMPPath, final ICarbideBuildConfiguration buildConfig) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1731
		final List<String> macros = new ArrayList<String>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1732
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1733
		EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  1734
				new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1735
				new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1736
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1737
				public Object run(IMMPData mmpData) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1738
					Map<EMMPStatement, List<String>> listArgumentSettings = mmpData.getListArgumentSettings();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1739
					List<String> macroList = listArgumentSettings.get(EMMPStatement.MACRO);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1740
					for (String macro : macroList) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1741
						if (!macros.contains(macro)) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1742
							macros.add(macro);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1743
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1744
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1745
					return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1746
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1747
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1748
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1749
		return macros;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1750
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1751
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1752
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1753
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1754
	 * Get the resolved user and system include paths from the given MMP 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1755
	 * and build context.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1756
	 * @param project the project, must not be null
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1757
	 * @param mmp the project-relative MMP path, may not be null
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1758
	 * @param buildContext the build context, may not be null
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1759
	 * @param userPaths list of user paths to append to, may not be null
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1760
	 * @param systemPaths list of system paths to append to, may not be null
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1761
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1762
	public static void getMMPIncludePaths(final IProject project, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1763
			IPath mmp, final ICarbideBuildConfiguration buildConfiguration,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1764
			final List<File> userPaths, final List<File> systemPaths) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1765
		IMMPViewConfiguration viewConfiguration = new DefaultMMPViewConfiguration(
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  1766
				project, buildConfiguration.getBuildContext(), new AcceptedNodesViewFilter());
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1767
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1768
		final IPath epocRoot = new Path(buildConfiguration.getSDK().getEPOCROOT());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1769
		EpocEnginePlugin.runWithMMPData(new Path(project.getName()).append(mmp), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1770
				viewConfiguration, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1771
			new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1772
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1773
				public Object failedLoad(CoreException exception) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1774
					return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1775
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1776
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1777
				public Object run(IMMPData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1778
					MMPViewPathHelper helper = new MMPViewPathHelper(data, epocRoot);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1779
					for (IPath path : data.getUserIncludes()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1780
						IPath full = helper.convertMMPToFilesystem(EMMPPathContext.USERINCLUDE, path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1781
						if (full != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1782
							File resolved = full.toFile();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1783
							if (!userPaths.contains(resolved))
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1784
								userPaths.add(resolved);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1785
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1786
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1787
					for (IPath path : data.getSystemIncludes()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1788
						IPath full = helper.convertMMPToFilesystem(EMMPPathContext.SYSTEMINCLUDE, path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1789
						if (full != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1790
							File resolved = full.toFile();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1791
							if (!systemPaths.contains(resolved))
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1792
								systemPaths.add(resolved);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1793
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1794
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1795
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1796
					// add \epoc32\include\stdapis as a system include when target type is STDLIB, STDDLL or STDEXE
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1797
					String targetType = data.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1798
					if (targetType != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1799
						if (targetType.toUpperCase().matches("STDLIB|STDDLL|STDEXE")) { //$NON-NLS-1$
657
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
  1800
							File resolved = epocRoot.append("epoc32/include/stdapis").toFile(); //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1801
							if (!systemPaths.contains(resolved))
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1802
								systemPaths.add(resolved);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1803
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1804
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1805
					return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1806
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1807
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1808
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1809
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1810
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1811
	 * Return the set of directories containing SDK libraries for a build context,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1812
	 * taking into account the SDK, platform and target.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1813
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1814
	public static IPath[] getLibDirectoriesForBuildContext(ISymbianBuildContext buildContext) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1815
		ArrayList<IPath> dirList = new ArrayList<IPath>();
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
  1816
		IPath releaseRoot = buildContext.getSDK().getReleaseRoot();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1817
		String platformString = buildContext.getPlatformString();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1818
		boolean isDebug = ISymbianBuildContext.DEBUG_TARGET.equals(buildContext.getTargetString());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1819
		// TODO is this correct, what about ARMv6?
1479
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1820
		boolean isARMv5 = false;
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1821
		boolean isGCCE = false;
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1822
		
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1823
		if (buildContext instanceof ISBSv1BuildContext) {
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1824
			isARMv5 = ISBSv1BuildContext.ARMV5_PLATFORM.equals(platformString) ||
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1825
			ISBSv1BuildContext.ARMV5_ABIV2_PLATFORM.equals(platformString);
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1826
			isGCCE = ISBSv1BuildContext.GCCE_PLATFORM.equals(platformString);
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1827
		} else if (buildContext instanceof ISBSv2BuildContext){
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1828
			String alias = ((ISBSv2BuildContext)buildContext).getSBSv2Alias();
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1829
			if (alias.toUpperCase().contains(ISBSv2BuildContext.TOOLCHAIN_ARM)){
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1830
				isARMv5 = true;
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1831
			}
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1832
			if (alias.toUpperCase().contains(ISBSv2BuildContext.TOOLCHAIN_GCCE)){
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1833
				isGCCE = true;
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1834
			}
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1835
		}
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
  1836
		
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1837
		if (isARMv5 || isGCCE) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1838
			if (isDebug) {
657
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
  1839
				dirList.add(releaseRoot.append("armv5/udeb/")); //$NON-NLS-1$
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
  1840
				dirList.add(releaseRoot.append("armv5/urel/")); //$NON-NLS-1$
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
  1841
				dirList.add(releaseRoot.append("armv5/lib/")); //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1842
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1843
			else {
657
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
  1844
				dirList.add(releaseRoot.append("armv5/urel/"));			 //$NON-NLS-1$
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
  1845
				dirList.add(releaseRoot.append("armv5/lib/")); //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1846
			} 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1847
		} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1848
			if (isDebug) {
657
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
  1849
				dirList.add(releaseRoot.append(platformString + "/udeb/")); //$NON-NLS-1$
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
  1850
				dirList.add(releaseRoot.append(platformString + "/urel/")); //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1851
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1852
			else {
657
7f614450f806 Fix more Linux path conversions in EpocEngineHelper
Ed Swartz <ed.swartz@nokia.com>
parents: 430
diff changeset
  1853
				dirList.add(releaseRoot.append(platformString + "/urel/"));			 //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1854
			} 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1855
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1856
		return dirList.toArray(new IPath[dirList.size()]);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1857
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1858
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1859
	// regex to match on library file extension
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1860
	static final Pattern EXTENSION_FILTER = Pattern.compile("^\\S*\\.lib$"); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1861
	// regex to exclude file names of the form foo{xxxxxxxx}.lib
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1862
	static final Pattern EXCLUSION_FILTER = Pattern.compile("^\\S*\\{[0-9a-fA-F]{8,8}\\}\\.lib"); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1863
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1864
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1865
	 * Return the unique libraries appropriate to the given build configuration,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1866
	 * taking into account the SDK, platform and target.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1867
	 */	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1868
	public static Set<String> getSDKLibrariesForBuildContext(ISymbianBuildContext buildContext) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1869
		final HashSet<String> libs = new HashSet<String>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1870
		IPath[] libDirs = getLibDirectoriesForBuildContext(buildContext);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1871
		for (IPath libPath : libDirs) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1872
			File libDir = libPath.toFile();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1873
			if (libDir != null && libDir.isDirectory()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1874
				String[] libNames = libDir.list(new FilenameFilter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1875
					public boolean accept(File dir, String name) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1876
						boolean result = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1877
						Matcher extMatcher = EXTENSION_FILTER.matcher(name);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1878
						if (extMatcher.matches()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1879
							Matcher excludeMatcher = EXCLUSION_FILTER.matcher(name);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1880
							result = !excludeMatcher.matches();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1881
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1882
						return result;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1883
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1884
				});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1885
				for (String libName : libNames) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1886
					libs.add(libName);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1887
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1888
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1889
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1890
		return libs;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1891
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1892
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1893
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1894
	 * Get the MMP file that is the parent to a given source file for a given project. A source file is defined
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1895
	 * to be any of the MMP keywords: SOURCE, RESOURCE, SYSTEMRESOURCE, START RESOURCE, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1896
	 * @param project - The IProject with the sourcePath belongs
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1897
	 * @param sourcePath - The absolute file system path of the source file that is part of the IProject
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1898
	 * @return A list of project relative IPath entries of found MMP files that contain 'sourcePath' (may be empty).
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1899
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1900
	public static List<IPath> getMMPsForSource(final IProject project, final IPath sourcePath){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1901
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1902
		final ICarbideProjectInfo info = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1903
		final ICarbideBuildConfiguration buildConfig = info.getDefaultConfiguration();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1904
		final List<IPath>mmpPaths = new ArrayList<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1905
		EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(), 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  1906
				new DefaultViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1907
				new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1908
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1909
					public Object run(IBldInfData infView) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1910
						for (final IMMPReference mmp : infView.getAllMMPReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1911
								final IPath workspaceRelativeMMPPath = new Path(info.getProject().getName()).append(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1912
								
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1913
								EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  1914
										new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()),
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1915
										new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1916
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1917
										public Object run(IMMPData mmpData) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1918
											// read the project-wide target path
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1919
											 List<IPath> sourcePaths = mmpData.getSources();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1920
											MMPViewPathHelper helper = new MMPViewPathHelper(mmpData, null);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1921
											for (IPath currSrc : sourcePaths){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1922
												IPath fullPath = helper.convertMMPToFilesystem(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1923
														EMMPPathContext.SOURCE, currSrc);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1924
												//System.out.print("\nSOURCE: " + fullPath.toOSString());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1925
												if (fullPath.equals(sourcePath)){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1926
													mmpPaths.add(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1927
													return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1928
												}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1929
											}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1930
											
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1931
											List<IPath> resourcePaths = mmpData.getUserResources();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1932
											for (IPath currRSrc : resourcePaths){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1933
												IPath fullPath = helper.convertMMPToFilesystem(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1934
														EMMPPathContext.RESOURCE, currRSrc);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1935
												//System.out.print("\nEKA1 User Resource: " + fullPath.toOSString());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1936
												if (fullPath.equals(sourcePath)){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1937
													mmpPaths.add(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1938
													return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1939
												}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1940
											}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1941
											
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1942
											List<IPath> systemResourcePaths = mmpData.getSystemResources();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1943
											for (IPath currRSrc : systemResourcePaths){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1944
												IPath fullPath = helper.convertMMPToFilesystem(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1945
														EMMPPathContext.SYSTEMRESOURCE, currRSrc);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1946
												//System.out.print("\nEKA1 System Resource: " + fullPath.toOSString());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1947
												if (fullPath.equals(sourcePath)){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1948
													mmpPaths.add(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1949
													return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1950
												}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1951
											}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1952
											
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1953
											List<IMMPResource> newResourcePaths = new ArrayList<IMMPResource>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1954
											newResourcePaths = mmpData.getResourceBlocks();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1955
											for(IMMPResource currMMPRsrc : newResourcePaths){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1956
												IPath rsrcPath = currMMPRsrc.getSource();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1957
												IPath fullPath = helper.convertMMPToFilesystem(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1958
														EMMPPathContext.START_RESOURCE , rsrcPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1959
												//System.out.print("\nEKA2 Resource: " + fullPath.toOSString());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1960
												if (fullPath.equals(sourcePath)){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1961
													mmpPaths.add(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1962
													return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1963
												}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1964
											}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1965
											
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1966
											return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1967
										}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1968
								});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1969
							
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1970
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1971
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1972
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1973
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1974
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1975
		return mmpPaths;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1976
	}	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1977
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1978
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1979
	 * Returns host paths to all the executables built by the project for the default build configuration.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1980
	 * @param info project info
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1981
	 * @param allExePaths all the executable paths from all the mmps in the inf file for the
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1982
	 * default build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1983
	 * @param currBuiltExePaths all the executables that are actually being built for the default
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1984
	 * build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1985
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1986
	public static void getPathToAllExecutables(final ICarbideProjectInfo info,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1987
												final List<IPath> allExePaths,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1988
												final List<IPath> currBuiltExePaths) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1989
		getPathToAllExecutables(info.getDefaultConfiguration(), allExePaths, currBuiltExePaths,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1990
				new ArrayList<IPath>(), new ArrayList<IPath>());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1991
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1992
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1993
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1994
	 * Returns host paths to all the executables built by the project for the given build configuration.  Also
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1995
	 * returns the mmp paths as well.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1996
	 * @param buildConfig 		- 	current build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1997
	 * @param allExePaths 		- 	all the executable paths from all the mmp's that could be built for the given build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1998
	 * @param currBuiltExePaths - 	all the executable paths that are built for the given build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  1999
	 * @param allMMPPaths 		- 	all the mmp paths from all the mmp's that could be built for the given build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2000
	 * @param currBuiltMMPPaths - 	all the mmp paths that are built for the given build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2001
	 * 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2002
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2003
	public static void getPathToAllExecutables(final ICarbideBuildConfiguration buildConfig,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2004
												final List<IPath> allExePaths,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2005
												final List<IPath> currBuiltExePaths,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2006
												final List<IPath> allMMPPaths,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2007
												final List<IPath> currBuiltMMPPaths) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2008
		if (buildConfig == null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2009
			return;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2010
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2011
		final ICarbideProjectInfo cpi = buildConfig.getCarbideProject();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2012
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2013
		EpocEnginePlugin.runWithBldInfData(cpi.getWorkspaceRelativeBldInfPath(), 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2014
				new DefaultViewConfiguration(cpi, buildConfig.getBuildContext()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2015
				new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2016
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2017
					public Object run(IBldInfData infView) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2018
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2019
						EpocEnginePathHelper helper = new EpocEnginePathHelper(cpi.getProject());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2020
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2021
						// first calculate the paths to all binaries, built or not built
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2022
						for (IMakMakeReference mmp : infView.getAllMMPReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2023
							IPath workspaceRelativeMMPPath = helper.convertToWorkspace(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2024
							IPath path = getHostPathForExecutable(buildConfig, workspaceRelativeMMPPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2025
							if (path != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2026
								allExePaths.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2027
								allMMPPaths.add(workspaceRelativeMMPPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2028
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2029
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2030
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2031
						// now get the paths to only the binaries that are being built
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2032
						if (cpi.isBuildingFromInf()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2033
							// get all regular mmp binaries
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2034
							for (IMakMakeReference mmp : infView.getMakMakeReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2035
								if (!(mmp instanceof IMMPReference))
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2036
									continue;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2037
								IPath workspaceRelativeMMPPath = helper.convertToWorkspace(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2038
								IPath path = getHostPathForExecutable(buildConfig, workspaceRelativeMMPPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2039
								if (path != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2040
									currBuiltExePaths.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2041
									currBuiltMMPPaths.add(workspaceRelativeMMPPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2042
								}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2043
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2044
							
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2045
							if (cpi.isBuildingTestComps()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2046
								// get all test mmp binaries
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2047
								for (IMakMakeReference mmp : infView.getTestMakMakeReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2048
									if (!(mmp instanceof IMMPReference))
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2049
										continue;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2050
									IPath workspaceRelativeMMPPath = helper.convertToWorkspace(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2051
									IPath path = getHostPathForExecutable(buildConfig, workspaceRelativeMMPPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2052
									if (path != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2053
										currBuiltExePaths.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2054
										currBuiltMMPPaths.add(workspaceRelativeMMPPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2055
									}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2056
								}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2057
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2058
						} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2059
							// building a subset of regular and test components.  only get those binaries.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2060
							IMMPReference[] mmps = infView.getAllMMPReferences();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2061
							for (String component : cpi.getInfBuildComponents()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2062
								for (IMakMakeReference mmp : mmps) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2063
									if (mmp.getPath().lastSegment().compareToIgnoreCase(component) == 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2064
										IPath workspaceRelativeMMPPath = helper.convertToWorkspace(mmp.getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2065
										IPath path = getHostPathForExecutable(buildConfig, workspaceRelativeMMPPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2066
										if (path != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2067
											currBuiltExePaths.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2068
											currBuiltMMPPaths.add(workspaceRelativeMMPPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2069
										}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2070
									}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2071
								}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2072
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2073
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2074
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2075
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2076
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2077
			});		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2078
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2079
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2080
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2081
	 * Gets a list of upper case target type strings for the given build configuration.  There will be no
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2082
	 * duplicates in the list, and the list may be empty.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2083
	 * @param buildConfig the build configuration to use as a filter when parsing the bld.inf/mmp files
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2084
	 * @return list of target type strings
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2085
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2086
	public static List<String> getTargetTypesForBuildConfiguration(final ICarbideBuildConfiguration buildConfig) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2087
		final List<String> targetTypes = new ArrayList<String>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2088
		
289
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  2089
		// get the list of all mmp files selected for the build configuration
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  2090
		// a null buildComponents list means all MMPs are included - so leave it null when indexing all files
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  2091
		List<String> buildComponents = null;
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  2092
		if (!EpocEngineHelper.getIndexAllPreference())
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  2093
			buildComponents = buildConfig.getCarbideProject().isBuildingFromInf() ? null : buildConfig.getCarbideProject().getInfBuildComponents();
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  2094
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2095
		for (IPath mmpPath : getMMPFilesForBuildConfiguration(buildConfig)) {
293
66f0aa64d141 move string utility function into utils class
dadubrow
parents: 289
diff changeset
  2096
			if (buildComponents != null && !TextUtils.listContainsIgnoreCase(buildComponents, mmpPath.lastSegment()))
289
f512e4fde380 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected
Steve Sobek <steve.sobek@nokia.com>
parents: 251
diff changeset
  2097
				continue;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2098
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2099
			EpocEnginePlugin.runWithMMPData(mmpPath, 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2100
					new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2101
					new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2102
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2103
					public Object run(IMMPData mmpData) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2104
						String targetType = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2105
						if (targetType != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2106
							targetType = targetType.toUpperCase();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2107
							if (!targetTypes.contains(targetType)) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2108
								targetTypes.add(targetType);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2109
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2110
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2111
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2112
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2113
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2114
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2115
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2116
		return targetTypes;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2117
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2118
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2119
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2120
	 * Tell if the given bld.inf builds against variant platforms.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2121
	 * @return true if the bld.inf exists and VARIANT platform is specified, else false
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2122
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2123
	public static boolean isVariantBldInf(IPath bldInfFullPath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2124
		Boolean result = (Boolean) EpocEnginePlugin.runWithBldInfData(bldInfFullPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2125
			new DefaultViewConfiguration(bldInfFullPath, new AcceptedNodesViewFilter()), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2126
			new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2127
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2128
				public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2129
					for (String platform : data.getPlatforms()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2130
						if (platform.equalsIgnoreCase("VARIANT")) //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2131
							return true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2132
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2133
					return false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2134
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2135
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2136
		return result != null ? result.booleanValue() : false; 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2137
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2138
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2139
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2140
	 * Tell if given MMP builds variant executables under any configuration.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2141
	 * <p>
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2142
	 * Note: the variant is only built if the bld.inf is variant as well.  That is not checked here.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2143
	 * @param projectInfo the project to check
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2144
	 * @param projectRelativeMMPPath the MMP location in the project 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2145
	 * @return true if the MMP exists and the VAR keyword is used, else false
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2146
	 * @see #isVariantBldInf(IPath)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2147
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2148
	public static boolean isVariantMMP(ICarbideProjectInfo projectInfo, IPath projectRelativeMMPPath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2149
		Boolean result = (Boolean) EpocEnginePlugin.runWithMMPData(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2150
			projectRelativeMMPPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2151
			new DefaultMMPViewConfiguration(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2152
					projectInfo,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2153
					new AllNodesViewFilter()),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2154
			new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2155
				public Object run(IMMPData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2156
					return data.getSingleArgumentSettings().containsKey(EMMPStatement.VAR);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2157
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2158
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2159
		return result != null ? result.booleanValue() : false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2160
	}
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2161
	
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2162
	/**
162
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2163
	 * Tell if given MMP has the FEATUREVARIANT keyword
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2164
	 * 
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2165
	 * @param projectInfo the current Carbide project
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2166
	 * @param relativeMMPPath -project relative path to the MMP file we need to inspect
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2167
	 * 
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2168
	 */
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2169
	public static boolean hasFeatureVariantKeyword(ICarbideProjectInfo projectInfo, final IPath relativeMMPPath) {
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2170
		Boolean result = (Boolean) EpocEnginePlugin.runWithMMPData(
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2171
				relativeMMPPath, 
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2172
			new DefaultMMPViewConfiguration(
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2173
					projectInfo,
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2174
					new AllNodesViewFilter()),
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2175
			new MMPDataRunnableAdapter() {
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2176
				public Object run(IMMPData data) {
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2177
					return data.getFlags().contains(EMMPStatement.FEATUREVARIANT);
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2178
				}
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2179
		});
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2180
		return result != null ? result.booleanValue() : false;
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2181
	}
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2182
	
853
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2183
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2184
	/**
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2185
	 * Check whether or not the project and build for standard C++.
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2186
	 * The following rules apply:
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2187
	 * 
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2188
	 * 1) If an MMP contains NOSTDCPP then it does not have std C++ support
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2189
	 * 2) Else If the STDCPP keyword is set it does have std C++ support
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2190
	 * 3) Else if TARGETTYPE is one of STDEXE|STDDLL|STDLIB it does have std C++ support
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2191
	 * 4) Else not std C++ support
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2192
	 * 
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2193
	 * @return true if the MMP has standard C++ support
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2194
	 */
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2195
	public static boolean hasSTDCPPSupport(ICarbideProjectInfo projectInfo, final IPath relativeMMPPath) {
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2196
		Boolean result = (Boolean) EpocEnginePlugin.runWithMMPData(
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2197
				relativeMMPPath, 
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2198
			new DefaultMMPViewConfiguration(
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2199
					projectInfo,
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2200
					new AllNodesViewFilter()),
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2201
			new MMPDataRunnableAdapter() {
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2202
				public Object run(IMMPData data) {
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2203
					if (data.getFlags().contains(EMMPStatement.NOSTDCPP)){
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2204
						return false;
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2205
					} else if (data.getFlags().contains(EMMPStatement.STDCPP)){
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2206
						return true;
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2207
					} 
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2208
					
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2209
					String targetType = data.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE);
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2210
					if (targetType != null) {
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2211
						if (targetType.toUpperCase().matches("STDEXE|STDLIB|STDDLL")) { //$NON-NLS-1$
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2212
							return true;
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2213
						}
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2214
					}
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2215
					
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2216
					return false;
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2217
				}
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2218
		});
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2219
		return result != null ? result.booleanValue() : false;
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2220
	}
6c8527cdaa2e Add STDCPP keyword and targettype support. Bug 10460.
timkelly
parents: 798
diff changeset
  2221
	
162
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2222
	/**
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2223
	 * A particular MMP file is considered to be a Symbian Binary Variation iff the MMP file
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2224
	 * has the keyword "FEATUREVARIANT" flag defined and the build configuration has a valid
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2225
	 * build variant target in it's configuration name.
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2226
	 * @param mmpData - The data for the MMP file we want to inspect
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2227
	 * @param project - The project we need to get the build configuration name from
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2228
	 * @return true if a variant executable will be built for this mmp
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2229
	 */
162
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2230
	private static boolean isFeatureVariantMMP(IMMPData mmpData, IProject project){
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2231
		
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2232
		boolean isFeatureVariant = false;
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2233
		ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2234
		if (cpi != null){
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2235
			ICarbideBuildConfiguration defaultConfig = cpi.getDefaultConfiguration();
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2236
			if (defaultConfig != null){
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2237
				if (defaultConfig.getBuildVariationName().length() > 0 && 
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2238
					mmpData.getFlags().contains(EMMPStatement.FEATUREVARIANT)) {
1680
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
  2239
					isFeatureVariant = true;
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
  2240
				} else if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project) &&
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
  2241
						mmpData.getFlags().contains(EMMPStatement.FEATUREVARIANT)){
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2242
					isFeatureVariant = true;
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2243
				}
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2244
			}
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2245
			
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2246
		}
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2247
		
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2248
		return isFeatureVariant;
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2249
	}
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2250
	
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2251
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2252
	 * If the given MMP builds variant executables, return its current target.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2253
	 * Returns the normal target if not variant.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2254
	 * <p>
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2255
	 * Note: the variant is only built if the bld.inf is variant as well.  That is not checked here.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2256
	 * @param buildConfiguration the build configuration under which to parse the MMP
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2257
	 * @param projectRelativeMMPPath the MMP location in the project 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2258
	 * @return the epocroot-relative target path.  Only null if no target defined in MMP at all.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2259
	 * @see #isVariantBldInf(IPath)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2260
	 */
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2261
	public static IPath getVariantMMPTarget(final ICarbideBuildConfiguration buildConfiguration, final IPath projectRelativeMMPPath) {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2262
		IPath result = (IPath) EpocEnginePlugin.runWithMMPData(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2263
			projectRelativeMMPPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2264
			new DefaultMMPViewConfiguration(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2265
					buildConfiguration,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2266
					new AcceptedNodesViewFilter()),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2267
			new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2268
				public Object run(IMMPData data) {
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2269
					return getBinaryVariantTargetName(data, data.getTargetFilePath(), buildConfiguration.getCarbideProject().getProject());
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2270
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2271
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2272
		return result;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2273
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2274
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2275
	/**
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2276
	 * Get the target name with a variant suffix inserted. Since 2.1 this includes support for Symbian Binary Variation builds
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2277
	 * that have the FEATUREVARIANT keyword in their MMP file.
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2278
	 * @param mmpData
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2279
	 * @param target
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2280
	 * @return updated target name. This may return null for Symbian Binary Variation builds that do not yet have calcualted target files names (i.e. no makefiles)
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2281
	 */
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2282
	private static IPath getBinaryVariantTargetName(IMMPData mmpData, IPath target, IProject project) {
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2283
		if (target == null)
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2284
			return null;
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2285
		
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2286
		if (isFeatureVariantMMP(mmpData, project)) {
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2287
			
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2288
			// get the Symbian Binary Variation Name
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2289
			
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2290
			if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project)){
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2291
				// raptor is not yet supported
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2292
				return null;
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2293
			}
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2294
			
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2295
			ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2296
			if (cpi != null){
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2297
				
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2298
				// construct the location of the binary variant makefile.
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2299
				ICarbideBuildConfiguration defaultConfig = cpi.getDefaultConfiguration();
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2300
				File realMakeFile = getMakeFileForSymbianBinaryVariant(mmpData, defaultConfig);	
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2301
				
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2302
				String MD5Name = getMD5HashForBinaryVariant(defaultConfig, mmpData.getModelPath());
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2303
				
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2304
				if (MD5Name != null && MD5Name.length() > 0){
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2305
					//System.out.println("The target is: " + target.removeFileExtension().addFileExtension(MD5Name + "." + FileUtils.getSafeFileExtension(target)).toOSString()); //$NON-NLS-1$
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2306
					return 	target = target.removeFileExtension().addFileExtension(MD5Name + "." + FileUtils.getSafeFileExtension(target)); //$NON-NLS-1$
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2307
				} else {
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2308
					// The MD5 may not be able to be calculated
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2309
					return null;
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2310
				}
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2311
				
139
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2312
			} else {
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2313
				return null;
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2314
			}
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2315
			
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2316
		}
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2317
		else {
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2318
			String suffix = mmpData.getSingleArgumentSettings().get(EMMPStatement.VAR);
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2319
			if (suffix != null) {
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2320
				target = target.removeFileExtension().addFileExtension(suffix + "." + FileUtils.getSafeFileExtension(target)); //$NON-NLS-1$
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2321
			}
e743b7cf572c Add support for getting the Symbian Binary Variation name for variant builds. Bug 8793.
timkelly
parents: 74
diff changeset
  2322
		}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2323
		return target;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2324
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2325
	
179
77bd4ab5f973 cleanup some API/javadoc. Add API changes for SBV support.
timkelly
parents: 178
diff changeset
  2326
	/**
1680
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
  2327
	 * Get the MD5 hash for a configuration if it is a true binary variation. This is for abld buidler only.
179
77bd4ab5f973 cleanup some API/javadoc. Add API changes for SBV support.
timkelly
parents: 178
diff changeset
  2328
	 * @param config - The Carbide build configuration to check against
77bd4ab5f973 cleanup some API/javadoc. Add API changes for SBV support.
timkelly
parents: 178
diff changeset
  2329
	 * @param mmpFullPath - The path to the MMP file that builds the binary
77bd4ab5f973 cleanup some API/javadoc. Add API changes for SBV support.
timkelly
parents: 178
diff changeset
  2330
	 * @return A string of the MD5 hash. Returns an empty string if the configuration is not a binary variant or cannot be determined.
77bd4ab5f973 cleanup some API/javadoc. Add API changes for SBV support.
timkelly
parents: 178
diff changeset
  2331
	 */
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2332
	static public String getMD5HashForBinaryVariant(final ICarbideBuildConfiguration config, final IPath mmpFullPath){
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2333
		
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2334
		return (String)EpocEnginePlugin.runWithMMPData(mmpFullPath, 
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2335
				new DefaultMMPViewConfiguration(config, new AcceptedNodesViewFilter()),
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2336
				new MMPDataRunnableAdapter() {
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2337
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2338
				public Object run(IMMPData mmpData) {
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2339
					
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2340
					String md5 = "";
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2341
					
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2342
					File makefile = getMakeFileForSymbianBinaryVariant(mmpData, config);
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2343
					if (makefile != null && makefile.exists()){
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2344
						md5 = getMD5VariantFromMakefile(makefile, config);
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2345
					}
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2346
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2347
					return md5;	
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2348
				}
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2349
		});								
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2350
	}
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2351
	
1680
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
  2352
	/**
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
  2353
	 * NOTE: This only works for ABLD. Not SBSv2/Raptor!
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
  2354
	 * @param mmpData
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
  2355
	 * @param config
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
  2356
	 * @return
336352c21056 C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi
timkelly
parents: 1657
diff changeset
  2357
	 */
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2358
	private static File getMakeFileForSymbianBinaryVariant(IMMPData mmpData, ICarbideBuildConfiguration config){
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2359
		
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2360
		IPath makefileDir = CarbideCPPBuilder.getBuilderMakefileDir(config);
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2361
		
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2362
		IPath mmpFile = mmpData.getModelPath();
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2363
		mmpFile = mmpFile.removeFileExtension();
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2364
		String mmpRootName = mmpFile.lastSegment();
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2365
		String plat = config.getPlatformString();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2366
		String basePlat = "";
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2367
		if (config.getBuildContext() instanceof ISBSv2BuildConfigInfo){
1420
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1418
diff changeset
  2368
			basePlat = ((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2369
		} else {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2370
			basePlat = config.getPlatformString();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2371
		}
162
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2372
		String variantPlat = config.getBuildVariationName();
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2373
		
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2374
		if (variantPlat.length() == 0){
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2375
			plat = plat + "." + ISymbianBuildContext.DEFAULT_VARIANT;
9cf153286621 1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
timkelly
parents: 161
diff changeset
  2376
		}
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2377
		
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2378
		String makefilePath = makefileDir.toOSString() + File.separator + mmpRootName + File.separator + basePlat + File.separator;
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2379
		String variantMakeFileName = mmpRootName + "." + plat;
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2380
		File realMakeFile = new File(makefilePath + variantMakeFileName);
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2381
		
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2382
		return realMakeFile;
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2383
	}
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2384
	
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2385
	/**
1709
6bd6640867aa clean up some TODOs
timkelly
parents: 1707
diff changeset
  2386
	 * Get the MD5 hash value for an existing configuration by parsing its makefile. Should only be used for ABLD build system.
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2387
	 * @param makefile - The build makefile to parse to check for the MD5
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2388
	 * @param config - The build configuration to check under
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2389
	 * @return The string for the MD5 hash. An empty string if it cannot be determined.
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2390
	 */
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2391
	private static String getMD5VariantFromMakefile(File makefile, ICarbideBuildConfiguration config){
1709
6bd6640867aa clean up some TODOs
timkelly
parents: 1707
diff changeset
  2392
		// We could also use the .vmap in the release folder as well.
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2393
		// we can parse the makefile and get the variant name for each in the comments:
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2394
		//
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2395
		//# FeatureVariantURELLabel d41d8cd98f00b204e9800998ecf8427e
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2396
		//# FeatureVariantUDEBLabel d41d8cd98f00b204e9800998ecf8427e
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2397
		String MD5Str = "";
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2398
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2399
		if (makefile.exists()){
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2400
			String text = "";
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2401
			try {
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2402
				text = new String(FileUtils.readFileContents(makefile, null));
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2403
			} catch (CoreException e) {
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2404
				e.printStackTrace();
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2405
			}
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2406
			
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2407
			String searchString = "";
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2408
			if (config.getTargetString().equals(BuildContextSBSv1.DEBUG_TARGET)){
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2409
				searchString = "# FeatureVariantUDEBLabel";
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2410
			} else {
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2411
				searchString = "# FeatureVariantURELLabel";
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2412
			}
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2413
			
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2414
			for (String line : text.split("\n")) {
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2415
				if (line.startsWith(searchString)){
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2416
					String tokens[] = line.split(" ");
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2417
					if (tokens.length == 3){
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2418
						MD5Str = tokens[2];
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2419
						break;
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2420
					}
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2421
				}
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2422
			}
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2423
			
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2424
		} 
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2425
		
161
db723d303030 trim MD5 has name to get ride of whitespace
timkelly
parents: 156
diff changeset
  2426
		return MD5Str.trim();
156
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2427
	}
66bb501740a4 updates for SBV support to build and compile with proper platform name and makefile. Updates to refactor support to get MD5 from build target mmp.
timkelly
parents: 139
diff changeset
  2428
	
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2429
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2430
	 * If the given MMP builds variant executables, return all the variant targets it builds.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2431
	 * <p>
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2432
	 * Note: the variant is only built if the bld.inf is variant as well.  That is not checked here.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2433
	 * @param buildConfiguration the build configuration under which to parse the MMP
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2434
	 * @param projectRelativeMMPPath the MMP location in the project 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2435
	 * @return the array of unique variant targets
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2436
	 * @see #isVariantBldInf(IPath)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2437
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2438
	public static IPath[] getVariantMMPTargets(final ICarbideProjectInfo projectInfo, IPath projectRelativeMMPPath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2439
		Set<IPath> targets = new HashSet<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2440
		for (ICarbideBuildConfiguration buildConfiguration : projectInfo.getBuildConfigurations()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2441
			IPath targetPath = getVariantMMPTarget(buildConfiguration, projectRelativeMMPPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2442
			if (targetPath != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2443
				targets.add(targetPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2444
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2445
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2446
		return (IPath[]) targets.toArray(new IPath[targets.size()]);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2447
	}	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2448
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2449
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2450
	 * Get all the #include files, plus self, referenced by a given MMP file in either
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2451
	 * a specific build configuration or all build configurations.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2452
	 * @param projectInfo info for the project being considered 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2453
	 * @param buildConfig build configuration, or <code>null</code> for all configurations
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2454
	 * @param mmpPath the full filesystem path to the MMP
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2455
	 * @param pathList collection of full filesystem paths, updated with results
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2456
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2457
	public static void addIncludedFilesFromMMP(ICarbideProjectInfo projectInfo, ICarbideBuildConfiguration buildConfig, IPath mmpPath, final Collection<IPath> pathList) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2458
		DefaultMMPViewConfiguration viewConfig = buildConfig != null ?
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2459
				new DefaultMMPViewConfiguration(buildConfig, new AcceptedNodesViewFilter()) :
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2460
					new DefaultMMPViewConfiguration(projectInfo, new AllNodesViewFilter());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2461
		EpocEnginePlugin.runWithMMPData(mmpPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2462
				viewConfig,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2463
				new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2464
					public Object run(IMMPData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2465
						for (IPath path : data.getReferencedFiles()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2466
							pathList.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2467
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2468
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2469
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2470
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2471
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2472
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2473
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2474
	 * Get all the #include files, plus self, referenced by a given MMP file in any
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2475
	 * configuration.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2476
	 * @param projectPath full path of the project 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2477
	 * @param mmpPath the full filesystem path to the MMP
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2478
	 * @param pathList collection of full filesystem paths, updated with results
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2479
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2480
	public static void addIncludedFilesFromMMP(IPath projectPath, IPath mmpPath, final Collection<IPath> pathList) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2481
		EpocEnginePlugin.runWithMMPData(mmpPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2482
				new DefaultMMPViewConfiguration(projectPath), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2483
				new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2484
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2485
					public Object run(IMMPData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2486
						for (IPath path : data.getReferencedFiles()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2487
							pathList.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2488
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2489
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2490
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2491
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2492
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2493
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2494
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2495
	 * Get all the #include files, plus self, referenced by a given bld.inf file in either
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2496
	 * a specific build configuration or all build configurations.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2497
	 * @param projectInfo info for the project being considered 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2498
	 * @param buildConfig the build configuration, or <code>null</code> for all configurations
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2499
	 * @param bldinfPath the full filesystem path to the bld.inf
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2500
	 * @param pathList collection of full filesystem paths, updated with results
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2501
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2502
	public static void addIncludedFilesFromBldInf(ICarbideProjectInfo projectInfo, ICarbideBuildConfiguration buildConfig, IPath bldinfPath, final Collection<IPath> pathList) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2503
		DefaultViewConfiguration viewConfig = buildConfig != null ?
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2504
				new DefaultViewConfiguration(projectInfo, buildConfig.getBuildContext()) :
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2505
					new DefaultViewConfiguration(projectInfo);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2506
		EpocEnginePlugin.runWithBldInfData(bldinfPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2507
				viewConfig, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2508
				new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2509
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2510
					public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2511
						for (IPath path : data.getReferencedFiles()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2512
							pathList.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2513
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2514
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2515
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2516
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2517
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2518
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2519
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2520
	 * Get all the #include files, plus self, referenced by a given bld.inf file in any
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2521
	 * configuration.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2522
	 * @param projectPath the full filesystem path to the project 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2523
	 * @param bldinfPath the full filesystem path to the bld.inf
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2524
	 * @param pathList collection of full filesystem paths, updated with results
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2525
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2526
	public static void addIncludedFilesFromBldInf(IPath projectPath, IPath bldinfPath, final Collection<IPath> pathList) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2527
		EpocEnginePlugin.runWithBldInfData(bldinfPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2528
				new DefaultViewConfiguration(projectPath), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2529
				new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2530
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2531
					public Object run(IBldInfData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2532
						for (IPath path : data.getReferencedFiles()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2533
							pathList.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2534
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2535
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2536
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2537
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2538
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2539
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2540
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2541
	 * Returns a list of absolute host paths for any files in the given pkg file.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2542
	 * @param pkgPath absolute path to the pkg file
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2543
	 * @param buildConfig build configuration context
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2544
	 * @param sisInfo optional sisFinfo.  content search location is used from this to find relative paths and
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2545
	 * filenames.  when null, the first sis info for the build configuration that matches the pkg file will be
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2546
	 * used.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2547
	 * @return list of absolute paths to files used in pkg
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2548
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2549
	public static List<IPath> getFilesInPKG(IPath pkgPath, final ICarbideBuildConfiguration buildConfig, final ISISBuilderInfo sisInfo) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2550
		final List<IPath> filePaths = new ArrayList<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2551
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2552
		PKGModelHelper.runWithPKGView(pkgPath, 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2553
				new DefaultViewConfiguration(buildConfig.getCarbideProject(), buildConfig.getBuildContext()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2554
				new PKGViewRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2555
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2556
				public Object run(IPKGView view) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2557
					PKGViewPathHelper helper = new PKGViewPathHelper(view, buildConfig);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2558
					if (sisInfo != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2559
						helper.setSISBuilderInfo(sisInfo);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2560
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2561
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2562
					for (IPKGInstallFile file : view.getAllInstallFiles()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2563
						Map<EPKGLanguage, IPath> sourceFiles = file.getSourceFiles();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2564
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2565
						for (EPKGLanguage language : sourceFiles.keySet()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2566
							IPath path = helper.getAbsolutePathFromViewPath(sourceFiles.get(language));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2567
							if (path != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2568
								filePaths.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2569
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2570
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2571
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2572
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2573
					for (IPKGEmbeddedSISFile file : view.getAllEmbeddedSISFiles()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2574
						Map<EPKGLanguage, IPath> sourceFiles = file.getSourceFiles();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2575
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2576
						for (EPKGLanguage language : sourceFiles.keySet()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2577
							IPath path = helper.getAbsolutePathFromViewPath(sourceFiles.get(language));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2578
							if (path != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2579
								filePaths.add(path);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2580
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2581
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2582
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2583
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2584
					return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2585
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2586
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2587
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2588
		return filePaths;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2589
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2590
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2591
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2592
	 * Returns the UID2 string value for the given mmp file and build config context.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2593
	 * @param buildConfiguration the build configuration under which to parse the MMP
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2594
	 * @param projectRelativeMMPPath the MMP location in the project 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2595
	 * @return the UID2 string, or null if none.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2596
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2597
	public static String getUID2(ICarbideBuildConfiguration buildConfiguration, IPath projectRelativeMMPPath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2598
		String result = (String) EpocEnginePlugin.runWithMMPData(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2599
			projectRelativeMMPPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2600
			new DefaultMMPViewConfiguration(
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2601
					buildConfiguration,
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2602
					new AcceptedNodesViewFilter()),
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2603
			new MMPDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2604
				public Object run(IMMPData data) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2605
					return data.getUid2();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2606
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2607
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2608
		return result;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2609
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2610
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2611
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2612
	 * Returns the absolute file system path to the EPOCROOT directory of
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2613
	 * the SDK for the active build configuration of the project
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2614
	 * @param project the project
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2615
	 * @return the absolute path to EPOCROOT, or null if the project is
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2616
	 * not a Carbide project, is closed, or there are no build configurations
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2617
	 * in the project.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2618
	 * @since 2.0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2619
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2620
	public static IPath getEpocRootForProject(IProject project) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2621
		IPath epocroot = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2622
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2623
		if (project != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2624
			if (CarbideBuilderPlugin.getBuildManager().isCarbideProject(project) && project.isAccessible()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2625
				ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2626
				if (cpi != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2627
					ICarbideBuildConfiguration config = cpi.getDefaultConfiguration();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2628
					if (config != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2629
						ISymbianSDK sdk = config.getSDK();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2630
						if (sdk != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2631
							epocroot = new Path(sdk.getEPOCROOT());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2632
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2633
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2634
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2635
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2636
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2637
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2638
		return epocroot;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2639
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2640
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2641
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2642
	 * Adds the given include path as a user include path to all mmps in the project for
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2643
	 * all build configurations
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2644
	 * @param project the project
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2645
	 * @param projectRelativeIncDirPath project relative path to the include directory
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2646
	 * @since 2.0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2647
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2648
	public static void addIncludePathToProject(IProject project, final IPath projectRelativeIncDirPath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2649
		if (project == null || projectRelativeIncDirPath == null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2650
			return;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2651
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2652
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2653
		if (CarbideBuilderPlugin.getBuildManager().isCarbideProject(project) && project.isAccessible()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2654
			ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2655
			if (cpi != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2656
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2657
				// loop through all build configurations since the list of mmp's could be different
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2658
				// depending on the build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2659
				for (ICarbideBuildConfiguration config : cpi.getBuildConfigurations()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2660
					final IPath epocroot = new Path(config.getSDK().getEPOCROOT());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2661
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2662
					// loop through each mmp file and add the include path if necessary
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2663
					for (final IPath mmpPath : getMMPFilesForBuildConfiguration(config)) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2664
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2665
						EpocEnginePlugin.runWithMMPView(mmpPath, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2666
							new DefaultMMPViewConfiguration(config, new AcceptedNodesViewFilter()), 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2667
							new MMPViewRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2668
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2669
								public Object run(IMMPView view) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2670
									MMPViewPathHelper helper = new MMPViewPathHelper(view, epocroot);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2671
									try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2672
										// convert the project relative path to an mmp view path
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2673
										IPath incPath = helper.convertProjectOrFullPathToMMP(EMMPPathContext.USERINCLUDE, projectRelativeIncDirPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2674
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2675
										// get the list of user include paths and add it if it's not
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2676
										// already there
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2677
										List<IPath> userIncludes = view.getUserIncludes();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2678
										if (!userIncludes.contains(incPath)) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2679
											userIncludes.add(incPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2680
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2681
											// now commit the changes and release the file
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2682
											while (true) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2683
												try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2684
													view.commit();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2685
													break;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2686
												} catch (IllegalStateException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2687
													if (!view.merge()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2688
														view.revert();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2689
													}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2690
												}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2691
											}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2692
										}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2693
										
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2694
									} catch (InvalidDriveInMMPPathException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2695
										// shouldn't get here; we passed in a project-relative path
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2696
										CarbideBuilderPlugin.log(e);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2697
									}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2698
									
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2699
									return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2700
								}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2701
						});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2702
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2703
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2704
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2705
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2706
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2707
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2708
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2709
	 * Gets the list of mmp and makefiles being built by the given build configuration.  Note that this takes
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2710
	 * builder settings into account.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2711
	 * @param buildConfig the build configuration
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2712
	 * @return the list of workspace relative compoment paths, may be empty
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2713
	 * @since 2.0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2714
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2715
	public static List<IPath> getComponentsBuiltByConifguration(ICarbideBuildConfiguration buildConfig) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2716
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2717
		final List<IPath> paths = new ArrayList<IPath>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2718
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2719
		final ICarbideProjectInfo cpi = buildConfig.getCarbideProject();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2720
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2721
		EpocEnginePlugin.runWithBldInfData(cpi.getWorkspaceRelativeBldInfPath(), 
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1234
diff changeset
  2722
				new DefaultViewConfiguration(cpi, buildConfig.getBuildContext()), 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2723
				new BldInfDataRunnableAdapter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2724
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2725
					public Object run(IBldInfData infView) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2726
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2727
						EpocEnginePathHelper helper = new EpocEnginePathHelper(cpi.getProject());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2728
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2729
						// get the paths of the components being built
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2730
						if (cpi.isBuildingFromInf()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2731
							// get all regular components
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2732
							for (IMakMakeReference component : infView.getMakMakeReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2733
								paths.add(helper.convertToWorkspace(component.getPath()));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2734
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2735
							
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2736
							if (cpi.isBuildingTestComps()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2737
								// get all test components
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2738
								for (IMakMakeReference component : infView.getTestMakMakeReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2739
									paths.add(helper.convertToWorkspace(component.getPath()));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2740
								}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2741
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2742
						} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2743
							// building a subset of regular and test components.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2744
							for (String component : cpi.getInfBuildComponents()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2745
								for (IMakMakeReference comp : infView.getAllMakMakeReferences()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2746
									if (comp.getPath().lastSegment().compareToIgnoreCase(component) == 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2747
										paths.add(helper.convertToWorkspace(comp.getPath()));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2748
									}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2749
								}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2750
							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2751
						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2752
						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2753
						return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2754
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2755
			});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2756
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2757
		return paths;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2758
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
  2759
}