# HG changeset patch # User timkelly # Date 1242067530 18000 # Node ID bd4f938f2be5d268834c46071384b8f0b32a80eb # Parent 4284eb246b5232cd55983a4e0b15021b72f5fc11 more tests for binary variation .var file parsing. updated UI text per bug 8794 diff -r 4284eb246b52 -r bd4f938f2be5 core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SBVCatalogTest.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SBVCatalogTest.java Mon May 11 09:15:26 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SBVCatalogTest.java Mon May 11 13:45:30 2009 -0500 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" @@ -55,109 +55,51 @@ } /** - * Test the catalog for new-style BSFs + * Test that the correct SBV platforms are created * @throws Exception */ - public void testSBVCatalog() throws Exception { + public void testSBVCatalogCreation() throws Exception { setupForSDK(new Path("Data/var/group1")); ISBVPlatform[] platforms = catalog.getPlatforms(); - assertEquals(6, platforms.length); + assertEquals(7, platforms.length); assertEquals("barney", platforms[0].getName()); assertEquals("default", platforms[1].getName()); assertEquals("dino79", platforms[2].getName()); assertEquals("flintstone500", platforms[3].getName()); assertEquals("fred99nhd", platforms[4].getName()); - assertEquals("wilma88", platforms[5].getName()); + assertEquals("variants", platforms[5].getName()); + assertEquals("wilma88", platforms[6].getName()); } /** - * Test new-style Nokia BSF support, which establishes a hierarchy of BSF platforms + * Test SBV support, which establishes a hierarchy of SBV platforms * and also supports additional levels of system include paths. * @throws Exception */ -// public void testNewStyleBSFSDK1() throws Exception { -// setupForSDK(new Path("Data/var/group1")); -// ISBVPlatform[] platforms = catalog.getPlatforms(); -// assertEquals(12, platforms.length); -// -// IBSFPlatform platform; -// platform = catalog.findPlatform("ARM11"); -// assertNotNull(platform); -// assertEquals("arm11", platform.getName()); -// assertEquals("ARMV5_ABIV1", platform.getCustomizedPlatformName()); -// assertNull(platform.getCustomizedPlatform()); // built-in -// assertEquals(ETristateFlag.UNSPECIFIED, platform.getCompileWithParent()); -// -// assertFalse(platform.isVariant()); -// assertFalse(platform.isVirtualVariant()); -// assertEquals(2, platform.getCustomizationOptions().size()); -// assertEquals("-Ono_known_library --enum_is_int --fpmode ieee_no_fenv --export_all_vtbl --no_vfe --APCS /inter --dllimport_runtime -O3 -Otime", -// platform.getCustomizationOptions().get("INVARIANT_OPTIONS")); -// assertEquals(ETristateFlag.UNSPECIFIED, platform.getCompileWithParent()); -// -// // no custom include dirs for this level -// assertNull(platform.getSystemIncludePath()); -// assertEquals(0, platform.getSystemIncludePaths().length); -// -// ////// -// -// platform = catalog.findPlatform("variant"); -// assertNotNull(platform); -// assertEquals("variant", platform.getName()); -// assertEquals("ARMV5", platform.getCustomizedPlatformName()); -// assertNull(platform.getCustomizedPlatform()); // built-in -// assertFalse(platform.isVariant()); -// assertTrue(platform.isVirtualVariant()); -// assertEquals(ETristateFlag.ENABLED, platform.getCompileWithParent()); -// -// assertEquals(0, platform.getCustomizationOptions().size()); -// -// // no custom include dirs -// assertNull(platform.getSystemIncludePath()); -// assertEquals(0, platform.getSystemIncludePaths().length); -// -// ////// -// -// platform = catalog.findPlatform("config"); -// assertNotNull(platform); -// assertEquals("config", platform.getName()); -// // lowercase since it found the real platform -// assertEquals("variant", platform.getCustomizedPlatformName()); -// -// IBSFPlatform cust = platform.getCustomizedPlatform(); -// assertNotNull(cust); -// assertEquals("variant", cust.getName()); -// -// assertTrue(platform.isVariant()); -// assertFalse(platform.isVirtualVariant()); -// assertEquals(ETristateFlag.UNSPECIFIED, platform.getCompileWithParent()); -// -// assertEquals(0, platform.getCustomizationOptions().size()); -// -// // now it has an include dir -// assertEquals(sdkIncludePath.append("config"), platform.getSystemIncludePath()); -// -// // and the full list has only this entry -// IPath[] systemIncludePaths = platform.getSystemIncludePaths(); -// assertEquals(1, systemIncludePaths.length); -// assertEquals(sdkIncludePath.append("config"), systemIncludePaths[0]); -// -// IBSFPlatform[] built = catalog.getAdditionalBuiltPlatforms("ncx51"); -// assertEquals(5, built.length); -// assertTrue(findPlatform(built, "m_product")); -// assertTrue(findPlatform(built, "r_product")); -// assertTrue(findPlatform(built, "s_product")); -// assertTrue(findPlatform(built, "a_product")); -// assertTrue(findPlatform(built, "dev51")); -// -// built = catalog.getAdditionalBuiltPlatforms("armv5"); -// assertEquals(7, built.length); -// assertTrue(findPlatform(built, "s_product")); -// assertTrue(findPlatform(built, "ncx51")); -// assertTrue(findPlatform(built, "config")); -// assertFalse(findPlatform(built, "variant")); // virtuals not built -// } + public void testSBVDataView() throws Exception { + setupForSDK(new Path("Data/var/group1")); + ISBVPlatform[] platforms = catalog.getPlatforms(); + assertEquals(7, platforms.length); + + ISBVPlatform platform; + platform = catalog.findPlatform("BARNEY"); + assertNotNull(platform); + assertEquals("barney", platform.getName()); + assertEquals("FLINTSTONE500", platform.getExtendedVariantName().toUpperCase()); + + assertFalse(platform.isVirtual()); + + platform = catalog.findPlatform(platform.getExtendedVariantName()); + assertNotNull(platform); + assertTrue(platform.isVirtual()); + assertEquals("VARIANTS", platform.getExtendedVariantName().toUpperCase()); + + assertNotNull(platform.getSystemIncludePath()); + assertEquals(1, platform.getSystemIncludePaths().length); + + assertTrue("Didn't get expected VARIANT_HRH value", platform.getBuildVariantHRHFile().toPortableString().contains("/epoc32/include/feature_settings.hrh")); + } /** * @param built @@ -171,64 +113,4 @@ return false; } - /** - * Test new-style Nokia BSF support, which establishes a hierarchy of BSF platforms - * and also supports additional levels of system include paths. - * @throws Exception - */ -// public void testNewStyleBSFSDK2() throws Exception { -// setupForSDK(new Path("Data/bsf/NewStyleBSFSDK")); -// IBSFPlatform[] platforms = catalog.getPlatforms(); -// assertEquals(12, platforms.length); -// -// IBSFPlatform platform; -// platform = catalog.findPlatform("r_product"); -// assertNotNull(platform); -// assertEquals("r_product", platform.getName()); -// assertEquals("ncx51", platform.getCustomizedPlatformName()); -// assertNotNull(platform.getCustomizedPlatform()); // built-in -// assertEquals(ETristateFlag.UNSPECIFIED, platform.getCompileWithParent()); -// -// assertTrue(platform.isVariant()); -// assertFalse(platform.isVirtualVariant()); -// assertEquals(0, platform.getCustomizationOptions().size()); -// assertEquals(ETristateFlag.UNSPECIFIED, platform.getCompileWithParent()); -// -// // now it has an include dir -// assertEquals(sdkIncludePath.append("config").append("ncx51").append("r_product"), platform.getSystemIncludePath()); -// -// // and the full list entries from deepest to shallowest -// IPath[] systemIncludePaths = platform.getSystemIncludePaths(); -// assertEquals(3, systemIncludePaths.length); -// assertEquals(sdkIncludePath.append("config").append("ncx51").append("r_product"), systemIncludePaths[0]); -// assertEquals(sdkIncludePath.append("config").append("ncx51"), systemIncludePaths[1]); -// assertEquals(sdkIncludePath.append("config"), systemIncludePaths[2]); -// -// IBSFPlatform[] built = catalog.getAdditionalBuiltPlatforms("r_product"); -// assertEquals(0, built.length); -// -// built = catalog.getAdditionalBuiltPlatforms("variant"); -// assertEquals(7, built.length); -// // spot test -// assertTrue(findPlatform(built, "config")); -// assertTrue(findPlatform(built, "r_product")); -// -// } - -// /** The #getReleasePlatform() API should point to the first non-variant platform in the -// * BSF tree. Before (boog 5132) it was going all the way to the root. -// * @throws Exception -// */ -// public void testReleasePlatformBug5132() throws Exception { -// setupForSDK(new Path("Data/bsf/S60_50_BSFs")); -// -// assertEquals("armv6", catalog.getReleasePlatform("armv6")); -// assertEquals("ARMV5", catalog.getReleasePlatform("config")); -// assertEquals("ARMV5", catalog.getReleasePlatform("variant")); -// assertEquals("arm9e", catalog.getReleasePlatform("arm9e")); -// assertEquals("ARMV5", catalog.getReleasePlatform("t_product")); -// assertEquals("arm11", catalog.getReleasePlatform("arm11")); -// assertEquals("gccev6t2", catalog.getReleasePlatform("gccev6t2")); -// -// } } diff -r 4284eb246b52 -r bd4f938f2be5 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalog.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalog.java Mon May 11 09:15:26 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalog.java Mon May 11 13:45:30 2009 -0500 @@ -52,9 +52,6 @@ // gather the individual SBV platforms for (File sbvFile : sbvFiles) { IPath sbvPath = new Path(sbvFile.getAbsolutePath()); - if (sbvPath.toFile().toString().endsWith("variants.var")){ - continue; - } SBVPlatform platform = SBVPlatform.createPlatform(this, sbvPath, messages, sdkIncludePath); if (platform != null) { platforms.add(platform); diff -r 4284eb246b52 -r bd4f938f2be5 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java Mon May 11 09:15:26 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java Mon May 11 13:45:30 2009 -0500 @@ -12,15 +12,14 @@ */ package com.nokia.carbide.cpp.internal.sdk.core.model; +import java.io.File; import java.text.MessageFormat; import java.util.*; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.*; import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; import com.nokia.carbide.cpp.epoc.engine.ISBVViewRunnable; -import com.nokia.carbide.cpp.epoc.engine.model.ETristateFlag; import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView; import com.nokia.carbide.cpp.internal.api.sdk.Messages; import com.nokia.carbide.cpp.sdk.core.ISBVCatalog; @@ -36,30 +35,40 @@ /** The exact basename of the .var */ private String name; private IPath path; - private ISBVPlatform customizedPlatform; - private String customizes; + private ISBVPlatform extendedPlatform; + private String extendedPlatName; private IPath[] systemIncludePaths; private IPath sdkIncludePath; private IPath systemIncludePath; - private Map customizationOptions; - private ETristateFlag compileWithParent; + private IPath bldVarintHRH; private ISBVCatalog catalog; - - /** + private boolean virtual; + + /** Create a Symbian Binary Variation platform from parse results of a .var file * @param sdk * @param sbvPath * @param enableAbiV2Mode used to remap ARMV5, ARMV6, or ARMV6_ABIV1 to an appropriate canonical name */ - // TODO: Add ISBVView for actual parsing SBVPlatform(ISBVCatalog catalog, IPath sdkIncludePath, ISBVView view ) { this.catalog = catalog; this.sdkIncludePath = sdkIncludePath; this.name = view.getName(); - this.customizes = view.getCustomizes().toUpperCase(); + this.extendedPlatName = view.getExtends().toUpperCase(); this.path = view.getModel().getPath(); - this.compileWithParent = view.getCompileWithParent(); - this.customizationOptions = new HashMap(view.getCustomizationOptions()); + this.virtual = view.getVirtualFlag(); + + String temp = view.getBuildVariantHRH(); + String EPOC32_INCLUDE = "epoc32" + File.separator + "include"; + if (temp != null && temp.length() > 0){ + if (sdkIncludePath.toOSString().contains(EPOC32_INCLUDE)){ + bldVarintHRH = new Path(sdkIncludePath.toOSString().substring(0, sdkIncludePath.toOSString().indexOf(EPOC32_INCLUDE)) + temp); + } else { + bldVarintHRH = new Path(sdkIncludePath + temp); + } + } + + } /* (non-Javadoc) @@ -85,9 +94,9 @@ */ void setCustomizedPlatform(ISBVPlatform customized) { Check.checkState(customized != this); - this.customizedPlatform = customized; + this.extendedPlatform = customized; if (customized != null) { - this.customizes = customized.getName(); + this.extendedPlatName = customized.getName(); } } @@ -113,17 +122,17 @@ } /* (non-Javadoc) - * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getCustomizedPlatformName() + * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getExtendedPlatformName() */ - public String getCustomizedPlatformName() { - return customizes; + public String getExtendedVariantName() { + return extendedPlatName; } /* (non-Javadoc) - * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getCustomizedPlatform() + * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getExtendedVariant()() */ - public ISBVPlatform getCustomizedPlatform() { - return customizedPlatform; + public ISBVPlatform getExtendedVariant() { + return extendedPlatform; } /* (non-Javadoc) @@ -131,10 +140,21 @@ */ public IPath getSystemIncludePath() { if (systemIncludePath == null) { - IPath customizedPlatformPath = null; - if (customizedPlatform != null) { - customizedPlatformPath = customizedPlatform.getSystemIncludePath(); + IPath extendedPlatformPath = null; + if (extendedPlatform != null) { + extendedPlatformPath = extendedPlatform.getSystemIncludePath(); } + + // VIRTUALVARIANT does not have its own path + + // else, construct the system include path from the customized + // platform by appending our platform name + if (extendedPlatformPath == null) { + systemIncludePath = sdkIncludePath.append(name); //$NON-NLS-1$ + } else { + systemIncludePath = extendedPlatformPath.append(name); + } + } return systemIncludePath; @@ -151,8 +171,10 @@ ISBVPlatform platform = this; while (platform != null) { IPath path = platform.getSystemIncludePath(); - if (path != null) + if (path != null){ paths.add(path); + } + platform = platform.getExtendedVariant(); } systemIncludePaths = (IPath[]) paths.toArray(new IPath[paths.size()]); } @@ -202,6 +224,15 @@ return (SBVPlatform) EpocEnginePlugin.runWithSBVView(sbvPath, runnable); } - + public boolean isVirtual() { + return virtual; + } + + public IPath getBuildVariantHRHFile() { + + return bldVarintHRH; + + } + } diff -r 4284eb246b52 -r bd4f938f2be5 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 Mon May 11 09:15:26 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Mon May 11 13:45:30 2009 -0500 @@ -299,8 +299,11 @@ ISBVCatalog catalog = getSBVCatalog(); for (ISBVPlatform sbvPlatform : catalog.getPlatforms()) { // Currently only variation of ARMV5 is supported... So just hard code the variated platform - binaryVariantContextList.add(new SymbianBuildContext(this, SymbianBuildContext.ARMV5_PLATFORM + "." + sbvPlatform.getName(), ISymbianBuildContext.DEBUG_TARGET)); - binaryVariantContextList.add(new SymbianBuildContext(this, SymbianBuildContext.ARMV5_PLATFORM + "." + sbvPlatform.getName(), ISymbianBuildContext.RELEASE_TARGET)); + // Only add the build platform if it's not virtual. + if (!sbvPlatform.isVirtual()){ + binaryVariantContextList.add(new SymbianBuildContext(this, SymbianBuildContext.ARMV5_PLATFORM + "." + sbvPlatform.getName(), ISymbianBuildContext.DEBUG_TARGET)); + binaryVariantContextList.add(new SymbianBuildContext(this, SymbianBuildContext.ARMV5_PLATFORM + "." + sbvPlatform.getName(), ISymbianBuildContext.RELEASE_TARGET)); + } } } diff -r 4284eb246b52 -r bd4f938f2be5 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVPlatform.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVPlatform.java Mon May 11 09:15:26 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVPlatform.java Mon May 11 13:45:30 2009 -0500 @@ -63,4 +63,29 @@ * @return array of full filesystem paths, never null */ IPath[] getSystemIncludePaths(); + + /** + * Get the name of the variant this SBV platform extends + * @return + */ + String getExtendedVariantName(); + + /** + * Get the variant platform this platform extends + * @return + */ + public ISBVPlatform getExtendedVariant(); + + /** + * Is the VIRTUAL keyword present? + * @return + */ + public boolean isVirtual(); + + /** + * Get the + * @return The path to the defined HRH file, null if none. + */ + public IPath getBuildVariantHRHFile(); + } diff -r 4284eb246b52 -r bd4f938f2be5 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Mon May 11 09:15:26 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Mon May 11 13:45:30 2009 -0500 @@ -67,8 +67,8 @@ BuildPlatformFilterPage.EKA2_Platforms=EKA2 Platforms BuildPlatformFilterPage.Specify_Platforms_Help2=Specifies platforms to be displayed for OS versions 8.1a and less (8.xa, 7.x, 6.x) BuildPlatformFilterPage.EKA1_Platforms_Label=EKA1 Platforms -BuildPlatformFilterPage.BSF_Help=Scans for .bsf files under \\epoc32\\tools for platform extensions. These are platforms such as ARMV6 and ARM9E. -BuildPlatformFilterPage.BSF_Label=Discover SDK Customization Platforms Dynamically (BSF Scanner) +BuildPlatformFilterPage.BSF_Help=Scans for .bsf and/or .var files under \\epoc32\\tools for platform variants. +BuildPlatformFilterPage.BSF_Label=Discover customization (.bsf) and Symbian Binary Variant (.var) platforms dynamically. SDKPreferencePage.List_of_Available_SDKs_ToolTip=List of available SDKs from devices.xml. SDKPreferencePage.Platforms_cannot_be_determined=Platforms cannot be determined SDKPreferencePage.OS_Version_Cannot_Be_Determined=OS version cannot be determined diff -r 4284eb246b52 -r bd4f938f2be5 project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/sbv/ISBVView.java --- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/sbv/ISBVView.java Mon May 11 09:15:26 2009 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/sbv/ISBVView.java Mon May 11 13:45:30 2009 -0500 @@ -17,11 +17,8 @@ package com.nokia.carbide.cpp.epoc.engine.model.sbv; -import com.nokia.carbide.cpp.epoc.engine.model.ETristateFlag; import com.nokia.carbide.cpp.epoc.engine.model.IView; -import java.util.Map; - /** * A view onto .VAR (Symbian Binary Variation) contents. This is a parse over a single .VAR file. *

