core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java
author timkelly
Fri, 27 Aug 2010 16:34:38 -0500
changeset 1906 6f11f5393a5c
parent 1879 5486b48b06ad
child 2050 0d6ae58214f3
permissions -rw-r--r--
for gcce and armv5 based targets for sbsv2, if the compiler prefix does not exist on disk for a particular configuraiton, attempt to perform a raptor query to reubuild the config data.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
     1
/*
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
     3
* All rights reserved.
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
     4
* This component and the accompanying materials are made available
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
     6
* which accompanies this distribution, and is available
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
     8
*
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
     9
* Initial Contributors:
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    11
*
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    12
*/
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    13
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    14
package com.nokia.carbide.cpp.internal.sdk.core.model;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    15
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
    16
import java.text.MessageFormat;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    17
import java.util.ArrayList;
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    18
import java.util.HashMap;
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
    19
import java.util.Iterator;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    20
import java.util.List;
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    21
import java.util.Map;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    22
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    23
import org.eclipse.core.runtime.IPath;
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
    24
import org.eclipse.core.runtime.IStatus;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    25
import org.eclipse.core.runtime.Path;
1543
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    26
import org.eclipse.jface.dialogs.MessageDialog;
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    27
import org.eclipse.ui.PlatformUI;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    28
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    29
import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv2;
1739
5f659a59d04a refactoring ISBSv2BuildContext, ISBSv1BuildContext, ISBSv2ConfigQueryData from public to internal package.
timkelly
parents: 1709
diff changeset
    30
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    31
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    32
import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1543
diff changeset
    33
import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2ConfigQueryData;
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
    34
import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2MinimumVersionException;
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    35
import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    36
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    37
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
    38
import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    39
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
    40
import com.nokia.cpp.internal.api.utils.core.Logging;
1543
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    41
import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    42
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    43
/**
1820
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1811
diff changeset
    44
 * SBSv2 specific build information. Serves as a container for build data container for a Symbian SDK using SBSv2
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1811
diff changeset
    45
 * @since 3.0
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    46
 *
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    47
 */
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    48
public class SBSv2BuildInfo implements ISBSv2BuildInfo {
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
    49
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    50
	private ISymbianSDK sdk;
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
    51
	private List<ISymbianBuildContext> sbsv2FilteredContexts = new ArrayList<ISymbianBuildContext>();
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    52
	private boolean wasScanned = false;
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
    53
	/** from <metadata> element from sbs --query=config[] */
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
    54
	private Map<String, Map<String, String>> cachedMetadataMacros = new HashMap<String, Map<String, String>>();
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
    55
	/** from <build> element from sbs --query=config[] */
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
    56
	private Map<String, Map<String, String>> cachedBuildMacros = new HashMap<String, Map<String, String>>();
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    57
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    58
	private Map<String, String> aliasToMeaningMap = new HashMap<String, String>();
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
    59
	private List<String> productList = null;
1521
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
    60
	private IPath cachedVariantHRHFile = null;
1543
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    61
	private static boolean hasShownDialog;
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    62
	
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    63
	public SBSv2BuildInfo(ISymbianSDK sdk) {
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    64
		this.sdk = sdk;
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    65
	}
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    66
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    67
	public List<ISymbianBuildContext> getAllBuildConfigurations() {
1709
6bd6640867aa clean up some TODOs
timkelly
parents: 1691
diff changeset
    68
		// This really only applies to SBSv1. We never return the full list of configs for SBSv2, only the filtered ones
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
    69
		return sbsv2FilteredContexts;
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    70
	}
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    71
1820
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1811
diff changeset
    72
	public void clearDataFromBuildCache(){
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1811
diff changeset
    73
		aliasToMeaningMap.clear();
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1811
diff changeset
    74
		if (productList != null) productList.clear();
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
    75
		sbsv2FilteredContexts.clear();
1820
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1811
diff changeset
    76
		cachedBuildMacros.clear();
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1811
diff changeset
    77
		cachedMetadataMacros.clear();
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1811
diff changeset
    78
		cachedVariantHRHFile = null;
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1811
diff changeset
    79
	}
5c955fcfdc3d fix npe, clear sbsv2 query cache data in memory when rebuilding sbsv2 cache from pref, other code clean-up
timkelly
parents: 1811
diff changeset
    80
	
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
    81
	public List<ISymbianBuildContext> getFilteredBuildConfigurations() {
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    82
		
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
    83
		if (aliasToMeaningMap.size() == 0){
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
    84
			try {
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1690
diff changeset
    85
				aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk);
1543
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    86
			} catch (final SBSv2MinimumVersionException e) {
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    87
				if (hasShownDialog == false){
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    88
					
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    89
					PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    90
						public void run() {
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    91
							MessageDialog.openError(WorkbenchUtils.getSafeShell(), "Minimum sbs version not met.", e.getMessage());
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    92
						}
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    93
					});	
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    94
					
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
    95
				Logging.log( SDKCorePlugin.getDefault(),
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
    96
							Logging.newSimpleStatus(0, IStatus.ERROR,
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
    97
								MessageFormat.format(e.getMessage(), ""), e));
1543
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    98
				
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
    99
				hasShownDialog = true;
69d5b194482b fix bug 11556
timkelly
parents: 1521
diff changeset
   100
				}
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
   101
			}
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   102
		}
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   103
		
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   104
		if (productList == null){
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   105
			// Not all SDKs will have products, so size of 0 is acceptable
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   106
			productList = new ArrayList<String>();
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   107
			try {
1691
b249ba29f642 Remove boolean API to force rescan the SBS cache (there was API to do that already)
timkelly
parents: 1690
diff changeset
   108
				productList = SBSv2QueryUtils.getProductVariantsForSDK(sdk);
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   109
			} catch (SBSv2MinimumVersionException e) {
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   110
				// ignore
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   111
			}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   112
		}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   113
		List<String> allowedConfigs = SBSv2Utils.getSBSv2FilteredConfigPreferences(); // From global prefs	
