# HG changeset patch # User timkelly # Date 1279825331 18000 # Node ID 5243d04d391780849ebe58086cd6f128d0e23021 # Parent 65c3d72a8793909eba05fabd4c713427e688dbd9 fix 11553. For project template filtering, use feature fags. No longer us OS/SDK version or name attribute. diff -r 65c3d72a8793 -r 5243d04d3917 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Wed Jul 21 17:12:21 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Thu Jul 22 14:02:11 2010 -0500 @@ -77,6 +77,8 @@ private static final String BUILD_INFO_KEYWORD = "ManufacturerSoftwareBuild"; private static final String WINSCW_UREL_DIR = "epoc32/release/winscw/urel"; + private static final String WINSCW_UDEB_DIR = "epoc32/release/winscw/udeb"; + private static final String ARMV5_UDEB_DIR = "epoc32/release/armv5/udeb"; protected DeviceType deviceEntry = null; private boolean enabled = true; @@ -86,7 +88,7 @@ private Map buildInfoMap = new HashMap(); private Map prefixFileMap = new HashMap(); @SuppressWarnings("rawtypes") - private Set sdkFeatures = new HashSet(); + private Set sdkFeatures = new HashSet(); // greedy match means the filename is in the last group public static Pattern VARIANT_HRH_LINE_PATTERN = Pattern.compile("(?i)(.*)(/|\\\\)(.*hrh)"); @@ -639,23 +641,6 @@ } - /** - * Check to see whether or not we should support WINSCW UREL - */ - @SuppressWarnings("unchecked") - private void scanForWINSCW_UREL(){ - String winscwURELFullPathStr = getEPOCROOT(); - winscwURELFullPathStr += WINSCW_UREL_DIR; - IPath winscwURELPath = new Path(winscwURELFullPathStr); - if (winscwURELPath != null && winscwURELPath.toFile().exists()){ - if (winscwURELPath.append("epoc.exe").toFile().exists()){ - if (winscwURELPath.append("euser.dll").toFile().exists()){ - sdkFeatures.add(ISymbianSDKFeatures.IS_WINSCW_UREL_SUPPORTED); - } - } - } - } - private boolean setDataFromManifestXML(){ if (hasManifestXML()){ @@ -673,7 +658,50 @@ @SuppressWarnings("unchecked") private void setSupportFeatures() { scanForWINSCW_UREL(); + scanForAvkon(); sdkFeatures.add(ISymbianSDKFeatures.IS_EKA2); } + /** + * Check if avkon is a supported feature. + */ + private void scanForAvkon() { + String armv5UDEBFullPathStr = getEPOCROOT(); + armv5UDEBFullPathStr += ARMV5_UDEB_DIR; + IPath armv5UDEBPath = new Path(armv5UDEBFullPathStr); + if (armv5UDEBPath != null && armv5UDEBPath.toFile().exists()){ + if (armv5UDEBPath.append("avkon.dll").toFile().exists()){ + sdkFeatures.add(ISymbianSDKFeatures.IS_AVKON_SUPPORTED); + return; + } + // not there, check winscw + String winscwURELFullPathStr = getEPOCROOT(); + winscwURELFullPathStr += WINSCW_UREL_DIR; + IPath winscwURELPath = new Path(winscwURELFullPathStr); + if (winscwURELPath != null && winscwURELPath.toFile().exists()){ + if (winscwURELPath.append("avkon.dll").toFile().exists()){ + sdkFeatures.add(ISymbianSDKFeatures.IS_AVKON_SUPPORTED); + return; + } + } + } + } + + /** + * Check to see whether or not we should support WINSCW UREL + */ + @SuppressWarnings("unchecked") + private void scanForWINSCW_UREL(){ + String winscwURELFullPathStr = getEPOCROOT(); + winscwURELFullPathStr += WINSCW_UREL_DIR; + IPath winscwURELPath = new Path(winscwURELFullPathStr); + if (winscwURELPath != null && winscwURELPath.toFile().exists()){ + if (winscwURELPath.append("epoc.exe").toFile().exists()){ + if (winscwURELPath.append("euser.dll").toFile().exists()){ + sdkFeatures.add(ISymbianSDKFeatures.IS_WINSCW_UREL_SUPPORTED); + } + } + } + } + } diff -r 65c3d72a8793 -r 5243d04d3917 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/TemplateUtils.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/TemplateUtils.java Wed Jul 21 17:12:21 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/TemplateUtils.java Thu Jul 22 14:02:11 2010 -0500 @@ -20,19 +20,21 @@ import java.util.ArrayList; import java.util.List; - -import org.osgi.framework.Version; +import java.util.Set; -import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.template.engine.ITemplate; public class TemplateUtils { + + private static final String SDK_FEATURE_DELIM = ";"; //$NON-NLS-1$ - private static final String FAMILY_DELIM = ":"; //$NON-NLS-1$ - private static final String RANGE_DELIM = "-"; //$NON-NLS-1$ - private static final String VERSION_DELIM = ";"; //$NON-NLS-1$ + // Template flags. These are the template flags used for filtering + // As of Carbide 3.0, we no longer use OS/SDK version or family name + // to filter templates. + private static final String FEATURE_SUPPORTS_AVKON = "supportsAvkon"; //$NON-NLS-1$ public static final String PROJECT_NAME = "projectName"; //$NON-NLS-1$ public static final String BASE_NAME = "baseName"; //$NON-NLS-1$ @@ -45,70 +47,33 @@ * @param symbianSDK * @param template * @return whether this sdk matches the template - * template filter arguments:= framework[:versionSpec] - * versionSpec is a list of version or versionRange delimited by ; - * versionRange is a minVersion and maxVersion delimited by - + * template filter arguments */ public static boolean sdkMatchesTemplate(ISymbianSDK symbianSDK, ITemplate template) { - Version sdkVersion = symbianSDK.getSDKVersion(); - String family = symbianSDK.getFamily(); // S60, symbian... 3rd segment of devices.xml 'name' attrib - return sdkMatchesTemplate(sdkVersion, family, template); - } - - - private static boolean isSameFamily(String f1, String f2) { - if (f1.equalsIgnoreCase(f2)) - return true; + String filterArgs = template.getFilterArguments(); + Set supportedFeatures = symbianSDK.getSupportedFeatures(); + if (filterArgs != null && filterArgs.length() > 0) { + String[] strings = filterArgs.split(SDK_FEATURE_DELIM); + if (strings.length > 0) { + // check for avkon support + boolean hasAvkon = false; + if (supportedFeatures.contains(ISymbianSDKFeatures.IS_AVKON_SUPPORTED)){ + + for (String templateFeature : strings){ + if (templateFeature.equals(FEATURE_SUPPORTS_AVKON)){ + hasAvkon = true; // This template requires avkon support and it's there + break; + } + } + } + if (!hasAvkon) + return false; // This template requires avkon support but is not there. Don't show + } + } - if ((f1.equalsIgnoreCase(ISBSv1BuildInfo.S60_FAMILY_ID) && - f2.equalsIgnoreCase(ISBSv1BuildInfo.SERIES60_FAMILY_ID)) || - (f2.equalsIgnoreCase(ISBSv1BuildInfo.S60_FAMILY_ID) && - f1.equalsIgnoreCase(ISBSv1BuildInfo.SERIES60_FAMILY_ID))) - return true; - - return false; + return true; } - /** - * @param symbianSDK - * @param template - * @return whether this sdk matches the template - * template filter arguments:= family[:versionSpec] - * versionSpec is a list of version or versionRange delimited by ; - * versionRange is a minVersion and maxVersion delimited by - - */ - public static boolean sdkMatchesTemplate(Version sdkVersion, String family, ITemplate template) { - String filterArgs = template.getFilterArguments(); - if (filterArgs != null) { - String[] strings = filterArgs.split(FAMILY_DELIM); - if (strings.length > 0) { - if (!isSameFamily(family, strings[0])) - return false; - - if (strings.length > 1) { - String[] versions = strings[1].split(VERSION_DELIM); - for (int i = 0; i < versions.length; i++) { - String[] versionRange = versions[i].split(RANGE_DELIM); - if (versionRange.length == 1) { - Version version = Version.parseVersion(versionRange[0]); - if (sdkVersion.equals(version)) - return true; - } - else if (versionRange.length > 1) { - Version minVersion = Version.parseVersion(versionRange[0]); - Version maxVersion = Version.parseVersion(versionRange[1]); - if (sdkVersion.compareTo(minVersion) >= 0 && - sdkVersion.compareTo(maxVersion) <= 0) - return true; - } - } - return false; - } - } - } - return true; - } - public static List getEnabledSDKs() { List enabledSDKList = new ArrayList(); diff -r 65c3d72a8793 -r 5243d04d3917 templates/com.nokia.carbide.cpp.qt.templates/plugin.xml --- a/templates/com.nokia.carbide.cpp.qt.templates/plugin.xml Wed Jul 21 17:12:21 2010 -0500 +++ b/templates/com.nokia.carbide.cpp.qt.templates/plugin.xml Thu Jul 22 14:02:11 2010 -0500 @@ -14,7 +14,7 @@