@@ -34,28 +31,36 @@ /** Get the name of SBV as a platform. */ String getName(); - /** Set the CUSTOMIZES platform. - * @param platform may not be null, but may be "" */ - void setCustomizes(String platform); + /** Set the EXTENDS platform. + * @param binary variant platform may not be null, but may be "" */ + void setExtends(String platform); - /** Get the CUSTOMIZES platform. - * @return platform this customizes; never null, but may be the empty string if .var is invalid. */ - String getCustomizes(); + /** Get the EXTENDS platform. + * @return binary variant platform this extends; never null, but may be the empty string if .var is invalid. */ + String getExtends(); - /** Tell whether the .var is compiled with its parent (COMPILEWITHPARENT, - * COMPILEALONE, or unspecified) */ - ETristateFlag getCompileWithParent(); + /** + * Set whether or not the VIRTUAL flag defined? + * @param flag + */ + void setVirtualFlag(boolean flag); - /** Set the COMPILEWITHPARENT disposition. */ - void setCompileWithParent(ETristateFlag flag); - - /** Get the map of customization options, which is a map of - * the (capitalized) first token on the line to the remainder of the line. - * @return map never null */ - Map getCustomizationOptions(); - - /** Replace the map of customization options. - * @param map may not be null*/ - void setCustomizationOptions(Map map); - + /** + * Get whether or not the virtual flag is defined. + * @return true if VIRTUAL is defined in the .var file + */ + boolean getVirtualFlag(); + + /** + * Sets the BUILD_HRH value + * @param pathStr, the value of the path in the .var file + */ + void setBuildHRHFile(String pathStr); + + /** + * Get the BUILD_HRH value + * @return The string of the BUILD_HRH, null if not defined. + */ + String getBuildVariantHRH(); + } diff -r 4284eb246b52 -r bd4f938f2be5 project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/sbv/SBVView.java --- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/sbv/SBVView.java Mon May 11 09:15:26 2009 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/sbv/SBVView.java Mon May 11 13:45:30 2009 -0500 @@ -37,20 +37,18 @@ public class SBVView extends ViewBase implements ISBVView { - private static final String HEADER = "##"; //$NON-NLS-1$ - private static final String COMPILEWITHPARENT = "COMPILEWITHPARENT"; //$NON-NLS-1$ - private static final String COMPILEALONE = "COMPILEALONE"; //$NON-NLS-1$ - private static final String CUSTOMIZES = "CUSTOMIZES"; //$NON-NLS-1$ - private static final String VARIANT = "VARIANT"; //$NON-NLS-1$ - private static final String VIRTUALVARIANT = "VIRTUALVARIANT"; //$NON-NLS-1$ + private static final String EXTENDS = "EXTENDS"; //$NON-NLS-1$ + private static final String VIRTUAL = "VIRTUAL"; //$NON-NLS-1$ + private static final String VARIANT_HRH = "VARIANT_HRH"; //$NON-NLS-1$ + private IASTSBVTranslationUnit tu; private boolean sawHeaderComment; - private boolean sawCustomizes; - - private ETristateFlag compileWithParent; - private Map customizationOptions; - private String customizes; + private boolean sawExtends; + private boolean sawBuildHRH; + private String extendsVariantStr; + private String varintHRHStr; + private boolean isVirtual; /** * @param model @@ -60,26 +58,20 @@ public SBVView(ModelBase model, IViewConfiguration viewConfiguration) { super(model, null, viewConfiguration); tu = null; - customizationOptions = new HashMap(); } private void refresh() { - compileWithParent = ETristateFlag.UNSPECIFIED; - customizationOptions.clear(); - customizes = ""; //$NON-NLS-1$ + extendsVariantStr = ""; //$NON-NLS-1$ IDocumentParser sbvParser = ParserFactory.createSBVParser(); tu = (IASTSBVTranslationUnit) sbvParser.parse(getModel().getPath(), getModel().getDocument()); sawHeaderComment = false; - sawCustomizes = false; + sawExtends = false; + sawBuildHRH = false; for (IASTTopLevelNode stmt : tu.getNodes()) { - if (stmt instanceof IASTSBVCommentStatement) { - if (((IASTSBVCommentStatement) stmt).getNewText().equals(HEADER)) { - sawHeaderComment = true; - } - } else if (stmt instanceof IASTSBVFlagStatement) { + if (stmt instanceof IASTSBVFlagStatement) { String flag = ((IASTSBVFlagStatement) stmt).getKeywordName(); handleStatement(flag); } else if (stmt instanceof IASTSBVArgumentStatement) { @@ -98,12 +90,16 @@ * @param value */ private void handleStatement(String option, String value) { - if (!sawCustomizes && option.equals(CUSTOMIZES)) { - setCustomizes(value); - sawCustomizes = true; - } else { - getCustomizationOptions().put(option, value); - } + if (!sawExtends && option.equals(EXTENDS)) { + setExtends(value); + sawExtends = true; + } + + if (!sawBuildHRH && option.equals(VARIANT_HRH)) { + setBuildHRHFile(value); + sawBuildHRH = true; + } + } /** @@ -111,13 +107,9 @@ * @param flag */ private void handleStatement(String flag) { - if (flag.equals(COMPILEWITHPARENT)) { - setCompileWithParent(ETristateFlag.ENABLED); - } else if (flag.equals(COMPILEALONE)) { - setCompileWithParent(ETristateFlag.DISABLED); - } else { - getCustomizationOptions().put(flag, null); - } + if (flag.equals(VIRTUAL)) { + setVirtualFlag(true); + } } @Override @@ -175,32 +167,19 @@ new Object[0], new MessageLocation(fullPath))); } - if (!sawCustomizes) { + if (!sawExtends) { messageList.add(ASTFactory.createErrorMessage("SBVView.NoCustomizesStatement", new Object[0], new MessageLocation(fullPath))); } } - /* (non-Javadoc) - * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#getCompileWithParent() - */ - public ETristateFlag getCompileWithParent() { - return compileWithParent; - } - - /* (non-Javadoc) - * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#getCustomizationOptions() - */ - public Map getCustomizationOptions() { - return customizationOptions; - } /* (non-Javadoc) * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#getCustomizes() */ - public String getCustomizes() { - return customizes; + public String getExtends() { + return extendsVariantStr; } /* (non-Javadoc) @@ -210,27 +189,12 @@ return getModel().getPath().removeFileExtension().lastSegment(); } - /* (non-Javadoc) - * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#setCompileWithParent(com.nokia.carbide.cpp.epoc.engine.model.ETristateFlag) - */ - public void setCompileWithParent(ETristateFlag flag) { - Check.checkArg(flag); - this.compileWithParent = flag; - } - - /* (non-Javadoc) - * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#setCustomizationOptions(java.util.Map) - */ - public void setCustomizationOptions(Map map) { - Check.checkArg(map); - this.customizationOptions = map; - } /* (non-Javadoc) * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#setCustomizes(java.lang.String) */ - public void setCustomizes(String platform) { - this.customizes = platform; + public void setExtends(String platform) { + this.extendsVariantStr = platform; } /* (non-Javadoc) @@ -239,4 +203,26 @@ public IData getData() { return null; } + + /* (non-Javadoc) + * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#setVirtualFlag(boolean) + */ + public void setVirtualFlag(boolean flag) { + this.isVirtual = flag; + } + + public boolean getVirtualFlag() { + return isVirtual; + } + + public String getBuildVariantHRH() { + return varintHRHStr; + } + + public void setBuildHRHFile(String pathStr) { + varintHRHStr = pathStr; + } + + + }