1683
659fdb7ee701 simplify building of filtered alias lists from sbsv2 filtering prefs. Fix NPE when creating a build config that has errors and not platform or target.
timkelly
parents: 1672
diff changeset
   114
		if (SBSv2Utils.enableSBSv2Support()){
1480
c26f1a4c14aa Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
timkelly
parents: 1478
diff changeset
   115
			
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   116
			try {
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   117
				initSBSv2BuildContextList(allowedConfigs);
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   118
			} catch (SBSv2MinimumVersionException e) {
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   119
				// igore, would be caught above
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   120
			}
1683
659fdb7ee701 simplify building of filtered alias lists from sbsv2 filtering prefs. Fix NPE when creating a build config that has errors and not platform or target.
timkelly
parents: 1672
diff changeset
   121
		} 
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   122
		
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   123
		return sbsv2FilteredContexts;
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   124
	}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   125
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   126
	private void initSBSv2BuildContextList(List<String> allowedConfigs) throws SBSv2MinimumVersionException {
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   127
		List<String> filteredAliasList = new ArrayList<String>();
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   128
		
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   129
		for (String alias : aliasToMeaningMap.keySet()){
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   130
			for (String checkedAlias : allowedConfigs){
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   131
				if (checkedAlias.equalsIgnoreCase(alias)){
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   132
					filteredAliasList.add(alias);
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   133
					break;
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   134
				}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   135
			}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   136
		}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   137
		
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   138
		if (productList != null && productList.size() > 0){
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   139
			for (String testConfig : allowedConfigs) {
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   140
				if (testConfig.contains(".")){
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   141
					String tokens[] = testConfig.split("\\.");
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   142
					for (String tok : tokens){
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   143
						if (productList.contains(tok)){
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   144
							filteredAliasList.add(testConfig);
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   145
							break;
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   146
						}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   147
					}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   148
				}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   149
			}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   150
		}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   151
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   152
		List<String> processedAliasList = new ArrayList<String>();
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   153
		sbsv2FilteredContexts.clear();
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   154
		for (String alias : filteredAliasList) {
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   155
			SBSv2ConfigQueryData configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias);
1690
ff22cda9e578 1) always try to rescan configs that have error messages. 2) remove some dead code
timkelly
parents: 1685
diff changeset
   156
			if (configQueryData != null && configQueryData.getConfigurationErrorMessage().trim().length() == 0) {
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   157
				ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData);
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   158
				sbsv2FilteredContexts.add(sbsv2Context);
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   159
				processedAliasList.add(alias);
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   160
			}
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   161
		}
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   162
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   163
		if (!processedAliasList.isEmpty()) {
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   164
			filteredAliasList.removeAll(processedAliasList);
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   165
		}
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   166
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   167
		if (!filteredAliasList.isEmpty()) {
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   168
			String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, filteredAliasList);
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   169
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   170
			for (String alias : filteredAliasList) {
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   171
				String meaning = "";
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   172
				if (alias.contains(".")){
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   173
					meaning = getMeaningForVariant(alias);
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   174
				} else {
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   175
					meaning = aliasToMeaningMap.get(alias);
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   176
				}
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   177
				if (meaning == null){
1779
73303c546665 clean up some TODO comments
timkelly
parents: 1739
diff changeset
   178
					continue; 
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   179
				}
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   180
				SBSv2ConfigQueryData configQueryData = new SBSv2ConfigQueryData(alias, meaning, configQueryXML);
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   181
				ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData);
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   182
				sbsv2FilteredContexts.add(sbsv2Context);
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   183
				SBSv2QueryUtils.storeConfigQueryDataForSDK(sdk, alias, configQueryData);
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1543
diff changeset
   184
			}
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   185
		}
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   186
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   187
		checkWINSCWSupport();
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   188
	}
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   189
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   190
	private void checkWINSCWSupport() {
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   191
		List<ISymbianBuildContext> contextList = new ArrayList<ISymbianBuildContext>();
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   192
		for (Iterator<ISymbianBuildContext> itr = sbsv2FilteredContexts.iterator(); itr.hasNext();) {
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   193
			ISBSv2BuildContext context = (ISBSv2BuildContext) itr.next();
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   194
			if (context.getPlatformString().equalsIgnoreCase(ISBSv2BuildContext.TOOLCHAIN_WINSCW)) {
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   195
				if (context.getTargetString().equalsIgnoreCase(ISymbianBuildContext.DEBUG_TARGET)) {
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   196
					if (sdk.getSupportedFeatures().contains(ISymbianSDKFeatures.IS_WINSCW_UDEB_SUPPORTED)){
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   197
						contextList.add(context);
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   198
					}
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   199
				}
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   200
				else
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   201
					if (context.getTargetString().equalsIgnoreCase(ISymbianBuildContext.RELEASE_TARGET)) {
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   202
						if (sdk.getSupportedFeatures().contains(ISymbianSDKFeatures.IS_WINSCW_UREL_SUPPORTED)){
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   203
							contextList.add(context);
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   204
						}
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   205
					}
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   206
			} else {
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   207
				contextList.add(context);
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   208
			}
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   209
		}
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   210
		sbsv2FilteredContexts = contextList;
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   211
	}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   212
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   213
	private String getMeaningForVariant(String alias) {
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   214
		String meaning = null;
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   215
		
1709
6bd6640867aa clean up some TODOs
timkelly
parents: 1691
diff changeset
   216
		// The alias is the first token when splitting on a dot.
1502
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   217
		String tokens[] = alias.split("\\.");
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   218
		if (tokens.length > 0){
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   219
			meaning = aliasToMeaningMap.get(tokens[0]);
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   220
			for (int i = 1; i < tokens.length; i++){
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   221
				meaning += "." + tokens[i];
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   222
			}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   223
		}
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   224
		
31f428aec716 add initial support for viewing variants in the sdk config tree. refactor some code which initializes sbsv2 contexts.
timkelly
parents: 1497
diff changeset
   225
		return meaning;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   226
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   227
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   228
	public Map<String, String> getMetadataMacros(String buildAlias) {
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   229
		Map<String, String> platformMacros = cachedMetadataMacros.get(buildAlias);
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   230
		if (platformMacros == null) {
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1543
diff changeset
   231
			platformMacros = new HashMap<String, String>();
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   232
			synchronized (cachedMetadataMacros) {
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   233
				if (sbsv2FilteredContexts == null || sbsv2FilteredContexts.size() == 0) {
1521
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   234
					getFilteredBuildConfigurations();
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   235
				}
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   236
				if (sbsv2FilteredContexts.size() > 0) {
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   237
					for (ISymbianBuildContext context : sbsv2FilteredContexts) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   238
						if (((ISBSv2BuildContext)context).getSBSv2Alias().equalsIgnoreCase(buildAlias)) {
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1543
diff changeset
   239
							platformMacros.putAll(((ISBSv2BuildContext)context).getConfigQueryData().getMetaDataMacros());
1521
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   240
						}
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   241
					}
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   242
					cachedMetadataMacros.put(buildAlias, platformMacros);
1521
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   243
				}
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   244
			}
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   245
		}
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   246
		return platformMacros;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   247
	}
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   248
	
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   249
	public Map<String, String> getBuildMacros(String buildAlias) {
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   250
		Map<String, String> buildMacros = cachedBuildMacros.get(buildAlias);
1906
6f11f5393a5c for gcce and armv5 based targets for sbsv2, if the compiler prefix does not exist on disk for a particular configuraiton, attempt to perform
timkelly
parents: 1879
diff changeset
   251
		
6f11f5393a5c for gcce and armv5 based targets for sbsv2, if the compiler prefix does not exist on disk for a particular configuraiton, attempt to perform
timkelly
parents: 1879
diff changeset
   252
		if (buildMacros == null || buildMacros.size() == 0) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   253
			buildMacros = new HashMap<String, String>();
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   254
			synchronized (cachedBuildMacros) {
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   255
				if (sbsv2FilteredContexts == null || sbsv2FilteredContexts.size() == 0) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   256
					getFilteredBuildConfigurations();
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   257
				}
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   258
				if (sbsv2FilteredContexts.size() > 0) {
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   259
					for (ISymbianBuildContext context : sbsv2FilteredContexts) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   260
						if (((ISBSv2BuildContext)context).getSBSv2Alias().equalsIgnoreCase(buildAlias)) {
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   261
							buildMacros.putAll(((ISBSv2BuildContext)context).getConfigQueryData().getBuildMacros());
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   262
						}
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   263
					}
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   264
					cachedBuildMacros.put(buildAlias, buildMacros);
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   265
				}
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   266
			}
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   267
		}
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   268
		return buildMacros;
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   269
	}
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   270
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   271
	/**
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   272
	 * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   273
	 * @return A path object, or null if the variant.cfg does not exist. This routine does not check to see if the returned path exists.
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   274
	 */
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   275
	public IPath getPrefixFromVariantCfg(){
1906
6f11f5393a5c for gcce and armv5 based targets for sbsv2, if the compiler prefix does not exist on disk for a particular configuraiton, attempt to perform
timkelly
parents: 1879
diff changeset
   276
		if (cachedVariantHRHFile == null || cachedVariantHRHFile.toOSString().length() == 0) {
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   277
			if (sbsv2FilteredContexts == null || sbsv2FilteredContexts.size() == 0) {
1521
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   278
				getFilteredBuildConfigurations();
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   279
			}
1879
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   280
			if (sbsv2FilteredContexts.size() > 0) {
5486b48b06ad Filter SBSv2 build configurations for WINSCW targets based on emulator support in SDK.
stechong
parents: 1871
diff changeset
   281
				for (ISymbianBuildContext context : sbsv2FilteredContexts) {
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1543
diff changeset
   282
					String vStr = ((ISBSv2BuildContext)context).getConfigQueryData().getMetaDataVariantHRH();
1521
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   283
					if (vStr != null) {
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   284
						cachedVariantHRHFile = new Path(vStr);
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   285
						break;
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   286
					}
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   287
				}
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   288
			}
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   289
		}
1521
807590ebabb2 Get SBSv2 macros via Raptor query.
stechong
parents: 1502
diff changeset
   290
		return cachedVariantHRHFile;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   291
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   292
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   293
	public String getTargetTypeMacro(String targettype) {
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   294
		// this is based on \epoc32\tools\trgtype.pm which changes from
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   295
		// OS version to OS version, but largely remains constant with
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   296
		// regards to the basic type.
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   297
		
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   298
		// if it's not one of these then it's a DLL
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   299
		if (targettype.compareToIgnoreCase("EPOCEXE") == 0) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   300
			return "__EXEDLL__";
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   301
		} else if (targettype.compareToIgnoreCase("EXEDLL") == 0) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   302
			return "__EXEDLL__";
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   303
		} else if (targettype.compareToIgnoreCase("EXE") == 0) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   304
			return "__EXE__";
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   305
		} else if (targettype.compareToIgnoreCase("EXEXP") == 0) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   306
			return "__EXE__";
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   307
		} else if (targettype.compareToIgnoreCase("IMPLIB") == 0) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   308
			return "__IMPLIB__";
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   309
		} else if (targettype.compareToIgnoreCase("KLIB") == 0) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   310
			return "__LIB__";
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   311
		} else if (targettype.compareToIgnoreCase("LIB") == 0) {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   312
			return "__LIB__";
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   313
		} else {
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   314
			return "__DLL__";
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   315
		}
1811
b1772bf1197b major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype),
timkelly
parents: 1779
diff changeset
   316
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   317
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   318
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   319
	public boolean isPreviouslyScanned() {
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   320
		return wasScanned;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   321
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   322
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   323
	public void setPreviouslyScanned(boolean wasScanned) {
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1444
diff changeset
   324
		this.wasScanned = wasScanned;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   325
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   326
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents:
diff changeset
   327
}