# HG changeset patch # User stechong # Date 1279732308 18000 # Node ID 03f5f8bf29b48a531abfc5f73559bf83da2dfa58 # Parent d1edeecb12af5f78697ec19c6b798d03aa5bf8c4# Parent e17ab99b8f30318f1ecc7137469ef3b9ee907d89 Merge from default. diff -r e17ab99b8f30 -r 03f5f8bf29b4 .branch.txt diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/ProjectPropertiesTest.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/ProjectPropertiesTest.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/ProjectPropertiesTest.java Wed Jul 21 12:11:48 2010 -0500 @@ -34,7 +34,7 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier; import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; import com.nokia.carbide.cdt.internal.api.builder.SISBuilderInfo2; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; @@ -171,11 +171,11 @@ ICarbideProjectModifier cpm = CarbideBuilderPlugin.getBuildManager().getProjectModifier(project); assertEquals(1, cpm.getBuildConfigurations().size()); - ISymbianBuildContext context2 = SymbianBuildContext.getBuildContextFromDisplayName(stockBuildConfigs.get(1).getDisplayString()); + ISymbianBuildContext context2 = BuildContextSBSv1.getBuildContextFromDisplayName(stockBuildConfigs.get(1).getDisplayString()); assertNotNull(context2); cpm.createNewConfiguration(context2, true); - ISymbianBuildContext context3 = SymbianBuildContext.getBuildContextFromDisplayName(stockBuildConfigs.get(2).getDisplayString()); + ISymbianBuildContext context3 = BuildContextSBSv1.getBuildContextFromDisplayName(stockBuildConfigs.get(2).getDisplayString()); assertNotNull(context3); cpm.createNewConfiguration(context3, false); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/SBSv2QueryTests.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/SBSv2QueryTests.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/SBSv2QueryTests.java Wed Jul 21 12:11:48 2010 -0500 @@ -17,15 +17,16 @@ */ package com.nokia.carbide.cdt.builder.test; -import java.util.ArrayList; -import java.util.HashMap; +import java.io.File; import java.util.List; import org.osgi.framework.Version; -import com.nokia.carbide.cdt.builder.test.sandbox.ISBSv2ConfigData; -import com.nokia.carbide.cdt.builder.test.sandbox.ISBSv2QueryData; -import com.nokia.carbide.cdt.builder.test.sandbox.SBSv2QueryUtils; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISDKBuildInfo; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; @@ -33,8 +34,6 @@ private boolean printTimingStats = true; - private static ISBSv2QueryData sbsAliasBaseQuery; - private long startTime; private final String SDK_ID1 = "K_92_WK12"; // SDK with additional aliases and products @@ -43,10 +42,10 @@ protected void setUp() throws Exception { super.setUp(); Version sbsVersion = SDKCorePlugin.getSDKManager().getSBSv2Version(true); - if ((sbsVersion.getMajor() == 2 && sbsVersion.getMinor() < 14) || + if ((sbsVersion.getMajor() == 2 && sbsVersion.getMinor() < 15) || sbsVersion.getMajor() < 2){ - fail("SBS Query tests require Raptor 2.14 or greater. Raptor version found is: " + sbsVersion); + fail("SBS Query tests require Raptor 2.15 or greater. Raptor version found is: " + sbsVersion); } } @@ -55,121 +54,35 @@ super.tearDown(); } - public void testQueryAliases() throws Exception { - - startTime = System.currentTimeMillis(); - if (sbsAliasBaseQuery == null){ - sbsAliasBaseQuery = SBSv2QueryUtils.queryAliasAndProductVariants(); - } - - if (printTimingStats) - System.out.println("Time for testQueryProductsFromSDKs(): " + getTimingStats()); - - HashMap baseConfigs = sbsAliasBaseQuery.getBaseSBSConfigurations(); - - for (String aliasKey : baseConfigs.keySet()){ - ISBSv2ConfigData config = baseConfigs.get(aliasKey); - boolean isBaseConfig = config.getSupportingSDK() == null ? true : false; - assertTrue("Configuration should be true : " + config.toString(), isBaseConfig); - } - assertEquals(18, baseConfigs.size()); - - assertNotNull(sbsAliasBaseQuery.getSBSConfigByAlias(null, "armv5_udeb")); - assertNotNull(sbsAliasBaseQuery.getSBSConfigByAlias(null, "armv5_urel")); - assertNotNull(sbsAliasBaseQuery.getSBSConfigByAlias(null, "winscw_udeb")); - assertNotNull(sbsAliasBaseQuery.getSBSConfigByAlias(null, "winscw_urel")); - assertNotNull(sbsAliasBaseQuery.getSBSConfigByAlias(null, "armv5_urel_gcce4_4_1")); - assertNotNull(sbsAliasBaseQuery.getSBSConfigByAlias(null, "armv5_udeb_gcce4_4_1")); - - assertNotNull(sbsAliasBaseQuery.getSBSConfigByMeaning(null, "arm.v5.udeb.rvct2_2")); - assertNotNull(sbsAliasBaseQuery.getSBSConfigByMeaning(null, "arm.v5.urel.rvct2_2")); - assertNotNull(sbsAliasBaseQuery.getSBSConfigByMeaning(null, "winscw_base.winscw_debug")); - assertNotNull(sbsAliasBaseQuery.getSBSConfigByMeaning(null, "winscw_base.winscw_release")); - assertNotNull(sbsAliasBaseQuery.getSBSConfigByMeaning(null, "arm.v5.urel.gcce4_4_1")); - assertNotNull(sbsAliasBaseQuery.getSBSConfigByMeaning(null, "arm.v5.udeb.gcce4_4_1")); - - assertNull(sbsAliasBaseQuery.getSBSConfigByAlias(null, "armv5_udeb.foobar")); - assertNull(sbsAliasBaseQuery.getSBSConfigByMeaning(null, "arm.v5.udeb.foo.bar")); - - // Get the Raptor configs that are defined in an SDK - ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(SDK_ID1, false); - assertNotNull("Missing SDK on your system: " + SDK_ID1, sdk); - List sdkSpecificConfigs = sbsAliasBaseQuery.getSDKSpecificConfigData(sdk); - assertEquals(10, sdkSpecificConfigs.size()); - - // Get the union of the base Raptor configs and the SDK - List allSDKConfigUnion = sbsAliasBaseQuery.getAllConfigurationsForSDK(sdk); - assertEquals(28, allSDKConfigUnion.size()); - } /** * Query data for a single configuration * @throws Exception */ - public void testQuerySingleConfig() throws Exception { + public void testQueryBuildConfigsFromSDK() throws Exception { - assertNotNull(sbsAliasBaseQuery); - - startTime = System.currentTimeMillis(); + ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(SDK_ID1, true); + assertNotNull(sdk); - ISBSv2ConfigData config = sbsAliasBaseQuery.getSBSConfigByAlias(null, "armv5_udeb"); - assertNotNull(config); - assertEquals("/epoc32/release/armv5/udeb", config.getReleaseDirectory(null)); - assertEquals("armv5", config.getTraditionalPlatform(null)); - assertEquals("udeb", config.getTraditionalTarget(null)); + ISDKBuildInfo sbsv2BuildInfo = sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + assertNotNull(sbsv2BuildInfo); + + List buildContexts = sbsv2BuildInfo.getFilteredBuildConfigurations(); + assertEquals(6, buildContexts.size()); - config = sbsAliasBaseQuery.getSBSConfigByAlias(null, "armv5_udeb_gcce"); - assertNull(config); // This config should only be defined by SDK suppliers - - ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(SDK_ID1, false); - assertNotNull("Missing SDK on your system: " + SDK_ID1, sdk); - config = sbsAliasBaseQuery.getSBSConfigByAlias(sdk, "armv5_udeb_gcce"); - assertNotNull(config); // This config should only be defined by SDK suppliers - - // TODO: This should fail if 'SBS_GCCE432BIN is not set - // So we should have one test that will fail with known error message - // and another that will pass when an env var is set correctly. - // e.g. test two different versions of GCCE aliases. -// assertEquals("/epoc32/release/armv5/udeb", config.getReleaseDirectory(null)); -// assertEquals("armv5", config.getTraditionalPlatform(null)); -// assertEquals("udeb", config.getTraditionalTarget(null)); + for (ISymbianBuildContext context : buildContexts){ + assertTrue(context instanceof ISBSv2BuildContext); + ISBSv2BuildContext sbsv2Context = (ISBSv2BuildContext)context; + + assertTrue(sbsv2Context.getVariantHRHDefines().size() > 0); + if (sbsv2Context.getConfigQueryData().getConfigurationErrorMessage() == null || sbsv2Context.getConfigQueryData().getConfigurationErrorMessage().length() == 0){ + assertTrue((new File(sbsv2Context.getConfigQueryData().getMetaDataVariantHRH())).exists()); + } else { + System.out.println("Config " + sbsv2Context.getSBSv2Alias() + " had error, cannot fully test: " + sbsv2Context.getConfigQueryData().getConfigurationErrorMessage()); + } + } } - - - /** - * TODO: The SBS API FOR THIS QUERY IS UNDER CONSTRUCTION..... - * TODO; This test should be run on individual %EPOCROOT% values - * @throws Exception - */ - public void testQueryMultipleConfigs() throws Exception { - assertNotNull(sbsAliasBaseQuery); - - startTime = System.currentTimeMillis(); - - - List aliasOrMeaningArray = new ArrayList(); - aliasOrMeaningArray.add("armv5_udeb"); - aliasOrMeaningArray.add("arm.9e.udeb.rvct2_2"); - HashMap releaseMap = SBSv2QueryUtils.queryConfigTargetInfo(aliasOrMeaningArray , null); - - assertEquals(2, releaseMap.size()); - - ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(SDK_ID1, false); - assertNotNull("Missing SDK on your system: " + SDK_ID1, sdk); - releaseMap = SBSv2QueryUtils.queryConfigTargetInfo(aliasOrMeaningArray , sdk); - assertEquals(2, releaseMap.size()); -// String queryResult = getSBSQueryOutput(argList, null); -// assertTrue("No output found from " + SBSv2QueryUtils.QUERY_CONFIG_COMMAND, queryResult.length() > 0); -// -// HashMap outputMap = parseQueryConfigResults(queryResult); -// assertTrue("No configs were found in query for : " + SBSv2QueryUtils.QUERY_CONFIG_COMMAND, outputMap.size() > 0); -// - if (printTimingStats) - System.out.println("Time for testQueryProductsFromSDKs(): " + getTimingStats()); -// - } - /** * This test should be run on individual %EPOCROOT% values * Products are defined in the SDK @@ -178,46 +91,10 @@ public void testQueryProductsFromSDKs() throws Exception { ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(SDK_ID1, false); assertNotNull("Missing SDK on your system: " + SDK_ID1, sdk); - List products = sbsAliasBaseQuery.getProductsForSDK(sdk); - assertEquals(19, products.size()); + List productList = SBSv2QueryUtils.getProductVariantsForSDK(sdk); + assertTrue(productList.size() > 0); } - public void testStressQueryTest() throws Exception { - - long stressTestStartTime = System.currentTimeMillis(); - - testQueryAliases(); - - testQueryMultipleConfigs(); - testQueryMultipleConfigs(); - testQueryMultipleConfigs(); - testQueryMultipleConfigs(); - testQueryMultipleConfigs(); - testQueryMultipleConfigs(); - testQueryMultipleConfigs(); - testQueryMultipleConfigs(); - testQueryMultipleConfigs(); - testQueryMultipleConfigs(); - - testQueryProductsFromSDKs(); - testQueryProductsFromSDKs(); - testQueryProductsFromSDKs(); - testQueryProductsFromSDKs(); - testQueryProductsFromSDKs(); - testQueryProductsFromSDKs(); - testQueryProductsFromSDKs(); - testQueryProductsFromSDKs(); - testQueryProductsFromSDKs(); - testQueryProductsFromSDKs(); - testQueryProductsFromSDKs(); - - startTime = stressTestStartTime; - - if (printTimingStats) - System.out.println("Time for testStressQueryTest(): " + getTimingStats()); - } - - public String getTimingStats(){ if (startTime != 0){ long millisec = (System.currentTimeMillis() - startTime); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPlugin.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPlugin.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPlugin.java Wed Jul 21 12:11:48 2010 -0500 @@ -79,7 +79,7 @@ */ public static List getUsableBuildConfigs() { for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) { - List contexts = sdk.getUnfilteredBuildConfigurations(); + List contexts = sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations(); if (contexts.size() > 0) { return contexts.subList(0, Math.min(contexts.size(), 8)); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/ErrorParserRegressionGenerator.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/ErrorParserRegressionGenerator.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/ErrorParserRegressionGenerator.java Wed Jul 21 12:11:48 2010 -0500 @@ -32,7 +32,9 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; @@ -45,7 +47,7 @@ private static final String PROJECT_NAME = "TestErrorParser"; // Platform matters, set this before you build - private static final String PLATFORM_STRING = ISymbianBuildContext.ARMV5_PLATFORM; + private static final String PLATFORM_STRING = ISBSv1BuildContext.ARMV5_PLATFORM; CarbideErrorParserTestHarness harness; private IProject project; @@ -59,7 +61,7 @@ // You need to set the proper default configuration so the correct set of error parsers is called List sdkList = SDKCorePlugin.getSDKManager().getSDKList(); for (ISymbianSDK currSDK : sdkList){ - List contexts = currSDK.getUnfilteredBuildConfigurations(); + List contexts = currSDK.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations(); for (ISymbianBuildContext context : contexts) { if (context.getPlatformString().equals(PLATFORM_STRING)) { contextList.add(context); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestGcceErrorParser.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestGcceErrorParser.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestGcceErrorParser.java Wed Jul 21 12:11:48 2010 -0500 @@ -31,7 +31,9 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; @@ -56,9 +58,9 @@ // You need to set the proper default configuration so the correct set of error parsers is called List sdkList = SDKCorePlugin.getSDKManager().getSDKList(); for (ISymbianSDK currSDK : sdkList){ - List contexts = currSDK.getUnfilteredBuildConfigurations(); + List contexts = currSDK.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations(); for (ISymbianBuildContext context : contexts) { - if (context.getPlatformString().equals(ISymbianBuildContext.GCCE_PLATFORM)) { + if (context.getPlatformString().equals(ISBSv1BuildContext.GCCE_PLATFORM)) { contextList.add(context); break; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakeErrorParser.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakeErrorParser.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakeErrorParser.java Wed Jul 21 12:11:48 2010 -0500 @@ -31,7 +31,9 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; @@ -57,9 +59,9 @@ // You need to set the proper default configuration so the correct set of error parsers is called List sdkList = SDKCorePlugin.getSDKManager().getSDKList(); for (ISymbianSDK currSDK : sdkList){ - List contexts = currSDK.getUnfilteredBuildConfigurations(); + List contexts = currSDK.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations(); for (ISymbianBuildContext context : contexts) { - if (context.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (context.getPlatformString().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { contextList.add(context); break; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakmakeErrorParser.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakmakeErrorParser.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakmakeErrorParser.java Wed Jul 21 12:11:48 2010 -0500 @@ -32,7 +32,9 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; @@ -54,9 +56,9 @@ // You need to set the proper default configuration so the correct set of error parsers is called List sdkList = SDKCorePlugin.getSDKManager().getSDKList(); for (ISymbianSDK currSDK : sdkList){ - List contexts = currSDK.getUnfilteredBuildConfigurations(); + List contexts = currSDK.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations(); for (ISymbianBuildContext context : contexts) { - if (context.getPlatformString().equals(ISymbianBuildContext.ARMV5_PLATFORM)) { + if (context.getPlatformString().equals(ISBSv1BuildContext.ARMV5_PLATFORM)) { contextList.add(context); break; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestRVCTErrorParser.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestRVCTErrorParser.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestRVCTErrorParser.java Wed Jul 21 12:11:48 2010 -0500 @@ -32,7 +32,9 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; @@ -54,9 +56,9 @@ // You need to set the proper default configuration so the correct set of error parsers is called List sdkList = SDKCorePlugin.getSDKManager().getSDKList(); for (ISymbianSDK currSDK : sdkList){ - List contexts = currSDK.getUnfilteredBuildConfigurations(); + List contexts = currSDK.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations(); for (ISymbianBuildContext context : contexts) { - if (context.getPlatformString().equals(ISymbianBuildContext.ARMV5_PLATFORM)) { + if (context.getPlatformString().equals(ISBSv1BuildContext.ARMV5_PLATFORM)) { contextList.add(context); break; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestSBSv2ErrorParser.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestSBSv2ErrorParser.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestSBSv2ErrorParser.java Wed Jul 21 12:11:48 2010 -0500 @@ -32,7 +32,9 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; @@ -54,9 +56,9 @@ // You need to set the proper default configuration so the correct set of error parsers is called List sdkList = SDKCorePlugin.getSDKManager().getSDKList(); for (ISymbianSDK currSDK : sdkList){ - List contexts = currSDK.getUnfilteredBuildConfigurations(); + List contexts = currSDK.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations(); for (ISymbianBuildContext context : contexts) { - if (context.getPlatformString().equals(ISymbianBuildContext.ARMV5_PLATFORM)) { + if (context.getPlatformString().equals(ISBSv1BuildContext.ARMV5_PLATFORM)) { contextList.add(context); break; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/ISBSv2ConfigData.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/ISBSv2ConfigData.java Wed Jul 21 11:32:00 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2010 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Test the BldInfViewPathHelper class. -* -*/ -package com.nokia.carbide.cdt.builder.test.sandbox; - -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; - -/** - * Data that describes the meaning of a single build configuration, as discovered by SBS - * - * @noimplement - */ -public interface ISBSv2ConfigData { - - /** - * Get the usable SBS build alias that can be used for the -c parameter - * @return the unique build alias - */ - String getBuildAlias(); - - /** - * Get the meaning (aka dotted name, component name) fo the build alias. - * Can also be used as a -c argument in SBS - * @return the meaning - */ - String getMeaning(); - - /** - * Get the directory for a given SDK where binaries are output - * @param sdk - use null if for base configuration - * @return the portable OS string starting from /epoc32/ - */ - String getReleaseDirectory(ISymbianSDK sdk); - - /** - * TODO: This API is not yet defined. - * @param sdk - * @return - */ - ISBSv2ConfigPreprocessorInfo getBuildData(ISymbianSDK sdk); - - /** - * Get the name of the folder where executable binaries are written (typically 'debug' or 'release') - * @param sdk - use null for base configuration - * @return string of folder name - */ - String getTraditionalTarget(ISymbianSDK sdk); - - /** - * Get the name of the folder where executable binaries are written (component before the target) - * @param sdk - use null for base configuration - * @return string of folder name - */ - String getTraditionalPlatform(ISymbianSDK sdk); - - /** - * Get the SDK for which this configuration was qeuried. - * @return the SDK, or null if it's a base sbs configuration - */ - ISymbianSDK getSupportingSDK(); - -} diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/ISBSv2ConfigPreprocessorInfo.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/ISBSv2ConfigPreprocessorInfo.java Wed Jul 21 11:32:00 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2010 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Test the BldInfViewPathHelper class. -* -*/ -package com.nokia.carbide.cdt.builder.test.sandbox; - -import java.util.List; - -import org.eclipse.core.runtime.IPath; - -/** - * TODO: This API is not yet developed - * - * @noimplement - */ -public interface ISBSv2ConfigPreprocessorInfo { - - List getMacroList(); - - List getSystemIncludes(); - - IPath getVariantConfig(); - - String getCompiler(); - - IPath getCompilerPrefix(); - - ISBSv2ConfigData getSBSv2QueryConfigData(); - -} diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/ISBSv2QueryData.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/ISBSv2QueryData.java Wed Jul 21 11:32:00 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2010 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Test the BldInfViewPathHelper class. -* -*/ -package com.nokia.carbide.cdt.builder.test.sandbox; - -import java.util.HashMap; -import java.util.List; - -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; - -/** - * Interface that wraps all queries to the Symbian Build System (SBSv2/Raptor) - * - * @noimplement - */ -public interface ISBSv2QueryData { - - /** - * For given SDK, add an SBS build configuration - * @param sdk - use null if base SBS data - * @param configData - The configuration to add - */ - void addConfigurationData(ISymbianSDK sdk, ISBSv2ConfigData configData); - - /** - * Get all usable SBS configurations for a given SDK, which is the union of - * the SBS base configurations and SDK specific configurations. - * @param sdk - should not be null - * @return -The list of all usable SBS build configurations - * @see {@link ISBSv2QueryData#getSDKSpecificConfigData(ISymbianSDK)} - * @see {@link ISBSv2QueryData#getBaseSBSConfigurations()} - */ - List getAllConfigurationsForSDK(ISymbianSDK sdk); - - /** - * Get the SBS configurations that are defined only by the SDK. - * This does not include configurations that have altered meanings, - * rather they provide a new unique build alias that is not defined in the base SBS installation. - * @param sdk - never null - * @return The unique SBS configurations to a given SDK. An empty list of none. - */ - List getSDKSpecificConfigData(ISymbianSDK sdk); - - /** - * Get the map of build alias to sbs configuration data that Raptor defines - * without input from any SDK - * @return a HashMap of SBS build alias to configuration data - */ - HashMap getBaseSBSConfigurations(); - - /** - * Get the product variant list for a given SDK - * @param sdk - The SDK, should not be null - * @return The list of product variants - */ - List getProductsForSDK(ISymbianSDK sdk); - - /** - * Sets the product variant list by the SDK. Products are typically defined - * under /epoc32/sbs_config/variant_configurations.xml - * @param sdk - The SDK, must not be null - * @param products - The list of build variants that can be applied to any build alias or meaning - */ - void addProductListForSDK(ISymbianSDK sdk, List products); - - /** - * Find SBS configuration data for a single build configuration. - * @param sdk - The SDK that contains the build configuration. Null for a base configuration - * @param string - The build alias (e.g. armv5_udeb) - * @return SBS configuration data, or null if not found - */ - ISBSv2ConfigData getSBSConfigByAlias(ISymbianSDK sdk, String alias); - - /** - * Find SBS configuration data for a single build configuration. - * @param sdk - The SDK that contains the build configuration. Null for a base configuration - * @param string - The build meaning or dotted name (e.g. arm.v5.udeb.rvct2_2) - * @return SBS configuration data, or null if not found - */ - ISBSv2ConfigData getSBSConfigByMeaning(ISymbianSDK sdk, String meaning); -} diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/SBSv2ConfigData.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/SBSv2ConfigData.java Wed Jul 21 11:32:00 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* -* Copyright (c) 2010 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Test the BldInfViewPathHelper class. -* -*/ -package com.nokia.carbide.cdt.builder.test.sandbox; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; - -public class SBSv2ConfigData implements ISBSv2ConfigData { - - /** The supporting SDK. May be null if it's a base configuration */ - ISymbianSDK sdk; - - /** - * A unique build alias. There can only be one alias definition, but an SDK can change the meaning of the alias - */ - String buildAlias; - /* - * The dotted name for the alias. One build alias can have multiple meanings, each defined in an SDK - */ - String meaning; - - String target = null; - String platform = null; - String releaseDirectory = null; - - public SBSv2ConfigData(String buildAlias, String meaning, ISymbianSDK sdk){ - this.buildAlias = buildAlias; - this.meaning = meaning; - if (sdk != null){ - this.sdk = sdk; - } - } - - public String getBuildAlias() { - return buildAlias; - } - - public String getMeaning() { - return meaning; - } - - - public String getReleaseDirectory(ISymbianSDK sdk) { - if (releaseDirectory == null){ - initDefaultConfigTargetInfo(sdk); - } - return releaseDirectory; - } - - private void initDefaultConfigTargetInfo(ISymbianSDK sdk) { - List aliasOrMeaningArray = new ArrayList(); - aliasOrMeaningArray.add(buildAlias); - HashMap configResponse = SBSv2QueryUtils.queryConfigTargetInfo(aliasOrMeaningArray, sdk); - String releaseTree = configResponse.get(meaning); - if (releaseTree == null){ - // TODO: Throw Exception - return; - } - IPath releasePath = new Path(releaseTree); - int epoc32SegmentIndex = 0; - for (String segment : releasePath.segments()){ - if (segment.toLowerCase().equals("epoc32")) - break; - epoc32SegmentIndex++; - } - platform = releasePath.segment(epoc32SegmentIndex+2); - target = releasePath.segment(epoc32SegmentIndex+3); - String device = releasePath.getDevice(); - releaseDirectory = releasePath.removeFirstSegments(epoc32SegmentIndex).toPortableString(); - releaseDirectory = releaseDirectory.replace(device, ""); - - } - - public ISBSv2ConfigPreprocessorInfo getBuildData(ISymbianSDK sdk) { - // TODO Auto-generated method stub - return null; - } - - public String getTraditionalTarget(ISymbianSDK sdk) { - if (target == null){ - initDefaultConfigTargetInfo(sdk); - } - - return target; - } - - public String getTraditionalPlatform(ISymbianSDK sdk) { - if (platform == null){ - initDefaultConfigTargetInfo(sdk); - } - - return platform; - } - - public String toString(){ - return "Alias = " + buildAlias + " : Meaning = " + meaning; - } - - public ISymbianSDK getSupportingSDK() { - return sdk; - } - - -} diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/SBSv2QueryData.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/SBSv2QueryData.java Wed Jul 21 11:32:00 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* -* Copyright (c) 2010 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Test the BldInfViewPathHelper class. -* -*/ -package com.nokia.carbide.cdt.builder.test.sandbox; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; - -public class SBSv2QueryData implements ISBSv2QueryData { - - /** alias to ISBSv2ConfigData - These are the standard build configs defined by Raptor, and are treated as virtual by this API */ - HashMap baseSBSConfigs = new HashMap(); - /** SDK ==> ISBSv2ConfigData : Contains all the SBS configs particular to a single SDK */ - HashMap> sbsSDKBuildConfigMap = new HashMap>(); - HashMap> sdkProductVariantList = new HashMap>(); - - public void addConfigurationData(ISymbianSDK sdk, ISBSv2ConfigData configData) { - - if (sdk == null){ - baseSBSConfigs.put(configData.getBuildAlias(), configData); - } - - List configDataForSDK = sbsSDKBuildConfigMap.get(sdk); - - if (configDataForSDK == null){ - // This SDK does not exist, create the first entry - configDataForSDK = new ArrayList(); - configDataForSDK.add(configData); - sbsSDKBuildConfigMap.put(sdk, configDataForSDK); - return; - } - - configDataForSDK.add(configData); - } - - public HashMap getBaseSBSConfigurations() { - return baseSBSConfigs; - } - - public List getSDKSpecificConfigData(ISymbianSDK sdk) { - List sdkDefinedConfigs = new ArrayList(); - - for (ISBSv2ConfigData oneConfig : sbsSDKBuildConfigMap.get(sdk)){ - // check if the alias is already in the base list, if not add it - boolean addConfigForReturn = true; - for (String alias : baseSBSConfigs.keySet()){ - ISBSv2ConfigData baseConfig = baseSBSConfigs.get(alias); - if (oneConfig.getBuildAlias().equals(baseConfig.getBuildAlias())){ - addConfigForReturn = false; - break; - } - } - if (addConfigForReturn){ - sdkDefinedConfigs.add(oneConfig); - } - } - - return sdkDefinedConfigs; - } - - public List getAllConfigurationsForSDK(ISymbianSDK sdk) { - return sbsSDKBuildConfigMap.get(sdk); - } - - public List getProductsForSDK(ISymbianSDK sdk) { - return sdkProductVariantList.get(sdk); - } - - public void addProductListForSDK(ISymbianSDK sdk, List products) { - if (null == sdkProductVariantList.get(sdk) || - sdkProductVariantList.size() == 0){ - - sdkProductVariantList.put(sdk, products); - } - } - - public ISBSv2ConfigData getSBSConfigByAlias(ISymbianSDK sdk, String alias) { - - if (sdk == null){ - return baseSBSConfigs.get(alias); - } else { - List configListForSDK = sbsSDKBuildConfigMap.get(sdk); - - for (ISBSv2ConfigData config : configListForSDK){ - if (config.getBuildAlias().equals(alias)){ - return config; - } - } - } - - return null; - } - - public ISBSv2ConfigData getSBSConfigByMeaning(ISymbianSDK sdk, String meaning) { - if (sdk == null){ - for (String aliasKey : baseSBSConfigs.keySet()){ - ISBSv2ConfigData config = baseSBSConfigs.get(aliasKey); - if (config.getMeaning().equals(meaning)){ - return config; - } - } - } else { - List configListForSDK = sbsSDKBuildConfigMap.get(sdk); - - for (ISBSv2ConfigData config : configListForSDK){ - if (config.getMeaning().equals(meaning)){ - return config; - } - } - } - - return null; - } - -} diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/SBSv2QueryUtils.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/sandbox/SBSv2QueryUtils.java Wed Jul 21 11:32:00 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,305 +0,0 @@ -/* -* Copyright (c) 2010 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Test the BldInfViewPathHelper class. -* -*/ -package com.nokia.carbide.cdt.builder.test.sandbox; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Properties; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.eclipse.cdt.utils.spawner.EnvironmentReader; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.helpers.DefaultHandler; - -import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; -import com.nokia.cpp.internal.api.utils.core.Logging; - -public class SBSv2QueryUtils { - - public static final String QUERY_PRODUCTS_COMMAND = "--query=products"; - public static final String QUERY_CONFIG_COMMAND = "--query=config"; - public static final String QUERY_COMMAND = "--query=aliases"; - - public static ISBSv2QueryData queryAliasAndProductVariants() { - List argListConfigQuery = new ArrayList(); - List argListProductQuery = new ArrayList(); - argListConfigQuery.add(QUERY_COMMAND); - SBSv2QueryData sbsQueryData = new SBSv2QueryData(); - - /////// Invoke Raptor once with no EPOCROOT - Properties envVars = EnvironmentReader.getEnvVars(); - envVars.setProperty("EPOCROOT", "FOOBAR"); - String queryResult = getSBSQueryOutput(argListConfigQuery, createEnvStringList(envVars)); - - HashMap sbsAliasMap = parseQueryAliasResult(queryResult); - - for (String aliasKey : sbsAliasMap.keySet()){ - String meaning = sbsAliasMap.get(aliasKey); - SBSv2ConfigData oneSBSConfig = new SBSv2ConfigData(aliasKey, meaning, null); - sbsQueryData.addConfigurationData(null, oneSBSConfig); - } - - /////// Do for each SDK to build up the alias list... - for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){ - IPath epocRoot = new Path(sdk.getEPOCROOT()); - if ((sdk.getOSVersion().getMajor() <= 9 && sdk.getOSVersion().getMinor() <5) - || !epocRoot.toFile().exists()){ - - continue; // skip it, the sdk is not supported or broken - } - - envVars = EnvironmentReader.getEnvVars(); - envVars.setProperty("EPOCROOT", sdk.getEPOCROOT()); - - queryResult = getSBSQueryOutput(argListConfigQuery, createEnvStringList(envVars)); - - sbsAliasMap = parseQueryAliasResult(queryResult); - - for (String aliasKey : sbsAliasMap.keySet()){ - String meaning = sbsAliasMap.get(aliasKey); - SBSv2ConfigData oneSBSConfig = new SBSv2ConfigData(aliasKey, meaning, sdk); - sbsQueryData.addConfigurationData(sdk, oneSBSConfig); - } - - // Now get the products for each SDK - argListProductQuery.add(QUERY_PRODUCTS_COMMAND); - queryResult = getSBSQueryOutput(argListProductQuery, createEnvStringList(envVars)); - List productList = parseQueryProductsResults(queryResult); - sbsQueryData.addProductListForSDK(sdk, productList); - } - - return sbsQueryData; - } - - public static HashMap queryConfigTargetInfo(List aliasOrMeaningArray, ISymbianSDK sdk){ - - List argListConfigQuery = new ArrayList(); - - for (String alias : aliasOrMeaningArray){ - argListConfigQuery.add(QUERY_CONFIG_COMMAND + "[" + alias + "]"); - } - - Properties envVars = null; - if (sdk != null){ - File epocRoot = new File(sdk.getEPOCROOT()); - if (epocRoot.exists()){ - envVars = EnvironmentReader.getEnvVars(); - envVars.setProperty("EPOCROOT", sdk.getEPOCROOT()); - } - } - String queryResult = getSBSQueryOutput(argListConfigQuery, createEnvStringList(envVars)); - - return parseQueryConfigResults(queryResult); - } - - private static String[] createEnvStringList(Properties envProps) { - - if (envProps == null){ - return null; - } - String[] env = null; - List envList = new ArrayList(); - Enumeration names = envProps.propertyNames(); - if (names != null) { - while (names.hasMoreElements()) { - String key = (String) names.nextElement(); - envList.add(key + "=" + envProps.getProperty(key)); - } - env = (String[]) envList.toArray(new String[envList.size()]); - } - return env; - } - - private static String getSBSQueryOutput(List queryCommandList, String[] env) { - String overallOutput = ""; - - Runtime rt = Runtime.getRuntime(); - IPath sbsPath = SBSv2Utils.getSBSPath(); - Process p = null; - List args = new ArrayList(); - args.add(sbsPath.toOSString()); - args.addAll(queryCommandList); - try { - p = rt.exec(args.toArray(new String[args.size()]), env); - } catch (IOException e) { - // no such process, SBSv2 not available - Logging.log( - SDKCorePlugin.getDefault(), - Logging.newSimpleStatus( - 0, - IStatus.WARNING, - MessageFormat - .format( - "Could not find or launch Raptor script ''{0}''; SBSv2 support will not be available", - sbsPath), e)); - } - if (p != null) { - BufferedReader br = new BufferedReader(new InputStreamReader(p - .getInputStream())); - - String stdErrLine = null; - try { - - // Only try for 30 seconds then bail in case Raptor hangs - int maxTries = 60; - int numTries = 0; - while (numTries < maxTries) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // ignore - } - if (br.ready()) { - while ((stdErrLine = br.readLine()) != null) { - overallOutput += stdErrLine; - numTries = maxTries; - } - - } - numTries++; - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - return overallOutput; - } - - private static HashMap parseQueryAliasResult(String queryResult) { - /* Alias to dotted name config */ - HashMap sbsAliasMap = new HashMap(); - - try { - Element root = null; - DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - parser.setErrorHandler(new DefaultHandler()); - - StringReader reader = new StringReader( queryResult ); - InputSource inputSource = new InputSource( reader ); - root = parser.parse(inputSource).getDocumentElement(); - - NodeList children = root.getChildNodes(); - for (int i=0; i< children.getLength(); i++) { - Node aliasNode = children.item(i); - if (aliasNode.getNodeName().equals("alias")){ - NamedNodeMap meaning = aliasNode.getAttributes(); - String dottedName = meaning.getNamedItem("meaning").getNodeValue(); - String alias = meaning.getNamedItem("name").getNodeValue(); - //System.out.println("ALIAS QUERY ==> " + dottedName + " <==> " + alias); - sbsAliasMap.put(alias, dottedName); - } - } - - } catch (Exception e) { - e.printStackTrace(); - Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); - } - - - return sbsAliasMap; - } - - private static HashMap parseQueryConfigResults(String queryResult) { - /* Alias to output directory */ - HashMap sbsAliasMap = new HashMap(); - - try { - Element root = null; - DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - parser.setErrorHandler(new DefaultHandler()); - - StringReader reader = new StringReader( queryResult ); - InputSource inputSource = new InputSource( reader ); - root = parser.parse(inputSource).getDocumentElement(); - - NodeList children = root.getChildNodes(); - for (int i=0; i< children.getLength(); i++) { - Node aliasNode = children.item(i); - if (aliasNode.getNodeName().equals("config")){ - NamedNodeMap meaning = aliasNode.getAttributes(); - String outputpath = meaning.getNamedItem("outputpath").getNodeValue(); - String fullName = meaning.getNamedItem("fullname").getNodeValue(); - //System.out.println("ALIAS QUERY ==> " + dottedName + " <==> " + alias); - sbsAliasMap.put(fullName, outputpath); - } - } - - } catch (Exception e) { - e.printStackTrace(); - Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); - } - - - return sbsAliasMap; - } - - private static List parseQueryProductsResults(String queryResult) { - List productList = new ArrayList(); - - try { - Element root = null; - DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - parser.setErrorHandler(new DefaultHandler()); - - StringReader reader = new StringReader( queryResult ); - InputSource inputSource = new InputSource( reader ); - root = parser.parse(inputSource).getDocumentElement(); - - NodeList children = root.getChildNodes(); - for (int i=0; i< children.getLength(); i++) { - Node aliasNode = children.item(i); - if (aliasNode.getNodeName().equals("product")){ - NamedNodeMap productAttribs = aliasNode.getAttributes(); - String name = productAttribs.getNamedItem("name").getNodeValue(); - //System.out.println("ALIAS QUERY ==> " + dottedName + " <==> " + alias); - productList.add(name); - } - } - - } catch (Exception e) { - e.printStackTrace(); - Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); - } - - return productList; - } - - - - -} diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/BuildArgumentsInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/BuildArgumentsInfo.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/BuildArgumentsInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -18,6 +18,7 @@ import com.nokia.carbide.cdt.builder.project.IBuildArgumentsInfo; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; /* * Wrapper for the build arguments settings in Carbide Build Configuration preferences @@ -64,7 +65,7 @@ this.abldCleanArgs = ""; //$NON-NLS-1$ this.abldFreezeArgs = ""; //$NON-NLS-1$ - if (sdk.isEKA2()) { + if (sdk.getSupportedFeatures().contains(ISymbianSDKFeatures.IS_EKA2)) { this.abldFreezeArgs = "-r"; //$NON-NLS-1$ } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultGNUMakefileViewConfiguration.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultGNUMakefileViewConfiguration.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultGNUMakefileViewConfiguration.java Wed Jul 21 12:11:48 2010 -0500 @@ -48,7 +48,7 @@ * The build context may be null. */ public DefaultGNUMakefileViewConfiguration(ICarbideProjectInfo info, IViewFilter viewFilter) { - this(info.getProject(), info.getDefaultConfiguration(), viewFilter); + this(info.getProject(), info.getDefaultConfiguration().getBuildContext(), viewFilter); } /** diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultImageMakefileViewConfiguration.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultImageMakefileViewConfiguration.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultImageMakefileViewConfiguration.java Wed Jul 21 12:11:48 2010 -0500 @@ -40,7 +40,7 @@ * The build context may not be null. */ public DefaultImageMakefileViewConfiguration(ICarbideProjectInfo info, IViewFilter viewFilter) { - super(info.getProject(), info.getDefaultConfiguration(), viewFilter); + super(info.getProject(), info.getDefaultConfiguration().getBuildContext(), viewFilter); } /** diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultIncludeFileLocator.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultIncludeFileLocator.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultIncludeFileLocator.java Wed Jul 21 12:11:48 2010 -0500 @@ -20,13 +20,15 @@ package com.nokia.carbide.cdt.builder; import java.io.File; -import java.util.*; +import java.util.ArrayList; +import java.util.List; import org.eclipse.core.resources.IProject; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; -import com.nokia.carbide.cpp.sdk.core.*; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv2; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.BasicIncludeFileLocator; import com.nokia.cpp.internal.api.utils.core.Check; @@ -52,9 +54,14 @@ } // get info from context - Check.checkState(buildContext instanceof SymbianBuildContext); + // TODO: HACK HACK. Hard coded build context to get working.... + Check.checkState(buildContext instanceof BuildContextSBSv1 || buildContext instanceof BuildContextSBSv2); - systemPaths.addAll(((SymbianBuildContext) buildContext).getCachedSystemIncludePaths()); + if (buildContext instanceof BuildContextSBSv1){ + systemPaths.addAll(((BuildContextSBSv1) buildContext).getCachedSystemIncludePaths()); + } else if (buildContext instanceof BuildContextSBSv2){ + systemPaths.addAll(((BuildContextSBSv2) buildContext).getCachedSystemIncludePaths()); + } } setPaths(null, (File[]) systemPaths.toArray(new File[systemPaths.size()])); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultMMPViewConfiguration.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultMMPViewConfiguration.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultMMPViewConfiguration.java Wed Jul 21 12:11:48 2010 -0500 @@ -23,14 +23,16 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement; import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPViewConfiguration; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.*; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.IViewFilter; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; public class DefaultMMPViewConfiguration extends DefaultViewConfiguration implements IMMPViewConfiguration { /** Configuration for the default build configuration of the project */ public DefaultMMPViewConfiguration(ICarbideProjectInfo info, IViewFilter viewFilter) { - super(info.getProject(), info.getDefaultConfiguration(), viewFilter); + super(info.getProject(), info.getDefaultConfiguration().getBuildContext(), viewFilter); } /** Configuration for the given build configuration of the project with the given filter */ public DefaultMMPViewConfiguration(IProject project, ISymbianBuildContext context, IViewFilter viewFilter) { @@ -49,7 +51,7 @@ /** Configuration for the given build configuration of the project with the given filter */ public DefaultMMPViewConfiguration(ICarbideBuildConfiguration buildConfiguration, IViewFilter viewFilter) { - super(buildConfiguration.getCarbideProject().getProject(), buildConfiguration, viewFilter); + super(buildConfiguration.getCarbideProject().getProject(), buildConfiguration.getBuildContext(), viewFilter); } /** @@ -64,15 +66,20 @@ return true; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { if (context != null) - return context.getDefaultDefFileDirectoryName(isASSP); + return context.getDefaultDefFileDirectoryName(); return null; } public boolean isEmulatorBuild() { - if (context != null) - return context.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM); - return true; + if (context != null){ + if (context instanceof ISBSv1BuildContext){ + return context.getPlatformString().equals(ISBSv1BuildContext.EMULATOR_PLATFORM); + } else if (context instanceof ISBSv2BuildContext){ + return ((ISBSv2BuildContext)context).getSBSv2Alias().toUpperCase().contains(ISBSv2BuildContext.TOOLCHAIN_WINSCW); + } + } + return false; } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultViewConfiguration.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultViewConfiguration.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultViewConfiguration.java Wed Jul 21 12:11:48 2010 -0500 @@ -20,7 +20,12 @@ import com.nokia.carbide.cpp.epoc.engine.model.IViewConfiguration; import com.nokia.carbide.cpp.epoc.engine.model.IViewParserConfiguration; import com.nokia.carbide.cpp.epoc.engine.preprocessor.*; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.cpp.internal.api.utils.core.Check; import org.eclipse.core.resources.IProject; @@ -43,7 +48,7 @@ public DefaultViewConfiguration(ICarbideProjectInfo projectInfo) { Check.checkArg(projectInfo); this.project = projectInfo.getProject(); - this.context = projectInfo.getDefaultConfiguration(); + this.context = projectInfo.getDefaultConfiguration().getBuildContext(); this.bldInfPath = null; this.viewFilter = new AllNodesViewFilter(); wrapViewFilter(); @@ -198,23 +203,35 @@ public Collection getMacros() { List macros = new ArrayList(); if (context != null) { - - if (context.getSBSv2Alias() != null){ + ISymbianSDK sdk = context.getSDK(); + + if (context instanceof ISBSv2BuildContext){ macros.add(DefineFactory.createDefine("SBSV2", null)); + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + if (sbsv2BuildInfo != null) { + Map platMacros = sbsv2BuildInfo.getPlatformMacros(context.getPlatformString()); + for (Iterator it = platMacros.keySet().iterator(); it.hasNext(); ) { + String name = it.next(); + String value = platMacros.get(name); + macros.add(DefineFactory.createDefine(name, value)); + } + } + } else { + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + if (sbsv1BuildInfo != null) { + for (String platMacro : sbsv1BuildInfo.getPlatformMacros(context.getPlatformString())) { + macros.add(DefineFactory.createDefine(platMacro.trim(), platMacro.trim())); + } + + for (String vendorMacro : sbsv1BuildInfo.getVendorSDKMacros()){ + macros.add(DefineFactory.createDefine(vendorMacro.trim(), vendorMacro.trim())); + } + } } for (IDefine macro : context.getVariantHRHDefines()) { macros.add(macro); } - - for (String platMacro : context.getSDK().getPlatformMacros(context.getPlatformString())) { - macros.add(DefineFactory.createDefine(platMacro.trim(), platMacro.trim())); - } - - for (String vendorMacro : context.getSDK().getVendorSDKMacros()){ - macros.add(DefineFactory.createDefine(vendorMacro.trim(), vendorMacro.trim())); - } - } macros.addAll(extraMacros); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,36 +16,82 @@ */ package com.nokia.carbide.cdt.builder; -import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; -import com.nokia.carbide.cdt.builder.project.*; -import com.nokia.carbide.cdt.internal.builder.CarbideBuildConfiguration; -import com.nokia.carbide.cdt.internal.builder.ISBSv2BuildConfigInfo; -import com.nokia.carbide.cpp.epoc.engine.*; -import com.nokia.carbide.cpp.epoc.engine.image.*; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.*; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExtension; -import com.nokia.carbide.cpp.epoc.engine.model.makefile.image.IImageMakefileData; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.*; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.AllNodesViewFilter; -import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContextDataCache; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.*; -import com.nokia.cpp.internal.api.utils.core.*; +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.InstanceScope; -import java.io.*; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; +import com.nokia.carbide.cdt.internal.builder.ISBSv2BuildConfigInfo; +import com.nokia.carbide.cpp.epoc.engine.BldInfDataRunnableAdapter; +import com.nokia.carbide.cpp.epoc.engine.BldInfViewRunnableAdapter; +import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; +import com.nokia.carbide.cpp.epoc.engine.ImageMakefileDataRunnableAdapter; +import com.nokia.carbide.cpp.epoc.engine.MMPDataRunnableAdapter; +import com.nokia.carbide.cpp.epoc.engine.MMPViewRunnableAdapter; +import com.nokia.carbide.cpp.epoc.engine.PKGViewRunnableAdapter; +import com.nokia.carbide.cpp.epoc.engine.image.IBitmapSource; +import com.nokia.carbide.cpp.epoc.engine.image.IImageSource; +import com.nokia.carbide.cpp.epoc.engine.image.IMultiImageSource; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfData; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfView; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExport; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExtension; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMMPReference; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakMakeReference; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakefileReference; +import com.nokia.carbide.cpp.epoc.engine.model.makefile.image.IImageMakefileData; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPLanguage; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPAIFInfo; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPBitmap; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPResource; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPView; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPViewConfiguration; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.AllNodesViewFilter; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContextDataCache; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.EPKGLanguage; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGEmbeddedSISFile; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGInstallFile; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGView; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.PKGModelHelper; +import com.nokia.cpp.internal.api.utils.core.CommonPathFinder; +import com.nokia.cpp.internal.api.utils.core.FileUtils; +import com.nokia.cpp.internal.api.utils.core.Logging; +import com.nokia.cpp.internal.api.utils.core.PathUtils; +import com.nokia.cpp.internal.api.utils.core.TextUtils; public class EpocEngineHelper { @@ -369,8 +415,14 @@ && context.getSDK().getEPOCROOT() != null && new File(context.getSDK().getEPOCROOT()).exists()) { defaultContext = context; - if (defaultContext.getSDK().getPrefixFile() != null) - break; + ISymbianSDK sdk = defaultContext.getSDK(); + if (context instanceof ISBSv2BuildContext){ + if (sdk.getPrefixFile(ISymbianBuilderID.SBSV2_BUILDER) != null) + break; + } else { + if (sdk.getPrefixFile(ISymbianBuilderID.SBSV1_BUILDER) != null) + break; + } } } final ISymbianBuildContext defaultContextToUse = defaultContext; @@ -650,7 +702,7 @@ final Set tempNormalProjects = new LinkedHashSet(); for (final ICarbideBuildConfiguration buildConfig : buildConfigs) { EpocEnginePlugin.runWithBldInfData(cpi.getWorkspaceRelativeBldInfPath(), - new DefaultViewConfiguration(project, buildConfig, new AcceptedNodesViewFilter()), + new DefaultViewConfiguration(project, buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new BldInfDataRunnableAdapter() { public Object run(IBldInfData data) { for (IMakMakeReference normalRef : data.getMakMakeReferences()) { @@ -692,7 +744,7 @@ } exePath = (String)EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(), - new DefaultViewConfiguration(info.getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new BldInfDataRunnableAdapter() { public Object run(IBldInfData data) { String exePath = ""; //$NON-NLS-1$ @@ -702,7 +754,7 @@ if (mmps.length == 1) { final IPath workspaceRelativeMMPPath = new Path(info.getProject().getName()).append(mmps[0].getPath()); exePath = (String)EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, - new DefaultMMPViewConfiguration(info.getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { @@ -713,11 +765,19 @@ return null; } - String releasePlatform = buildConfig.getSDK().getBSFCatalog().getReleasePlatform(buildConfig.getPlatformString()); - IPath path = buildConfig.getSDK().getReleaseRoot().append(releasePlatform.toLowerCase()).append(buildConfig.getTargetString().toLowerCase()); + ISymbianSDK sdk = buildConfig.getSDK(); + ISymbianBuildContext context = buildConfig.getBuildContext(); + IPath path; + if (context instanceof ISBSv2BuildContext) { + path = new Path(((ISBSv2BuildContext)context).getConfigQueryData().getOutputPathString()); + } else { + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + String releasePlatform = sbsv1BuildInfo.getBSFCatalog().getReleasePlatform(buildConfig.getPlatformString()); + path = sdk.getReleaseRoot().append(releasePlatform.toLowerCase()).append(buildConfig.getTargetString().toLowerCase()); + } // if targetpath is non-null and this is an EKA1 emulator config then add it - if (buildConfig.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (buildConfig.getPlatformString().toUpperCase().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { if (buildConfig.getSDK().getOSVersion().getMajor() < 9) { String targetPath = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETPATH); if (targetPath != null) { @@ -736,7 +796,9 @@ } exePath = targetPath.toOSString(); + return exePath; + } }); } @@ -782,7 +844,7 @@ final ICarbideBuildConfiguration buildConfig = info.getDefaultConfiguration(); exePath = (IPath)EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(), - new DefaultViewConfiguration(info.getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new BldInfDataRunnableAdapter() { public Object run(IBldInfData data) { IPath exePath = null; @@ -792,7 +854,7 @@ if (mmps.length == 1) { final IPath workspaceRelativeMMPPath = new Path(info.getProject().getName()).append(mmps[0].getPath()); exePath = (IPath)EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, - new DefaultMMPViewConfiguration(info.getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { IPath exePath = null; @@ -871,7 +933,7 @@ IPath path = buildConfig.getTargetOutputDirectory(); // if targetpath is non-null and this is an EKA1 emulator config then add it - if (buildConfig.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (buildConfig.getPlatformString().toUpperCase().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { if (buildConfig.getSDK().getOSVersion().getMajor() < 9) { String targetPath = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETPATH); if (targetPath != null) { @@ -985,7 +1047,7 @@ final ICarbideBuildConfiguration buildConfig = info.getDefaultConfiguration(); EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(), - new DefaultViewConfiguration(info.getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new BldInfDataRunnableAdapter() { public Object run(IBldInfData data) { @@ -994,7 +1056,7 @@ if (mmps.length == 1) { final IPath workspaceRelativeMMPPath = new Path(info.getProject().getName()).append(mmps[0].getPath()); EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, - new DefaultMMPViewConfiguration(info.getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { @@ -1151,12 +1213,11 @@ final ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); EpocEnginePlugin.runWithBldInfView(cpi.getWorkspaceRelativeBldInfPath(), - new DefaultViewConfiguration(cpi.getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultViewConfiguration(cpi.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new BldInfViewRunnableAdapter() { public Object run(IBldInfView view) { EpocEnginePathHelper helper = new EpocEnginePathHelper(buildConfig); - final String dataZDir = buildConfig.getSDK().getReleaseRoot().removeLastSegments(1).toOSString() + "\\data\\z\\"; //$NON-NLS-1$ for (IMakefileReference ref : view.getAllMakefileReferences()) { @@ -1280,7 +1341,7 @@ if (mmpName.toUpperCase().equals(mmpName2.toUpperCase())){ EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, - new DefaultMMPViewConfiguration(info.getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { @@ -1629,7 +1690,7 @@ final IPath workspaceRelativeldInfPath = buildConfig.getCarbideProject().getWorkspaceRelativeBldInfPath(); EpocEnginePlugin.runWithBldInfData(workspaceRelativeldInfPath, - new DefaultViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new BldInfDataRunnableAdapter() { public Object run(IBldInfData data) { @@ -1660,7 +1721,7 @@ final List macros = new ArrayList(); EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, - new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { @@ -1692,7 +1753,7 @@ IPath mmp, final ICarbideBuildConfiguration buildConfiguration, final List userPaths, final List systemPaths) { IMMPViewConfiguration viewConfiguration = new DefaultMMPViewConfiguration( - project, buildConfiguration, new AcceptedNodesViewFilter()); + project, buildConfiguration.getBuildContext(), new AcceptedNodesViewFilter()); final IPath epocRoot = new Path(buildConfiguration.getSDK().getEPOCROOT()); EpocEnginePlugin.runWithMMPData(new Path(project.getName()).append(mmp), @@ -1742,14 +1803,27 @@ */ public static IPath[] getLibDirectoriesForBuildContext(ISymbianBuildContext buildContext) { ArrayList dirList = new ArrayList(); - ISymbianSDK sdk = buildContext.getSDK(); - IPath releaseRoot = sdk.getReleaseRoot(); + IPath releaseRoot = buildContext.getSDK().getReleaseRoot(); String platformString = buildContext.getPlatformString(); boolean isDebug = ISymbianBuildContext.DEBUG_TARGET.equals(buildContext.getTargetString()); // TODO is this correct, what about ARMv6? - boolean isARMv5 = ISymbianBuildContext.ARMV5_PLATFORM.equals(platformString) || - ISymbianBuildContext.ARMV5_ABIV2_PLATFORM.equals(platformString); - boolean isGCCE = ISymbianBuildContext.GCCE_PLATFORM.equals(platformString); + boolean isARMv5 = false; + boolean isGCCE = false; + + if (buildContext instanceof ISBSv1BuildContext) { + isARMv5 = ISBSv1BuildContext.ARMV5_PLATFORM.equals(platformString) || + ISBSv1BuildContext.ARMV5_ABIV2_PLATFORM.equals(platformString); + isGCCE = ISBSv1BuildContext.GCCE_PLATFORM.equals(platformString); + } else if (buildContext instanceof ISBSv2BuildContext){ + String alias = ((ISBSv2BuildContext)buildContext).getSBSv2Alias(); + if (alias.toUpperCase().contains(ISBSv2BuildContext.TOOLCHAIN_ARM)){ + isARMv5 = true; + } + if (alias.toUpperCase().contains(ISBSv2BuildContext.TOOLCHAIN_GCCE)){ + isGCCE = true; + } + } + if (isARMv5 || isGCCE) { if (isDebug) { dirList.add(releaseRoot.append("armv5/udeb/")); //$NON-NLS-1$ @@ -1819,7 +1893,7 @@ final ICarbideBuildConfiguration buildConfig = info.getDefaultConfiguration(); final ListmmpPaths = new ArrayList(); EpocEnginePlugin.runWithBldInfData(info.getWorkspaceRelativeBldInfPath(), - new DefaultViewConfiguration(info.getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new BldInfDataRunnableAdapter() { public Object run(IBldInfData infView) { @@ -1827,7 +1901,7 @@ final IPath workspaceRelativeMMPPath = new Path(info.getProject().getName()).append(mmp.getPath()); EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, - new DefaultMMPViewConfiguration(info.getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(info.getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { @@ -1927,7 +2001,7 @@ final ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); EpocEnginePlugin.runWithBldInfData(cpi.getWorkspaceRelativeBldInfPath(), - new DefaultViewConfiguration(cpi, buildConfig), + new DefaultViewConfiguration(cpi, buildConfig.getBuildContext()), new BldInfDataRunnableAdapter() { public Object run(IBldInfData infView) { @@ -2013,7 +2087,7 @@ continue; EpocEnginePlugin.runWithMMPData(mmpPath, - new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { @@ -2272,7 +2346,12 @@ mmpFile = mmpFile.removeFileExtension(); String mmpRootName = mmpFile.lastSegment(); String plat = config.getPlatformString(); - String basePlat = config.getBasePlatformForVariation(); + String basePlat = ""; + if (config.getBuildContext() instanceof ISBSv2BuildConfigInfo){ + basePlat = ((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation(); + } else { + basePlat = config.getPlatformString(); + } String variantPlat = config.getBuildVariationName(); if (variantPlat.length() == 0){ @@ -2309,7 +2388,7 @@ } String searchString = ""; - if (config.getTargetString().equals(SymbianBuildContext.DEBUG_TARGET)){ + if (config.getTargetString().equals(BuildContextSBSv1.DEBUG_TARGET)){ searchString = "# FeatureVariantUDEBLabel"; } else { searchString = "# FeatureVariantURELLabel"; @@ -2405,7 +2484,7 @@ */ public static void addIncludedFilesFromBldInf(ICarbideProjectInfo projectInfo, ICarbideBuildConfiguration buildConfig, IPath bldinfPath, final Collection pathList) { DefaultViewConfiguration viewConfig = buildConfig != null ? - new DefaultViewConfiguration(projectInfo, buildConfig) : + new DefaultViewConfiguration(projectInfo, buildConfig.getBuildContext()) : new DefaultViewConfiguration(projectInfo); EpocEnginePlugin.runWithBldInfData(bldinfPath, viewConfig, @@ -2454,7 +2533,7 @@ final List filePaths = new ArrayList(); PKGModelHelper.runWithPKGView(pkgPath, - new DefaultViewConfiguration(buildConfig.getCarbideProject(), buildConfig), + new DefaultViewConfiguration(buildConfig.getCarbideProject(), buildConfig.getBuildContext()), new PKGViewRunnableAdapter() { public Object run(IPKGView view) { @@ -2623,7 +2702,7 @@ final ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); EpocEnginePlugin.runWithBldInfData(cpi.getWorkspaceRelativeBldInfPath(), - new DefaultViewConfiguration(cpi, buildConfig), + new DefaultViewConfiguration(cpi, buildConfig.getBuildContext()), new BldInfDataRunnableAdapter() { public Object run(IBldInfData infView) { diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java Wed Jul 21 12:11:48 2010 -0500 @@ -78,8 +78,8 @@ import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter; import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; import com.nokia.carbide.cpp.internal.qt.core.QtCorePlugin; -import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; import com.nokia.carbide.cpp.internal.x86build.X86BuildPlugin; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.EPKGLanguage; @@ -461,7 +461,7 @@ ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); List buildConfigList = new ArrayList(1); - buildConfigList.add(buildConfig); + buildConfigList.add(buildConfig.getBuildContext()); if (clearMarkers) { try { @@ -623,7 +623,7 @@ final List rules = new ArrayList(); EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, - new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { @@ -719,7 +719,7 @@ } protected static void runPreBuildChecks(ICarbideBuildConfiguration buildConfig, CarbideCommandLauncher launcher) { - if (buildConfig.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM) && BuilderPreferencePage.useBuiltInX86Vars()) { + if (buildConfig.getPlatformString().toUpperCase().equals(ISBSv1BuildContext.EMULATOR_PLATFORM) && BuilderPreferencePage.useBuiltInX86Vars()) { X86BuildPlugin.checkForUpdates(); } } @@ -733,7 +733,7 @@ ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); List buildConfigList = new ArrayList(1); - buildConfigList.add(buildConfig); + buildConfigList.add(buildConfig.getBuildContext()); // get the list of mmp/make files for this build configuration EpocEngineHelper.getMakMakeFiles(cpi.getAbsoluteBldInfPath(), buildConfigList, normalMakMakePaths, testMakMakePaths, new NullProgressMonitor()); @@ -906,7 +906,9 @@ List argsList = new ArrayList(); argsList.add("bldfiles"); - argsList.add(config.getBasePlatformForVariation().toLowerCase()); + if (config instanceof ISBSv1BuildContext){ + argsList.add(((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation().toLowerCase()); + } for (String arg : config.getBuildArgumentsInfo().getBldmakeBldFilesArgs().split(" ")) { argsList.add(arg); @@ -1352,7 +1354,7 @@ IPath tmpPKGPath = buildDirPath.append(prefix + pkgPath.lastSegment()); - IPath resolvedPKGPath = resolvePKGFile(pkgPath, config, tmpPKGPath); + IPath resolvedPKGPath = resolvePKGFile(pkgPath, config.getBuildContext(), tmpPKGPath); List args = new ArrayList(); @@ -1626,7 +1628,7 @@ // update the temp pkg file by setting the PU flag and removing any files that have not been modified PKGModelHelper.runWithPKGView(tempPkgBuildTreePath, - new DefaultViewConfiguration(config.getCarbideProject(), config), + new DefaultViewConfiguration(config.getCarbideProject(), config.getBuildContext()), new PKGViewRunnableAdapter() { public Object run(IPKGView view) { @@ -1710,7 +1712,7 @@ } }); - tempPkgBuildTreePath = resolvePKGFile(tempPkgBuildTreePath, config, tempPkgBuildTreePath); + tempPkgBuildTreePath = resolvePKGFile(tempPkgBuildTreePath, config.getBuildContext(), tempPkgBuildTreePath); // create link to temp pkg file and mark it as derived. IFile tempPkgFileLink = getTempPkgIFile(pkgPath, tempPkgBuildTreePath, config); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideBuildConfiguration.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideBuildConfiguration.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideBuildConfiguration.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,12 +16,15 @@ */ package com.nokia.carbide.cdt.builder.project; +import java.io.File; import java.util.List; import org.eclipse.core.runtime.IPath; import com.nokia.carbide.cdt.builder.BuildArgumentsInfo; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; /** * An ICarbideBuildConfiguration interface represents on buildable target for a project. A single @@ -29,7 +32,7 @@ * * @noimplement This interface is not intended to be implemented by clients. */ -public interface ICarbideBuildConfiguration extends ISymbianBuildContext { +public interface ICarbideBuildConfiguration { /** Integer identifier for the set of parser to be used for building the WINSCW platform */ public static final int ERROR_PARSERS_WINSCW = 1; @@ -137,4 +140,35 @@ */ IPath getTargetOutputDirectory(); + ISymbianBuildContext getBuildContext(); + + /** ISymbianBuildContext wrapper */ + String getDisplayString(); + + /** ISymbianBuildContext wrapper */ + ISymbianSDK getSDK(); + + /** ISymbianBuildContext wrapper */ + String getPlatformString(); + + /** ISymbianBuildContext wrapper */ + String getTargetString(); + + /** TODO: Detect on instanceof ? */ + public IPath getCompilerPrefixFile(); + + /** TODO: Detect on instanceof ? */ + public List getCompilerMacros(); + + /** TODO: Detect on instanceof ? */ + public List getVariantHRHDefines(); + + /** TODO: Detect on instanceof ? */ + public List getPrefixFileIncludes(); + + /** TODO: Detect on instanceof ? */ + public String getBuildVariationName(); + + String getConfigurationID(); + } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java Wed Jul 21 12:11:48 2010 -0500 @@ -28,6 +28,7 @@ import org.eclipse.cdt.core.ICExtensionReference; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICStorageElement; import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider; import org.eclipse.core.resources.IFolder; @@ -39,6 +40,7 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.Job; +import org.osgi.framework.Version; import com.nokia.carbide.cdt.builder.BuildArgumentsInfo; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; @@ -52,12 +54,18 @@ import com.nokia.carbide.cdt.internal.builder.CarbideProjectInfo; import com.nokia.carbide.cdt.internal.builder.EnvironmentVarsInfo; import com.nokia.carbide.cdt.internal.builder.EnvironmentVarsInfo2; +import com.nokia.carbide.cdt.internal.builder.ISBSv2BuildConfigInfo; import com.nokia.carbide.cdt.internal.builder.SISBuilderInfo; import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.CarbideBuilderConfigInfoType; import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.ConfigurationType; import com.nokia.carbide.cdt.internal.builder.xml.CarbideBuildConfigurationLoader; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv2; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory; /** * Main interface point with CDT with regards to our build configurations. Note that @@ -119,9 +127,24 @@ throw new CoreException(new Status(IStatus.ERROR, CarbideBuilderPlugin.PLUGIN_ID, IStatus.OK, "Project " + project.getName() + " is not a valid Carbide project.", null)); } - // find the configuration that matches the id (sdk, platform, target) - String configId = des.getConfiguration().getId(); - ISymbianBuildContext context = SymbianBuildContext.getBuildContextFromDisplayName(configId); + ISymbianBuildContext context = null; + if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project)){ + + context = loadSBSv2Configuration(des, monitor); + + if (context == null){ + throw new CoreException(new Status(IStatus.ERROR, + CarbideBuilderPlugin.PLUGIN_ID, IStatus.OK, + "Unable to load Carbide settings for project " + + project.getProject().getName(), null)); + } + } else { + // TODO: Presume it's SBSv1? + // find the configuration that matches the id (sdk, platform, target) + String configId = des.getConfiguration().getId(); + context = BuildContextSBSv1.getBuildContextFromDisplayName(configId); + } + if (context == null) { throw new CoreException(new Status(IStatus.ERROR, CarbideBuilderPlugin.PLUGIN_ID, IStatus.OK, "SDK specified in project " + project.getName() + " is not installed, please set it up from project property", null)); } @@ -140,6 +163,99 @@ return null; } + private ISymbianBuildContext loadSBSv2Configuration(ICConfigurationDescription des, + IProgressMonitor monitor) { + + ICStorageElement rootStorage; + try { + rootStorage = des.getStorage(CarbideBuildConfiguration.CARBIDE_STORAGE_ID, false); + } catch (CoreException e) { + return null; + } + String configID = des.getConfiguration().getId(); + String buidAlias = null; + String platform = null; + String target = null; + String displayString = null; + String variant = ""; + String sdkID = null; + if (rootStorage != null) { + for (ICStorageElement se : rootStorage.getChildren()) { + if (se.getName().equals( + CarbideBuildConfiguration.SBSV2_DATA_ID)) { + + String value = se.getAttribute(ISBSv2BuildConfigInfo.ATRRIB_CONFIG_BASE_PLATFORM); + if (value != null) { + platform = value; + } + + value = se.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT); + if (value != null) { + variant = value; + } + + value = se.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_CONFIG_TARGET); + if (value != null) { + target = value; + } + + value = se.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_BUILD_ALIAS); + if (value != null) { + buidAlias = value; + } + + value = se.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_CONFIG_DISPLAY_STRING); + if (value != null) { + displayString = value; + } + + value = se.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_SDK_ID); + if (value != null) { + sdkID = value; + } + } + } + } else { + return null; + } + + ISymbianSDK sdk = null; + if (!configID.startsWith(ISBSv2BuildContext.BUILDER_ID)){ + // pre-C3 project, get SDK id from config name + if (displayString == null){ + displayString = configID; + } + if (sdkID == null){ + sdkID = BuildContextSBSv2.getSDKIDFromV1ConfigName(displayString); + } + if (platform == null){ + platform = BuildContextSBSv2.getPlatformFromV1ConfigName(displayString); + } + if (target == null){ + target = BuildContextSBSv2.getTargetFromV1ConfigName(displayString); + } + if (buidAlias == null){ + buidAlias = BuildContextSBSv2.getBuildAliasFromV1ConfigName(displayString); + } + } + if (sdkID != null){ + sdk = SDKCorePlugin.getSDKManager().getSDK(sdkID, true); + // TODO: NEED TO HANDLE MISSING SDK ID + if (sdk != null){ + return new BuildContextSBSv2(sdk, platform, target, buidAlias, displayString, configID); + } else { + ISymbianSDK deadSDK = SymbianSDKFactory.createInstance(sdkID, "FIXME", "", new Version("0.0"), new Version("0.0")); + SDKCorePlugin.getSDKManager().addSDK(deadSDK); + + return new BuildContextSBSv2(deadSDK, platform, target, buidAlias, displayString, configID); + } + } + + + return null; + + } + @Override public void removeConfiguration(ICConfigurationDescription des, CConfigurationData data, IProgressMonitor monitor) { @@ -180,7 +296,8 @@ // as they are computed dynamically now. for (Iterator i = buildConfigType.getConfiguration().iterator(); i.hasNext();) { ConfigurationType currConfig = (ConfigurationType)i.next(); - ISymbianBuildContext context = SymbianBuildContext.getBuildContextFromDisplayName(currConfig.getName()); + // TODO: YUKCY! + ISymbianBuildContext context = BuildContextSBSv1.getBuildContextFromDisplayName(currConfig.getName()); IEnvironmentVarsInfo envSettings = new EnvironmentVarsInfo(project, context, currConfig.getEnvVars()); List varsFromSettings = envSettings.getModifiedEnvVarsListFromSettings(); List updatedEnvList = new ArrayList(); @@ -304,8 +421,8 @@ List configs = new ArrayList(); for (Iterator i = oldConfigInfo.getConfiguration().iterator(); i.hasNext();) { ConfigurationType currConfig = (ConfigurationType)i.next(); - - ISymbianBuildContext context = SymbianBuildContext.getBuildContextFromDisplayName(currConfig.getName()); + // TODO: YUCKY! + ISymbianBuildContext context = BuildContextSBSv1.getBuildContextFromDisplayName(currConfig.getName()); if (context != null) { configs.add(context); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/BrokenConfigurationInProjectTreeNode.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/BrokenConfigurationInProjectTreeNode.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/BrokenConfigurationInProjectTreeNode.java Wed Jul 21 12:11:48 2010 -0500 @@ -41,7 +41,7 @@ for (ICarbideBuildConfiguration config : buildConfigList) { if (config.getSDK().getUniqueId().equals(value.getUniqueId())) { - childConfig.add(config); + childConfig.add(config.getBuildContext()); } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Wed Jul 21 12:11:48 2010 -0500 @@ -17,6 +17,7 @@ package com.nokia.carbide.cdt.internal.api.builder.ui; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -24,6 +25,7 @@ import org.eclipse.jface.dialogs.TrayDialog; import org.eclipse.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.IColorProvider; import org.eclipse.jface.viewers.IFilter; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; @@ -34,6 +36,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -56,17 +59,19 @@ import com.nokia.carbide.cpp.internal.qt.core.QtConfigFilter; import com.nokia.carbide.cpp.internal.qt.core.QtCorePlugin; import com.nokia.carbide.cpp.internal.qt.core.QtSDKFilter; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; import com.nokia.carbide.cpp.sdk.core.ISDKManager; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.cpp.sdk.ui.shared.BuildTargetTreeNode; import com.nokia.cpp.internal.api.utils.core.Check; +import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; +@SuppressWarnings("restriction") public class ManageConfigurationsDialog extends TrayDialog { protected ContainerCheckedTreeViewer properSdkViewer; - protected ContainerCheckedTreeViewer missingSdkViewer; private FilteringContentProviderWrapper filteringContentProviderWrapper; private final ICarbideProjectInfo cpi; @@ -184,7 +189,28 @@ properSdkViewer = new ContainerCheckedTreeViewer(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); properSdkViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); - properSdkViewer.setLabelProvider(new LabelProvider()); + + class SDKNodeLabelProvider extends LabelProvider implements IColorProvider { + + public Color getForeground(Object element) { + if (element instanceof BuildTargetTreeNode){ + BuildTargetTreeNode treeNode = (BuildTargetTreeNode)element; + if (treeNode.getValue() instanceof ISymbianSDK){ + if (treeNode.toString().contains(BuildTargetTreeNode.SDK_NODE_ERROR_EPOCROOT_INVALID)){ + return WorkbenchUtils.getSafeShell().getDisplay().getSystemColor(SWT.COLOR_RED); + } + } + } + + return null; + } + + public Color getBackground(Object element) { + return null; + } + } + + properSdkViewer.setLabelProvider(new SDKNodeLabelProvider()); TreeNodeContentProvider treeNodeContentProvider = new TreeNodeContentProvider(); filteringContentProviderWrapper = new FilteringContentProviderWrapper(treeNodeContentProvider); @@ -202,36 +228,17 @@ final Label uninstalledSdkConfigLabel = new Label(container, SWT.NONE); uninstalledSdkConfigLabel.setToolTipText(Messages.getString("ManageConfigurationsDialog.Unavailable_Config_Label_ToolTip")); //$NON-NLS-1$ uninstalledSdkConfigLabel.setText(Messages.getString("ManageConfigurationsDialog.Unavailable_SDks_and_Configs")); //$NON-NLS-1$ - missingSdkViewer = new ContainerCheckedTreeViewer(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); - missingSdkViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); - missingSdkViewer.setLabelProvider(new LabelProvider()); - filteringContentProviderWrapper = - new FilteringContentProviderWrapper(treeNodeContentProvider); - missingSdkViewer.setContentProvider(filteringContentProviderWrapper); - missingSdkViewer.setInput(brokenTreeInput); - propagateMissingSdkTree(); - missingSdkViewer.addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - // Disclose the tree if the user selected the parent node - Object obj = event.getElement(); - if (obj instanceof BrokenConfigurationInProjectTreeNode){ - BrokenConfigurationInProjectTreeNode bttn = (BrokenConfigurationInProjectTreeNode)obj; - missingSdkViewer.setExpandedState(bttn, true); - } - validatePage(); - } - }); } final Label sdkStaticHelp = new Label(parent, SWT.WRAP); sdkStaticHelp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); sdkStaticHelp.setText(Messages.getString("ManageConfigurationsDialog.Select_config_help_text")); //$NON-NLS-1$ - Link fLink = new Link(parent, SWT.WRAP); - fLink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - fLink.setText(Messages.getString("ManageConfigurationsDialog.Select_Filtering_Prefs_Link")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - fLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); - fLink.addSelectionListener(new SelectionAdapter() { + Link configPrefLink = new Link(parent, SWT.WRAP); + configPrefLink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + configPrefLink.setText(Messages.getString("ManageConfigurationsDialog.Select_Filtering_Prefs_Link")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + configPrefLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); + configPrefLink.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // I don't see a way to open it to a specific tab, only the page if (Window.OK == PreferencesUtil.createPreferenceDialogOn(getShell(), "com.nokia.carbide.cpp.sdk.ui.preferences.BuildPlatformFilterPage", null, null, 0).open()){ //$NON-NLS-1$ @@ -240,6 +247,19 @@ } }); + Link sdkLink = new Link(parent, SWT.WRAP); + sdkLink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + sdkLink.setText(Messages.getString("ManageConfigurationsDialog.Select_SymbianSDKs_Prefs_Link")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + sdkLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); + sdkLink.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + // I don't see a way to open it to a specific tab, only the page + if (Window.OK == PreferencesUtil.createPreferenceDialogOn(getShell(), "com.nokia.carbide.cpp.sdk.ui.preferences.SDKPreferencePage", null, null, 0).open()){ //$NON-NLS-1$ + drawSDKConfigTree(); + } + } + }); + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, CarbideCPPBuilderUIHelpIds.CARBIDE_BUILDER_MANAGE_CONFIGURATIONS_DLG); return container; @@ -249,7 +269,12 @@ boolean sbsv2Project = CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject()); properSdkViewer.setContentProvider(filteringContentProviderWrapper); - properSdkViewer.setInput(BuildTargetTreeNode.getTreeViewerInput(sbsv2Project)); + BuildTargetTreeNode[] sdkConfigTreeNodes = BuildTargetTreeNode.getTreeViewerInput(sbsv2Project); + if (sbsv2Project){ + replaceFilteredConfigsFromProject(sdkConfigTreeNodes); + } + + properSdkViewer.setInput(sdkConfigTreeNodes); propagateSdkTree(); properSdkViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { @@ -266,6 +291,98 @@ } /** + * When displaying build configs there may be configurations in the project that may not be displayed + * We add those back in so they reside in the checked tree viewer in case the user wants to remove them. + * @param sdkConfigTreeNodes + */ + private void replaceFilteredConfigsFromProject(BuildTargetTreeNode[] sdkConfigTreeNodes) { + List bldConfigs = cpi.getBuildConfigurations(); + + HashMap> missingConfigMap = new HashMap>(); + for (ICarbideBuildConfiguration config : bldConfigs){ + boolean foundConfig = false; + // Add in configs that are only defined in the project and not the + // suggested filtered config cache + for (BuildTargetTreeNode sdkConfigNode : sdkConfigTreeNodes){ + ISymbianSDK sdk = sdkConfigNode.getSymbianSDK(); + if (!sdk.getUniqueId().equals(config.getSDK().getUniqueId())){ + continue; // not in this SDK, don't bother looking at all configs + } else { + // Found the right SDK, now check and see if the config exists + TreeNode[] configNodes = sdkConfigNode.getChildren(); + if (configNodes != null){ + for (TreeNode childConfig : configNodes){ + if (childConfig == null){ + continue; + } + if (childConfig.getValue() instanceof ISymbianBuildContext){ + ISymbianBuildContext context = (ISymbianBuildContext)(childConfig.getValue()); + if (config.getBuildContext().equals(context)){ + foundConfig = true; + break; + } + } + } + } + if (!foundConfig){ + // save config off, we'll add it back in later + List contextsToAdd = new ArrayList(); + if (null == missingConfigMap.get(sdkConfigNode)){ + contextsToAdd.add(config.getBuildContext()); + } else { + contextsToAdd = missingConfigMap.get(sdkConfigNode); + contextsToAdd.add(config.getBuildContext()); + } + missingConfigMap.put(sdkConfigNode, contextsToAdd); + + } + } + } + } + + for (BuildTargetTreeNode sdkNode : missingConfigMap.keySet()){ + List configsToAdd = missingConfigMap.get(sdkNode); + TreeNode[] oldConfigNodes = sdkNode.getChildren(); + if (oldConfigNodes == null || oldConfigNodes.length == 0){ + continue; + } + TreeNode[] newConfigNodes = new TreeNode[oldConfigNodes.length + configsToAdd.size()]; + int index = 0; + // build up the old list.... + for (TreeNode newConfigNode : oldConfigNodes){ + if (newConfigNode == null){ + continue; + } + if (newConfigNode.getValue() instanceof ISymbianBuildContext){ + ISymbianBuildContext context = (ISymbianBuildContext)(newConfigNode.getValue()); + newConfigNodes[index++] = new TreeNode(context) { + @Override + public String toString() { + ISymbianBuildContext context = (ISymbianBuildContext)getValue(); + return context.getDisplayString(); + } + }; + } + } + + // ... then add the project specific items... + for (ISymbianBuildContext newContext : configsToAdd){ + newConfigNodes[index++] = new TreeNode(newContext) { + @Override + public String toString() { + ISymbianBuildContext context = (ISymbianBuildContext)getValue(); + return context.getDisplayString(); + } + }; + } + + sdkNode.setChildren(newConfigNodes); + + } + + } + + /** * Create contents of the button bar * @param parent */ @@ -309,17 +426,19 @@ ISymbianBuildContext buildContext = (ISymbianBuildContext)currConfigNode.getValue(); for (ICarbideBuildConfiguration currExistingConfig : buildConfigList){ boolean checkIt = false; - checkIt = currExistingConfig.equals(buildContext); + checkIt = currExistingConfig.getBuildContext().equals(buildContext); if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject()) && - !checkIt && currExistingConfig.getSBSv2Alias() == null){ + !checkIt){ - // extra check to see if we're using SBSv2 and config display name is older SBSv1 style - if (buildContext.getTargetString().equals(currExistingConfig.getTargetString()) && - buildContext.getPlatformString().equals(currExistingConfig.getPlatformString()) && - buildContext.getSDK().getUniqueId().equals(currExistingConfig.getSDK().getUniqueId() ) - && buildContext.getSBSv2Alias() != null && buildContext.getSBSv2Alias().split("_").length == 2){ - - checkIt = true; + if (buildContext instanceof ISBSv2BuildContext){ + ISBSv2BuildContext v2Context = (ISBSv2BuildContext)buildContext; + ISBSv2BuildContext currV2Context = (ISBSv2BuildContext)currExistingConfig.getBuildContext(); + // extra check to see if we're using SBSv2 and config display name is older SBSv1 style + if (currV2Context.getConfigID().startsWith(ISBSv2BuildContext.BUILDER_ID)){ + if (v2Context.getConfigID().equals(currV2Context.getConfigID()) ){ + checkIt = true; + } + } } } if (checkIt){ @@ -336,19 +455,6 @@ properSdkViewer.refresh(); } - private void propagateMissingSdkTree() { - TreeItem[] items = missingSdkViewer.getTree().getItems(); - // all nodes in this tree are select, as the tree only reflect selected config with bad SDK - for (int i=0; iPlatform Filtering Preferences to configure displayed build configurations. +ManageConfigurationsDialog.Select_Filtering_Prefs_Link=\n See Build Configuration Filtering Preferences to configure displayed build configurations. +ManageConfigurationsDialog.Select_SymbianSDKs_Prefs_Link=\n See Symbian SDKs to manage your Symbian SDK installations. MMPSelectionUI.BuildOrderColumnLabel=Build order MMPSelectionUI.FileNameColumnLabel=File name diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java Wed Jul 21 12:11:48 2010 -0500 @@ -48,6 +48,8 @@ import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; import com.nokia.cpp.internal.api.utils.core.TextUtils; /** @@ -125,7 +127,13 @@ @Override public String getId() { - return carbideBuildConfig.getDisplayString(); + if (carbideBuildConfig.getBuildContext() instanceof ISBSv1BuildContext){ + return carbideBuildConfig.getDisplayString(); + } else if (carbideBuildConfig.getBuildContext() instanceof ISBSv2BuildContext) { + return ((ISBSv2BuildContext)carbideBuildConfig.getBuildContext()).getConfigID(); + } + + return null; } @Override @@ -277,7 +285,7 @@ ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(cpi.getProject()); if (projDes != null) { - ICConfigurationDescription configDes = projDes.getConfigurationById(carbideBuildConfig.getDisplayString()); + ICConfigurationDescription configDes = projDes.getConfigurationById(carbideBuildConfig.getConfigurationID()); if (configDes != null) { String sourcesCacheValue = ""; for (ICSourceEntry src : sourceEntries) { @@ -308,7 +316,7 @@ try { ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(project); if (projDes != null) { - ICConfigurationDescription configDes = projDes.getConfigurationById(carbideBuildConfig.getDisplayString()); + ICConfigurationDescription configDes = projDes.getConfigurationById(((CarbideBuildConfiguration)carbideBuildConfig).getConfigurationID()); if (configDes != null) { ICStorageElement storage = configDes.getStorage(CONFIG_DATA_CACHE, false); if (storage != null) { diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,6 +16,7 @@ */ package com.nokia.carbide.cdt.internal.builder; +import java.io.File; import java.util.ArrayList; import java.util.List; @@ -31,6 +32,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import com.nokia.carbide.cdt.builder.BuildArgumentsInfo; @@ -44,26 +46,32 @@ import com.nokia.carbide.cdt.builder.project.IROMBuilderInfo; import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; import com.nokia.carbide.cdt.internal.api.builder.SISBuilderInfo2; -import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; import com.nokia.carbide.cpp.internal.api.sdk.SDKManagerInternalAPI; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.cpp.internal.api.utils.core.TrackedResource; -public class CarbideBuildConfiguration extends SymbianBuildContext implements ICarbideBuildConfiguration { +public class CarbideBuildConfiguration implements ICarbideBuildConfiguration { static final String NOT_INSTALLED = "(SDK not found)"; //$NON-NLS-1$ - protected static final String CARBIDE_STORAGE_ID = "CarbideConfigurationDataProvider"; //$NON-NLS-1$ + public static final String CARBIDE_STORAGE_ID = "CarbideConfigurationDataProvider"; //$NON-NLS-1$ protected final static String SIS_BUILDER_DATA_ID = "SIS_BUILDER_DATA_ID"; //$NON-NLS-1$ protected final static String ENV_VAR_DATA_ID = "ENV_VAR_DATA_ID"; //$NON-NLS-1$ protected final static String ARGUMENTS_DATA_ID = "ARGUMENTS_DATA_ID"; //$NON-NLS-1$ protected final static String ROM_BUILDER_DATA_ID = "ROM_BUILDER_DATA_ID"; //$NON-NLS-1$ // SBSv2 only config settings - protected final static String SBSV2_DATA_ID = "SBSV2_DATA_ID"; //$NON-NLS-1$ + public final static String SBSV2_DATA_ID = "SBSV2_DATA_ID"; //$NON-NLS-1$ + protected ISymbianBuildContext context; protected TrackedResource projectTracker; protected List sisBuilderInfoList; protected EnvironmentVarsInfo2 envVarsInfo; @@ -73,8 +81,16 @@ protected SBSv2BuilderInfo sbsv2BuilderInfo; protected boolean rebuildNeeded; + /** + * TODO: Target constants - copied from ISymbianBuildContext + */ + + public static final String DEBUG_TARGET = "UDEB"; + + public static final String RELEASE_TARGET = "UREL"; + public CarbideBuildConfiguration(IProject project, ISymbianBuildContext context) { - super(context.getSDK(), context.getPlatformString(), context.getTargetString(), context.getSBSv2Alias()); + this.context = context; projectTracker = new TrackedResource(project); sisBuilderInfoList = new ArrayList(0); envVarsInfo = new EnvironmentVarsInfo2(project, context); @@ -82,9 +98,10 @@ buildConfigData = new BuildConfigurationData(this); romBuilderInfo = new ROMBuilderInfo(getSDK()); if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project)){ - sbsv2BuilderInfo = new SBSv2BuilderInfo(context); + sbsv2BuilderInfo = new SBSv2BuilderInfo((ISBSv2BuildContext)context); } rebuildNeeded = true; + } public void loadFromStorage(ICConfigurationDescription projDes) throws CoreException { @@ -255,7 +272,8 @@ try { ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(projectTracker.getProject()); if (projDes != null) { - ICConfigurationDescription configDes = projDes.getConfigurationById(getDisplayString()); + + ICConfigurationDescription configDes = projDes.getConfigurationById(getConfigurationID()); if (configDes != null) { // save the CDT project description. this saves all configs but that's the // only thing CDT allows at this point. @@ -271,6 +289,18 @@ return false; } + /** + * Get the unique ID for this build configuration. + * For ABLD it is the display name, for SBSv2, it is the builder ID + * @return + */ + public String getConfigurationID() { + if (context instanceof ISBSv2BuildContext){ + return ((ISBSv2BuildContext) context).getConfigID(); + } + return context.getDisplayString(); + } + public List getSISBuilderInfoList() { return sisBuilderInfoList; } @@ -292,16 +322,24 @@ public int getErrorParserId(){ String plat = this.getPlatformString(); - if (this.getSBSv2Alias() != null && this.getSBSv2Alias().toUpperCase().contains(ISymbianBuildContext.GCCE_PLATFORM)){ - return ERROR_PARSERS_GCCE; - } - - if (plat.equals(ISymbianBuildContext.EMULATOR_PLATFORM)){ - return ERROR_PARSERS_WINSCW; - } else if (plat.startsWith("ARMV")){ - return ERROR_PARSERS_ARMVx; - } else if (plat.equals(ISymbianBuildContext.GCCE_PLATFORM)){ - return ERROR_PARSERS_GCCE; + if (context instanceof ISBSv2BuildContext){ + String toolChain = ((ISBSv2BuildContext)context).getToolChain(); + if (toolChain.equalsIgnoreCase(ISBSv2BuildContext.TOOLCHAIN_ARM)){ + return ERROR_PARSERS_ARMVx; + } else if (toolChain.equalsIgnoreCase(ISBSv2BuildContext.TOOLCHAIN_GCCE)){ + return ERROR_PARSERS_GCCE; + } else if (toolChain.equalsIgnoreCase(ISBSv2BuildContext.TOOLCHAIN_WINSCW)){ + return ERROR_PARSERS_WINSCW; + } + } else { + // SBSV1 + if (plat.equals(ISBSv1BuildContext.EMULATOR_PLATFORM)){ + return ERROR_PARSERS_WINSCW; + } else if (plat.startsWith("ARMV")){ + return ERROR_PARSERS_ARMVx; + } else if (plat.equals(ISBSv1BuildContext.GCCE_PLATFORM)){ + return ERROR_PARSERS_GCCE; + } } return ERROR_PARSERS_ALL; @@ -358,7 +396,7 @@ public static String toMarkedConfig(String config) { if (config == null) return null; - if (SDKManagerInternalAPI.getMissingSdk(SymbianBuildContext.getSDKIDFromConfigName(config)) != null) { + if (SDKManagerInternalAPI.getMissingSdk(BuildContextSBSv1.getSDKIDFromConfigName(config)) != null) { return badSdkString() + config; } return config; @@ -401,7 +439,7 @@ List buildConfig = new ArrayList(); List normalMakMakePaths = new ArrayList(); List testMakMakePaths = new ArrayList(); - buildConfig.add(this); + buildConfig.add(this.getBuildContext()); EpocEngineHelper.getMakMakeFiles(cpi.getAbsoluteBldInfPath(), buildConfig, normalMakMakePaths, testMakMakePaths, new NullProgressMonitor()); for (IPath mmpPath : normalMakMakePaths){ @@ -418,15 +456,19 @@ } public IPath getTargetOutputDirectory() { - String releasePlatform = getSDK().getBSFCatalog().getReleasePlatform(getBasePlatformForVariation()); - if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(getCarbideProject().getProject())){ - // Test is this is an SBSv2 build binary variant (changes the output directory) - ISBSv2BuildConfigInfo sbsv2Info = getSBSv2BuildConfigInfo(); - if ( sbsv2Info != null && SBSv2Utils.getVariantOutputDirModifier(sbsv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT)) != null && !releasePlatform.contains(".") ){ - releasePlatform = releasePlatform + SBSv2Utils.getVariantOutputDirModifier(sbsv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT)); + if (context instanceof ISBSv2BuildContext){ + if (((ISBSv2BuildContext) context).getConfigQueryData() != null){ + return new Path(((ISBSv2BuildContext)context).getConfigQueryData().getOutputPathString()); + } else { + return new Path("/" + SBSv2QueryUtils.BAD_EPOCROOT); } - } - return getSDK().getReleaseRoot().append(releasePlatform.toLowerCase()).append(getTargetString().toLowerCase()); + } else { + ISymbianSDK sdk = getSDK(); + ISBSv1BuildContext v1Context = (ISBSv1BuildContext)context; + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + String releasePlatform = sbsv1BuildInfo.getBSFCatalog().getReleasePlatform(v1Context.getBasePlatformForVariation()); + return sdk.getReleaseRoot().append(releasePlatform.toLowerCase()).append(getTargetString().toLowerCase()); + } } public boolean getRebuildNeeded() { @@ -436,5 +478,47 @@ public void setRebuildNeeded(boolean value) { rebuildNeeded = value; } + + public ISymbianSDK getSDK() { + return context.getSDK(); + } + + public String getPlatformString() { + return context.getPlatformString(); + } + + public String getTargetString() { + return context.getTargetString(); + } + + public String getDisplayString() { + return context.getDisplayString(); + } + + public ISymbianBuildContext getBuildContext() { + return context; + } + + public List getCompilerMacros() { + return context.getCompilerMacros(); + } + + public IPath getCompilerPrefixFile() { + return context.getCompilerPrefixFile(); + } + + public List getVariantHRHDefines() { + return context.getVariantHRHDefines(); + } + + public List getPrefixFileIncludes() { + return context.getPrefixFileIncludes(); + } + + public String getBuildVariationName() { + return context.getBuildVariationName(); + } + + } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java Wed Jul 21 12:11:48 2010 -0500 @@ -389,19 +389,22 @@ CarbideBuilderPlugin.getDefault().getPreferenceStore().setValue(CONVERTED_SRC_MAPPINGS_2X_TO_3X, true); } - synchronized(projectInfoMap){ - for (IProject currPrj : projectInfoMap.keySet()){ - try { - ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(currPrj); - if (projDes != null) { - CCorePlugin.getDefault().setProjectDescription(currPrj, projDes, true, null); - } - } catch (CoreException e) { - e.printStackTrace(); - CarbideBuilderPlugin.log(e); - } - } - } + // TODO: This is causing deadlocks with the indexer and generally when other project info is being retrieved + // Need to consider what this is actually doing and why it even needs to be here. + +// synchronized(projectInfoMap){ +// for (IProject currPrj : projectInfoMap.keySet()){ +// try { +// ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(currPrj); +// if (projDes != null) { +// CCorePlugin.getDefault().setProjectDescription(currPrj, projDes, true, null); +// } +// } catch (CoreException e) { +// e.printStackTrace(); +// CarbideBuilderPlugin.log(e); +// } +// } +// } } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java Wed Jul 21 12:11:48 2010 -0500 @@ -17,25 +17,48 @@ package com.nokia.carbide.cdt.internal.builder; import java.io.File; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.settings.model.*; +import org.eclipse.cdt.core.settings.model.CIncludePathEntry; +import org.eclipse.cdt.core.settings.model.CMacroEntry; +import org.eclipse.cdt.core.settings.model.CMacroFileEntry; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICSettingEntry; +import org.eclipse.cdt.core.settings.model.ICStorageElement; import org.eclipse.cdt.core.settings.model.extension.CLanguageData; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ProjectScope; -import org.eclipse.core.runtime.*; -import org.eclipse.core.runtime.content.*; -import org.eclipse.swt.widgets.Display; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.content.IContentType; +import org.eclipse.core.runtime.content.IContentTypeManager; +import org.eclipse.core.runtime.content.IContentTypeSettings; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView; import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISBVPlatform; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.cpp.internal.api.utils.core.FileUtils; import com.nokia.cpp.internal.api.utils.core.TextUtils; /** @@ -174,10 +197,18 @@ CarbideProjectInfo cpi = (CarbideProjectInfo)carbideBuildConfig.getCarbideProject(); IProject project = cpi.getProject(); + ISymbianSDK sdk = carbideBuildConfig.getSDK(); + ISymbianBuildContext context = carbideBuildConfig.getBuildContext(); // add platform includes first - IBSFPlatform platform = carbideBuildConfig.getSDK().getBSFCatalog().findPlatform(carbideBuildConfig.getPlatformString()); - ISBVPlatform sbvPlat = carbideBuildConfig.getSDK().getSBVCatalog().findPlatform(carbideBuildConfig.getPlatformString()); + IBSFPlatform platform = null; + ISBVPlatform sbvPlat = null; + if (context instanceof ISBSv1BuildContext) { + // SBSv1 only + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + platform = sbsv1BuildInfo.getBSFCatalog().findPlatform(carbideBuildConfig.getPlatformString()); + sbvPlat = sbsv1BuildInfo.getSBVCatalog().findPlatform(carbideBuildConfig.getPlatformString()); + } if (platform != null) { IPath[] systemIncludePaths = platform.getSystemIncludePaths(); for (IPath path : systemIncludePaths) { @@ -224,7 +255,7 @@ } // add OEM dir - File oemDir = carbideBuildConfig.getSDK().getIncludePath().append("oem").toFile(); + File oemDir = sdk.getIncludePath().append("oem").toFile(); if (oemDir.exists()) { includeEntries.add(new CIncludePathEntry(new Path(oemDir.getAbsolutePath()), 0)); } @@ -237,8 +268,21 @@ Map macros = new HashMap(); // platform macros - for (String platMacro : carbideBuildConfig.getSDK().getPlatformMacros(carbideBuildConfig.getPlatformString())) { - macros.put("__" + platMacro + "__", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (context instanceof ISBSv1BuildContext) { + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + // platform macros + for (String platMacro : sbsv1BuildInfo.getPlatformMacros(carbideBuildConfig.getPlatformString())) { + macros.put("__" + platMacro + "__", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + // vendor macros (e.g. __SERIES60_3x__) + for (String builtinMacro : sbsv1BuildInfo.getVendorSDKMacros()) { + macros.put(builtinMacro, ""); //$NON-NLS-1$ + } + } else { + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + // platform macros + macros.putAll(sbsv2BuildInfo.getPlatformMacros(carbideBuildConfig.getPlatformString())); } // built in macros @@ -246,19 +290,22 @@ macros.put(builtinMacro, ""); //$NON-NLS-1$ } - // vendor macros (e.g. __SERIES60_3x__) - for (String builtinMacro : carbideBuildConfig.getSDK().getVendorSDKMacros()) { - macros.put(builtinMacro, ""); //$NON-NLS-1$ - } - // target type macros (e.g. __DLL__) List targetTypes = EpocEngineHelper.getTargetTypesForBuildConfiguration(carbideBuildConfig); // only add these if there is one target type. this is the case when there is only one mmp file, or // more than one but all have the same target type macro. it wouldn't make sense to add different // target type macros like __EXE__ and __DLL__. if (targetTypes.size() == 1) { - for (String targetTypeMacro : carbideBuildConfig.getSDK().getTargetTypeMacros(targetTypes.get(0))) { - macros.put(targetTypeMacro, ""); //$NON-NLS-1$ + if (context instanceof ISBSv1BuildContext) { + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + for (String targetTypeMacro : sbsv1BuildInfo.getTargetTypeMacros(targetTypes.get(0))) { + macros.put(targetTypeMacro, ""); //$NON-NLS-1$ + } + } else { + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + for (String targetTypeMacro : sbsv2BuildInfo.getTargetTypeMacros(targetTypes.get(0))) { + macros.put(targetTypeMacro, ""); //$NON-NLS-1$ + } } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -24,6 +24,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICStorageElement; import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; +import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; @@ -302,6 +303,13 @@ ICConfigurationDescription config = projectDescription.getActiveConfiguration(); if (config != null) { CConfigurationData data = config.getConfigurationData(); + if (data == null){ + // TODO: HACK. FOR REASONS I DON'T GET RIGHT NOW, IF I CREATE A VARIANT AND SAVE IT'S + // OK. BUT IF I CLOSE AND RE-OPEN THE PROJECT THE DEFAULT CONFIG DATA IS NOT LOADED. + // SO JUST LOAD THE FIRST IN THE LIST. THIS NEEDS TO BE ADDRESSED. + ICConfigurationDescription[] config2 = projectDescription.getConfigurations(); + data = config2[0].getConfigurationData(); + } if (data instanceof BuildConfigurationData) { return ((BuildConfigurationData)data).getConfiguration(); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,22 +16,32 @@ */ package com.nokia.carbide.cdt.internal.builder; +import java.util.ArrayList; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICStorageElement; +import org.eclipse.cdt.core.settings.model.WriteAccessException; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Plugin; + import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier; import com.nokia.carbide.cdt.internal.api.builder.CarbideConfigurationDataProvider; import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContextDataCache; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.cpp.internal.api.utils.core.Logging; -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.settings.model.*; -import org.eclipse.core.runtime.*; - -import java.util.ArrayList; - public class CarbideProjectModifier extends CarbideProjectInfo implements ICarbideProjectModifier { // need to make all changes to the same description and save it diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,35 +16,76 @@ */ package com.nokia.carbide.cdt.internal.builder; -import java.io.*; -import java.util.*; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileFilter; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; -import org.eclipse.cdt.make.core.makefile.*; +import org.eclipse.cdt.make.core.makefile.ICommand; +import org.eclipse.cdt.make.core.makefile.IMacroDefinition; +import org.eclipse.cdt.make.core.makefile.IRule; +import org.eclipse.cdt.make.core.makefile.ITargetRule; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.dialogs.*; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.*; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; -import com.nokia.carbide.cdt.builder.*; +import com.nokia.carbide.cdt.builder.BuilderPreferenceConstants; +import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.DefaultGNUMakefileViewConfiguration; +import com.nokia.carbide.cdt.builder.DefaultMMPViewConfiguration; +import com.nokia.carbide.cdt.builder.DefaultViewConfiguration; +import com.nokia.carbide.cdt.builder.EpocEngineHelper; +import com.nokia.carbide.cdt.builder.EpocEnginePathHelper; import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; import com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher; -import com.nokia.carbide.cdt.builder.project.*; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.internal.builder.ui.MMPChangedActionDialog; +import com.nokia.carbide.cdt.internal.builder.ui.MMPChangedActionDialog.MMPChangedAction; import com.nokia.carbide.cdt.internal.builder.ui.TrackDependenciesQueryDialog; -import com.nokia.carbide.cdt.internal.builder.ui.MMPChangedActionDialog.MMPChangedAction; -import com.nokia.carbide.cpp.epoc.engine.*; +import com.nokia.carbide.cpp.epoc.engine.BldInfViewRunnableAdapter; +import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; +import com.nokia.carbide.cpp.epoc.engine.MMPDataRunnableAdapter; import com.nokia.carbide.cpp.epoc.engine.model.IModel; import com.nokia.carbide.cpp.epoc.engine.model.IModelProvider; import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfView; import com.nokia.carbide.cpp.epoc.engine.model.makefile.IMakefileView; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.*; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPLanguage; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPResource; import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; import com.nokia.carbide.cpp.internal.qt.core.QtCorePlugin; -import com.nokia.carbide.cpp.sdk.core.*; +import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBVPlatform; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.cpp.internal.api.utils.core.FileUtils; import com.nokia.cpp.internal.api.utils.core.HostOS; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; @@ -98,14 +139,18 @@ areWeManagingTheMakeFiles = shouldManageMakeFiles(buildConfig); // if variant BSF, let them know the other platforms that will be built as a result - IBSFPlatform[] bsfPlatforms = buildConfig.getSDK().getBSFCatalog().getAdditionalBuiltPlatforms(buildConfig.getPlatformString()); - if (bsfPlatforms.length > 0) { - String plats = ""; - for (IBSFPlatform plat : bsfPlatforms) { - plats = ", " + plat.getName(); + ISymbianSDK sdk = buildConfig.getSDK(); + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + if (sbsv1BuildInfo != null) { + IBSFPlatform[] bsfPlatforms = sbsv1BuildInfo.getBSFCatalog().getAdditionalBuiltPlatforms(buildConfig.getPlatformString()); + if (bsfPlatforms.length > 0) { + String plats = ""; + for (IBSFPlatform plat : bsfPlatforms) { + plats = ", " + plat.getName(); + } + plats = plats.replaceFirst(", ", ""); + launcher.writeToConsole("\n***Additionally built platforms: " + plats + "\n"); } - plats = plats.replaceFirst(", ", ""); - launcher.writeToConsole("\n***Additionally built platforms: " + plats + "\n"); } } @@ -123,11 +168,11 @@ String componentName = componentPath.removeFileExtension().lastSegment(); String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), componentPath)){ buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig.getBuildContext()).getBasePlatformForVariation().toLowerCase(); } // need to run individual build steps when managing makefiles or doing concurrent builds @@ -305,11 +350,11 @@ String componentName = componentPath.removeFileExtension().lastSegment(); String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), componentPath)){ buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } SubMonitor progress = SubMonitor.convert(monitor, 2); @@ -368,11 +413,11 @@ String componentName = componentPath.removeFileExtension().lastSegment(); String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), componentPath)){ buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } // run abld makefile platform for each component to be built if needed @@ -425,7 +470,7 @@ } List buildConfigList = new ArrayList(1); - buildConfigList.add(buildConfig); + buildConfigList.add(buildConfig.getBuildContext()); List normalMakMakePaths = new ArrayList(); List testMakMakePaths = new ArrayList(); @@ -520,7 +565,7 @@ modelProvider.releaseSharedModel(model); IPath objectDir = null; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(cpi, fullMMPPath)){ // if symbian binary variation, then the object file dir will be in sub-directory with /udeb/ // The platform can only be a variant if the MMP file has FEATUREVARIANT keyword && The platform is ARMV5-based. @@ -597,7 +642,7 @@ final List rules = new ArrayList(); EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, - new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { @@ -710,13 +755,14 @@ // add the following to the top of the the Deps_GenDependsL subroutine in makdeps.pm String change = "\r\n\t# Carbide.c++ change. See CARBIDE_CHANGES.TXT for more details.\r\n\tif ($ENV{CARBIDE_NO_DEPENDENCIES}) {\r\n\t\treturn;\r\n\t}\r\n"; + IPath toolsPath = sdk.getToolsPath(); boolean updated = false; try { - File mdFile = sdk.getToolsPath().append("makdeps.pm").toFile(); + File mdFile = toolsPath.append("makdeps.pm").toFile(); RandomAccessFile makDepsFile = new RandomAccessFile(mdFile, "rw"); // back up the file first - File backupFile = sdk.getToolsPath().append("makdeps.pmbak").toFile(); + File backupFile = toolsPath.append("makdeps.pmbak").toFile(); if (backupFile.createNewFile()) { FileUtils.copyFile(mdFile, backupFile); } @@ -753,7 +799,7 @@ } // now create the CARBIDE_CHANGES.TXT file - File ourFile = sdk.getToolsPath().append(CARBIDE_CHANGES_FILE).toFile(); + File ourFile = toolsPath.append(CARBIDE_CHANGES_FILE).toFile(); try { if (!ourFile.createNewFile()) { return false; @@ -1123,13 +1169,13 @@ for (IPath path : normalMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } List argsList = new ArrayList(); @@ -1155,13 +1201,13 @@ for (IPath path : testMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } List argsList = new ArrayList(); @@ -1250,13 +1296,13 @@ for (IPath path : normalMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } argsList.clear(); @@ -1282,13 +1328,13 @@ for (IPath path : normalMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } argsList.clear(); @@ -1315,13 +1361,13 @@ for (IPath path : normalMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } argsList.clear(); @@ -1346,13 +1392,13 @@ // run abld final platform target for each component for (IPath path : normalMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } argsList.clear(); @@ -1400,13 +1446,13 @@ for (IPath path : testMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } argsList.clear(); @@ -1433,13 +1479,13 @@ for (IPath path : testMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } argsList.clear(); @@ -1467,13 +1513,13 @@ for (IPath path : testMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } argsList.clear(); @@ -1500,13 +1546,13 @@ for (IPath path : testMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } argsList.clear(); @@ -1669,13 +1715,13 @@ for (IPath path : normalMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } List argsList = new ArrayList(); @@ -1844,13 +1890,13 @@ for (IPath path : normalMakMakePaths) { String buildPlatform = ""; - if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( buildConfig.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), path)) { buildPlatform = buildConfig.getPlatformString().toLowerCase(); - } else { - buildPlatform = buildConfig.getBasePlatformForVariation().toLowerCase(); + } else if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)buildConfig).getBasePlatformForVariation().toLowerCase(); } List argsList = new ArrayList(); @@ -2261,7 +2307,7 @@ } // we need to check the variant hrh files as well - File prefixFile = config.getSDK().getPrefixFile(); + File prefixFile = config.getSDK().getPrefixFile(ISymbianBuilderID.SBSV1_BUILDER); if (prefixFile != null && prefixFile.lastModified() > oldestMakefileTimestamp) { return true; } @@ -2275,7 +2321,7 @@ // all make files exist. now make sure the oldest of them is newer than the bld.inf or any of its includes final long finalOldestMakefileTimestamp = oldestMakefileTimestamp; Boolean regenerate = (Boolean)EpocEnginePlugin.runWithBldInfView(bldInfPath, - new DefaultViewConfiguration(config, bldInfPath, new AcceptedNodesViewFilter()), + new DefaultViewConfiguration(config.getBuildContext(), bldInfPath, new AcceptedNodesViewFilter()), new BldInfViewRunnableAdapter() { public Object run(IBldInfView view) { for (IPath file : view.getReferencedFiles()) { @@ -2308,7 +2354,7 @@ // delete the *.uid.cpp file if it exists so it gets regenerated. makmake won't regenerate it if only an mmp include // file has changed. see bug #4590 for details. - if (config.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (config.getPlatformString().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { File uidFile = new Path(getMakefileForMMP(config, componentPath).getAbsolutePath()).removeFileExtension().addFileExtension("UID.CPP").toFile(); if (uidFile.exists()) { uidFile.delete(); @@ -2325,11 +2371,11 @@ } String buildPlatform = ""; - if ( config.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) && + if ( config.getPlatformString().startsWith(ISBSv1BuildContext.ARMV5_PLATFORM) && EpocEngineHelper.hasFeatureVariantKeyword(config.getCarbideProject(), componentPath)){ buildPlatform = config.getPlatformString().toLowerCase(); - } else { - buildPlatform = config.getBasePlatformForVariation().toLowerCase(); + } else if (config.getBuildContext() instanceof ISBSv1BuildContext) { + buildPlatform = ((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation().toLowerCase(); } abldArgs.add(MAKEFILE_CMD); //$NON-NLS-1$ @@ -2382,7 +2428,7 @@ final long makefileTimestamp = makefile.lastModified(); // we need to check the variant hrh files as well - File prefixFile = config.getSDK().getPrefixFile(); + File prefixFile = config.getSDK().getPrefixFile(ISymbianBuilderID.SBSV1_BUILDER); if (prefixFile != null && prefixFile.lastModified() > makefileTimestamp) { return true; } @@ -2395,7 +2441,7 @@ // see if the makefile is newer than the mmp and all of its includes Boolean regenerate = (Boolean)EpocEnginePlugin.runWithMMPData(componentPath, - new DefaultMMPViewConfiguration(cpi.getProject(), config, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(cpi.getProject(), config.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData data) { for (IPath path : data.getReferencedFiles()) { @@ -2465,7 +2511,7 @@ final long makefileTimestamp = makefile.lastModified(); // we need to check the variant hrh files as well - File prefixFile = config.getSDK().getPrefixFile(); + File prefixFile = config.getSDK().getPrefixFile(ISymbianBuilderID.SBSV1_BUILDER); if (prefixFile != null && prefixFile.lastModified() > makefileTimestamp) { return true; } @@ -2478,7 +2524,7 @@ // see if the makefile is newer than the mmp and all of its includes Boolean regenerate = (Boolean)EpocEnginePlugin.runWithMMPData(componentPath, - new DefaultMMPViewConfiguration(cpi.getProject(), config, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(cpi.getProject(), config.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData data) { for (IPath path : data.getReferencedFiles()) { @@ -2547,11 +2593,11 @@ String platformName = ""; if (EpocEngineHelper.hasFeatureVariantKeyword(config.getCarbideProject(), componentPath)){ platformName = config.getPlatformString().toUpperCase(); - } else { - platformName = config.getBasePlatformForVariation(); + } else if (config.getBuildContext() instanceof ISBSv1BuildContext) { + platformName = ((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation(); } - makefilePath = makefilePath.append(config.getBasePlatformForVariation().toUpperCase()); + makefilePath = makefilePath.append(((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation().toUpperCase()); // and the makefile has the form MMPNAME.PLATFORM makefilePath = makefilePath.append(mmpName + "." + platformName); @@ -2607,7 +2653,7 @@ // .d for everything but WINSCW String dependencyFileExt = "d"; - if (config.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (config.getPlatformString().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { dependencyFileExt = "dep"; } @@ -2624,7 +2670,7 @@ // now add the -MD switch to the compiler args final String platform = config.getPlatformString(); - if (platform.equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (platform.equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { // append the -MD and -gccdep switches to the CWFLAGS macro IMacroDefinition[] macros = view.getAllMacroDefinitions("CWFLAGS"); if (macros.length < 1) { @@ -2639,7 +2685,7 @@ macroText = macroText + " -MD -gccdep" + view.getEOL(); view.replaceDirective(macro, macroText); - } else if (platform.equals(ISymbianBuildContext.GCCE_PLATFORM)) { + } else if (platform.equals(ISBSv1BuildContext.GCCE_PLATFORM)) { // append the -MD switch to the CCFLAGS macro. there may be more than one so take the last one IMacroDefinition[] macros = view.getAllMacroDefinitions("CCFLAGS"); if (macros.length < 1) { @@ -2778,7 +2824,7 @@ // find the macros we need to pass, and replace the -u switch with them String macros = null; - if (platform.equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (platform.equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { // the macros are listed in the CWDEFS macro IMacroDefinition[] defs = view.getAllMacroDefinitions("CWDEFS"); if (defs.length != 1) { @@ -2793,7 +2839,7 @@ macros = macros.replaceAll("\"", ""); macros = macros.replaceAll("-d ", "-D"); - } else if (platform.equals(ISymbianBuildContext.GCCE_PLATFORM)) { + } else if (platform.equals(ISBSv1BuildContext.GCCE_PLATFORM)) { // the macros are listed in the CCDEFS macro IMacroDefinition[] defs = view.getAllMacroDefinitions("CCDEFS"); if (defs.length != 1) { @@ -2835,8 +2881,11 @@ } // add the compiler prefix file if any - ISBVPlatform sbvPlatform = config.getSDK().getSBVCatalog().findPlatform(config.getPlatformString()); - File sdkPrefix = config.getSDK().getPrefixFile(); + ISymbianSDK sdk = config.getSDK(); + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + ISBVPlatform sbvPlatform = sbsv1BuildInfo.getSBVCatalog().findPlatform(config.getPlatformString()); + File sdkPrefix = sdk.getPrefixFile(ISymbianBuilderID.SBSV1_BUILDER); + if (sbvPlatform != null){ // might be an alternate HRH file to use IPath varVarHRH = sbvPlatform.getBuildVariantHRHFile(); @@ -2906,8 +2955,8 @@ } boolean moveDepFile = false; - if (!platform.equals(ISymbianBuildContext.EMULATOR_PLATFORM) && - !platform.equals(ISymbianBuildContext.GCCE_PLATFORM)) { + if (!platform.equals(ISBSv1BuildContext.EMULATOR_PLATFORM) && + !platform.equals(ISBSv1BuildContext.GCCE_PLATFORM)) { // some form of ARMV5|6 moveDepFile = true; @@ -2919,9 +2968,9 @@ } String plat = ""; - if (platform.equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (platform.equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { plat = "winscw"; - } else if (platform.equals(ISymbianBuildContext.GCCE_PLATFORM)) { + } else if (platform.equals(ISBSv1BuildContext.GCCE_PLATFORM)) { plat = "gcce"; } @@ -2938,7 +2987,7 @@ // fix for bug #7748. we may need to update the listing rule as well since it could generate // a dependency file - if (!platform.equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (!platform.equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { // only non-WINSCW platforms are affected rule = view.findRuleForTarget(new Path(rule.getTarget().toString()).removeFileExtension().addFileExtension("lis").toOSString(), true); if (rule != null) { diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Wed Jul 21 12:11:48 2010 -0500 @@ -33,6 +33,7 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; public class CarbideSBSv2Builder implements ICarbideBuilder { @@ -88,7 +89,7 @@ /** Get the build-able configuration from the command line (i.e. build alias). This is passed after the sbs -c parameter */ protected String getConfigName(ICarbideBuildConfiguration buildConfig) { - String buildAlias = buildConfig.getSBSv2Alias(); + String buildAlias = ((ISBSv2BuildContext)buildConfig.getBuildContext()).getSBSv2Alias(); if (buildAlias == null){ // Just get the default target. This is a SBSv1 style configuration name... buildAlias = buildConfig.getPlatformString().toLowerCase() + "_" + buildConfig.getTargetString().toLowerCase(); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/EnvironmentVarsInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/EnvironmentVarsInfo.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/EnvironmentVarsInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,15 +16,12 @@ */ package com.nokia.carbide.cdt.internal.builder; -import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; -import com.nokia.carbide.cdt.builder.project.*; -import com.nokia.carbide.cdt.internal.api.builder.CarbideConfigurationDataProvider; -import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.*; -import com.nokia.carbide.cdt.internal.builder.ui.BuilderPreferencePage; -import com.nokia.carbide.cdt.internal.builder.xml.CarbideBuildConfigurationLoader; -import com.nokia.carbide.cpp.internal.x86build.X86BuildPlugin; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import org.eclipse.cdt.utils.spawner.EnvironmentReader; import org.eclipse.core.resources.IProject; @@ -32,10 +29,24 @@ import org.eclipse.core.runtime.Path; import org.eclipse.emf.common.util.EList; -import java.io.File; -import java.io.IOException; -import java.net.URISyntaxException; -import java.util.*; +import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.carbide.cdt.builder.project.IEnvironmentVariable; +import com.nokia.carbide.cdt.builder.project.IEnvironmentVarsInfo; +import com.nokia.carbide.cdt.internal.api.builder.CarbideConfigurationDataProvider; +import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.CarbideBuildConfigFactory; +import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.CarbideBuilderConfigInfoType; +import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.ConfigurationType; +import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.EnvVarsType; +import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.UseType; +import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.VarType; +import com.nokia.carbide.cdt.internal.builder.ui.BuilderPreferencePage; +import com.nokia.carbide.cdt.internal.builder.xml.CarbideBuildConfigurationLoader; +import com.nokia.carbide.cpp.internal.x86build.X86BuildPlugin; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; /** * @deprecated use {@link EnvironmentVarsInfo2} instead @@ -206,7 +217,7 @@ // Now check for specific variables relating to the Nokia x86 environment // and update the environment that we just updated, if at all. - if (context.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM) && + if (context.getPlatformString().toUpperCase().equals(ISBSv1BuildContext.EMULATOR_PLATFORM) && BuilderPreferencePage.useBuiltInX86Vars()){ int i = 0; diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/EnvironmentVarsInfo2.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/EnvironmentVarsInfo2.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/EnvironmentVarsInfo2.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,17 +16,11 @@ */ package com.nokia.carbide.cdt.internal.builder; -import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; -import com.nokia.carbide.cdt.builder.extension.IEnvironmentModifier; -import com.nokia.carbide.cdt.builder.project.*; -import com.nokia.carbide.cdt.internal.builder.ui.BuilderPreferencePage; -import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; -import com.nokia.carbide.cpp.internal.x86build.X86BuildPlugin; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.cpp.internal.api.utils.core.HostOS; -import com.nokia.cpp.internal.api.utils.core.PathUtils; -import com.nokia.cpp.internal.api.utils.core.TrackedResource; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.eclipse.cdt.core.settings.model.ICStorageElement; import org.eclipse.cdt.utils.spawner.EnvironmentReader; @@ -34,8 +28,21 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -import java.io.File; -import java.util.*; +import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.extension.IEnvironmentModifier; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.carbide.cdt.builder.project.IEnvironmentVariable; +import com.nokia.carbide.cdt.builder.project.IEnvironmentVarsInfo; +import com.nokia.carbide.cdt.internal.builder.ui.BuilderPreferencePage; +import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; +import com.nokia.carbide.cpp.internal.x86build.X86BuildPlugin; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.cpp.internal.api.utils.core.HostOS; +import com.nokia.cpp.internal.api.utils.core.PathUtils; +import com.nokia.cpp.internal.api.utils.core.TrackedResource; public class EnvironmentVarsInfo2 implements IEnvironmentVarsInfo { @@ -195,7 +202,7 @@ // Now check for specific variables relating to the Nokia x86 environment // and update the environment that we just updated, if at all. - if (context.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM) && + if (context.getPlatformString().toUpperCase().equals(ISBSv1BuildContext.EMULATOR_PLATFORM) && BuilderPreferencePage.useBuiltInX86Vars()) { int i = 0; diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ISBSv2BuildConfigInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ISBSv2BuildConfigInfo.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ISBSv2BuildConfigInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -27,6 +27,7 @@ public final static String ATTRIB_SBSV2_BUILD_ALIAS = "SBSV2_BUILD_ALIAS"; //$NON-NLS-1$ public final static String ATTRIB_SBSV2_CONFIG_DISPLAY_STRING = "SBSV2_CONFIG_DISPLAY_STRING"; //$NON-NLS-1$ public final static String ATTRIB_SBSV2_VARIANT = "ATTRIB_SBSV2_VARIANT"; + public final static String ATTRIB_SBSV2_SDK_ID = "ATTRIB_SBSV2_SDK_ID"; /** Retrieve a specfic .cproject SBSv2 data value from a given ID */ String getSBSv2Setting(String id); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/SBSv2BuilderInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/SBSv2BuilderInfo.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/SBSv2BuilderInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -20,6 +20,7 @@ import org.eclipse.cdt.core.settings.model.ICStorageElement; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; public class SBSv2BuilderInfo implements ISBSv2BuildConfigInfo { @@ -31,13 +32,14 @@ ISymbianBuildContext context; - public SBSv2BuilderInfo(ISymbianBuildContext context) { + public SBSv2BuilderInfo(ISBSv2BuildContext context) { String buildAlias = context.getSBSv2Alias() != null ? context.getSBSv2Alias() : ""; sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_BUILD_ALIAS, buildAlias); - sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATRRIB_CONFIG_BASE_PLATFORM, context.getBasePlatformForVariation()); + sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATRRIB_CONFIG_BASE_PLATFORM, context.getPlatformString()); sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_CONFIG_TARGET, context.getTargetString()); sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, context.getDisplayString()); sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT, ""); + sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_SDK_ID, context.getSDK().getUniqueId()); this.context = context; } @@ -68,6 +70,12 @@ sbsv2ConfigDataMap.put(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, value); } + value = rootStorage.getAttribute(ATTRIB_SBSV2_SDK_ID); + if (value != null) { + sbsv2ConfigDataMap.put(ATTRIB_SBSV2_SDK_ID, value); + } + + } public void saveToStorage(ICStorageElement rootStorage) { @@ -96,6 +104,11 @@ if (value != null && value.trim().length() > 0){ rootStorage.setAttribute(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, value); } + + value = sbsv2ConfigDataMap.get(ATTRIB_SBSV2_SDK_ID); + if (value != null && value.trim().length() > 0){ + rootStorage.setAttribute(ATTRIB_SBSV2_SDK_ID, value); + } } @@ -106,5 +119,5 @@ public void setSBSv2Setting(String id, String value) { sbsv2ConfigDataMap.put(id, value); } - + } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/SISBuilderInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/SISBuilderInfo.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/SISBuilderInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -27,6 +27,7 @@ import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.CarbideBuildConfigFactory; import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.SisBuilderType; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; /** * @deprecated use {@link SISBuilderInfo2} instead @@ -250,7 +251,7 @@ if (getCertificate().length() > 0) { return KEY_CERT_SIGN; } - if (sdk.isEKA2()) { + if (sdk.getSupportedFeatures().contains(ISymbianSDKFeatures.IS_EKA2)) { return SELF_SIGN; } return DONT_SIGN; diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/ArgumentsTabComposite.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/ArgumentsTabComposite.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/ArgumentsTabComposite.java Wed Jul 21 12:11:48 2010 -0500 @@ -30,6 +30,7 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.internal.builder.CarbideBuildConfiguration; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; /** * Arguments tab for the Carbide Build Configurations page @@ -211,7 +212,7 @@ abldCleanEdit.setText(""); //$NON-NLS-1$ abldFreezeEdit.setText(""); //$NON-NLS-1$ - if (sdk.isEKA2()) { + if (sdk.getSupportedFeatures().contains(ISymbianSDKFeatures.IS_EKA2)) { abldFreezeEdit.setText("-r"); //$NON-NLS-1$ } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideBuildConfigurationsPage.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideBuildConfigurationsPage.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideBuildConfigurationsPage.java Wed Jul 21 12:11:48 2010 -0500 @@ -1001,8 +1001,8 @@ sisFilesBlock.performDefaults(); IEnvironmentVarsInfo envVarsDefaults = cpi.getNamedConfiguration(lastSelectedConfigName).getEnvironmentVarsInfo(); - String[] defaultVars = envVarsDefaults.getDefaultEnvVarsSettings(cpi, cpi.getNamedConfiguration(lastSelectedConfigName)); - setUpEnvVarsTable(defaultVars, envVarsDefaults.getDefaultEnvVarsList(cpi, cpi.getNamedConfiguration(lastSelectedConfigName))); + String[] defaultVars = envVarsDefaults.getDefaultEnvVarsSettings(cpi, cpi.getNamedConfiguration(lastSelectedConfigName).getBuildContext()); + setUpEnvVarsTable(defaultVars, envVarsDefaults.getDefaultEnvVarsList(cpi, cpi.getNamedConfiguration(lastSelectedConfigName).getBuildContext())); if (argumentsTabcomposite != null) { argumentsTabcomposite.performDefaults(cpi.getNamedConfiguration(lastSelectedConfigName).getSDK()); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPProjectSettingsPage.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPProjectSettingsPage.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPProjectSettingsPage.java Wed Jul 21 12:11:48 2010 -0500 @@ -52,6 +52,7 @@ import org.eclipse.ui.dialogs.PropertyPage; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.internal.api.builder.ui.MMPSelectionUI; import com.nokia.carbide.cdt.internal.api.builder.ui.MMPSelectionUI.FileInfo; @@ -355,7 +356,9 @@ // get the list of normal and test project extensions List buildConfigList = new ArrayList(); - buildConfigList.addAll(cpi.getBuildConfigurations()); + for (ICarbideBuildConfiguration config : cpi.getBuildConfigurations()){ + buildConfigList.add(config.getBuildContext()); + } enableOrDisableControls(); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/PathsAndSymbolsTabComposite.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/PathsAndSymbolsTabComposite.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/PathsAndSymbolsTabComposite.java Wed Jul 21 12:11:48 2010 -0500 @@ -116,7 +116,7 @@ String macrosFile = cpi.getMacrosFile(); if (macrosFile != null && macrosFile.length() > 0) { MacroScanner scanner = new MacroScanner( - new DefaultIncludeFileLocator(buildConfig.getCarbideProject().getProject(), buildConfig), + new DefaultIncludeFileLocator(buildConfig.getCarbideProject().getProject(), buildConfig.getBuildContext()), DefaultModelDocumentProvider.getInstance(), DefaultTranslationUnitProvider.getInstance()); scanner.scanFile(new File(macrosFile)); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/SBSv2BuildConfigTabComposite.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/SBSv2BuildConfigTabComposite.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/SBSv2BuildConfigTabComposite.java Wed Jul 21 12:11:48 2010 -0500 @@ -34,6 +34,7 @@ import com.nokia.carbide.cdt.internal.builder.CarbideBuildConfiguration; import com.nokia.carbide.cdt.internal.builder.ISBSv2BuildConfigInfo; import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; public class SBSv2BuildConfigTabComposite extends Composite { @@ -46,6 +47,7 @@ Label configCmdLabel; Label releaseTreeLabel; private ICarbideBuildConfiguration config; + ISBSv2BuildContext context; public SBSv2BuildConfigTabComposite(TabItem tabItem) { super(tabItem.getParent(), SWT.NONE); @@ -88,6 +90,7 @@ public void initData(ICarbideBuildConfiguration buildConfig) { this.config = buildConfig; + context = (ISBSv2BuildContext)buildConfig.getBuildContext(); ISBSv2BuildConfigInfo sbsv2ConfigInfo = ((CarbideBuildConfiguration)buildConfig).getSBSv2ConfigInfo(); if (sbsv2ConfigInfo != null && sbsv2ConfigInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT) != null){ variantEdit.setText(sbsv2ConfigInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT)); @@ -101,11 +104,11 @@ private void setVaraintDetailsText() { String configCmdText = configCmdLabelPrefixText; - if (config != null){ - if (config.getSBSv2Alias() == null){ + if (context != null){ + if (context.getSBSv2Alias() == null){ configCmdText += config.getPlatformString().toLowerCase() + "_" + config.getTargetString().toLowerCase() + variantEdit.getText(); } else { - configCmdText += config.getSBSv2Alias() + variantEdit.getText(); + configCmdText += context.getSBSv2Alias() + variantEdit.getText(); } } configCmdLabel.setText(configCmdText); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/SisFilesBlock.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/SisFilesBlock.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/SisFilesBlock.java Wed Jul 21 12:11:48 2010 -0500 @@ -61,6 +61,7 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; import com.nokia.carbide.cdt.internal.api.builder.SISBuilderInfo2; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; /** * A composite that displays files in a table. Files can be @@ -297,7 +298,7 @@ listCopy.add(new SISBuilderInfo2(info)); } - isEKA2 = buildConfig.getSDK().isEKA2(); + isEKA2 = buildConfig.getSDK().getSupportedFeatures().contains(ISymbianSDKFeatures.IS_EKA2); setFiles(listCopy); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuildPKGCommandHandler.java --- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuildPKGCommandHandler.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuildPKGCommandHandler.java Wed Jul 21 12:11:48 2010 -0500 @@ -48,7 +48,7 @@ import com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; import com.nokia.carbide.cpp.internal.builder.utils.Activator; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; @@ -153,7 +153,8 @@ bldMakeLauncher.showCommand(true); String defaultConfigName = cpi.getDefaultBuildConfigName(); ICarbideBuildConfiguration defaultConfig = cpi.getDefaultConfiguration(); - ISymbianBuildContext context = SymbianBuildContext.getBuildContextFromDisplayName(defaultConfigName); + // TODO: YUCKY!!! + ISymbianBuildContext context = BuildContextSBSv1.getBuildContextFromDisplayName(defaultConfigName); bldMakeLauncher.startTimingStats(); diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuilderUtilsPropertyTester.java --- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuilderUtilsPropertyTester.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuilderUtilsPropertyTester.java Wed Jul 21 12:11:48 2010 -0500 @@ -61,14 +61,6 @@ if (!CarbideBuilderPlugin.getBuildManager().isCarbideProject(file.getProject())) { return false; } - - if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(file.getProject())) { - Version sbsVers = SDKCorePlugin.getSDKManager().getSBSv2Version(false); - if (sbsVers.compareTo(SDKCorePlugin.getSDKManager().getMinimumSupportedSBSv2Version()) >= 0) - return true; - else - return false; - } } return true; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/PreprocessHandler.java --- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/PreprocessHandler.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/PreprocessHandler.java Wed Jul 21 12:11:48 2010 -0500 @@ -20,7 +20,9 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import java.util.List; +import java.util.Map; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; @@ -80,9 +82,15 @@ import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData; import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPResource; import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefineFactory; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; import com.nokia.carbide.cpp.internal.builder.utils.Activator; import com.nokia.carbide.cpp.internal.builder.utils.ui.LanguageSelectionDialog; import com.nokia.carbide.cpp.internal.builder.utils.ui.PreprocessPreferencePage; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.cpp.internal.api.utils.core.FileUtils; import com.nokia.cpp.internal.api.utils.core.HostOS; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; @@ -196,7 +204,12 @@ } // add the sdk prefix file if any - File sdkPrefix = buildConfig.getSDK().getPrefixFile(); + File sdkPrefix = null; + if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + sdkPrefix = buildConfig.getSDK().getPrefixFile(ISymbianBuilderID.SBSV1_BUILDER); + } else { + sdkPrefix = buildConfig.getSDK().getPrefixFile(ISymbianBuilderID.SBSV2_BUILDER); + } if (sdkPrefix != null && sdkPrefix.exists()) { args.add("-include"); //$NON-NLS-1$ args.add("\"" + sdkPrefix.getAbsolutePath() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ @@ -403,10 +416,24 @@ private List getMacros(ICarbideBuildConfiguration buildConfig, final IPath filePath, final IProgressMonitor monitor) { final List macros = new ArrayList(); - - // platform macros - for (String platMacro : buildConfig.getSDK().getPlatformMacros(buildConfig.getPlatformString())) { - macros.add("__" + platMacro + "__"); //$NON-NLS-1$ //$NON-NLS-2$ + ISymbianSDK sdk = buildConfig.getSDK(); + if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) { + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + // platform macros + for (String platMacro : sbsv1BuildInfo.getPlatformMacros(buildConfig.getPlatformString())) { + macros.add("__" + platMacro + "__"); //$NON-NLS-1$ //$NON-NLS-2$ + } + // vendor macros (e.g. __SERIES60_3x__) + for (String builtinMacro : sbsv1BuildInfo.getVendorSDKMacros()) { + macros.add(builtinMacro); + } + } else { + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + // platform macros + for (Iterator it = sbsv2BuildInfo.getPlatformMacros(buildConfig.getPlatformString()).keySet().iterator(); it.hasNext(); ) { + String platMacro = it.next(); + macros.add(platMacro); + } } // built in macros @@ -414,11 +441,6 @@ macros.add(builtinMacro); } - // vendor macros (e.g. __SERIES60_3x__) - for (String builtinMacro : buildConfig.getSDK().getVendorSDKMacros()) { - macros.add(builtinMacro); - } - IProject project = buildConfig.getCarbideProject().getProject(); List mmps = EpocEngineHelper.getMMPsForSource(project, filePath); @@ -429,7 +451,7 @@ // target type macro (e.g. __DLL__) EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, - new DefaultMMPViewConfiguration(project, buildConfig, new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(project, buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData mmpData) { diff -r e17ab99b8f30 -r 03f5f8bf29b4 builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ProjectCommandHandler.java --- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ProjectCommandHandler.java Wed Jul 21 11:32:00 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ProjectCommandHandler.java Wed Jul 21 12:11:48 2010 -0500 @@ -221,7 +221,7 @@ ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); final ICarbideBuildConfiguration defaultConfig = cpi.getDefaultConfiguration(); - Job buildJob = new Job("Freezing Configuration - " + defaultConfig.getDisplayString()) { + Job buildJob = new Job("Freezing Configuration - " + defaultConfig.getBuildContext().getDisplayString()) { protected IStatus run(IProgressMonitor monitor) { CarbideCPPBuilder.invokeFreeze(defaultConfig, monitor, true); Activator.refreshProjectAfterFreeze(project); diff -r e17ab99b8f30 -r 03f5f8bf29b4 carbidesdk/com.nokia.carbide.cpp.sdk.examples/src/com/nokia/carbide/cpp/sdk/examples/jobs/NewProjectJob.java --- a/carbidesdk/com.nokia.carbide.cpp.sdk.examples/src/com/nokia/carbide/cpp/sdk/examples/jobs/NewProjectJob.java Wed Jul 21 11:32:00 2010 -0500 +++ b/carbidesdk/com.nokia.carbide.cpp.sdk.examples/src/com/nokia/carbide/cpp/sdk/examples/jobs/NewProjectJob.java Wed Jul 21 12:11:48 2010 -0500 @@ -142,7 +142,7 @@ List result = new ArrayList(); List sdks = SDKCorePlugin.getSDKManager().getSDKList(); ISymbianSDK sdk = sdks.get(0); - result.addAll(sdk.getFilteredBuildConfigurations()); + result.addAll(sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getFilteredBuildConfigurations()); return result; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 carbidesdk/com.nokia.carbide.cpp.sdk.examples/src/com/nokia/carbide/cpp/sdk/examples/jobs/ProjectReportJob.java --- a/carbidesdk/com.nokia.carbide.cpp.sdk.examples/src/com/nokia/carbide/cpp/sdk/examples/jobs/ProjectReportJob.java Wed Jul 21 11:32:00 2010 -0500 +++ b/carbidesdk/com.nokia.carbide.cpp.sdk.examples/src/com/nokia/carbide/cpp/sdk/examples/jobs/ProjectReportJob.java Wed Jul 21 12:11:48 2010 -0500 @@ -310,7 +310,7 @@ emitPara(infPath.toString(), null); IResource resource = project.findMember(infPath); IPath bldInfPath = resource.getFullPath(); - IViewConfiguration viewConfig = new DefaultViewConfiguration(info, buildConfiguration); + IViewConfiguration viewConfig = new DefaultViewConfiguration(info, buildConfiguration.getBuildContext()); EpocEnginePlugin.runWithBldInfView(bldInfPath, viewConfig, this); worked(1); @@ -394,7 +394,7 @@ IResource mmpResource = project.findMember(mmpPath); if (mmpResource != null ) { IMMPViewConfiguration viewConfig = new DefaultMMPViewConfiguration(project, - buildConfiguration, new AcceptedNodesViewFilter()); + buildConfiguration.getBuildContext(), new AcceptedNodesViewFilter()); EpocEnginePlugin.runWithMMPView(mmpResource.getFullPath(), viewConfig, this); } else { emitPara(mmpPath.toString() + " not found.", null); diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/CSScanner.java --- a/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/CSScanner.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/CSScanner.java Wed Jul 21 12:11:48 2010 -0500 @@ -274,7 +274,7 @@ ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); if (cpi != null) { ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); - IMMPViewConfiguration viewConfiguration = new DefaultMMPViewConfiguration(project, buildConfig, new AcceptedNodesViewFilter()); + IMMPViewConfiguration viewConfiguration = new DefaultMMPViewConfiguration(project, buildConfig.getBuildContext(), new AcceptedNodesViewFilter()); EpocEnginePathHelper helper = new EpocEnginePathHelper(cpi.getProject()); IPath workspaceRelativeMMPPath = helper.convertToWorkspace(inMMPPath); final String epocRoot = buildConfig.getSDK().getEPOCROOT(); @@ -312,7 +312,7 @@ ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); if (cpi != null) { ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); - IMMPViewConfiguration viewConfiguration = new DefaultMMPViewConfiguration(project, buildConfig, new AcceptedNodesViewFilter()); + IMMPViewConfiguration viewConfiguration = new DefaultMMPViewConfiguration(project, buildConfig.getBuildContext(), new AcceptedNodesViewFilter()); final EpocEnginePathHelper pathHelper = new EpocEnginePathHelper(cpi.getProject()); IPath workspaceRelativeMMPPath = pathHelper.convertToWorkspace(inMMPPath); final String epocRoot = buildConfig.getSDK().getEPOCROOT(); diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/kb/CSKbManager.java --- a/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/kb/CSKbManager.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/kb/CSKbManager.java Wed Jul 21 12:11:48 2010 -0500 @@ -40,6 +40,7 @@ import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; import com.nokia.carbide.cpp.internal.codescanner.CSPlugin; import com.nokia.carbide.cpp.internal.codescanner.Messages; import com.nokia.carbide.cpp.internal.codescanner.config.CSConfigSettings; @@ -68,6 +69,7 @@ import com.nokia.carbide.cpp.internal.codescanner.gen.Kbdata.SolutionType; import com.nokia.carbide.cpp.internal.codescanner.gen.Kbdata.SymptomType; import com.nokia.carbide.cpp.internal.codescanner.xml.CSKbdataXMLLoader; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; /** @@ -392,8 +394,7 @@ List buildConfigList = projectInfo.getBuildConfigurations(); for (Iterator iterator = buildConfigList.iterator(); iterator.hasNext();) { ICarbideBuildConfiguration buildConfig = iterator.next(); - ISymbianSDK sdk = buildConfig.getSDK(); - Version version = sdk.getSDKVersion(); + Version version = buildConfig.getSDK().getSDKVersion(); sdkVersions.add(version); } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/bugs_fixed.htm diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/concepts/images/wnd_workspace_launcher.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/concepts/images/workbench.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/images/views/perspective_debug.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_02.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_04.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_05.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_07.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_08.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_09.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_10.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_11.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_12.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_13.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_14.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dlg_build_project_progress.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_attach_to_process.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_build_project.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_change_debug_process.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_change_remote_connection.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_new_launch_config.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_other_settings.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_build_project.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_debug.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_edit_settings.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_project_built.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_project_error_badge.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_project_warning_badge.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_run.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/menu_new_proj_build_project.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_build_project_console_view.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_build_project_executables_view.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_build_project_problems_view.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_dll_project_02.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_dll_project_03.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_dll_project_04.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_dll_project_07.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_launch_config_03.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_launch_config_04.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_launch_config_05.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_launch_config_08.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_project_template_01.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_project_template_02.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_project_template_07.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/pref_cdt_build_console.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/run_mode_debug_01.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/run_mode_debug_02.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/run_mode_debug_05.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/run_mode_debug_06.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/images/run_mode_debug_07.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/projects/launch/images/filter_launch_config.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/MMP_wizard.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/MMP_wizard2.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/add_images_from_filesys.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/add_images_from_project.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/build_pkg_file.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/build_symbian_comp.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/carbide_build_config.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/carbide_macro_settings.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/carbide_proj_settings.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/carbide_proj_settings_sbsv1.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/clean_symbian_comp.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/icon_install_extensions.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/icon_show_overview.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/import_bld_inf_01.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/import_bld_inf_02.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/import_bld_inf_03.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/import_bld_inf_04.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/import_bld_inf_05.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_memory_rendering_options.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_symb_abld.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_symb_compile.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_symb_freeze_comp.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_symb_freeze_exports.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_symb_preprocess.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/mmp_editor.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/mmp_editor_libraries.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/mmp_editor_mmpfile.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/mmp_editor_options.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/mmp_editor_sources.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/pref_indexer.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/pref_indexer_properties.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/pref_launch_config_filter.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/prefs_carbide_cpp.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_carbide_portal.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_install_extensions.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_memory.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_project_explorer.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_show_overview_popup.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_sym_proj_nav.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/wiz_new_class.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/wnd_edit_mbm_contents.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/reference/images/wnd_pref_code_styles.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/release_notes.htm diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/tasks/images/menu_reformat_source_file.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/tasks/projects/images/clean.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/tasks/start/images/debug_set_breakpoint.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/tasks/start/images/wnd_symbian_emulator_01.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/tasks/start/images/wnd_symbian_emulator_02.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.doc.user/html/tasks/start/images/wnd_symbian_emulator_03.png diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/AllTests.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/AllTests.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/AllTests.java Wed Jul 21 12:11:48 2010 -0500 @@ -33,6 +33,8 @@ suite.addTestSuite(SymbianContextTest.class); suite.addTestSuite(TestSDKChangeListener.class); suite.addTestSuite(TestDevicesXMLListener.class); + suite.addTestSuite(TestCarbideSDKCache.class); + suite.addTestSuite(TestSBSv2BuildContext.class); //$JUnit-END$ return suite; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/DevicesLoaderTest.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/DevicesLoaderTest.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/DevicesLoaderTest.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,6 +16,12 @@ */ package com.nokia.carbide.cpp.sdk.core.test; +import java.util.Iterator; + +import org.eclipse.emf.common.util.EList; +import org.osgi.framework.Version; + +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DeviceType; import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesType; import com.nokia.carbide.cpp.internal.sdk.core.xml.DevicesLoader; @@ -24,11 +30,6 @@ import com.nokia.cpp.internal.api.utils.core.FileUtils; import com.nokia.cpp.internal.api.utils.core.HostOS; -import org.eclipse.emf.common.util.EList; -import org.osgi.framework.Version; - -import java.util.Iterator; - /** * NOTE: this test expects all three methods to be run in order. * @@ -59,13 +60,13 @@ Version osVersion = new Version("9.1"); Version sdkVersion = new Version("3.0"); - ISymbianSDK sdk = SymbianSDKFactory.createInstance(S60_SDKID, M_DRIVE, ISymbianSDK.SERIES60_SDK_NAME, osVersion, "", sdkVersion, true); + ISymbianSDK sdk = SymbianSDKFactory.createInstance(S60_SDKID, M_DRIVE, ISBSv1BuildInfo.SERIES60_SDK_NAME, osVersion, sdkVersion); DevicesLoader.updateDevice(sdk, devicesFile.toURI().toURL()); - sdk = SymbianSDKFactory.createInstance(TV_SDKID, P_DRIVE, ISymbianSDK.TECHVIEW_SDK_NAME, osVersion, "", sdkVersion, false); + sdk = SymbianSDKFactory.createInstance(TV_SDKID, P_DRIVE, ISBSv1BuildInfo.TECHVIEW_SDK_NAME, osVersion, sdkVersion); DevicesLoader.updateDevice(sdk, devicesFile.toURI().toURL()); - sdk = SymbianSDKFactory.createInstance(UIQ3_SDKID, UIQ3_EPOCROOT, ISymbianSDK.UIQ_SDK_NAME, osVersion, "", sdkVersion, false); + sdk = SymbianSDKFactory.createInstance(UIQ3_SDKID, UIQ3_EPOCROOT, ISBSv1BuildInfo.UIQ_SDK_NAME, osVersion, sdkVersion); DevicesLoader.updateDevice(sdk, devicesFile.toURI().toURL()); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SDKCreationTest.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SDKCreationTest.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SDKCreationTest.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,18 +16,20 @@ */ package com.nokia.carbide.cpp.sdk.core.test; +import java.io.File; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.emf.common.util.EList; + +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DeviceType; import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesType; import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK; import com.nokia.carbide.cpp.internal.sdk.core.xml.DevicesLoader; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.cpp.internal.api.utils.core.FileUtils; -import org.eclipse.emf.common.util.EList; - -import java.io.File; -import java.util.Iterator; -import java.util.List; - public class SDKCreationTest extends BaseDeviceModifierTest { protected void setUp() throws Exception { @@ -48,21 +50,23 @@ for (Iterator iter = devices.iterator(); iter.hasNext();) { SymbianSDK sdk = new SymbianSDK((DeviceType) iter.next()); assertNotNull(sdk); + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); // Test an SDK that exists and we know OS version if (sdk.getUniqueId().equals("UIQ3")){ - List platMacros = sdk.getPlatformMacros("WINSCW"); + List platMacros = sbsv1BuildInfo.getPlatformMacros("WINSCW"); assertTrue(platMacros != null); assertEquals(3, platMacros.size()); - assertTrue(sdk.getFilteredBuildConfigurations().size() > 0); + assertTrue(sbsv1BuildInfo.getFilteredBuildConfigurations().size() > 0); } // Test an SDK that does not exist. Check for proper null values else if (sdk.getUniqueId().equals("SDK_No_Exist")){ + if (sbsv1BuildInfo != null) { + assertTrue(sdk.getSDKVersion().getMajor() == 0); + assertTrue(sbsv1BuildInfo.getAvailablePlatforms().size() == 0); + assertTrue(sbsv1BuildInfo.getFilteredBuildConfigurations().size() == 0); + } assertTrue(sdk.getOSVersion().getMajor() == 0); - assertTrue(sdk.getSDKVersion().getMajor() == 0); - assertTrue(sdk.getPlatformMacros("WINSCW").size() == 0); - assertTrue(sdk.getProjectVariantHRHMacros().size() == 0); - assertTrue(sdk.getAvailablePlatforms().size() == 0); - assertTrue(sdk.getFilteredBuildConfigurations().size() == 0); + assertTrue(sbsv1BuildInfo.getPlatformMacros("WINSCW").size() == 0); assertTrue(sdk.getSupportedTargetTypes().size() == 0); File epocRoot = new File(sdk.getEPOCROOT()); assertTrue(epocRoot.exists() == false); diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SymbianContextTest.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SymbianContextTest.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SymbianContextTest.java Wed Jul 21 12:11:48 2010 -0500 @@ -18,14 +18,16 @@ import java.util.List; +import junit.framework.TestCase; + import org.osgi.framework.Version; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; -import junit.framework.TestCase; - /** * This test the creation and APIs of the Symbian build context class. * Much of this functionality is covered by com.nokia.carbide.cpp.build plugin @@ -58,6 +60,7 @@ * @param sdk */ private void doTestSDK(ISymbianSDK sdk) { + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); if (sdk.getName().equals("S60_5th_Edition_SDK_v1.0")) { // test that we get the SDK version Version sdkVer = sdk.getSDKVersion(); @@ -70,15 +73,16 @@ assertEquals(4,osVer.getMinor()); } - SymbianBuildContext context = new SymbianBuildContext(sdk, "WINSCW", "UDEB"); + BuildContextSBSv1 context = new BuildContextSBSv1(sdk, "WINSCW", "UDEB"); ISymbianSDK contextSDK = context.getSDK(); + sbsv1BuildInfo = (ISBSv1BuildInfo)contextSDK.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); assertEquals(sdk, contextSDK); // test that we can get the macros for valid SDKs // (if the default of 0.0, then we never fetch macros) - if (sdk.getOSVersion().compareTo(new Version(0, 0, 0)) > 0) { - List platMacros = contextSDK.getPlatformMacros("WINSCW"); + if (sbsv1BuildInfo != null && sdk.getOSVersion().compareTo(new Version(0, 0, 0)) > 0) { + List platMacros = sbsv1BuildInfo.getPlatformMacros("WINSCW"); if (platMacros.size() == 0) fail("WINSCW platform macros should be > 0"); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestCarbideSDKCache.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestCarbideSDKCache.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,124 @@ +package com.nokia.carbide.cpp.sdk.core.test; + +import java.io.File; +import java.util.Map; + +import junit.framework.TestCase; + +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.IJobChangeListener; +import org.eclipse.core.runtime.jobs.Job; +import org.osgi.framework.Version; + +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory; + +public class TestCarbideSDKCache extends TestCase { + + private class TestSDKManager extends SDKManager { + private File cacheFile = new File(System.getProperty("user.home"), CARBIDE_SDK_CACHE_FILE_NAME); + public File getCacheFile() { + return cacheFile; + } + + public Job getScanJob() { + return scanJob; + } + } + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + public void testCacheCreation() throws Exception { + final TestSDKManager manager = new TestSDKManager(); + File cacheFile = manager.getCacheFile(); + if (cacheFile != null && cacheFile.exists()) { + cacheFile.delete(); + } + IJobChangeListener listener = new IJobChangeListener() { + + public void sleeping(IJobChangeEvent event) { + } + + public void scheduled(IJobChangeEvent event) { + } + + public void running(IJobChangeEvent event) { + } + + public void done(IJobChangeEvent event) { + File cacheFile = manager.getCacheFile(); + assertNotNull(cacheFile); + assertTrue(cacheFile.exists()); + } + + public void awake(IJobChangeEvent event) { + } + + public void aboutToRun(IJobChangeEvent event) { + } + }; + manager.addScanJobListner(listener); + manager.scanSDKs(); + manager.getScanJob().join(); + manager.removeScanJobLisner(listener); + } + + public void testCacheModification() throws Exception { + final TestSDKManager manager = new TestSDKManager(); + long orgTime = manager.getCacheFile().lastModified(); + manager.scanSDKs(); + manager.getScanJob().join(); + assertTrue(manager.getCacheFile().lastModified() > orgTime); + final String sdkId = "test"; + ISymbianSDK sdk = SymbianSDKFactory.createInstance(sdkId, "C:\\", "com.nokia.s60", + new Version("9.5"), new Version("5.0")); + orgTime = manager.getCacheFile().lastModified(); + waitASecond(); + manager.addSDK(sdk); + assertTrue(manager.getCacheFile().lastModified() > orgTime); + orgTime = manager.getCacheFile().lastModified(); + waitASecond(); + manager.updateSDK(sdk); + assertTrue(manager.getCacheFile().lastModified() > orgTime); + orgTime = manager.getCacheFile().lastModified(); + waitASecond(); + manager.removeSDK(sdkId); + assertTrue(manager.getCacheFile().lastModified() > orgTime); + } + + public void testSBSv2QueryCache() throws Exception { + SBSv2QueryUtils.removeAllCachedQueries(); + assertNull(SDKCorePlugin.getCache().getCache(SBSv2QueryUtils.ALIAS_CACHE_KEY)); + assertNull(SDKCorePlugin.getCache().getCache(SBSv2QueryUtils.PRODUCT_CACHE_KEY)); + assertNull(SDKCorePlugin.getCache().getCache(SBSv2QueryUtils.CONFIG_CACHE_KEY)); + final TestSDKManager manager = new TestSDKManager(); + manager.scanSDKs(); + manager.getScanJob().join(); + assertNotNull(SDKCorePlugin.getCache().getCachedData(SBSv2QueryUtils.ALIAS_CACHE_KEY, Map.class, 0)); + assertNotNull(SDKCorePlugin.getCache().getCachedData(SBSv2QueryUtils.PRODUCT_CACHE_KEY, Map.class, 0)); + assertNotNull(SDKCorePlugin.getCache().getCachedData(SBSv2QueryUtils.CONFIG_CACHE_KEY, Map.class, 0)); + SDKCorePlugin.getCache().flushAll(); + SBSv2QueryUtils.removeAllCachedQueries(); + assertNotNull(SDKCorePlugin.getCache().getCachedData(SBSv2QueryUtils.ALIAS_CACHE_KEY, Map.class, 0)); + assertNotNull(SDKCorePlugin.getCache().getCachedData(SBSv2QueryUtils.PRODUCT_CACHE_KEY, Map.class, 0)); + assertNotNull(SDKCorePlugin.getCache().getCachedData(SBSv2QueryUtils.CONFIG_CACHE_KEY, Map.class, 0)); + } + + private void waitASecond() { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestDevicesXMLListener.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestDevicesXMLListener.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestDevicesXMLListener.java Wed Jul 21 12:11:48 2010 -0500 @@ -28,6 +28,7 @@ import com.nokia.carbide.cpp.internal.api.sdk.ICarbideDevicesXMLChangeListener; import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal; import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; +import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK; import com.nokia.carbide.cpp.sdk.core.*; /** @@ -91,7 +92,7 @@ assertTrue("Devices.xml has changed only timestamp, bad return value", sdkMgr.checkDevicesXMLSynchronized()); ISymbianSDK sdk = sdkMgr.getSDKList().get(0); - sdk.setEPOCROOT("K:\\"); + ((SymbianSDK)sdk).setEPOCROOT("K:\\"); sdkMgr.updateSDK(sdk); assertTrue("Devices.xml should still be true with sdk update via APIs", sdkMgr.checkDevicesXMLSynchronized()); diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestSBSv2BuildContext.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestSBSv2BuildContext.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,107 @@ +package com.nokia.carbide.cpp.sdk.core.test; + +import java.io.File; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import junit.framework.TestCase; + +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISDKBuildInfo; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; + +public class TestSBSv2BuildContext extends TestCase { + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + public void testBuildContextsInSDKs() throws Exception { + List sdkList = SDKCorePlugin.getSDKManager().getSDKList(); + for (Iterator sdkItr = sdkList.iterator(); sdkItr.hasNext();) { + ISymbianSDK sdk = sdkItr.next(); + ISDKBuildInfo buildInfo = sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + if (buildInfo != null) { + assertTrue(buildInfo instanceof ISBSv2BuildInfo); + List contextList = buildInfo.getFilteredBuildConfigurations(); + if (contextList != null && contextList.size() > 0) { + for (Iterator cItr = contextList.iterator(); cItr.hasNext();) { + ISymbianBuildContext context = cItr.next(); + assertTrue(context instanceof ISBSv2BuildContext); + testBuildContext((ISBSv2BuildContext)context); + } + } + } + } + } + + private void testBuildContext(ISBSv2BuildContext context) { + // getConfigQueryData() + assertNotNull(context.getConfigQueryData()); + + // getConfigID() + assertNotNull(context.getConfigID()); + + // getDisplayString() + assertNotNull(context.getDisplayString()); + + // getDefaultDefFileDirectoryName() + assertNotNull(context.getDefaultDefFileDirectoryName()); + + // getPlatformString() + assertNotNull(context.getPlatformString()); + + // getSBSv2Alias() + assertNotNull(context.getSBSv2Alias()); + String sbsv2Alias = context.getSBSv2Alias(); + + // getTargetString() + assertNotNull(context.getTargetString()); + + // getCompilerPrefixFile() + if (sbsv2Alias.toUpperCase().contains(ISBSv2BuildContext.TOOLCHAIN_GCCE) || + sbsv2Alias.toUpperCase().contains(ISBSv2BuildContext.TOOLCHAIN_ARM)) { + assertNotNull(context.getCompilerPrefixFile()); + } + + // getVariantHRHDefines() + assertNotNull(context.getVariantHRHDefines()); + + // getPrefixFileIncludes() + assertNotNull(context.getPrefixFileIncludes()); + for (Iterator itr = context.getPrefixFileIncludes().iterator(); itr.hasNext();) { + File includeFile = itr.next(); + assertTrue(includeFile.exists()); + } + + // getCompilerMacros() + assertNotNull(context.getCompilerMacros()); + + // getToolChain() + String toolChain = context.getToolChain(); + assertNotNull(toolChain); + Map buildMacros = context.getConfigQueryData().getBuildMacros(); + if (buildMacros != null) { + if (buildMacros.containsKey(ISBSv2BuildContext.MACRO_ARM)) { + assertTrue(toolChain.equals(ISBSv2BuildContext.TOOLCHAIN_ARM)); + } else if (buildMacros.containsKey(ISBSv2BuildContext.MACRO_GCCE)) { + assertTrue(toolChain.equals(ISBSv2BuildContext.TOOLCHAIN_GCCE)); + } else if (buildMacros.containsKey(ISBSv2BuildContext.MACRO_WINSCW)) { + assertTrue(toolChain.equals(ISBSv2BuildContext.TOOLCHAIN_WINSCW)); + } else { + assertTrue(toolChain.equals(ISBSv2BuildContext.TOOLCHAIN_UNKNOWN)); + } + } + + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF --- a/core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF Wed Jul 21 12:11:48 2010 -0500 @@ -16,14 +16,15 @@ org.eclipse.core.filesystem, com.nokia.cpp.utils.ui Bundle-ActivationPolicy: lazy -Export-Package: com.nokia.carbide.cpp.internal.api.sdk, - com.nokia.carbide.cpp.internal.sdk.core.model;x-friends:="com.nokia.carbide.cpp.sdk.core.test", - com.nokia.carbide.cpp.internal.sdk.core.xml;x-friends:="com.nokia.carbide.cpp.sdk.core.test", - com.nokia.carbide.cpp.sdk.core, +Export-Package: com.nokia.carbide.cpp.internal.api.sdk;x-friends:="com.nokia.carbide.cpp.sdk.core.test", + com.nokia.carbide.cpp.internal.api.sdk.sbsv2;x-friends:="com.nokia.carbide.cdt.builder.test,com.nokia.carbide.cpp.sdk.core.test", com.nokia.carbide.cpp.internal.sdk.core.gen.Devices;x-friends:="com.nokia.carbide.cpp.sdk.core.test,com.nokia.carbide.cpp.sdk.ui", com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.impl;x-friends:="com.nokia.carbide.cpp.sdk.core.test", com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.util;x-friends:="com.nokia.carbide.cpp.sdk.core.test", com.nokia.carbide.cpp.internal.sdk.core.gen.SymbianMacroStore;x-friends:="com.nokia.carbide.cpp.sdk.core.test", com.nokia.carbide.cpp.internal.sdk.core.gen.SymbianMacroStore.impl;x-friends:="com.nokia.carbide.cpp.sdk.core.test", - com.nokia.carbide.cpp.internal.sdk.core.gen.SymbianMacroStore.util;x-friends:="com.nokia.carbide.cpp.sdk.core.test" + com.nokia.carbide.cpp.internal.sdk.core.gen.SymbianMacroStore.util;x-friends:="com.nokia.carbide.cpp.sdk.core.test", + com.nokia.carbide.cpp.internal.sdk.core.model;x-friends:="com.nokia.carbide.cpp.sdk.core.test,com.nokia.carbide.cpp.sdk.ui", + com.nokia.carbide.cpp.internal.sdk.core.xml;x-friends:="com.nokia.carbide.cpp.sdk.core.test", + com.nokia.carbide.cpp.sdk.core Bundle-ClassPath: sdkCorePlugin.jar diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv1.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv1.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,416 @@ +/* +* 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +*/ +package com.nokia.carbide.cpp.internal.api.sdk; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.IPath; +import org.osgi.framework.Version; + +import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; +import com.nokia.carbide.cpp.internal.sdk.core.model.SBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianMissingSDKFactory; +import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK; +import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; +import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; +import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; + +public class BuildContextSBSv1 implements ISBSv1BuildContext { + + private String sdkId; + private String platform; + private String target; + private String displayString = null; + + private static String EMULATOR_DISPLAY_TEXT = "Emulator"; //$NON-NLS-1$ + private static String PHONE_DISPLAY_TEXT = "Phone"; //$NON-NLS-1$ + private static String DEBUG_DISPLAY_TEXT = "Debug"; //$NON-NLS-1$ + private static String RELEASE_DISPLAY_TEXT = "Release"; //$NON-NLS-1$ + private static String SPACE_DISPLAY_TEXT = " "; //$NON-NLS-1$ + private static String SDK_NOT_INSTALLED = "SDK not installed"; //$NON-NLS-1$ + + // a copy of bad SDK default to fall back + private static ISymbianSDK fallbackForBadSdk = SymbianMissingSDKFactory.createInstance("dummy_ID"); //$NON-NLS-1$ + + public BuildContextSBSv1(ISymbianSDK theSDK, String thePlatform, String theTarget) { + sdkId = theSDK.getUniqueId(); + platform = thePlatform.toUpperCase(); + target = theTarget.toUpperCase(); + + getDisplayString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((platform == null) ? 0 : platform.hashCode()); + result = prime * result + ((getSDK() == null) ? 0 : getSDK().getEPOCROOT().hashCode()); + result = prime * result + ((target == null) ? 0 : target.hashCode()); + return result; + } + + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof BuildContextSBSv1)) + return false; + final BuildContextSBSv1 other = (BuildContextSBSv1) obj; + if (platform == null) { + if (other.platform != null) + return false; + } else if (!platform.equals(other.platform)) + return false; + if (getSDK() == null) { + if (other.getSDK() != null) + return false; + } else if (!getSDK().getEPOCROOT().equals(other.getSDK().getEPOCROOT())) + return false; + if (target == null) { + if (other.target != null) + return false; + } else if (!target.equals(other.target)) { + return false; + } + return true; + } + + + public ISymbianSDK getSDK() { + + ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(sdkId, true); + if (sdk == null){ + sdk = fallbackForBadSdk; + } + + return sdk; + } + + public String getPlatformString() { + return platform.toUpperCase(); + } + + public String getTargetString() { + return target.toUpperCase(); + } + + public String getDisplayString() { + if (displayString == null) { + // in the form Emulation Debug (WINSCW) [S60_3rd_MR] or + // Phone Release (GCCE) [S60_3rd_MR] + if (platform.compareTo(EMULATOR_PLATFORM) == 0) { + displayString = EMULATOR_DISPLAY_TEXT; + } else { + displayString = PHONE_DISPLAY_TEXT; + } + + if (target.compareTo(ISymbianBuildContext.DEBUG_TARGET) == 0) { + displayString = displayString + SPACE_DISPLAY_TEXT + DEBUG_DISPLAY_TEXT; + } else { + displayString = displayString + SPACE_DISPLAY_TEXT + RELEASE_DISPLAY_TEXT; + } + + String basePlatform = platform; + + displayString = displayString + " (" + basePlatform + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$ + } + return displayString; + } + + public static ISymbianBuildContext getBuildContextFromDisplayName(String displayName) { + if (isValidConfigName(displayName)) { + String sdkId = getSDKIDFromConfigName(displayName); + ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(sdkId, true); + if (sdk == null) { + // add a dummy should a build context ask for a removed SDK + sdk = SDKManagerInternalAPI.addMissingSdk(sdkId); + } + + return new BuildContextSBSv1(sdk, + getPlatformFromBuildConfigName(displayName), + getTargetFromBuildConfigName(displayName)); + } + return new BuildContextSBSv1(fallbackForBadSdk, SDK_NOT_INSTALLED, SDK_NOT_INSTALLED); + } + + private static String getPlatformFromBuildConfigName(String configName) { + String[] tokens = configName.split(SPACE_DISPLAY_TEXT); + String sdkIdToken = tokens[2]; + if (sdkIdToken.contains("_")){ + sdkIdToken = sdkIdToken.substring(1, sdkIdToken.length()-1); + String[] aliasTokens = sdkIdToken.split("_"); + return aliasTokens[0]; + } else { + return sdkIdToken.substring(1, sdkIdToken.length()-1); + } + + } + + public static String getSDKIDFromConfigName(String configName) { + int indexBegin = configName.indexOf("["); //$NON-NLS-1$ + int indexEnd = configName.indexOf("]"); //$NON-NLS-1$ + if (indexBegin > 0 && indexEnd > 0){ + return configName.substring(indexBegin+1, indexEnd); + } else { + return ""; //$NON-NLS-1$ + } + } + + private static String getTargetFromBuildConfigName(String configName) { + String[] tokens = configName.split(SPACE_DISPLAY_TEXT); + if (tokens[1].compareTo(DEBUG_DISPLAY_TEXT) == 0) { + return ISymbianBuildContext.DEBUG_TARGET; + } else { + return ISymbianBuildContext.RELEASE_TARGET; + } + } + + private static boolean isValidConfigName(String configName) { + // () [] + if (configName != null && !configName.equals("")) { //$NON-NLS-1$ + String[] tokens = configName.split(SPACE_DISPLAY_TEXT); + if (tokens.length >= 4) { + if (tokens[0].compareTo(EMULATOR_DISPLAY_TEXT) == 0 || tokens[0].compareTo(PHONE_DISPLAY_TEXT) == 0) { + if (tokens[1].compareTo(DEBUG_DISPLAY_TEXT) == 0 || tokens[1].compareTo(RELEASE_DISPLAY_TEXT) == 0) { + if (tokens[2].matches("(.*)")) { //$NON-NLS-1$ + if (tokens[3].matches("\\[.*")) { //$NON-NLS-1$ + return true; + } + } + } + } + } + } + return false; + } + + public String toString() { + return getDisplayString(); + } + + private ISBSv1BuildInfo getBuildInfo() { + ISBSv1BuildInfo buildInfo = (ISBSv1BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + if (buildInfo == null) { + buildInfo = new SBSv1BuildInfo(getSDK()); + ((SymbianSDK)getSDK()).setBuildInfo(buildInfo, ISymbianBuilderID.SBSV1_BUILDER); + } + return buildInfo; + } + + public String getDefaultDefFileDirectoryName() { + // TODO: How the ASSP option affects the path? + + String dirName = getDefFileDirectoryNameForPlatform(platform); + if (dirName == null) { + // check BSF's + IBSFCatalog catalog = getBuildInfo().getBSFCatalog(); + if (catalog != null) { + for (IBSFPlatform plat : catalog.getPlatforms()) { + if (plat.getName().compareToIgnoreCase(platform) == 0) { + String mainPlatform = catalog.getReleasePlatform(platform); + if (mainPlatform != null) { + dirName = getDefFileDirectoryNameForPlatform(mainPlatform); + if (dirName == null || dirName.length() < 1) { + // fallback - all BSF's should be EABI anyway + return "EABI"; //$NON-NLS-1$ + } + } + } + } + } + } + + if (dirName == null) { + // fallback for unknown cases + dirName = platform; + } + + return dirName; + } + + private String getDefFileDirectoryNameForPlatform(String platform) { + if (platform.equals(EMULATOR_PLATFORM)) { + return "BWINS"; //$NON-NLS-1$ + } else if (platform.equals(ARMV5_PLATFORM) + || platform.equals(ARMV5_ABIV2_PLATFORM) + || platform.equals(ARMV6_PLATFORM) + || platform.equals(ARMV6_ABIV2_PLATFORM) + || platform.equals(GCCE_PLATFORM)) { + return "EABI"; //$NON-NLS-1$ + } + return null; + } + + public IPath getCompilerPrefixFile() { + if (platform.equals(GCCE_PLATFORM)) { + return getGCCEPrefixFilePath(); + } else if (platform.equals(ARMV5_PLATFORM) + || platform.equals(ARMV5_ABIV2_PLATFORM) + || platform.equals(ARMV6_PLATFORM) + || platform.equals(ARMV6_ABIV2_PLATFORM)) { + return getRVCTPrefixFilePath(); + } else { + // check BSF's + IBSFCatalog catalog = getBuildInfo().getBSFCatalog(); + if (catalog != null) { + for (IBSFPlatform plat : catalog.getPlatforms()) { + if (plat.getName().compareToIgnoreCase(platform) == 0) { + String mainPlatform = catalog.getReleasePlatform(platform); + if (mainPlatform != null) { + if (mainPlatform.equals(GCCE_PLATFORM)) { + return getGCCEPrefixFilePath(); + } else if (mainPlatform.equals(ARMV5_PLATFORM) + || mainPlatform.equals(ARMV5_ABIV2_PLATFORM) + || mainPlatform.equals(ARMV6_PLATFORM) + || mainPlatform.equals(ARMV6_ABIV2_PLATFORM)) { + return getRVCTPrefixFilePath(); + } else { + // fallback - all BSF's should be EABI anyway + return getRVCTPrefixFilePath(); + } + } + } + } + } + } + + // fallback for WINSCW, MSVC, etc. + return null; + } + + private IPath getIncludePath() { + return getSDK().getIncludePath(); + } + + private IPath getGCCEPrefixFilePath() { + return getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$ + } + + private IPath getRVCTPrefixFilePath() { + IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools(); + // use default in case tools aren't installed + String rvctFragment = "rvct2_2"; //$NON-NLS-1$ + if (installedRVCTTools.length > 0) { + rvctFragment = getRVCTFragment(installedRVCTTools[0]); + } + IPath prefixFilePath = getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$ + if (prefixFilePath.toFile().exists()){ + return prefixFilePath; + } else { + // SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones + // based on the default installation + return getIncludePath().append("rvct").append("rvct" + ".h"); + } + } + + private String getRVCTFragment(IRVCTToolChainInfo info) { + int major = 0, minor = 0; + if (info != null) { + Version rvctToolsVersion = info.getRvctToolsVersion(); + if (rvctToolsVersion != null) { + major = info.getRvctToolsVersion().getMajor(); + minor = info.getRvctToolsVersion().getMinor(); + } + } + return "rvct" + major + "_" + minor; //$NON-NLS-1$ //$NON-NLS-2$ + } + + public List getVariantHRHDefines() { + + return getCachedData().getVariantHRHDefines(); + } + + public List getPrefixFileIncludes() { + return getCachedData().getPrefixFileIncludes(); + } + + + public List getCompilerMacros() { + // we parse the compiler prefix file to gather macros. this can be time consuming so do it + // once and cache the values. only reset the cache when the compiler prefix has changed. + + IPath prefixFile = getCompilerPrefixFile(); + if (prefixFile == null) { + return Collections.emptyList(); + } + + return getCachedData().getCompilerMacros(prefixFile); + } + + + public String getBuildVariationName() { + String varName = ""; + + String[] tokens = getPlatformString().split("\\."); + if (tokens.length == 2){ + varName = tokens[1]; + } + + return varName; + } + + + public boolean isSymbianBinaryVariation() { + if (getPlatformString().split("\\.").length == 2){ + return true; + } else { + return false; + } + } + + /** + * Get the cache holding the data that applies to this build context globally. + * A build context is subclassed by CarbideBuildConfiguration, which has multiple + * instances at runtime, thus, a SymbianBuildContext instance should not hold a cache itself. + * @return cache, never null + */ + private SymbianBuildContextDataCache getCachedData() { + return SymbianBuildContextDataCache.getCache(this); + } + + + public String getBasePlatformForVariation() { + String plat = ""; + + String[] tokens = getPlatformString().split("\\."); + if (tokens.length == 2){ + plat = tokens[0]; + } else { + return platform; + } + + return plat; + } + + + /** + * Get the list of #include paths detected for this context. + * @return List or null + */ + public List getCachedSystemIncludePaths() { + return getCachedData().getSystemIncludePaths(); + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,339 @@ +package com.nokia.carbide.cpp.internal.api.sdk; + +import java.io.File; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.PlatformUI; + +import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2ConfigQueryData; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2MinimumVersionException; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBSv2ConfigQueryData; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.cpp.internal.api.utils.core.Check; +import com.nokia.cpp.internal.api.utils.core.Logging; +import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; + +public class BuildContextSBSv2 implements ISBSv2BuildContext { + + private String platform; + private String target; + private String sbsv2Alias; + private ISymbianSDK sdk; + private String displayString; + private String configID; // cconfiguration 'id' attribute from .cproject + + // Raptor config query data + private ISBSv2ConfigQueryData configQueryData; + + public BuildContextSBSv2(ISymbianSDK sdk, String platform, String target, String alias, String displayString, String configID) { + this.sdk = sdk; + this.platform = platform.toUpperCase(); + this.target = target.toUpperCase(); + this.sbsv2Alias = alias; + this.displayString = displayString; + this.configID = configID; + this.configQueryData = setConfigQueryData(sdk, alias); + } + + public BuildContextSBSv2(ISymbianSDK sdk, String alias, ISBSv2ConfigQueryData configData) { + this.sdk = sdk; + this.sbsv2Alias = alias; + this.configQueryData = configData; + setPlatformAndTargetFromOutputPath(); + this.configID = ISBSv2BuildContext.BUILDER_ID + "." + sbsv2Alias + "." + sdk.getUniqueId(); + this.displayString = sbsv2Alias + " [" + sdk.getUniqueId() + "]"; + } + + @Override + public ISymbianSDK getSDK() { + return sdk; + } + + @Override + public String getPlatformString() { + + if (platform == null){ + return configQueryData.getConfigurationErrorMessage(); + } + + if (platform.contains(".")){ + String[] tok = platform.split("."); + if (tok.length > 0) return tok[0]; + } + return platform; + } + + public String getPlatformReleaseDirName() { + return platform; + } + + @Override + public String getTargetString() { + if (target == null){ + return configQueryData.getConfigurationErrorMessage(); + } + return target; + } + + public String getConfigID(){ + return configID; + } + + @Override + public String getDisplayString() { + Check.checkState(displayString != null); + return displayString; + } + + @Override + public String toString() { + return getConfigID(); + } + + @Override + public String getDefaultDefFileDirectoryName() { + + String dirName = getDefFileDirectoryNameForPlatform(platform); + + if (dirName == null) { + // fallback for unknown cases + dirName = platform; + } + + return dirName; + } + + private String getDefFileDirectoryNameForPlatform(String platform) { + if (sbsv2Alias.toUpperCase().contains("WINSCW")) { + return "BWINS"; //$NON-NLS-1$ + } else if (sbsv2Alias.toUpperCase().contains("ARM")) { + return "EABI"; //$NON-NLS-1$ + } + return null; + } + + @Override + public IPath getCompilerPrefixFile() { + + if (sbsv2Alias.toUpperCase().contains(TOOLCHAIN_GCCE) || + sbsv2Alias.toUpperCase().contains(TOOLCHAIN_ARM)) { + if (configQueryData != null) { + return new Path(configQueryData.getBuildPrefix()); + } + } + + // fallback for WINSCW, MSVC, etc. + return null; + } + + @Override + public List getVariantHRHDefines() { + return getCachedData().getVariantHRHDefines(); + } + + @Override + public List getPrefixFileIncludes() { + return getCachedData().getPrefixFileIncludes(); + } + + @Override + public List getCompilerMacros() { + IPath prefixFile = getCompilerPrefixFile(); + if (prefixFile == null) { + return Collections.emptyList(); + } + + return getCachedData().getCompilerMacros(prefixFile); + } + + @Override + public String getBuildVariationName() { + // TODO: This should not be needed for Raptor + return ""; + } + + @Override + public boolean isSymbianBinaryVariation() { + // This should not be needed for Raptor. We do need a check + // in the MPP for the featurevariant keyword perhaps + return false; + } + + @Override + public String getSBSv2Alias() { + return sbsv2Alias; + } + + /** + * Get the cache holding the data that applies to this build context globally. + * A build context is subclassed by CarbideBuildConfiguration, which has multiple + * instances at runtime, thus, a SymbianBuildContext instance should not hold a cache itself. + * @return cache, never null + */ + private SymbianBuildContextDataCache getCachedData() { + return SymbianBuildContextDataCache.getCache(this); + } + + /** + * Get the list of #include paths detected for this context. + * @return List or null + */ + public List getCachedSystemIncludePaths() { + return getCachedData().getSystemIncludePaths(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((platform == null) ? 0 : platform.hashCode()); + result = prime * result + ((getSDK() == null) ? 0 : getSDK().getEPOCROOT().hashCode()); + result = prime * result + ((target == null) ? 0 : target.hashCode()); + return result; + } + + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof BuildContextSBSv2)) + return false; + final BuildContextSBSv2 other = (BuildContextSBSv2) obj; + if (!configID.equalsIgnoreCase(other.configID)){ + return false; + } + return true; + } + + public static String getPlatformFromV1ConfigName(String displayString) { + String[] tokens = displayString.split(" "); + String sdkIdToken = tokens[2]; + if (sdkIdToken.contains("_")){ + sdkIdToken = sdkIdToken.substring(1, sdkIdToken.length()-1); + String[] aliasTokens = sdkIdToken.split("_"); + return aliasTokens[0]; + } else { + return sdkIdToken.substring(1, sdkIdToken.length()-1); + } + } + + public static String getTargetFromV1ConfigName(String displayString) { + String[] tokens = displayString.split(" "); + if (tokens[1].compareTo("Debug") == 0) { + return ISymbianBuildContext.DEBUG_TARGET; + } else { + return ISymbianBuildContext.RELEASE_TARGET; + } + } + + public static String getBuildAliasFromV1ConfigName(String displayString) { + String target = getTargetFromV1ConfigName(displayString); + String platform = getPlatformFromV1ConfigName(displayString); + return platform.toLowerCase() + "_" + target.toLowerCase(); + } + + // Fall-back to get SDK id from old config name + public static String getSDKIDFromV1ConfigName(String configName) { + int indexBegin = configName.indexOf("["); //$NON-NLS-1$ + int indexEnd = configName.indexOf("]"); //$NON-NLS-1$ + if (indexBegin > 0 && indexEnd > 0){ + return configName.substring(indexBegin+1, indexEnd); + } else { + return ""; //$NON-NLS-1$ + } + } + + private void setPlatformAndTargetFromOutputPath() { + String pathString = configQueryData.getOutputPathString(); + if (pathString == null || pathString.length() == 0) { + platform = ""; + target = ""; + return; + } + + IPath releasePath = new Path(configQueryData.getOutputPathString()); + int epoc32SegmentIndex = 0; + for (String segment : releasePath.segments()){ + if (segment.toLowerCase().equals("epoc32")) + break; + epoc32SegmentIndex++; + } + // assuming /epoc32/// + platform = releasePath.segment(epoc32SegmentIndex+2).toUpperCase(); + target = releasePath.segment(epoc32SegmentIndex+3).toUpperCase(); + } + + private ISBSv2ConfigQueryData setConfigQueryData(ISymbianSDK sdk, String alias) { + SBSv2ConfigQueryData configQueryData = null; + try { + configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias); + if (configQueryData == null) { + Map aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk); + List aliasList = new ArrayList(); + aliasList.add(alias); + String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, aliasList); + if (aliasToMeaningMap.get(alias) != null){ + configQueryData = new SBSv2ConfigQueryData(alias, aliasToMeaningMap.get(alias), configQueryXML); + } + } + } catch (final SBSv2MinimumVersionException e) { + PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(WorkbenchUtils.getSafeShell(), "Minimum sbs version not met.", e.getMessage()); + } + }); + Logging.log(SDKCorePlugin.getDefault(), Logging.newSimpleStatus(0, IStatus.ERROR, + MessageFormat.format(e.getMessage(), ""), e)); + } + + return configQueryData; + } + + @Override + public ISBSv2ConfigQueryData getConfigQueryData() { + return configQueryData; + } + + @Override + public String getToolChain() { + + if (configQueryData != null) { + Map buildMacros = configQueryData.getBuildMacros(); + // try to figure out the tool chain using macros from Raptor config query + if (buildMacros.containsKey(MACRO_ARM)) { + return TOOLCHAIN_ARM; + } else if (buildMacros.containsKey(MACRO_GCCE)) { + return TOOLCHAIN_GCCE; + } else if (buildMacros.containsKey(MACRO_WINSCW)) { + return TOOLCHAIN_WINSCW; + } + } else { + // if no macros available, use alias name instead + if (sbsv2Alias.toUpperCase().contains(TOOLCHAIN_ARM)) { + return TOOLCHAIN_ARM; + } else if (sbsv2Alias.toUpperCase().contains(TOOLCHAIN_GCCE)) { + return TOOLCHAIN_GCCE; + } else if (sbsv2Alias.toUpperCase().contains(TOOLCHAIN_WINSCW)) { + return TOOLCHAIN_WINSCW; + } + } + return TOOLCHAIN_UNKNOWN; + } +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +*/ + +package com.nokia.carbide.cpp.internal.api.sdk; + +import java.util.List; + +import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; +import com.nokia.carbide.cpp.sdk.core.ISBVCatalog; +import com.nokia.carbide.cpp.sdk.core.ISDKBuildInfo; + +/** + * Interface for SBSv1 specific build information. + * + */ +public interface ISBSv1BuildInfo extends ISDKBuildInfo { + + // Family Ids don't include the vendor + public static final String SERIES60_FAMILY_ID = "series60"; //deprecated + public static final String S60_FAMILY_ID = "s60"; + public static final String S80_FAMILY_ID = "Series80"; + public static final String UIQ_FAMILY_ID = "UIQ"; + public static final String TECHVIEW_FAMILY_ID = "TechView"; + public static final String SYMBIAN_FOUNDATION_FAMILY_ID = "symbian"; // Symbian Foundation, starting with Symbian^3 + + // Unique Ids include the vendor + public static final String SERIES60_SDK_NAME = "com.nokia." + SERIES60_FAMILY_ID; + public static final String S60_SDK_NAME = "com.nokia." + S60_FAMILY_ID; + public static final String NOKIA_SF_SDK_NAME = "com.nokia." + SYMBIAN_FOUNDATION_FAMILY_ID; // Nokia+Symbian Foundation SDK + public static final String S80_SDK_NAME = "com.nokia." + S80_FAMILY_ID; + public static final String UIQ_SDK_NAME = "com.symbian." + UIQ_FAMILY_ID; + public static final String TECHVIEW_SDK_NAME = "com.symbian." + TECHVIEW_FAMILY_ID; + + public static final String PUBLISHER_NOKIA = "Nokia, Inc."; + public static final String PUBLISHER_UIQ = "UIQ Technology"; + public static final String PUBLISHER_SYMBIAN = "Symbian, Ltd."; + + void clearPlatformMacros(); + + /** + * Returns the list of all available platforms for a SDK. + * @return a list of platform names which may be empty. + */ + List getAvailablePlatforms(); + + /** + * Get the BSF catalog for a SDK. + */ + IBSFCatalog getBSFCatalog(); + + /** + * Returns the list of all platform macros for a SDK. + *

+ * This is somewhat equivalent to calling "bldmake plat" on the command line + * These are the macros that can be used in MMP and INF files. They are only given by name (no value) + *

+ * @param platform the platform name + * @return a list of macros, which may be empty. + */ + List getPlatformMacros(String platform); + + /** + * Get the Symbian Binary Variation (SBV) catalog for a SDK. + */ + ISBVCatalog getSBVCatalog(); + + /** + * Get a list of macros specific to the given target type, e.g. "__EXE__" or "__DLL__" + * @param targettype + * @return list of macro strings, may be empty + */ + List getTargetTypeMacros(String targettype); + + /** + * Get a list of macros that are used to distinguish a SDK. Typically only + * S603rd edition SDKs contain this information and it's used to differentiate between + * varios S60 SDK releases. Other vendors, such as UIQ may put their macros in the variant HRH file. + * @return A list of macros just returned by name. + */ + public List getVendorSDKMacros(); + + /** + * Tells whether or not the plug-in installer has sniffed this SDK for eclipse plug-ins to install. + * @return true if the SDK was scanned + */ + boolean isPreviouslyScanned(); + + /** + * Tell if the SDK is Series60. + * @return true if the SDK is Series60 + */ + boolean isS60(); + + void setPreviouslyScanned(boolean wasScanned); + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv2BuildInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv2BuildInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +*/ + +package com.nokia.carbide.cpp.internal.api.sdk; + +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.IPath; + +import com.nokia.carbide.cpp.sdk.core.ISDKBuildInfo; + +/** + * Interface for SBSv2 specific build information. + * + */ +public interface ISBSv2BuildInfo extends ISDKBuildInfo { + + /** + * Returns the list of all platform macros for a SDK. + *

+ * This is somewhat equivalent to calling "bldmake plat" on the command line + * These are the macros that can be used in MMP and INF files. They are only given by name (no value) + *

+ * @param platform the platform name + * @return a map of macros and values, which may be empty. + */ + Map getPlatformMacros(String platform); + + /** + * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg + * @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. + */ + public IPath getPrefixFromVariantCfg(); + + /** + * Get a list of macros specific to the given target type, e.g. "__EXE__" or "__DLL__" + * @param targettype + * @return list of macro strings, may be empty + */ + List getTargetTypeMacros(String targettype); + + /** + * Tells whether or not the plug-in installer has sniffed this SDK for eclipse plug-ins to install. + * @return true if the SDK was scanned. + * @since 2.0 + */ + boolean isPreviouslyScanned(); + + void setPreviouslyScanned(boolean wasScanned); + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISymbianSDKModifier.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISymbianSDKModifier.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +*/ + +package com.nokia.carbide.cpp.internal.api.sdk; + +import org.eclipse.core.runtime.IPath; +import org.osgi.framework.Version; + +import com.nokia.carbide.cpp.sdk.core.ISDKBuildInfo; + +/** + * Interface for modifying various attributes of Symbian OS SDK. + * + */ +public interface ISymbianSDKModifier { + + /** + * Add a feature supported by the SDK. + * @param feature supported feature + */ + void addSupportedFeature(Object feature); + + /** + * Sets the build info for a particular builder. + * @param buildInfo build info + * @param builderId id string of a builder + */ + void setBuildInfo(ISDKBuildInfo buildInfo, String builderId); + + /** + * Marks the SDK as enabled or disabled. + * @param enable whether to enable or disable the SDK + */ + void setEnabled(boolean enable); + + /** + * Set the absolute path to the epoc32 directory of this SDK. + * @param epocRoot absolute path to the epoc32 directory + */ + void setEPOCROOT(String epocRoot); + + /** + * Sets display name of a SDK. This is the com.vendor.family identifier. + * @param name SDK display name + */ + void setName(String name); + + /** + * Sets the OS version string of a SDK. + * @param osVer OS version + */ + public void setOSVersion(Version osVer); + + /** + * Sets the prefix file for a particular builder. + * @param prefixFile path of prefix file + * @param builderId id string of a builder + */ + void setPrefixFile(IPath prefixFile, String builderId); + + /** + * Sets the SDK version string of a SDK. + * @param sdkVers SDK version + */ + void setSDKVersion(Version sdkVers); + + /** + * Sets the unique id of a SDK. + * @param id id string of a SDK + */ + void setUniqueId(String id); + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Wed Jul 21 12:11:48 2010 -0500 @@ -13,38 +13,24 @@ package com.nokia.carbide.cpp.internal.api.sdk; import java.io.File; -import java.io.FileFilter; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Map; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; import org.eclipse.cdt.utils.spawner.EnvironmentReader; -import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.InstanceScope; import org.osgi.framework.Version; import org.osgi.service.prefs.BackingStoreException; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.helpers.DefaultHandler; import com.nokia.carbide.cpp.sdk.core.ISDKManager; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; -import com.nokia.cpp.internal.api.utils.core.FileUtils; import com.nokia.cpp.internal.api.utils.core.HostOS; import com.nokia.cpp.internal.api.utils.core.Logging; @@ -54,15 +40,17 @@ */ public class SBSv2Utils { - private static final String SBSV2_FILTERED_CONFIGS_STORE = "sbsv2FilteredConfigs"; //$NON-NLS-1$ - private static final String SBSV2_FILTERED_CONFIGS_STORE_INITED = "sbsv2FilteredConfigsInited"; //$NON-NLS-1$ + //private static final String SBSV2_FILTERED_CONFIGS_STORE = "sbsv2FilteredConfigs"; //$NON-NLS-1$ + private static final String SBSV2_FILTERED_CONFIGS_STORE_V2 = "sbsv2FilteredConfigs_V2"; //$NON-NLS-1$ + //private static final String SBSV2_FILTERED_CONFIGS_STORE_INITED = "sbsv2FilteredConfigsInited"; //$NON-NLS-1$ + private static final String SBSV2_FILTERED_CONFIGS_STORE_INITED_V2 = "sbsv2FilteredConfigsInited_V2"; //$NON-NLS-1$ private static final String SBSV2_FILTERED_CONFIGS_DELIMETER = ";"; //$NON-NLS-1$ private static final long VALID_ABLD_SIZE = 1024; /** * Map of usable Raptor alias for -c parameter and base platform: */ - private static Map unfilteredSBSv2ConfigNames; +// private static Map unfilteredSBSv2ConfigNames; /** Path, to and including the SBS script */ protected static IPath sbsPath; @@ -85,50 +73,6 @@ } /** - * Get the build configurations supported by SBSv2 - * @param refreshList whether or not to parse the configuration xml files again - * @return A map of raptor aliases (key) to base build platform. Never null; - */ - public static Map getUnfilteredSBSv2BuildConfigurations(boolean refreshList) { - - if (unfilteredSBSv2ConfigNames == null || refreshList || unfilteredSBSv2ConfigNames.size() == 0) { - unfilteredSBSv2ConfigNames = new HashMap(); - - // parse the xml files in /lib/config/ to get SBSv2 configs - try { - - IPath configPath = getSBSBinDirectory(); - if (configPath != null) { - configPath = configPath.removeLastSegments(1).append("lib/config"); //$NON-NLS-1$ - File configDir = configPath.toFile(); - if (configDir.exists() && configDir.isDirectory()) { - File[] configFiles = FileUtils.listFilesInTree(configDir, new FileFilter() { - - public boolean accept(File arg0) { - if (arg0.isDirectory()) { - return true; - } - return arg0.getName().toLowerCase().endsWith("xml"); //$NON-NLS-1$ - } - - }, false); - - for (File file : configFiles) { - getConfigsForFile(file); - } - } - } - - } catch (Exception e) { - e.printStackTrace(); - Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); - } - } - - return unfilteredSBSv2ConfigNames; - } - - /** * Given a list of SDKs, returns the list of the SDK's supported by SBSv2 * @param sdks list of SDK's to check * @return list of SBSv2 supported SDK's, may be empty @@ -144,8 +88,8 @@ // For now, just filter out anything older than 9.4 for (ISymbianSDK sdk : sdks) { Version osVersion = sdk.getOSVersion(); - if (osVersion.getMajor() > 8 || - (osVersion.getMajor() == 8 && osVersion.getMinor() > 3)) { + if (osVersion.getMajor() > 8 || osVersion.getMajor() == 0 || + (osVersion.getMajor() == 9 && osVersion.getMinor() > 3)) { supportedSDKs.add(sdk); } } @@ -155,23 +99,32 @@ /** * Returns the list of SBSv2 build configuration names that should - * be filtered out of any UI + * INCLUDED in any UI. Only configs to be displayed are saved */ - public static String[] getSBSv2ConfigurationsToFilter() { + public static List getSBSv2FilteredConfigPreferences() { + List buildAliasList = new ArrayList(); IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.PLUGIN_ID); if (prefs != null) { - String configs = prefs.get(SBSV2_FILTERED_CONFIGS_STORE, ""); - return configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER); + String configs = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_V2, ""); + if (configs.length() == 0){ + initDefaultConfigsToFilter(); + configs = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_V2, ""); + } + String aliasesToInclude[] = configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER); + for (String alias : aliasesToInclude){ + buildAliasList.add(alias); + } } - return new String[0]; + + return buildAliasList; } /** - * Set the list of SBSv2 build configurations that should be filtered - * out of any UI + * Set the list of SBSv2 build configurations that should be included in a build config list + * All others will be filtered out * @param configs configs to be filtered */ - public static void setSBSv2ConfigurationsToFilter(String[] configs) { + public static void setSBSv2FilteredConfigs(String[] configs) { IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.PLUGIN_ID); if (prefs != null) { String store = ""; //$NON-NLS-1$ @@ -185,7 +138,7 @@ } if (store.length() >= 0){ // lenght of zero means there are not configs to filter (or show them all) - prefs.put(SBSV2_FILTERED_CONFIGS_STORE, store); + prefs.put(SBSV2_FILTERED_CONFIGS_STORE_V2, store); try { prefs.flush(); } catch (BackingStoreException e) { @@ -197,77 +150,24 @@ } /** - * Gets the list of SBSv2 build contexts for the given SDK - * @param sdk the SDK to get the build contexts for - * @return the list of SBSv2 build contexts. the list may be empty - */ - public static List getFilteredSBSv2BuildContexts(ISymbianSDK sdk) { - List contexts = new ArrayList(); - - initDefaultConfigsToFilter(); - - Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator(); - - while (it.hasNext()){ - - Map.Entry buildConfigPair = (Map.Entry)it.next(); - String alias = (String)buildConfigPair.getKey(); // The sbsv2 alias - String basePlat = (String)buildConfigPair.getValue(); - boolean addConfig = true; - - for (String filteredConfig : getSBSv2ConfigurationsToFilter()) { - if (filteredConfig.compareTo(alias) == 0) { - addConfig = false; - break; - } - } - - if (addConfig) { - - // only support configs that fall into something we can make a build context - // out of. They must have a platform and a target. - String targetString = null; - String[] configTokens = alias.split("_"); // $//$NON-NLS-N$ - // We presume that aliases have the second token as the "target". - if (configTokens[1].toLowerCase().endsWith("deb")) { //$NON-NLS-1$ //$NON-NLS-2$ - targetString = ISymbianBuildContext.DEBUG_TARGET; - } else if (configTokens[1].toLowerCase().endsWith("rel")) { //$NON-NLS-1$ //$NON-NLS-2$ - targetString = ISymbianBuildContext.RELEASE_TARGET; - } - - if (targetString != null) { - SymbianBuildContext context = null; - context = new SymbianBuildContext(sdk, basePlat, targetString, alias); - if (context != null) - contexts.add(context); - } - } - } - - return sortContexts(contexts); - } - - /** * There are many build aliases presented by default from Raptor * Filter out those that are less commonly used on new workspace creation. */ public static void initDefaultConfigsToFilter() { IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.getPluginId()); - String inited = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_INITED, ""); + String inited = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_INITED_V2, ""); if (inited == null || inited.length() == 0){ - Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator(); List defaultConfigsToFilter = new ArrayList(); - while (it.hasNext()){ - Map.Entry buildConfigPair = (Map.Entry)it.next(); - String buildAlias = (String)buildConfigPair.getKey(); - if (buildAlias.toLowerCase().startsWith("armv6") || - buildAlias.toLowerCase().startsWith("armv7") || - buildAlias.toLowerCase().startsWith("armv9")){ - defaultConfigsToFilter.add(buildAlias); - } - } - prefs.put(SBSV2_FILTERED_CONFIGS_STORE_INITED, "true"); - setSBSv2ConfigurationsToFilter(defaultConfigsToFilter.toArray(new String[defaultConfigsToFilter.size()])); + + defaultConfigsToFilter.add("armv5_udeb"); + defaultConfigsToFilter.add("armv5_urel"); + defaultConfigsToFilter.add("armv5_udeb_gcce"); + defaultConfigsToFilter.add("armv5_urel_gcce"); + defaultConfigsToFilter.add("winscw_urel"); + defaultConfigsToFilter.add("winscw_udeb"); + + prefs.put(SBSV2_FILTERED_CONFIGS_STORE_INITED_V2, "true"); + setSBSv2FilteredConfigs(defaultConfigsToFilter.toArray(new String[defaultConfigsToFilter.size()])); } } @@ -304,66 +204,6 @@ return false; } - private static void getConfigsForFile(File file) { - - try { - Element root = null; - DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - parser.setErrorHandler(new DefaultHandler()); - - InputSource source = new InputSource(URIUtil.toURI(file.getAbsolutePath()).getPath()); - root = parser.parse(source).getDocumentElement(); - - NodeList children = root.getChildNodes(); - for (int i=0; i< children.getLength(); i++) { - getConfigsForNode(children.item(i), root); - } - - } catch (Exception e) { - e.printStackTrace(); - Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); - } - } - - private static void getConfigsForNode(Node node, Node parentNode) { - if (node.getNodeName().equals("config")) { //$NON-NLS-1$ - Node abstractNode = node.getAttributes().getNamedItem("abstract"); //$NON-NLS-1$ - Node namedNode = node.getAttributes().getNamedItem("name"); //$NON-NLS-1$ - if (abstractNode == null || abstractNode.getNodeValue().equals("false")) { //$NON-NLS-1$ - if (namedNode != null) { - - // Get the parent base build platform - String baseBuildPlatform = null; - if (parentNode != null){ - baseBuildPlatform = parentNode.getAttributes().getNamedItem("name").getNodeValue(); - if (baseBuildPlatform.split("_").length > 1){ - baseBuildPlatform = baseBuildPlatform.split("_")[0]; - } - } - - // only support configs that fall into something we can make a build context - // out of. They must have a platform and a target. - String configName = namedNode.getNodeValue(); - String[] configTokens = configName.split("_"); - if (configTokens.length >= 2) { //$NON-NLS-1$ - String target = configTokens[1]; - if (target.endsWith("deb") || target.endsWith("rel")){ //$NON-NLS-1$ - if (baseBuildPlatform == null){ - baseBuildPlatform = "unknown"; - } - unfilteredSBSv2ConfigNames.put(configName, baseBuildPlatform); - } - } - } - } - - NodeList children = node.getChildNodes(); - for (int i=0; i< children.getLength(); i++) { - getConfigsForNode(children.item(i), node); - } - } - } - /** * (Re-)scan the SBSv2 / Raptor configuration * @return message if error, else null @@ -402,78 +242,14 @@ } private static List sortContexts(List contexts){ - - // 2 sorting stages to handle long Raptor aliases, and multiple aliases that have a similar platform and target prefix (e.g. armv5_urel) - Collections.sort(contexts, new Comparator() { - - // First sort the target name (Debug / Release) and push Emulation to the top public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) { - String sbsAlias1 = o1.getSBSv2Alias(); - String sbsAlias2 = o2.getSBSv2Alias(); - - if (o1.getPlatformString().equals(o2.getPlatformString())) { - if (o1.getSBSv2Alias().split("_").length != o2.getSBSv2Alias().split("_").length) - return o1.getTargetString().compareTo(o2.getTargetString()); - else if (sbsAlias1.split("_").length >= 3){ - String temp1[] = sbsAlias1.split("_"); - String temp2[] = sbsAlias2.split("_"); - String suffix1 = ""; - String suffix2 = ""; - for (int i = 2; i < temp1.length; i++){ - suffix1 += temp1[i] + "_"; - } - - for (int i = 2; i < temp2.length; i++){ - suffix2 += temp2[i] + "_"; - } - - return suffix1.compareTo(suffix2); - } - } else { - if (sbsAlias1.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) { - return -1; - }else if (sbsAlias2.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) { - return 1; - } - } - return sbsAlias1.compareTo(sbsAlias2); - } - - }); - - // Sort long alias names - Collections.sort(contexts, new Comparator() { - - public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) { - String sbsAlias1 = o1.getSBSv2Alias(); - String sbsAlias2 = o2.getSBSv2Alias(); - - if (o1.getSBSv2Alias().split("_").length == 3 && o2.getSBSv2Alias().split("_").length == 3 && - o1.getPlatformString().equals(o2.getPlatformString())) - return o1.getTargetString().compareTo(o2.getTargetString()); - else if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3 && !sbsAlias1.equals(sbsAlias2)){ - String temp1[] = sbsAlias1.split("_"); - String temp2[] = sbsAlias2.split("_"); - String suffix1 = ""; - String suffix2 = ""; - for (int i = 2; i < temp1.length; i++){ - suffix1 += temp1[i] + "_"; - } - - for (int i = 2; i < temp2.length; i++){ - suffix2 += temp2[i] + "_"; - } - - return suffix1.compareTo(suffix2); - } - - return 0; + return o2.getDisplayString().compareTo(o1.getDisplayString()); } }); - return contexts; - } + return contexts; + } /** * If a variant is defined and it changes the output directory, return the directory name. diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SDKCacheUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SDKCacheUtils.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2010 Nokia and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nokia - Initial API and implementation + *******************************************************************************/ + +package com.nokia.carbide.cpp.internal.api.sdk; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectStreamClass; + +import org.eclipse.core.runtime.IPath; + +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.cpp.internal.api.utils.core.CacheUtils; + +public class SDKCacheUtils extends CacheUtils { + + public SDKCacheUtils(IPath defaultLocation) { + super(defaultLocation); + } + + protected CacheEntry loadCachedData(IPath location, String cacheIdentifier) { + IPath flushPath = location.append(Integer.toString(cacheIdentifier.hashCode())).addFileExtension("txt"); + + if (flushPath.toFile().exists()) { + try { + final ClassLoader classLoader = SDKCorePlugin.getDefault().getClass().getClassLoader(); + FileInputStream fis = new FileInputStream(flushPath.toFile()); + ObjectInputStream ois = new ObjectInputStream(fis) { + + @Override + protected Class resolveClass(ObjectStreamClass desc) + throws IOException, ClassNotFoundException { + String name = desc.getName(); + try { + return classLoader.loadClass(name); + } catch (ClassNotFoundException e) { + return super.resolveClass(desc); + } + }}; + return new CacheEntry(ois); + } catch (Exception e) { + e.printStackTrace(); + } + } + + return null; + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java Wed Jul 21 11:32:00 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,433 +0,0 @@ -/* -* 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -*/ -package com.nokia.carbide.cpp.internal.api.sdk; - -import java.io.File; -import java.util.*; - -import org.eclipse.core.runtime.IPath; -import org.osgi.framework.Version; - -import com.nokia.carbide.cpp.epoc.engine.preprocessor.*; -import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianMissingSDKFactory; -import com.nokia.carbide.cpp.sdk.core.*; - -public class SymbianBuildContext implements ISymbianBuildContext { - - private String sdkId; - private String platform; - private String target; - private String displayString = null; - private String sbsv2Alias = null; - - private static String EMULATOR_DISPLAY_TEXT = "Emulator"; //$NON-NLS-1$ - private static String PHONE_DISPLAY_TEXT = "Phone"; //$NON-NLS-1$ - private static String DEBUG_DISPLAY_TEXT = "Debug"; //$NON-NLS-1$ - private static String RELEASE_DISPLAY_TEXT = "Release"; //$NON-NLS-1$ - private static String SPACE_DISPLAY_TEXT = " "; //$NON-NLS-1$ - private static String SDK_NOT_INSTALLED = "SDK not installed"; //$NON-NLS-1$ - - // a copy of bad SDK default to fall back - private static ISymbianSDK fallbackForBadSdk = SymbianMissingSDKFactory.createInstance("dummy_ID"); //$NON-NLS-1$ - - public SymbianBuildContext(ISymbianSDK theSDK, String thePlatform, String theTarget) { - sdkId = theSDK.getUniqueId(); - platform = thePlatform.toUpperCase(); - target = theTarget.toUpperCase(); - - getDisplayString(); - } - - public SymbianBuildContext(ISymbianSDK theSDK, String thePlatform, String theTarget, String theSBSv2Alias) { - sdkId = theSDK.getUniqueId(); - platform = thePlatform.toUpperCase(); - target = theTarget.toUpperCase(); - sbsv2Alias = theSBSv2Alias; - - getDisplayString(); - } - - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((platform == null) ? 0 : platform.hashCode()); - result = prime * result + ((getSDK() == null) ? 0 : getSDK().getEPOCROOT().hashCode()); - result = prime * result + ((target == null) ? 0 : target.hashCode()); - return result; - } - - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof SymbianBuildContext)) - return false; - final SymbianBuildContext other = (SymbianBuildContext) obj; - if (platform == null) { - if (other.platform != null) - return false; - } else if (!platform.equals(other.platform)) - return false; - if (getSDK() == null) { - if (other.getSDK() != null) - return false; - } else if (!getSDK().getEPOCROOT().equals(other.getSDK().getEPOCROOT())) - return false; - if (target == null) { - if (other.target != null) - return false; - } else if (!target.equals(other.target)) { - return false; - } else if (sbsv2Alias!= null && !sbsv2Alias.equals(other.sbsv2Alias)) { - return false; - } - return true; - } - - - public ISymbianSDK getSDK() { - - ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(sdkId, true); - if (sdk == null){ - sdk = fallbackForBadSdk; - } - - return sdk; - } - - public String getPlatformString() { - return platform.toUpperCase(); - } - - public String getTargetString() { - return target.toUpperCase(); - } - - public String getDisplayString() { - if (displayString == null) { - // in the form Emulation Debug (WINSCW) [S60_3rd_MR] or - // Phone Release (GCCE) [S60_3rd_MR] - if (platform.compareTo(ISymbianBuildContext.EMULATOR_PLATFORM) == 0) { - displayString = EMULATOR_DISPLAY_TEXT; - } else { - displayString = PHONE_DISPLAY_TEXT; - } - - if (target.compareTo(ISymbianBuildContext.DEBUG_TARGET) == 0) { - displayString = displayString + SPACE_DISPLAY_TEXT + DEBUG_DISPLAY_TEXT; - } else { - displayString = displayString + SPACE_DISPLAY_TEXT + RELEASE_DISPLAY_TEXT; - } - - String basePlatform; - if (sbsv2Alias != null) - basePlatform = sbsv2Alias; - else - basePlatform = platform; - - displayString = displayString + " (" + basePlatform + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$ - } - return displayString; - } - - public static ISymbianBuildContext getBuildContextFromDisplayName(String displayName) { - if (isValidConfigName(displayName)) { - String sdkId = getSDKIDFromConfigName(displayName); - ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(sdkId, true); - if (sdk == null) { - // add a dummy should a build context ask for a removed SDK - sdk = SDKManagerInternalAPI.addMissingSdk(sdkId); - } - - return new SymbianBuildContext(sdk, - getPlatformFromBuildConfigName(displayName), - getTargetFromBuildConfigName(displayName), - getSBSv2AliasFromConfigName(displayName)); - } - return new SymbianBuildContext(fallbackForBadSdk, SDK_NOT_INSTALLED, SDK_NOT_INSTALLED); - } - - /** - * See if the build configuration is an SBSv2 alias, and if so get the build-able alias name - * @param displayName - * @return The full SBSv2 alias that can be used with -c, otherwise null if not SBSv2 - */ - private static String getSBSv2AliasFromConfigName(String displayName) { - int indexBegin = displayName.indexOf("("); //$NON-NLS-1$ - int indexEnd = displayName.indexOf(")"); //$NON-NLS-1$ - if (indexBegin > 0 && indexEnd > 0){ - String configPart = displayName.substring(indexBegin+1, indexEnd); - if (configPart.split("_").length > 1){ - return configPart; - } - } - - return null; - } - - private static String getPlatformFromBuildConfigName(String configName) { - String[] tokens = configName.split(SPACE_DISPLAY_TEXT); - String sdkIdToken = tokens[2]; - if (sdkIdToken.contains("_")){ - sdkIdToken = sdkIdToken.substring(1, sdkIdToken.length()-1); - String[] aliasTokens = sdkIdToken.split("_"); - return aliasTokens[0]; - } else { - return sdkIdToken.substring(1, sdkIdToken.length()-1); - } - - } - - public static String getSDKIDFromConfigName(String configName) { - int indexBegin = configName.indexOf("["); //$NON-NLS-1$ - int indexEnd = configName.indexOf("]"); //$NON-NLS-1$ - if (indexBegin > 0 && indexEnd > 0){ - return configName.substring(indexBegin+1, indexEnd); - } else { - return ""; //$NON-NLS-1$ - } - } - - private static String getTargetFromBuildConfigName(String configName) { - String[] tokens = configName.split(SPACE_DISPLAY_TEXT); - if (tokens[1].compareTo(DEBUG_DISPLAY_TEXT) == 0) { - return ISymbianBuildContext.DEBUG_TARGET; - } else { - return ISymbianBuildContext.RELEASE_TARGET; - } - } - - private static boolean isValidConfigName(String configName) { - // () [] - if (configName != null && !configName.equals("")) { //$NON-NLS-1$ - String[] tokens = configName.split(SPACE_DISPLAY_TEXT); - if (tokens.length >= 4) { - if (tokens[0].compareTo(EMULATOR_DISPLAY_TEXT) == 0 || tokens[0].compareTo(PHONE_DISPLAY_TEXT) == 0) { - if (tokens[1].compareTo(DEBUG_DISPLAY_TEXT) == 0 || tokens[1].compareTo(RELEASE_DISPLAY_TEXT) == 0) { - if (tokens[2].matches("(.*)")) { //$NON-NLS-1$ - if (tokens[3].matches("\\[.*")) { //$NON-NLS-1$ - return true; - } - } - } - } - } - } - return false; - } - - public String toString() { - return getDisplayString(); - } - - public String getDefaultDefFileDirectoryName(boolean isASSP) { - // TODO: How the ASSP option affects the path? - - String dirName = getDefFileDirectoryNameForPlatform(platform); - if (dirName == null) { - // check BSF's - IBSFCatalog catalog = getSDK().getBSFCatalog(); - if (catalog != null) { - for (IBSFPlatform plat : catalog.getPlatforms()) { - if (plat.getName().compareToIgnoreCase(platform) == 0) { - String mainPlatform = catalog.getReleasePlatform(platform); - if (mainPlatform != null) { - dirName = getDefFileDirectoryNameForPlatform(mainPlatform); - if (dirName == null || dirName.length() < 1) { - // fallback - all BSF's should be EABI anyway - return "EABI"; //$NON-NLS-1$ - } - } - } - } - } - } - - if (dirName == null) { - // fallback for unknown cases - dirName = platform; - } - - return dirName; - } - - private String getDefFileDirectoryNameForPlatform(String platform) { - if (platform.equals(EMULATOR_PLATFORM)) { - return "BWINS"; //$NON-NLS-1$ - } else if (platform.equals(ARMV5_PLATFORM) - || platform.equals(ARMV5_ABIV2_PLATFORM) - || platform.equals(ARMV6_PLATFORM) - || platform.equals(ARMV6_ABIV2_PLATFORM) - || platform.equals(GCCE_PLATFORM)) { - return "EABI"; //$NON-NLS-1$ - } - return null; - } - - public IPath getCompilerPrefixFile() { - if (platform.equals(GCCE_PLATFORM) || - (sbsv2Alias != null && sbsv2Alias.toUpperCase().contains(GCCE_PLATFORM))) { - return getGCCEPrefixFilePath(); - } else if (platform.equals(ARMV5_PLATFORM) - || platform.equals(ARMV5_ABIV2_PLATFORM) - || platform.equals(ARMV6_PLATFORM) - || platform.equals(ARMV6_ABIV2_PLATFORM)) { - return getRVCTPrefixFilePath(); - } else { - // check BSF's - IBSFCatalog catalog = getSDK().getBSFCatalog(); - if (catalog != null) { - for (IBSFPlatform plat : catalog.getPlatforms()) { - if (plat.getName().compareToIgnoreCase(platform) == 0) { - String mainPlatform = catalog.getReleasePlatform(platform); - if (mainPlatform != null) { - if (mainPlatform.equals(GCCE_PLATFORM)) { - return getGCCEPrefixFilePath(); - } else if (mainPlatform.equals(ARMV5_PLATFORM) - || mainPlatform.equals(ARMV5_ABIV2_PLATFORM) - || mainPlatform.equals(ARMV6_PLATFORM) - || mainPlatform.equals(ARMV6_ABIV2_PLATFORM)) { - return getRVCTPrefixFilePath(); - } else { - // fallback - all BSF's should be EABI anyway - return getRVCTPrefixFilePath(); - } - } - } - } - } - } - - // fallback for WINSCW, MSVC, etc. - return null; - } - - private IPath getGCCEPrefixFilePath() { - return getSDK().getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$ - } - - private IPath getRVCTPrefixFilePath() { - IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools(); - // use default in case tools aren't installed - String rvctFragment = "rvct2_2"; //$NON-NLS-1$ - if (installedRVCTTools.length > 0) { - rvctFragment = getRVCTFragment(installedRVCTTools[0]); - } - IPath prefixFilePath = getSDK().getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$ - if (prefixFilePath.toFile().exists()){ - return prefixFilePath; - } else { - // SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones - // based on the default installation - return getSDK().getIncludePath().append("rvct").append("rvct" + ".h"); - } - } - - private String getRVCTFragment(IRVCTToolChainInfo info) { - int major = 0, minor = 0; - if (info != null) { - Version rvctToolsVersion = info.getRvctToolsVersion(); - if (rvctToolsVersion != null) { - major = info.getRvctToolsVersion().getMajor(); - minor = info.getRvctToolsVersion().getMinor(); - } - } - return "rvct" + major + "_" + minor; //$NON-NLS-1$ //$NON-NLS-2$ - } - - public List getVariantHRHDefines() { - - return getCachedData().getVariantHRHDefines(); - } - - public List getPrefixFileIncludes() { - return getCachedData().getPrefixFileIncludes(); - } - - - public List getCompilerMacros() { - // we parse the compiler prefix file to gather macros. this can be time consuming so do it - // once and cache the values. only reset the cache when the compiler prefix has changed. - - IPath prefixFile = getCompilerPrefixFile(); - if (prefixFile == null) { - return Collections.emptyList(); - } - - return getCachedData().getCompilerMacros(prefixFile); - } - - - public String getBuildVariationName() { - String varName = ""; - - String[] tokens = getPlatformString().split("\\."); - if (tokens.length == 2){ - varName = tokens[1]; - } - - return varName; - } - - - public boolean isSymbianBinaryVariation() { - if (getPlatformString().split("\\.").length == 2){ - return true; - } else { - return false; - } - } - - /** - * Get the cache holding the data that applies to this build context globally. - * A build context is subclassed by CarbideBuildConfiguration, which has multiple - * instances at runtime, thus, a SymbianBuildContext instance should not hold a cache itself. - * @return cache, never null - */ - private SymbianBuildContextDataCache getCachedData() { - return SymbianBuildContextDataCache.getCache(this); - } - - - public String getBasePlatformForVariation() { - String plat = ""; - - String[] tokens = getPlatformString().split("\\."); - if (tokens.length == 2){ - plat = tokens[0]; - } else { - return platform; - } - - return plat; - } - - - /** - * Get the list of #include paths detected for this context. - * @return List or null - */ - public List getCachedSystemIncludePaths() { - return getCachedData().getSystemIncludePaths(); - } - - public String getSBSv2Alias() { - return sbsv2Alias; - } -} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java Wed Jul 21 12:11:48 2010 -0500 @@ -102,6 +102,7 @@ private ExternalFileInfoCollection compilerPrefixFileInfo = null; private List systemIncludes; private ISymbianSDK sdk; + private ISymbianBuildContext context; private IPath compilerPrefixFile; private String platformString; @@ -109,17 +110,25 @@ private String displayString; private String contextKey; - + + private String builderId; + private boolean changed; private File cacheFile; private SymbianBuildContextDataCache(ISymbianBuildContext context) { if (DEBUG) System.out.println("Creating cache for " + context.getDisplayString()); + this.context = context; this.platformString = context.getPlatformString(); this.displayString = context.getDisplayString(); this.sdk = context.getSDK(); this.contextKey = getBuildContextKey(context); + if (context instanceof ISBSv1BuildContext) { + builderId = ISymbianBuilderID.SBSV1_BUILDER; + } else { + builderId = ISymbianBuilderID.SBSV2_BUILDER; + } } /* (non-Javadoc) @@ -166,15 +175,16 @@ List macros = new ArrayList(); Map namedMacros = new HashMap(); - File prefixFile = sdk.getPrefixFile(); + File prefixFile = sdk.getPrefixFile(builderId); + ISDKBuildInfo buildInfo = sdk.getBuildInfo(builderId); if (prefixFile == null){ // Check that the prefix file may have become available since the SDK was scanned last. // This can happen, for e.g., if the user opens the IDE _then_ does a subst on a drive that already has an SDK entry. - IPath prefixCheck = ((SymbianSDK)sdk).getPrefixFromVariantCfg(); + IPath prefixCheck = buildInfo.getPrefixFromVariantCfg(); if (prefixCheck != null){ prefixFile = prefixCheck.toFile(); - sdk.setPrefixFile(prefixCheck); + ((SymbianSDK)sdk).setPrefixFile(prefixCheck, builderId); } } @@ -186,23 +196,28 @@ // Always add epoc32/include to the search path as this is implicit for includes in the HRH systemPaths.add(new File(sdk.getEPOCROOT() + "epoc32/include")); - // add any BSF/SBV includes so the headers are picked up from the correct location - IBSFPlatform bsfPlat = sdk.getBSFCatalog().findPlatform(platformString); - ISBVPlatform sbvPlat = sdk.getSBVCatalog().findPlatform(platformString); - if (bsfPlat != null) { - for (IPath path : bsfPlat.getSystemIncludePaths()) { - systemPaths.add(path.toFile()); - } - } else if (sbvPlat != null) { - LinkedHashMap platPaths = sbvPlat.getBuildIncludePaths(); - Set set = platPaths.keySet(); - for (IPath path : set) { - String pathType = platPaths.get(path); - if (pathType.equalsIgnoreCase(ISBVView.INCLUDE_FLAG_PREPEND) || pathType.equalsIgnoreCase(ISBVView.INCLUDE_FLAG_SET)){ + if (buildInfo instanceof ISBSv1BuildInfo) { + // add any BSF/SBV includes so the headers are picked up from the correct location + // SBSv1 only + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)buildInfo; + IBSFPlatform bsfPlat = sbsv1BuildInfo.getBSFCatalog().findPlatform(platformString); + ISBVPlatform sbvPlat = sbsv1BuildInfo.getSBVCatalog().findPlatform(platformString); + + if (bsfPlat != null) { + for (IPath path : bsfPlat.getSystemIncludePaths()) { systemPaths.add(path.toFile()); } + } else if (sbvPlat != null) { + LinkedHashMap platPaths = sbvPlat.getBuildIncludePaths(); + Set set = platPaths.keySet(); + for (IPath path : set) { + String pathType = platPaths.get(path); + if (pathType.equalsIgnoreCase(ISBVView.INCLUDE_FLAG_PREPEND) || pathType.equalsIgnoreCase(ISBVView.INCLUDE_FLAG_SET)){ + systemPaths.add(path.toFile()); + } + } } - } + } MacroScanner scanner = new MacroScanner( new BasicIncludeFileLocator(null, systemPaths.toArray(new File[systemPaths.size()])), @@ -324,6 +339,19 @@ compilerPrefixFileInfo.setFiles(files); } + if (context instanceof ISBSv2BuildContext) { + // add macros from raptor query + ISBSv2BuildContext v2Context = (ISBSv2BuildContext) context; + Map buildMacros = v2Context.getConfigQueryData().getBuildMacros(); + if (buildMacros != null) { + for (Iterator itr = buildMacros.keySet().iterator(); itr.hasNext(); ) { + String name = itr.next(); + String value = buildMacros.get(name); + macros.add(DefineFactory.createDefine(name, value)); + } + } + } + compilerPrefixMacros = macros; saveCacheFile(); @@ -354,8 +382,15 @@ if (DEBUG) System.out.println("Scanning include paths for " + displayString); - IBSFPlatform bsfplatform = sdk.getBSFCatalog().findPlatform(platformString); - ISBVPlatform sbvPlatform = sdk.getSBVCatalog().findPlatform(platformString); + IBSFPlatform bsfplatform = null; + ISBVPlatform sbvPlatform = null; + ISDKBuildInfo buildInfo = sdk.getBuildInfo(builderId); + if (buildInfo instanceof ISBSv1BuildInfo) { + // SBSv1 only + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)buildInfo; + bsfplatform = sbsv1BuildInfo.getBSFCatalog().findPlatform(platformString); + sbvPlatform = sbsv1BuildInfo.getSBVCatalog().findPlatform(platformString); + } // look in the epoc32 directory of the SDK IPath includePath = sdk.getIncludePath(); @@ -386,7 +421,7 @@ } else { // legacy behavior - if (platformString.equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (platformString.equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { dir = new File(includeDir, "wins"); //$NON-NLS-1$ if (dir.exists() && dir.isDirectory()) { systemIncludes.add(dir); @@ -419,7 +454,7 @@ } // also search files in same folder as variant.hrh - File prefix = sdk.getPrefixFile(); + File prefix = sdk.getPrefixFile(builderId); if (sbvPlatform != null){ // might be an alternate HRH file to use IPath varVarHRH = sbvPlatform.getBuildVariantHRHFile(); diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2ConfigQueryData.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2ConfigQueryData.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,211 @@ +package com.nokia.carbide.cpp.internal.api.sdk.sbsv2; + +import java.io.StringReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.helpers.DefaultHandler; + +import com.nokia.carbide.cpp.sdk.core.ISBSv2ConfigQueryData; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.cpp.internal.api.utils.core.Logging; + +public class SBSv2ConfigQueryData implements ISBSv2ConfigQueryData { + + private static final long serialVersionUID = 3358697901364441158L; + + private String alias = ""; + private String meaning = ""; + + // Raptor config query data + private Map buildMacros = new HashMap(); // cpp preprocessor macros + private Map metaDataMacros = new HashMap(); // macros to parse the INF/MMPs files (these do not contain values) + private List metaDataIncludes = new ArrayList(); + private String buildPrefix = ""; + private String metaDataVariantHRH = ""; + private String outputPathString = ""; + private String configurationErrorMessage = ""; + + public SBSv2ConfigQueryData() { + this.alias = ""; + this.meaning = ""; + } + + public SBSv2ConfigQueryData(String alias, String meaning, String queryResult) { + this.alias = alias; + this.meaning = meaning; + parseQueryConfigResults(queryResult); + } + + @Override + public String getAlias() { + return alias; + } + + @Override + public String getBuildPrefix() { + return buildPrefix; + } + + @Override + public Map getBuildMacros() { + return buildMacros; + } + + @Override + public String getConfigurationErrorMessage() { + return configurationErrorMessage; + } + + @Override + public Map getMetaDataMacros() { + return metaDataMacros; + } + + @Override + public List getMetaDataIncludes() { + return metaDataIncludes; + } + + @Override + public String getMetaDataVariantHRH() { + return metaDataVariantHRH; + } + + @Override + public String getOutputPathString() { + return outputPathString; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((alias == null) ? 0 : alias.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + SBSv2ConfigQueryData other = (SBSv2ConfigQueryData) obj; + if (alias == null) { + if (other.alias != null) + return false; + } else if (!alias.equals(other.alias)) + return false; + return true; + } + + private void parseQueryConfigResults(String queryResult) { + try { + Element root = null; + DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + parser.setErrorHandler(new DefaultHandler()); + + StringReader reader = new StringReader( queryResult ); + InputSource inputSource = new InputSource( reader ); + root = parser.parse(inputSource).getDocumentElement(); + + NodeList children = root.getChildNodes(); + for (int i=0; i< children.getLength(); i++) { + Node configNode = children.item(i); + if (configNode.getNodeName().equals("config")){ + NamedNodeMap aliasAttribs = configNode.getAttributes(); + String dottedName = aliasAttribs.getNamedItem("meaning").getNodeValue(); + if (!dottedName.equalsIgnoreCase(meaning)){ + continue; + } + if (configNode.getTextContent() != null&& configNode.getTextContent().length() > 0){ + // The config failed, likely due to envrionment set up issue. + // Save the error message + configurationErrorMessage = configNode.getTextContent(); + break; + } + + String outputpath = aliasAttribs.getNamedItem("outputpath").getNodeValue(); + if (outputpath != null){ + outputPathString = outputpath; + } + + NodeList configChillens = configNode.getChildNodes(); + for (int ii = 0; ii < configChillens.getLength(); ii++){ + Node dataNode = configChillens.item(ii); + if (dataNode.getNodeName().equals("metadata")){ + // get + NodeList metaDataChillens = dataNode.getChildNodes(); + for (int iii = 0; iii < metaDataChillens.getLength(); iii++){ + Node metaChild = metaDataChillens.item(iii); + NamedNodeMap attribs = metaChild.getAttributes(); + try { + if (metaChild.getNodeName().equals("macro")){ + String name = attribs.getNamedItem("name").getNodeValue(); + String value = ""; + Node valueNode = attribs.getNamedItem("value"); + if (valueNode != null) { + value = valueNode.getNodeValue(); + } + metaDataMacros.put(name, value); + } else if (metaChild.getNodeName().equals("include")){ + String path = attribs.getNamedItem("path").getNodeValue(); + metaDataIncludes.add(path); + } else if (metaChild.getNodeName().equals("preinclude")){ + metaDataVariantHRH = attribs.getNamedItem("file").getNodeValue(); + } + } catch (Exception e) { + // skip it + e.printStackTrace(); + } + } + } else if (dataNode.getNodeName().equals("build")){ + // get + NodeList buildChillens = dataNode.getChildNodes(); + for (int iii = 0; iii < buildChillens.getLength(); iii++){ + Node buildChild = buildChillens.item(iii); + NamedNodeMap attribs = buildChild.getAttributes(); + try { + if (buildChild.getNodeName().equals("macro")){ + String name = attribs.getNamedItem("name").getNodeValue(); + String value = ""; + Node valueNode = attribs.getNamedItem("value"); + if (valueNode != null) { + value = valueNode.getNodeValue(); + } + buildMacros.put(name, value); + } else if (buildChild.getNodeName().equals("preinclude")){ + buildPrefix = attribs.getNamedItem("file").getNodeValue(); + } + } catch (Exception e) { + // skip it + e.printStackTrace(); + } + } + } + } + + break; + } + } + + } catch (Exception e) { + e.printStackTrace(); + Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); + } + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2MinimumVersionException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2MinimumVersionException.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,38 @@ +/* +* 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +*/ +package com.nokia.carbide.cpp.internal.api.sdk.sbsv2; + +/** + * Exception thrown in case something fails when trying + * find out facts about current SDK/Platform environment tools. + */ +public class SBSv2MinimumVersionException extends Exception { + + static final long serialVersionUID = -6103977959623981590L; + + /** + * Default constructor. + */ + public SBSv2MinimumVersionException(){ + super(); + } + + /** + * Constructor with attached message. + * @param message Informative message about situation causing the exception. + */ + public SBSv2MinimumVersionException(String message){ + super(message); + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,483 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Test the BldInfViewPathHelper class. +* +*/ +package com.nokia.carbide.cpp.internal.api.sdk.sbsv2; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Serializable; +import java.io.StringReader; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.cdt.utils.spawner.EnvironmentReader; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.osgi.framework.Version; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.helpers.DefaultHandler; + +import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.cpp.internal.api.utils.core.Logging; + +public class SBSv2QueryUtils { + + public static final String QUERY_ALIASES_COMMAND = "--query=aliases"; + public static final String QUERY_PRODUCTS_COMMAND = "--query=products"; + public static final String QUERY_CONFIG_COMMAND = "--query=config"; + + public static final String ALIAS_CACHE_KEY = "alias_cache"; + public static final String CONFIG_CACHE_KEY = "config_cache"; + public static final String PRODUCT_CACHE_KEY = "product_cache"; + + public static final String BAD_EPOCROOT = "BADEPOCROOT"; + + @SuppressWarnings("unchecked") + public static HashMap getAliasesForSDK(ISymbianSDK sdk) throws SBSv2MinimumVersionException { + HashMap aliases; + Map> aliasesMap = SDKCorePlugin.getCache().getCachedData(ALIAS_CACHE_KEY, Map.class, 0); + SBSv2SDKKey key = new SBSv2SDKKey(sdk); + + if (aliasesMap == null) { + aliasesMap = new HashMap>(); + } + else { + aliases = aliasesMap.get(key.toString()); + if (aliases != null && !aliases.containsKey(BAD_EPOCROOT)) { + return aliases; + } + } + + aliases = getAliasesQuery(sdk); + aliasesMap.put(key.toString(), aliases); + SDKCorePlugin.getCache().putCachedData(ALIAS_CACHE_KEY, (Serializable)aliasesMap, 0); + return aliases; + } + + @SuppressWarnings("unchecked") + public static List getProductVariantsForSDK(ISymbianSDK sdk) throws SBSv2MinimumVersionException { + List products; + Map> productsMap = SDKCorePlugin.getCache().getCachedData(PRODUCT_CACHE_KEY, Map.class, 0); + SBSv2SDKKey key = new SBSv2SDKKey(sdk); + + if (productsMap == null) { + productsMap = new HashMap>(); + } + else { + products = productsMap.get(key.toString()); + if (products != null && !products.contains(BAD_EPOCROOT)) { + return products; + } + } + + products = getProductsQuery(sdk); + productsMap.put(key.toString(), products); + SDKCorePlugin.getCache().putCachedData(PRODUCT_CACHE_KEY, (Serializable)productsMap, 0); + return products; + } + + public static String getConfigQueryXMLforSDK(ISymbianSDK sdk, List aliasOrMeaningArray) throws SBSv2MinimumVersionException { + + checkForMinimumRaptorVersion(); + + List argListConfigQuery = new ArrayList(); + for (String alias : aliasOrMeaningArray){ + argListConfigQuery.add(QUERY_CONFIG_COMMAND + "[" + alias + "]"); + } + + Properties envVars = null; + if (sdk != null){ + File epocRoot = new File(sdk.getEPOCROOT()); + if (epocRoot.exists()){ + envVars = EnvironmentReader.getEnvVars(); + envVars.setProperty("EPOCROOT", sdk.getEPOCROOT()); + } + } + + return getSBSQueryOutput(argListConfigQuery, createEnvStringList(envVars)); + } + + @SuppressWarnings("unchecked") + public static SBSv2ConfigQueryData getConfigQueryDataForSDK(ISymbianSDK sdk, String alias) { + SBSv2ConfigQueryData configQueryData = null; + Map configsMap = SDKCorePlugin.getCache().getCachedData(CONFIG_CACHE_KEY, Map.class, 0); + String key = (new SBSv2SDKKey(sdk)).toString() + "[" + alias + "]"; + + if (configsMap != null) { + configQueryData = configsMap.get(key); + } + return configQueryData; + } + + @SuppressWarnings("unchecked") + public static void storeConfigQueryDataForSDK(ISymbianSDK sdk, String alias, SBSv2ConfigQueryData configQueryData) { + Map configsMap = SDKCorePlugin.getCache().getCachedData(CONFIG_CACHE_KEY, Map.class, 0); + String key = (new SBSv2SDKKey(sdk)).toString() + "[" + alias + "]"; + + if (configsMap == null) { + configsMap = new HashMap(); + } else { + if (configsMap.get(key) != null) { + // configQueryData already exist in cache + return; + } + } + + configsMap.put(key, configQueryData); + SDKCorePlugin.getCache().putCachedData(CONFIG_CACHE_KEY, (Serializable)configsMap, 0); + } + + public static HashMap queryConfigTargetInfo(ISymbianSDK sdk, List aliasOrMeaningArray) throws SBSv2MinimumVersionException{ + + checkForMinimumRaptorVersion(); + + List argListConfigQuery = new ArrayList(); + + for (String alias : aliasOrMeaningArray){ + argListConfigQuery.add(QUERY_CONFIG_COMMAND + "[" + alias + "]"); + } + + Properties envVars = null; + if (sdk != null){ + File epocRoot = new File(sdk.getEPOCROOT()); + if (epocRoot.exists()){ + envVars = EnvironmentReader.getEnvVars(); + envVars.setProperty("EPOCROOT", sdk.getEPOCROOT()); + } + } + String queryResult = getSBSQueryOutput(argListConfigQuery, createEnvStringList(envVars)); + + return parseQueryConfigResults(queryResult); + } + + private static String[] createEnvStringList(Properties envProps) { + + if (envProps == null){ + return null; + } + String[] env = null; + List envList = new ArrayList(); + Enumeration names = envProps.propertyNames(); + if (names != null) { + while (names.hasMoreElements()) { + String key = (String) names.nextElement(); + envList.add(key + "=" + envProps.getProperty(key)); + } + env = (String[]) envList.toArray(new String[envList.size()]); + } + return env; + } + + private static HashMap getAliasesQuery(ISymbianSDK sdk) throws SBSv2MinimumVersionException { + + checkForMinimumRaptorVersion(); + if (!isEpocRootValid(sdk)) { + HashMap result = new HashMap(); + result.put(BAD_EPOCROOT, ""); + } + + List argListAliasQuery = new ArrayList(); + argListAliasQuery.add(QUERY_ALIASES_COMMAND); + + Properties envVars = EnvironmentReader.getEnvVars(); + if (sdk != null){ + envVars.setProperty("EPOCROOT", sdk.getEPOCROOT()); + } else { + envVars.setProperty("EPOCROOT", "FOOBAR"); + } + + String queryResult = getSBSQueryOutput(argListAliasQuery, createEnvStringList(envVars)); + + return parseQueryAliasResult(queryResult); + } + + private static List getProductsQuery(ISymbianSDK sdk) throws SBSv2MinimumVersionException { + + checkForMinimumRaptorVersion(); + if (!isEpocRootValid(sdk)) { + List result = new ArrayList(); + result.add(BAD_EPOCROOT); + return result; + } + + List argListProductQuery = new ArrayList(); + argListProductQuery.add(QUERY_PRODUCTS_COMMAND); + + Properties envVars = EnvironmentReader.getEnvVars(); + if (sdk != null){ + envVars.setProperty("EPOCROOT", sdk.getEPOCROOT()); + } else { + envVars.setProperty("EPOCROOT", "FOOBAR"); + } + + String queryResult = getSBSQueryOutput(argListProductQuery, createEnvStringList(envVars)); + return parseQueryProductsResults(queryResult); + } + + private static String getSBSQueryOutput(List queryCommandList, String[] env) { + String overallOutput = ""; + + Runtime rt = Runtime.getRuntime(); + IPath sbsPath = SBSv2Utils.getSBSPath(); + Process p = null; + List args = new ArrayList(); + args.add(sbsPath.toOSString()); + args.addAll(queryCommandList); + try { + p = rt.exec(args.toArray(new String[args.size()]), env); + } catch (IOException e) { + // no such process, SBSv2 not available + Logging.log( + SDKCorePlugin.getDefault(), + Logging.newSimpleStatus( + 0, + IStatus.WARNING, + MessageFormat + .format( + "Could not find or launch Raptor script ''{0}''; SBSv2 support will not be available", + sbsPath), e)); + } + if (p != null) { + BufferedReader br = new BufferedReader(new InputStreamReader(p + .getInputStream())); + + String stdErrLine = null; + try { + + // Only try for 30 seconds then bail in case Raptor hangs + int maxTries = 60; + int numTries = 0; + while (numTries < maxTries) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // ignore + } + if (br.ready()) { + while ((stdErrLine = br.readLine()) != null) { + overallOutput += stdErrLine; + numTries = maxTries; + } + + } + numTries++; + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + return overallOutput; + } + + private static Boolean isEpocRootValid(ISymbianSDK sdk) { + IPath epocRoot = new Path(sdk.getEPOCROOT()); + epocRoot = epocRoot.append("epoc32"); + File epocRootFile = epocRoot.toFile(); + if (epocRootFile.exists()) { + return true; + } else { + return false; + } + } + + private static HashMap parseQueryAliasResult(String queryResult) { + /* Alias to dotted name config */ + HashMap sbsAliasMap = new HashMap(); + + try { + Element root = null; + DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + parser.setErrorHandler(new DefaultHandler()); + + StringReader reader = new StringReader( queryResult ); + InputSource inputSource = new InputSource( reader ); + root = parser.parse(inputSource).getDocumentElement(); + + NodeList children = root.getChildNodes(); + for (int i=0; i< children.getLength(); i++) { + Node aliasNode = children.item(i); + if (aliasNode.getNodeName().equals("alias")){ + NamedNodeMap meaning = aliasNode.getAttributes(); + String dottedName = meaning.getNamedItem("meaning").getNodeValue(); + String alias = meaning.getNamedItem("name").getNodeValue(); + //System.out.println("ALIAS QUERY ==> " + dottedName + " <==> " + alias); + sbsAliasMap.put(alias, dottedName); + } + } + + } catch (Exception e) { + e.printStackTrace(); + Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); + } + + + return sbsAliasMap; + } + + private static HashMap parseQueryConfigResults(String queryResult) { + /* Alias to output directory */ + HashMap sbsAliasMap = new HashMap(); + + try { + Element root = null; + DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + parser.setErrorHandler(new DefaultHandler()); + + StringReader reader = new StringReader( queryResult ); + InputSource inputSource = new InputSource( reader ); + root = parser.parse(inputSource).getDocumentElement(); + + NodeList children = root.getChildNodes(); + for (int i=0; i< children.getLength(); i++) { + Node aliasNode = children.item(i); + if (aliasNode.getNodeName().equals("config")){ + NamedNodeMap meaning = aliasNode.getAttributes(); + String outputpath = meaning.getNamedItem("outputpath").getNodeValue(); + String fullName = meaning.getNamedItem("meaning").getNodeValue(); + //System.out.println("ALIAS QUERY ==> " + dottedName + " <==> " + alias); + sbsAliasMap.put(fullName, outputpath); + } + } + + } catch (Exception e) { + e.printStackTrace(); + Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); + } + + + return sbsAliasMap; + } + + private static List parseQueryProductsResults(String queryResult) { + List productList = new ArrayList(); + + try { + Element root = null; + DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + parser.setErrorHandler(new DefaultHandler()); + + StringReader reader = new StringReader( queryResult ); + InputSource inputSource = new InputSource( reader ); + root = parser.parse(inputSource).getDocumentElement(); + + NodeList children = root.getChildNodes(); + for (int i=0; i< children.getLength(); i++) { + Node aliasNode = children.item(i); + if (aliasNode.getNodeName().equals("product")){ + NamedNodeMap productAttribs = aliasNode.getAttributes(); + String name = productAttribs.getNamedItem("name").getNodeValue(); + productList.add(name); + } + } + + } catch (Exception e) { + e.printStackTrace(); + Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); + } + + return productList; + } + + private static boolean checkForMinimumRaptorVersion() throws SBSv2MinimumVersionException{ + Version sbsVers = SDKCorePlugin.getSDKManager().getSBSv2Version(false); + if (sbsVers.compareTo(SDKCorePlugin.getSDKManager().getMinimumSupportedSBSv2Version()) >= 0) + return true; + else { + String message = "Raptor/SBSv2 minimum version supported in Carbide.c++ is " + SDKCorePlugin.getSDKManager().getMinimumSupportedSBSv2Version() + ". Your sbs version is " + sbsVers + ". Please update your sbs installation and 'Rescan' from the Build Configuration Filtering preference page ."; + throw new SBSv2MinimumVersionException(message); + } + } + + public static HashMap getCompleteAliasList() throws SBSv2MinimumVersionException { + HashMap resultMap = new HashMap(); + + // iterate all SDKs and build the map up + for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) { + if (sdk.isEnabled() && isEpocRootValid(sdk)) { + HashMap aliasMap = getAliasesForSDK(sdk); + for (String alias : aliasMap.keySet()) { + if (alias.equals(BAD_EPOCROOT)) { + continue; + } + if (resultMap.get(alias) == null) { + resultMap.put(alias, aliasMap.get(alias)); + } + } + } + } + + return resultMap; + } + + public static List getCompleteProductVariantList() throws SBSv2MinimumVersionException { + List resultList = new ArrayList(); + + // iterate all SDKs and build the map up + for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) { + if (sdk.isEnabled() && isEpocRootValid(sdk)) { + List productList = getProductVariantsForSDK(sdk); + for (String variant : productList) { + if (variant.equals(BAD_EPOCROOT)) { + continue; + } + if (!resultList.contains(variant)) { + resultList.add(variant); + } + } + } + } + + return resultList; + } + + public static void removeAllCachedQueries() { + removeCachedAliases(); + removeCachedProducts(); + removeCachedConfigurations(); + } + + public static void removeCachedAliases() { + SDKCorePlugin.getCache().removeCache(ALIAS_CACHE_KEY); + } + + public static void removeCachedProducts() { + SDKCorePlugin.getCache().removeCache(PRODUCT_CACHE_KEY); + } + + public static void removeCachedConfigurations() { + SDKCorePlugin.getCache().removeCache(CONFIG_CACHE_KEY); + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2SDKKey.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2SDKKey.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Test the BldInfViewPathHelper class. +* +*/ + +package com.nokia.carbide.cpp.internal.api.sdk.sbsv2; + +import java.io.Serializable; + +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; + +public class SBSv2SDKKey implements Serializable { + + private static final long serialVersionUID = -5672527971643437442L; + + private String uniqueId; + private String epocRoot; + + public SBSv2SDKKey() { + uniqueId = ""; + epocRoot = ""; + } + + public SBSv2SDKKey(ISymbianSDK sdk) { + uniqueId = sdk.getUniqueId(); + epocRoot = sdk.getEPOCROOT(); + } + + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + SBSv2SDKKey other = (SBSv2SDKKey) obj; + if (epocRoot == null) { + if (other.epocRoot != null) + return false; + } else if (!epocRoot.equals(other.epocRoot)) + return false; + if (uniqueId == null) { + if (other.uniqueId != null) + return false; + } else if (!uniqueId.equals(other.uniqueId)) + return false; + return true; + } + + public String getUniqueId() { + return uniqueId; + } + + public String getEpocRoot() { + return epocRoot; + } + + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((epocRoot == null) ? 0 : epocRoot.hashCode()); + result = prime * result + + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + return result; + } + + public void setUniqueId(String id) { + uniqueId = id; + } + + public void setEpocRoot(String root) { + epocRoot = root; + } + + @Override + public String toString() { + return "SBSv2SDKKey [uniqueId=" + uniqueId + ", epocRoot=" + epocRoot + + "]"; + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,8 +16,6 @@ import java.io.File; import java.io.IOException; import java.io.InputStreamReader; -import java.net.MalformedURLException; -import java.net.URL; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; @@ -41,31 +39,41 @@ import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; -import org.eclipse.osgi.service.datalocation.Location; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.IJobChangeListener; +import org.eclipse.core.runtime.jobs.Job; import org.osgi.framework.Version; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.traversal.NodeIterator; -import org.xml.sax.SAXException; import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat; import com.nokia.carbide.cpp.internal.api.sdk.ICarbideDevicesXMLChangeListener; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal; import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerLoadedHook; import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; import com.nokia.carbide.cpp.internal.api.sdk.SDKManagerInternalAPI; import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContextDataCache; import com.nokia.carbide.cpp.internal.api.sdk.SymbianMacroStore; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils; import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener; +import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener.SDKChangeEventType; import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo; import com.nokia.carbide.cpp.sdk.core.ISDKManager; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; 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.cpp.sdk.core.ICarbideInstalledSDKChangeListener.SDKChangeEventType; +import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory; import com.nokia.cpp.internal.api.utils.core.FileUtils; import com.nokia.cpp.internal.api.utils.core.ListenerList; import com.nokia.cpp.internal.api.utils.core.Logging; @@ -77,6 +85,7 @@ protected static List sdkList = new ArrayList(); protected HashMap missingSdkMap = new HashMap(); + protected Job scanJob; protected static final String CARBIDE_SDK_CACHE_FILE_NAME = "carbideSDKCache.xml"; protected static final String SDK_CACHE_ID_ATTRIB = "id"; @@ -104,7 +113,7 @@ /** * Minimum SBSv2 version supported with Carbide */ - public static final Version MINIMUM_RAPTOR_VERSION = new Version(2, 8, 6); + public static final Version MINIMUM_RAPTOR_VERSION = new Version(2, 15, 0); static boolean hasScannedSDKs = false; // make sure we only scan SDKs when needed @@ -122,9 +131,29 @@ */ protected static ListenerList devicesXMLListeners = new ListenerList(); + IJobChangeListener scanJobListener = new IJobChangeListener() { + public void sleeping(IJobChangeEvent event) {} + public void scheduled(IJobChangeEvent event) {} + public void running(IJobChangeEvent event) {} + public void awake(IJobChangeEvent event) {} + public void aboutToRun(IJobChangeEvent event) {} + public void done(IJobChangeEvent event) { + fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned); + } + }; + + public AbstractSDKManager() { macroStore = SymbianMacroStore.getInstance(); + scanJob = new Job ("Scan for installed SDKs") { + @Override + protected IStatus run(IProgressMonitor monitor) { + return handleScan(monitor); + } + }; + + addScanJobListner(scanJobListener); } public SymbianMacroStore getSymbianMacroStore(){ @@ -132,6 +161,14 @@ } public void scanSDKs() { + SBSv2QueryUtils.removeAllCachedQueries(); + // do the real sdk scanning in a job. + if (scanJob.getState() == Job.NONE) { + scanJob.schedule(); + } + } + + private IStatus handleScan(IProgressMonitor monitor) { synchronized (sdkList) { ArrayList oldSDKList = new ArrayList(sdkList); @@ -142,9 +179,11 @@ sdkList.clear(); } - if (!doScanSDKs()) - return; - + if (!doScanSDKs(monitor)) + return Status.OK_STATUS;; + + scanCarbideSDKCache(); + // now these SDK's are newly added, remove from internal list for (ISymbianSDK sdk : sdkList) { if (SDKManagerInternalAPI.getMissingSdk(sdk.getUniqueId()) != null) { @@ -170,23 +209,22 @@ SymbianBuildContextDataCache.refreshForSDKs(new ISymbianSDK[] { oldSdk }); } } - - } // make sure we don't rescan over and over again hasScannedSDKs = true; - // tell others about it - fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned); - scanCarbideSDKCache(); + updateCarbideSDKCache(); // Notify any plugins that want to know if the SDKManager has scanned plugins. if (!sdkHookExtenstionsNotified) { notifySDKManagerLoaded(); sdkHookExtenstionsNotified = true; } - + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + return Status.OK_STATUS; } /** @@ -195,12 +233,24 @@ * when SDKs are newly missing * @return true if scan succeeded */ - abstract protected boolean doScanSDKs(); + abstract protected boolean doScanSDKs(IProgressMonitor monitor); + public void addScanJobListner(IJobChangeListener listener) { + if (scanJob != null && listener != null) { + scanJob.addJobChangeListener(listener); + } + } + + public void removeScanJobLisner(IJobChangeListener listener) { + if (scanJob != null && listener != null) { + scanJob.removeJobChangeListener(listener); + } + } protected void ensureScannedSDKs() { if (!hasScannedSDKs) { - scanSDKs(); + handleScan(new NullProgressMonitor()); + fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned); } } @@ -237,8 +287,8 @@ synchronized(sdkList) { try { + sdkList.add(sdk); updateSDK(sdk); - sdkList.add(sdk); SDKManagerInternalAPI.removeMissingSdk(sdk.getUniqueId()); // tell others about it fireInstalledSdkChanged(SDKChangeEventType.eSDKAdded); @@ -263,8 +313,11 @@ // tell others about it fireInstalledSdkChanged(SDKChangeEventType.eSDKRemoved); - - doRemoveSDK(sdkId); + + // only remove sdk from devices.xml if the sdk is defined in it + if (((SymbianSDK)currSDK).getSupportedFeatures().contains(ISymbianSDKFeatures.IS_FROM_DEVICES_XML)) { + doRemoveSDK(sdkId); + } break; } @@ -282,7 +335,6 @@ abstract protected boolean doRemoveSDK(String sdkId); protected void scanCarbideSDKCache(){ - DocumentBuilder docBuilder = null; try { docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); @@ -291,114 +343,98 @@ throw new RuntimeException(e); } - // NOTE: If debugging runtime workbench and you clear your configuraiton at each launch - // the data in the configuration location will be lost - Location configurationLocation = Platform.getConfigurationLocation(); try { - URL url = new URL(configurationLocation.getURL(), SDKCorePlugin.PLUGIN_ID); - File configFolder = new File(url.getFile()); - if (!configFolder.exists()) { - configFolder.mkdirs(); - } - - File carbideSDKCacheFile = new File(configFolder, CARBIDE_SDK_CACHE_FILE_NAME); + File carbideSDKCacheFile = getCardbieSDKCacheFile(); if (!carbideSDKCacheFile.exists()){ try { FileUtils.writeFileContents(carbideSDKCacheFile, EMPTY_STRING.toCharArray(), null); } catch (CoreException e){ e.printStackTrace(); } - }else if (carbideSDKCacheFile.length() > 0) { - Document lastKnownDoc = docBuilder.parse(carbideSDKCacheFile); - - NodeIterator ni = XPathAPI.selectNodeIterator(lastKnownDoc, "/sdks/sdk"); - for (Node n = ni.nextNode(); n != null; n = ni.nextNode()) { - - // get the unique ID - NamedNodeMap attribs = n.getAttributes(); - String id = attribs.getNamedItem(SDK_CACHE_ID_ATTRIB).getNodeValue(); - - // get whether or not the SDK is enabled - String sdkEnabled = "true"; - Node sdkEnabledItem = attribs.getNamedItem(SDK_CACHE_ENABLED_ATTRIB); - if (sdkEnabledItem != null) - sdkEnabled = sdkEnabledItem.getNodeValue(); - - // get the os version - String osVersion = ""; - Node osVersionItem = attribs.getNamedItem(SDK_CACHE_OS_VERSION_ATTRIB); - if (osVersionItem != null) - osVersion = osVersionItem.getNodeValue(); - - // get the os branch - String osBranch = ""; - Node osBranchItem = attribs.getNamedItem(SDK_CACHE_OS_BRANCH_ATTRIB); - if (osBranchItem != null) - osBranch = osBranchItem.getNodeValue(); + } else if (carbideSDKCacheFile.length() > 0) { + Document lastKnownDoc = docBuilder.parse(carbideSDKCacheFile); - // get the sdk version - String sdkVersion = ""; - Node sdkVersionItem = attribs.getNamedItem(SDK_CACHE_SDK_VERSION_ATTRIB); - if (sdkVersionItem != null) - sdkVersion = sdkVersionItem.getNodeValue(); - - // get the custom EPOCROOT, if allowed - String customEpocroot = null; - if (!isEPOCRootFixed()) { - Node epocrootItem = attribs.getNamedItem(SDK_CACHE_EPOCROOT_ATTRIB); - if (epocrootItem != null) - customEpocroot = epocrootItem.getNodeValue(); - } - - // get whether or not this SDK has been scanned - String wasScanned = "false"; - Node sdkScannedItem = attribs.getNamedItem(SDK_SCANNED_FOR_PLUGINS); - if (sdkScannedItem != null) - wasScanned = sdkScannedItem.getNodeValue(); - - ISymbianSDK sdk = getSDK(id, false); - if (sdk != null){ + NodeIterator ni = XPathAPI.selectNodeIterator(lastKnownDoc, "/sdks/sdk"); + for (Node n = ni.nextNode(); n != null; n = ni.nextNode()) { - if (wasScanned.equalsIgnoreCase("true")){ - sdk.setPreviouslyScanned(true); + // get the unique ID + NamedNodeMap attribs = n.getAttributes(); + String id = attribs.getNamedItem(SDK_CACHE_ID_ATTRIB).getNodeValue(); + + ISymbianSDK sdk = getSDK(id, false); + if (sdk == null) { + // unable to find ID in current SDK list, create a new entry and add it to the list + + // get whether or not the SDK is enabled + String sdkEnabled = "true"; + Node sdkEnabledItem = attribs.getNamedItem(SDK_CACHE_ENABLED_ATTRIB); + if (sdkEnabledItem != null) + sdkEnabled = sdkEnabledItem.getNodeValue(); + + // get the os version + String osVersion = ""; + Node osVersionItem = attribs.getNamedItem(SDK_CACHE_OS_VERSION_ATTRIB); + if (osVersionItem != null) + osVersion = osVersionItem.getNodeValue(); + + // get the sdk version + String sdkVersion = ""; + Node sdkVersionItem = attribs.getNamedItem(SDK_CACHE_SDK_VERSION_ATTRIB); + if (sdkVersionItem != null) + sdkVersion = sdkVersionItem.getNodeValue(); + + // get the EPOCROOT + String epocRoot = null; + Node epocrootItem = attribs.getNamedItem(SDK_CACHE_EPOCROOT_ATTRIB); + if (epocrootItem != null) + epocRoot = epocrootItem.getNodeValue(); + + // get whether or not this SDK has been scanned + String wasScanned = "false"; + Node sdkScannedItem = attribs.getNamedItem(SDK_SCANNED_FOR_PLUGINS); + if (sdkScannedItem != null) + wasScanned = sdkScannedItem.getNodeValue(); + + sdk = SymbianSDKFactory.createInstance(id, + epocRoot, + ISBSv1BuildInfo.S60_SDK_NAME, + new Version(osVersion), + new Version(sdkVersion)); + if (sdkEnabled.equalsIgnoreCase("true")){ + ((SymbianSDK)sdk).setEnabled(true); + } else { + ((SymbianSDK)sdk).setEnabled(false); + } + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + if (wasScanned.equalsIgnoreCase("true")){ + sbsv1BuildInfo.setPreviouslyScanned(true); + sbsv2BuildInfo.setPreviouslyScanned(true); + } else { + sbsv1BuildInfo.setPreviouslyScanned(false); + sbsv2BuildInfo.setPreviouslyScanned(false); + } + synchronized (sdkList) { + sdkList.add(sdk); + } } else { - sdk.setPreviouslyScanned(false); - } - - if (sdkEnabled.equalsIgnoreCase("true")){ - sdk.setEnabled(true); - } else { - sdk.setEnabled(false); - } - - if (!osVersion.equals("")){ - if (Version.parseVersion(osVersion).getMajor() != 0){ - sdk.setOSVersion(Version.parseVersion(osVersion)); + // get whether or not the SDK is enabled + String sdkEnabled = "true"; + Node sdkEnabledItem = attribs.getNamedItem(SDK_CACHE_ENABLED_ATTRIB); + if (sdkEnabledItem != null) + sdkEnabled = sdkEnabledItem.getNodeValue(); + + if (sdkEnabled.equalsIgnoreCase("true")){ + ((SymbianSDK)sdk).setEnabled(true); + } else { + ((SymbianSDK)sdk).setEnabled(false); } } - - if (!osBranch.equals("")){ - sdk.setOSSDKBranch(osBranch); - } - - if (!sdkVersion.equals("")){ - if (Version.parseVersion(sdkVersion).getMajor() != 0){ - sdk.setSDKVersion(Version.parseVersion(sdkVersion)); - } - } - - if (customEpocroot != null) { - sdk.setEPOCROOT(customEpocroot); - } - - } - - } // for - } - } catch (TransformerException e) { - } catch (SAXException e) { - } catch (IOException e) { - } + } // for + } + } catch (Exception e) { + e.printStackTrace(); + } } public void updateCarbideSDKCache() { @@ -413,85 +449,75 @@ return; } - Location configurationLocation = Platform.getConfigurationLocation(); - try { - - URL url = new URL(configurationLocation.getURL(), SDKCorePlugin.PLUGIN_ID); - File configFolder = new File(url.getFile()); - if (!configFolder.exists()) { - configFolder.mkdirs(); + File carbideSDKCacheFile = getCardbieSDKCacheFile(); + if (!carbideSDKCacheFile.exists()){ + try { + FileUtils.writeFileContents(carbideSDKCacheFile, EMPTY_STRING.toCharArray(), null); + } catch (CoreException e){ + e.printStackTrace(); } + } + + Document d = docBuilder.newDocument(); + Node sdks = d.appendChild(d.createElement("sdks")); - File carbideSDKCacheFile = new File(configFolder, CARBIDE_SDK_CACHE_FILE_NAME); - if (!carbideSDKCacheFile.exists()){ - try { - FileUtils.writeFileContents(carbideSDKCacheFile, EMPTY_STRING.toCharArray(), null); - } catch (CoreException e){ - e.printStackTrace(); - } - } - - Document d = docBuilder.newDocument(); - Node sdks = d.appendChild(d.createElement("sdks")); + synchronized(sdkList) + { + for (ISymbianSDK currSDK: sdkList) { + Node sdk = sdks.appendChild(d.createElement("sdk")); + NamedNodeMap attribs = sdk.getAttributes(); + Node idNode = d.createAttribute(SDK_CACHE_ID_ATTRIB); + idNode.setNodeValue(currSDK.getUniqueId()); + attribs.setNamedItem(idNode); + + // Hide the build config from view in the build config list? + Node enabledNode = d.createAttribute(SDK_CACHE_ENABLED_ATTRIB); + if (true == currSDK.isEnabled()) { + enabledNode.setNodeValue("true"); + } else { + enabledNode.setNodeValue("false"); + } + attribs.setNamedItem(enabledNode); + + Node osVerNode = d.createAttribute(SDK_CACHE_OS_VERSION_ATTRIB); + osVerNode.setNodeValue(currSDK.getOSVersion().toString()); + attribs.setNamedItem(osVerNode); - synchronized(sdkList) - { - for (ISymbianSDK currSDK: sdkList) { - Node sdk = sdks.appendChild(d.createElement("sdk")); - NamedNodeMap attribs = sdk.getAttributes(); - Node idNode = d.createAttribute(SDK_CACHE_ID_ATTRIB); - idNode.setNodeValue(currSDK.getUniqueId()); - attribs.setNamedItem(idNode); - - // Hide the build config from view in the build config list? - Node enabledNode = d.createAttribute(SDK_CACHE_ENABLED_ATTRIB); - if (true == currSDK.isEnabled()) { - enabledNode.setNodeValue("true"); - } else { - enabledNode.setNodeValue("false"); - } - attribs.setNamedItem(enabledNode); - - Node wasScannedNode = d.createAttribute(SDK_SCANNED_FOR_PLUGINS); - if (true == currSDK.isPreviouslyScanned()) { - wasScannedNode.setNodeValue("true"); - } else { - wasScannedNode.setNodeValue("false"); - } - attribs.setNamedItem(wasScannedNode); - - Node osVerNode = d.createAttribute(SDK_CACHE_OS_VERSION_ATTRIB); - osVerNode.setNodeValue(currSDK.getOSVersion().toString()); - attribs.setNamedItem(osVerNode); - - Node osBranchNode = d.createAttribute(SDK_CACHE_OS_BRANCH_ATTRIB); - osBranchNode.setNodeValue(currSDK.getSDKOSBranch()); - attribs.setNamedItem(osBranchNode); - - Node sdkVerNode = d.createAttribute(SDK_CACHE_SDK_VERSION_ATTRIB); - sdkVerNode.setNodeValue(currSDK.getSDKVersion().toString()); - attribs.setNamedItem(sdkVerNode); - - if (!isEPOCRootFixed()) { - Node sdkEpocRootNode = d.createAttribute(SDK_CACHE_EPOCROOT_ATTRIB); - sdkEpocRootNode.setNodeValue(currSDK.getEPOCROOT()); - attribs.setNamedItem(sdkEpocRootNode); - } + Node sdkVerNode = d.createAttribute(SDK_CACHE_SDK_VERSION_ATTRIB); + sdkVerNode.setNodeValue(currSDK.getSDKVersion().toString()); + attribs.setNamedItem(sdkVerNode); + + Node sdkEpocRootNode = d.createAttribute(SDK_CACHE_EPOCROOT_ATTRIB); + sdkEpocRootNode.setNodeValue(currSDK.getEPOCROOT()); + attribs.setNamedItem(sdkEpocRootNode); + + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)currSDK.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)currSDK.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + Node wasScannedNode = d.createAttribute(SDK_SCANNED_FOR_PLUGINS); + if (true == sbsv1BuildInfo.isPreviouslyScanned() || + true == sbsv2BuildInfo.isPreviouslyScanned()) { + wasScannedNode.setNodeValue("true"); + } else { + wasScannedNode.setNodeValue("false"); } + attribs.setNamedItem(wasScannedNode); } - DOMSource domSource = new DOMSource(d); - TransformerFactory transFactory = TransformerFactory.newInstance(); - Result fileResult = new StreamResult(carbideSDKCacheFile); - try { - transFactory.newTransformer().transform(domSource, fileResult); - } catch (TransformerConfigurationException e) { - ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e)); - } catch (TransformerException e) { - ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e)); - } - } catch (MalformedURLException e){ - } + DOMSource domSource = new DOMSource(d); + TransformerFactory transFactory = TransformerFactory.newInstance(); + Result fileResult = new StreamResult(carbideSDKCacheFile); + try { + transFactory.newTransformer().transform(domSource, fileResult); + } catch (TransformerConfigurationException e) { + ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e)); + } catch (TransformerException e) { + ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e)); + } + } + + protected File getCardbieSDKCacheFile() { + IPath path = new Path(System.getProperty("user.home")); + return path.append(CARBIDE_SDK_CACHE_FILE_NAME).toFile(); } /** diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/BSFCatalogFactory.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/BSFCatalogFactory.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/BSFCatalogFactory.java Wed Jul 21 12:11:48 2010 -0500 @@ -12,12 +12,12 @@ */ package com.nokia.carbide.cpp.internal.sdk.core.model; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; + import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - /** * This factory creates BSF catalogs. * diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv1BuildInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv1BuildInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,319 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +*/ + +package com.nokia.carbide.cpp.internal.sdk.core.model; + +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; + +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; +import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; +import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; +import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBVCatalog; +import com.nokia.carbide.cpp.sdk.core.ISBVPlatform; +import com.nokia.carbide.cpp.sdk.core.ISDKManager; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +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.cpp.internal.api.utils.core.PathUtils; + +/** + * SBSv1 specific build information. + * + */ +public class SBSv1BuildInfo implements ISBSv1BuildInfo { + + private ISymbianSDK sdk; + private IBSFCatalog bsfCatalog; + private ISBVCatalog sbvCatalog; + private boolean wasScanned = false; + private List binaryVariantContextList = new ArrayList(0); + private List bsfContextList = new ArrayList(0); + private Map> cachedPlatformMacros = new HashMap>(); + + public SBSv1BuildInfo(ISymbianSDK sdk) { + this.sdk = sdk; + } + + public void clearPlatformMacros() { + cachedPlatformMacros.clear(); + } + + public List getAvailablePlatforms() { + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + return sdkMgr.getSymbianMacroStore().getSupportedPlatforms(((SymbianSDK)sdk).getOSVersion(), "", getBSFCatalog()); + } + + @SuppressWarnings("rawtypes") + public List getAllBuildConfigurations() { + Set sdkFeatures = sdk.getSupportedFeatures(); + List buildTargets = new ArrayList(); + + // note that this gets variant platforms but not regular BSF's + List buildPlats = getAvailablePlatforms(); + + if (buildPlats.size() == 0){ + return Collections.emptyList(); + } + // TODO: Hard code build context hack + buildTargets.add(new BuildContextSBSv1(sdk, ISBSv1BuildContext.EMULATOR_PLATFORM, ISymbianBuildContext.DEBUG_TARGET)); + + if (sdkFeatures.contains(ISymbianSDKFeatures.IS_WINSCW_UREL_SUPPORTED)){ + // TODO: Hard code build context hack + buildTargets.add(new BuildContextSBSv1(sdk, ISBSv1BuildContext.EMULATOR_PLATFORM, ISymbianBuildContext.RELEASE_TARGET)); + } + + for (String currPlat : buildPlats){ + if (currPlat.equals(ISBSv1BuildContext.EMULATOR_PLATFORM) ) { + // emulation targets already determined (some SDKs don't get WISNCW UREL + continue; + } + // TODO: Hard code build context hack + buildTargets.add(new BuildContextSBSv1(sdk, currPlat, ISymbianBuildContext.DEBUG_TARGET)); + + // everything gets release except for WINSCW + // TODO: Hard code build context hack + buildTargets.add(new BuildContextSBSv1(sdk, currPlat, ISymbianBuildContext.RELEASE_TARGET)); + } + + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + if (sdkMgr.getBSFScannerEnabled()){ + buildTargets.addAll(getBSFPlatformContexts()); + buildTargets.addAll(getBinaryVariationPlatformContexts()); // Symbian Binary Variation (.var) + } + + return buildTargets; + } + + public IBSFCatalog getBSFCatalog() { + synchronized (sdk) { + if (bsfCatalog == null) { + bsfCatalog = BSFCatalogFactory.createCatalog(sdk); + } + } + return bsfCatalog; + } + + public List getFilteredBuildConfigurations() { + // This is probably a bug, but the filtering only uses SBSv1 preferences if SBSv1 is enabled... + List filteredContexts; + if (SBSv2Utils.enableSBSv1Support()) { + filteredContexts = getSBSv1FilteredBuildConfigurations(); + } else { + // be optimistic in this case... SBSv3? ;) + filteredContexts = getAllBuildConfigurations(); + } + return filteredContexts; + } + + public List getPlatformMacros(String platform) { + List platformMacros = cachedPlatformMacros.get(platform.toUpperCase()); + if (platformMacros == null) { + synchronized (cachedPlatformMacros) { + IBSFCatalog bsfCatalog = getBSFCatalog(); + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + platformMacros = sdkMgr.getSymbianMacroStore().getPlatformMacros(sdk.getOSVersion(), "", bsfCatalog, platform); + cachedPlatformMacros.put(platform.toUpperCase(), platformMacros); + } + } + return platformMacros; + } + + /** + * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg + * @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. + */ + public IPath getPrefixFromVariantCfg(){ + File epocRoot = new File(sdk.getEPOCROOT()); + File variantCfg; + variantCfg = new File(epocRoot, SymbianSDK.SPP_VARIANT_CFG_FILE); + if (!variantCfg.exists()) { + variantCfg = new File(epocRoot, SymbianSDK.VARIANT_CFG_FILE); + if (!variantCfg.exists()) + return null; + } + + String variantDir = null; + String variantFile = null; + try { + char[] cbuf = new char[(int) variantCfg.length()]; + Reader reader = new FileReader(variantCfg); + reader.read(cbuf); + reader.close(); + String[] lines = new String(cbuf).split("\r\n|\r|\n"); + for (int i = 0; i < lines.length; i++) { + // skip comments and blank lines + String line = SymbianSDK.removeComments(lines[i]); + if (line.matches("\\s*#.*") || line.trim().length() == 0) + continue; + + // parse the variant line, which is an EPOCROOT-relative + // path to a bldvariant.hrh file + Matcher matcher = SymbianSDK.VARIANT_HRH_LINE_PATTERN.matcher(line); + if (matcher.matches()) { + variantDir = matcher.group(1); + variantFile = matcher.group(3); + File variantFullPathFile = new File(epocRoot, variantDir + File.separator + variantFile); + IPath variantFilePath = new Path(PathUtils.convertPathToUnix(variantFullPathFile.getAbsolutePath())); + return variantFilePath; + } + } + } catch (IOException e) { + } + + return null; // can't find the file... + } + + public ISBVCatalog getSBVCatalog() { + synchronized (sdk) { + if (sbvCatalog == null) { + sbvCatalog = SBVCatalogFactory.createCatalog(sdk); + } + } + return sbvCatalog; + } + + public List getTargetTypeMacros(String targettype) { + // this is based on \epoc32\tools\trgtype.pm which changes from + // OS version to OS version, but largely remains constant with + // regards to the basic type. + List macros = new ArrayList(); + + // if it's not one of these then it's a DLL + if (targettype.compareToIgnoreCase("EPOCEXE") == 0) { + macros.add("__EXEDLL__"); + } else if (targettype.compareToIgnoreCase("EXEDLL") == 0) { + macros.add("__EXEDLL__"); + } else if (targettype.compareToIgnoreCase("EXE") == 0) { + macros.add("__EXE__"); + } else if (targettype.compareToIgnoreCase("EXEXP") == 0) { + macros.add("__EXE__"); + } else if (targettype.compareToIgnoreCase("IMPLIB") == 0) { + macros.add("__IMPLIB__"); + } else if (targettype.compareToIgnoreCase("KLIB") == 0) { + macros.add("__LIB__"); + } else if (targettype.compareToIgnoreCase("LIB") == 0) { + macros.add("__LIB__"); + } else { + macros.add("__DLL__"); + } + return macros; + } + + public List getVendorSDKMacros() { + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + return sdkMgr.getSymbianMacroStore().getVendorMacros(sdk.getSDKVersion(), sdk.getName()); + } + + public boolean isS60() { + return sdk.getFamily().equals(ISBSv1BuildInfo.S60_FAMILY_ID) + || sdk.getFamily().equals(ISBSv1BuildInfo.SERIES60_FAMILY_ID); + } + + public boolean isPreviouslyScanned() { + return wasScanned; + } + + public void setPreviouslyScanned(boolean wasScanned) { + this.wasScanned = wasScanned; + } + + protected List getBinaryVariationPlatformContexts() { + synchronized (binaryVariantContextList) { + if (!binaryVariantContextList.isEmpty()){ + return binaryVariantContextList; + } + + ISBVCatalog catalog = getSBVCatalog(); + for (ISBVPlatform sbvPlatform : catalog.getPlatforms()) { + // Currently only variation of ARMV5 is supported... So just hard code the variated platform + // Only add the build platform if it's not virtual. + if (!sbvPlatform.isVirtual()){ + // TODO: Hard code build context hack + binaryVariantContextList.add(new BuildContextSBSv1(sdk, BuildContextSBSv1.ARMV5_PLATFORM + "." + sbvPlatform.getName(), ISymbianBuildContext.DEBUG_TARGET)); + // TODO: Hard code build context hack + binaryVariantContextList.add(new BuildContextSBSv1(sdk, BuildContextSBSv1.ARMV5_PLATFORM + "." + sbvPlatform.getName(), ISymbianBuildContext.RELEASE_TARGET)); + } + } + } + return binaryVariantContextList; + } + + protected List getBSFPlatformContexts() { + synchronized (bsfContextList) { + if (!bsfContextList.isEmpty()){ + return bsfContextList; + } + + IBSFCatalog catalog = getBSFCatalog(); + for (IBSFPlatform platform : catalog.getPlatforms()) { + // only return non-variant style BSF's. see boog #4533 for details. + if (!platform.isVariant()) { + // TODO: Hard code build context hack + bsfContextList.add(new BuildContextSBSv1(sdk, platform.getName().toUpperCase(), ISymbianBuildContext.DEBUG_TARGET)); + // TODO: Hard code build context hack + bsfContextList.add(new BuildContextSBSv1(sdk, platform.getName().toUpperCase(), ISymbianBuildContext.RELEASE_TARGET)); + } + } + } + return bsfContextList; + } + + @SuppressWarnings("rawtypes") + protected List getSBSv1FilteredBuildConfigurations() { + Set sdkFeatures = sdk.getSupportedFeatures(); + List buildContexts = getAllBuildConfigurations(); + if (buildContexts.size() == 0){ + return Collections.emptyList(); + } + + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + List platFilterList = sdkMgr.getPlatformList(); + Iterator li = buildContexts.iterator(); + while(li.hasNext()){ + ISymbianBuildContext currContext = li.next(); + for (BuildPlat currPlat : platFilterList){ // see which ones need to be filtered out. + + if (currPlat.getPlatName().equals(currContext.getPlatformString())){ + if (!currPlat.isEnabled()){ + if (sdkFeatures.contains(ISymbianSDKFeatures.IS_EKA2) && + currPlat.getOsIdentifier().equals(BuildPlat.EKA2_IDENTIFIER)){ + li.remove(); // filtered out in UI, don't show + break; + } + } + } + } + } + return buildContexts; + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,325 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +*/ + +package com.nokia.carbide.cpp.internal.sdk.core.model; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.PlatformUI; + +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv2; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2ConfigQueryData; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2MinimumVersionException; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBSv2ConfigQueryData; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.cpp.internal.api.utils.core.Logging; +import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; + +/** + * SBSv2 specific build information. + * + */ +public class SBSv2BuildInfo implements ISBSv2BuildInfo { + + private ISymbianSDK sdk; + private List sbsv2FilteredConetxts = new ArrayList(); + private boolean wasScanned = false; + private Map> cachedPlatformMacros = new HashMap>(); + + private Map aliasToMeaningMap = new HashMap(); + private List productList = null; + private IPath cachedVariantHRHFile = null; + private static boolean hasShownDialog; + + public SBSv2BuildInfo(ISymbianSDK sdk) { + this.sdk = sdk; + } + + @Override + public List getAllBuildConfigurations() { + // TODO: Will get rid of this method. Only filtered configs will apply + return sbsv2FilteredConetxts; + } + + @Override + public List getFilteredBuildConfigurations() { + + if (aliasToMeaningMap.size() == 0){ + try { + aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk); + } catch (final SBSv2MinimumVersionException e) { + if (hasShownDialog == false){ + + PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(WorkbenchUtils.getSafeShell(), "Minimum sbs version not met.", e.getMessage()); + } + }); + + Logging.log( SDKCorePlugin.getDefault(), + Logging.newSimpleStatus(0, IStatus.ERROR, + MessageFormat.format(e.getMessage(), ""), e)); + + hasShownDialog = true; + } + } + } + + if (productList == null){ + // Not all SDKs will have products, so size of 0 is acceptable + productList = new ArrayList(); + try { + productList = SBSv2QueryUtils.getProductVariantsForSDK(sdk); + } catch (SBSv2MinimumVersionException e) { + // ignore + } + } + List allowedConfigs = SBSv2Utils.getSBSv2FilteredConfigPreferences(); // From global prefs + if ((sbsv2FilteredConetxts == null || sbsv2FilteredConetxts.size() == 0) + && SBSv2Utils.enableSBSv2Support()){ + + try { + initSBSv2BuildContextList(allowedConfigs); + } catch (SBSv2MinimumVersionException e) { + // igore, would be caught above + } + } else if (SBSv2Utils.enableSBSv2Support()){ + + try { + updateSBSv2BuildContextList(allowedConfigs); + } catch (SBSv2MinimumVersionException e) { + // igore, would be caught above + } + } + + + return sbsv2FilteredConetxts; + } + + private void updateSBSv2BuildContextList(List allowedConfigs) throws SBSv2MinimumVersionException { + + // Check and see if the filtered list has changed + boolean contextExists = false; + List newContextsToQuery = new ArrayList(); + for (String aliasName : allowedConfigs){ + for (ISymbianBuildContext context : sbsv2FilteredConetxts){ + ISBSv2BuildContext sbsv2Context = (ISBSv2BuildContext)context; + if (sbsv2Context.getSBSv2Alias().equals(aliasName)){ + contextExists = true; + continue; + } + } + if (!contextExists){ + newContextsToQuery.add(aliasName); + } + contextExists = false; + } + + List processedAliasList = new ArrayList(); + for (String alias : newContextsToQuery) { + SBSv2ConfigQueryData configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias); + if (configQueryData != null) { + ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData); + sbsv2FilteredConetxts.add(sbsv2Context); + processedAliasList.add(alias); + } + } + + if (!processedAliasList.isEmpty()) { + newContextsToQuery.removeAll(processedAliasList); + } + + if (!newContextsToQuery.isEmpty()) { + String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, newContextsToQuery); + + for (String alias : newContextsToQuery){ + // TODO: Need to test for variants. Right now variants are not added + if (aliasToMeaningMap.get(alias) == null){ + continue; // This alias is not valid with this SDK, ignore + } + ISBSv2ConfigQueryData configQueryData = new SBSv2ConfigQueryData(alias, aliasToMeaningMap.get(alias), configQueryXML); + ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData); + sbsv2FilteredConetxts.add(sbsv2Context); + } + } + } + + private void initSBSv2BuildContextList(List allowedConfigs) throws SBSv2MinimumVersionException { + List filteredAliasList = new ArrayList(); + + for (String alias : aliasToMeaningMap.keySet()){ + for (String checkedAlias : allowedConfigs){ + if (checkedAlias.equalsIgnoreCase(alias)){ + filteredAliasList.add(alias); + break; + } + } + } + + if (productList != null && productList.size() > 0){ + for (String testConfig : allowedConfigs) { + if (testConfig.contains(".")){ + String tokens[] = testConfig.split("\\."); + for (String tok : tokens){ + if (productList.contains(tok)){ + filteredAliasList.add(testConfig); + break; + } + } + } + } + } + + List processedAliasList = new ArrayList(); + for (String alias : filteredAliasList) { + SBSv2ConfigQueryData configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias); + if (configQueryData != null) { + ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData); + sbsv2FilteredConetxts.add(sbsv2Context); + processedAliasList.add(alias); + } + } + + if (!processedAliasList.isEmpty()) { + filteredAliasList.removeAll(processedAliasList); + } + + if (!filteredAliasList.isEmpty()) { + String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, filteredAliasList); + + for (String alias : filteredAliasList) { + String meaning = ""; + if (alias.contains(".")){ + meaning = getMeaningForVariant(alias); + } else { + meaning = aliasToMeaningMap.get(alias); + } + if (meaning == null){ + continue; // TODO: How to handle this scenario + } + SBSv2ConfigQueryData configQueryData = new SBSv2ConfigQueryData(alias, meaning, configQueryXML); + ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData); + sbsv2FilteredConetxts.add(sbsv2Context); + SBSv2QueryUtils.storeConfigQueryDataForSDK(sdk, alias, configQueryData); + } + } + } + + private String getMeaningForVariant(String alias) { + String meaning = null; + + // TODO: Assuming now that the alias now is the first part and the last bits are the variant bits. + String tokens[] = alias.split("\\."); + if (tokens.length > 0){ + meaning = aliasToMeaningMap.get(tokens[0]); + for (int i = 1; i < tokens.length; i++){ + meaning += "." + tokens[i]; + } + } + + return meaning; + } + + public Map getPlatformMacros(String platform) { + Map platformMacros = cachedPlatformMacros.get(platform); + if (platformMacros == null) { + platformMacros = new HashMap(); + synchronized (cachedPlatformMacros) { + if (sbsv2FilteredConetxts == null || sbsv2FilteredConetxts.size() == 0) { + getFilteredBuildConfigurations(); + } + if (sbsv2FilteredConetxts.size() > 0) { + for (ISymbianBuildContext context : sbsv2FilteredConetxts) { + if (context.getPlatformString().equalsIgnoreCase(platform)) { + platformMacros.putAll(((ISBSv2BuildContext)context).getConfigQueryData().getMetaDataMacros()); + } + } + cachedPlatformMacros.put(platform, platformMacros); + } + } + } + return platformMacros; + } + + /** + * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg + * @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. + */ + public IPath getPrefixFromVariantCfg(){ + if (cachedVariantHRHFile == null) { + if (sbsv2FilteredConetxts == null || sbsv2FilteredConetxts.size() == 0) { + getFilteredBuildConfigurations(); + } + if (sbsv2FilteredConetxts.size() > 0) { + for (ISymbianBuildContext context : sbsv2FilteredConetxts) { + String vStr = ((ISBSv2BuildContext)context).getConfigQueryData().getMetaDataVariantHRH(); + if (vStr != null) { + cachedVariantHRHFile = new Path(vStr); + break; + } + } + } + } + return cachedVariantHRHFile; + } + + public List getTargetTypeMacros(String targettype) { + // this is based on \epoc32\tools\trgtype.pm which changes from + // OS version to OS version, but largely remains constant with + // regards to the basic type. + List macros = new ArrayList(); + + // if it's not one of these then it's a DLL + if (targettype.compareToIgnoreCase("EPOCEXE") == 0) { + macros.add("__EXEDLL__"); + } else if (targettype.compareToIgnoreCase("EXEDLL") == 0) { + macros.add("__EXEDLL__"); + } else if (targettype.compareToIgnoreCase("EXE") == 0) { + macros.add("__EXE__"); + } else if (targettype.compareToIgnoreCase("EXEXP") == 0) { + macros.add("__EXE__"); + } else if (targettype.compareToIgnoreCase("IMPLIB") == 0) { + macros.add("__IMPLIB__"); + } else if (targettype.compareToIgnoreCase("KLIB") == 0) { + macros.add("__LIB__"); + } else if (targettype.compareToIgnoreCase("LIB") == 0) { + macros.add("__LIB__"); + } else { + macros.add("__DLL__"); + } + return macros; + } + + public boolean isPreviouslyScanned() { + return wasScanned; + } + + public void setPreviouslyScanned(boolean wasScanned) { + this.wasScanned = wasScanned; + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalogFactory.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalogFactory.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalogFactory.java Wed Jul 21 12:11:48 2010 -0500 @@ -12,12 +12,12 @@ */ package com.nokia.carbide.cpp.internal.sdk.core.model; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; + import com.nokia.carbide.cpp.sdk.core.ISBVCatalog; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - /** * This factory creates SBV catalogs. * diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java Wed Jul 21 12:11:48 2010 -0500 @@ -27,6 +27,7 @@ import org.eclipse.cdt.utils.WindowsRegistry; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; @@ -35,11 +36,15 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; +import org.osgi.framework.Version; +import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DefaultType; import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DeviceType; +import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesFactory; import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesType; import com.nokia.carbide.cpp.internal.sdk.core.xml.DevicesLoader; 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.cpp.sdk.core.SDKEnvInfoFailureException; import com.nokia.cpp.internal.api.utils.core.HostOS; @@ -54,7 +59,12 @@ private static final String WINDOWS_SYSTEM_ROOT_KEY = "SystemRoot"; private static final String EMPTY_DEVICES_XML_CONTENT = ""; - + + private static final String QMAKE_FILE = "epoc32/tools/qt/qmake" + HostOS.EXE_EXT; //$NON-NLS-1$ + private static final String MIFCONV_FILE = "epoc32/tools/mifconv" + HostOS.EXE_EXT; //$NON-NLS-1$ + private static final String ABLD_FILE = "epoc32/tools/abld.pl"; //$NON-NLS-1$ + private static final long VALID_ABLD_SIZE = 1024; + static boolean hasPromptedForDevicesXML = false; // make sure we only ask once at startup if devices.xml does not exist long devicesXLMLastModified; @@ -71,84 +81,62 @@ public SDKManager() { super(); checkPerlInstallation(); - } - protected boolean doScanSDKs() { - + protected boolean doScanSDKs(IProgressMonitor monitor) { + boolean result = true; DevicesType devicesType; try { File devicesFile = getDevicesXMLFile(); if (devicesFile == null || !devicesFile.exists()) { - // There is no devices.xml. Ask the user if he/she wants to - // add it - if (hasPromptedForDevicesXML == false) { - hasPromptedForDevicesXML = true; - doAsynchPromptCreateDevicesXML(); + // It's ok if there is no devices.xml. + // Raptor based SDKs no longer depends on it. + } else { + devicesXLMLastModified = devicesFile.lastModified(); + devicesType = DevicesLoader.loadDevices(devicesFile.toURL()); + EList devices = devicesType.getDevice(); + for (Iterator iter = devices.iterator(); iter.hasNext();) { + SymbianSDK sdk = new SymbianSDK((DeviceType) iter.next()); + sdk.addSupportedFeature(ISymbianSDKFeatures.IS_FROM_DEVICES_XML); + sdkList.add(sdk); } - return false; // no devices.xml file.. } + } catch (Exception e) { + logError("Failed to scan devices.xml", e); + result = false; + } - devicesXLMLastModified = devicesFile.lastModified(); - devicesType = DevicesLoader.loadDevices(devicesFile.toURL()); - EList devices = devicesType.getDevice(); - for (Iterator iter = devices.iterator(); iter.hasNext();) { - SymbianSDK sdk = new SymbianSDK((DeviceType) iter.next()); - sdkList.add(sdk); - } - - return true; - } catch (Exception e) { - logError("Failed to scan SDKs", e); - return false; - } + doScanDrives(monitor); + return result; } - public void updateSDK(ISymbianSDK sdk) { - try { - File devicesFile = getDevicesXMLFile(); - - // If file does not exist exception will catch it - DevicesLoader.updateDevice(sdk, devicesFile.toURL()); - updateCarbideSDKCache(); - - } catch (Exception e) { - // must catch and rethrow as unchecked exception this - // because no throws clause in API method - throw new RuntimeException(e); + if (((SymbianSDK)sdk).getSupportedFeatures().contains(ISymbianSDKFeatures.IS_FROM_DEVICES_XML)) { + try { + File devicesFile = getDevicesXMLFile(); + + if (devicesFile == null || !devicesFile.exists()) { + // There is no devices.xml. Ask the user if he/she wants to + // add it + doAsynchPromptCreateDevicesXML(); + return; + } + + // If file does not exist exception will catch it + DevicesLoader.updateDevice(sdk, devicesFile.toURL()); + + } catch (Exception e) { + // must catch and rethrow as unchecked exception this + // because no throws clause in API method + throw new RuntimeException(e); + } } + updateCarbideSDKCache(); } - public void setDefaultSDK(ISymbianSDK sdk){ - try { - File devicesFile = getDevicesXMLFile(); - - synchronized(sdkList) - { - for (ISymbianSDK currSDK : sdkList){ - if (!currSDK.getUniqueId().equals(sdk.getUniqueId())){ - currSDK.setIsDefaultSDK(false); // set all to false, except the input one - } - } - } - - DevicesLoader.setDefaultDevice(sdk, devicesFile.toURL()); - updateCarbideSDKCache(); - - } catch (MalformedURLException e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - protected boolean doRemoveSDK(String sdkId) { - // Now actually remove it from the file... + // Now actually remove it from devices.xml... DevicesType devicesType; try { File devicesFile = getDevicesXMLFile(); @@ -168,7 +156,7 @@ return true; } catch (Exception e) { - logError("Failed to remove SDK", e); + logError("Failed to remove SDK from devices.xml", e); } return false; @@ -192,8 +180,8 @@ // registry entry exists, check existence of file regPath = regPath.append(DEVICES_FILE_NAME); if (!regPath.toFile().exists()){ - String errMsg = MessageFormat.format("Devices.xml does not exist at: {0}", regPath); - logError(errMsg, null); +// String errMsg = MessageFormat.format("Devices.xml does not exist at: {0}", regPath); +// logError(errMsg, null); return null; } @@ -329,15 +317,7 @@ } catch (IOException e) { // report error to PDE log - ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Perl was not found on the PATH environment variable. Some tools will not function properly. Perl 5.6.1 is recommended for Carbide use (free download at www.activestate.com).", e)); - // Report dialog since this is always fatal for future work and the error log - // may be hidden - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - MessageDialog.openError(window.getShell(), "Missing Perl", "Perl was not found on your PATH. The Symbian build tools cannot work successfully without Perl. Please install Perl (v5.6.1 recommended)."); - } - }); + ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Perl was not found on the PATH environment variable. Perl 5.6.1 is recommended for Carbide use if using SBSv1 and Symbian OS 9.4 and prior.", e)); } } @@ -376,27 +356,23 @@ e.printStackTrace(); } - if (localSDKList.size() != sdkList.size()){ - needsRescan = true; - } else { - for (ISymbianSDK sdk : localSDKList){ - ISymbianSDK currSDK = getSDK(sdk.getUniqueId(), false); - if (currSDK == null){ - // sdk id has been changed - needsRescan = true; - break; - } - // check that the data are the same. - // Other than the 'id' attrib, all we really care is whether or not - // the EPOCROOT or vendor 'name' has changed. - if (!sdk.getEPOCROOT().equalsIgnoreCase(currSDK.getEPOCROOT())){ - needsRescan = true; - break; - } - if (!sdk.getName().equalsIgnoreCase(currSDK.getName())){ - needsRescan = true; - break; - } + for (ISymbianSDK sdk : localSDKList){ + ISymbianSDK currSDK = getSDK(sdk.getUniqueId(), false); + if (currSDK == null){ + // sdk id has been changed + needsRescan = true; + break; + } + // check that the data are the same. + // Other than the 'id' attrib, all we really care is whether or not + // the EPOCROOT or vendor 'name' has changed. + if (!sdk.getEPOCROOT().equalsIgnoreCase(currSDK.getEPOCROOT())){ + needsRescan = true; + break; + } + if (!sdk.getName().equalsIgnoreCase(currSDK.getName())){ + needsRescan = true; + break; } } @@ -416,4 +392,129 @@ protected boolean isEPOCRootFixed() { return true; } + + /** + * Scan system drives for installed SDKs + */ + protected void doScanDrives(IProgressMonitor monitor) { + File[] drives = getSystemDrives(); + monitor.beginTask("Scanning system drives for installed SDKs", drives.length); + for (File drive : drives) { + if (!isEPOCRoot(drive)) { + continue; + } + + String sdkId = getUniqueSDKId(drive); + DeviceType deviceType = DevicesFactory.eINSTANCE.createDeviceType(); + deviceType.setAlias(drive.toString()); + deviceType.setDefault(DefaultType.NO_LITERAL); + deviceType.setEpocroot(drive.getAbsolutePath()); + deviceType.setId(sdkId); + deviceType.setName("com.nokia.s60"); + deviceType.setToolsroot(drive.getAbsolutePath()); + deviceType.setUserdeletable("false"); + deviceType.setUserdeletetable("false"); + ISymbianSDK sdk = new SymbianSDK(deviceType); + if (sdk.getOSVersion().toString().equals("0.0.0")) { + ((SymbianSDK)sdk).setOSVersion(new Version("9.5")); + } + + if (sdk.getSDKVersion().toString().equals("0.0.0")) { + ((SymbianSDK)sdk).setSDKVersion(new Version("5.0")); + } + + if (!isSupportedSDK(sdk)) { + continue; + } + + if (isInSDKList(sdk)) { + continue; + } + + sdkList.add(sdk); + monitor.worked(1); + if (monitor.isCanceled()) { + monitor.done(); + return; + } + } + monitor.done(); + } + + private File[] getSystemDrives() { + if (HostOS.IS_WIN32) { + return File.listRoots(); + } + return new File[0]; + } + + private String getUniqueSDKId(File drive) { + String sdkId = drive.toString().charAt(0) + "_SDK"; + int suffice = 1; + while (!isUniqueSDKId(sdkId)) { + sdkId = drive.toString().charAt(0) + "_SDK" + suffice; + suffice++; + } + return sdkId; + } + + private boolean hasAbldSupport(ISymbianSDK sdk) { + File abld = new File(sdk.getEPOCROOT(), ABLD_FILE); + if (abld.exists()) { + long size = abld.length(); + if (size >= VALID_ABLD_SIZE) + return true; + } + return false; + } + + private boolean hasQmake(ISymbianSDK sdk) { + File qmake = new File(sdk.getEPOCROOT(), QMAKE_FILE); + if (qmake.exists()) { + return true; + } + return false; + } + + private boolean hasRaptor(ISymbianSDK sdk) { + File mifconv = new File(sdk.getEPOCROOT(), MIFCONV_FILE); + if (mifconv.exists()) { + return true; + } + return false; + } + + private boolean isEPOCRoot(File drive) { + File epocRoot = new File(drive, "epoc32"); + if (epocRoot.exists()) { + return true; + } else { + return false; + } + } + + private boolean isInSDKList(ISymbianSDK sdk) { + for (ISymbianSDK entry : sdkList) { + if (entry.getEPOCROOT().equalsIgnoreCase(sdk.getEPOCROOT())) { + return true; + } + } + return false; + } + + private boolean isSupportedSDK(ISymbianSDK sdk) { + if (!hasAbldSupport(sdk) || hasQmake(sdk) || hasRaptor(sdk)) { + return true; + } + return false; + } + + private boolean isUniqueSDKId(String sdkId) { + for (ISymbianSDK sdk : sdkList){ + if (sdk.getUniqueId().equalsIgnoreCase(sdkId)){ + return false; + } + } + return true; + } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManagerRaptorOnly.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManagerRaptorOnly.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManagerRaptorOnly.java Wed Jul 21 12:11:48 2010 -0500 @@ -19,6 +19,7 @@ import java.io.File; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.widgets.Display; @@ -39,7 +40,7 @@ * @see com.nokia.carbide.cpp.internal.sdk.core.model.AbstractSDKManager#doScanSDKs() */ @Override - protected boolean doScanSDKs() { + protected boolean doScanSDKs(IProgressMonitor monitor) { String message = SBSv2Utils.scanSBSv2(); if (message != null) { diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianMissingSDKFactory.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianMissingSDKFactory.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianMissingSDKFactory.java Wed Jul 21 12:11:48 2010 -0500 @@ -31,14 +31,11 @@ SymbianMissingSDK sdk = new SymbianMissingSDK(newDeviceEntry); // create SDK and set the attribs found in devices.xml // Set other essential paramaters not in devices.xml - if (sdk.getOSVersion().getMajor() != 0){ // use the version detected from the SDK creation } else { - sdk.setOSVersion(new Version("0.0")); //$NON-NLS-1$ - sdk.setOSSDKBranch("0.0"); //$NON-NLS-1$ + sdk.setOSVersion(new Version("0.0")); //$NON-NLS-1$ } - sdk.setSDKVersion(new Version("0.0")); //$NON-NLS-1$ return sdk; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 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 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Wed Jul 21 12:11:48 2010 -0500 @@ -12,60 +12,66 @@ */ package com.nokia.carbide.cpp.internal.sdk.core.model; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.*; -import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat; -import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; -import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DefaultType; -import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DeviceType; -import com.nokia.carbide.cpp.sdk.core.*; -import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.BasicIncludeFileLocator; -import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.MacroScanner; -import com.nokia.cpp.internal.api.utils.core.PathUtils; -import com.sun.org.apache.xpath.internal.XPathAPI; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.*; -import org.osgi.framework.Version; -import org.w3c.dom.*; -import org.w3c.dom.traversal.NodeIterator; -import org.xml.sax.SAXException; - -import java.io.*; -import java.net.MalformedURLException; -import java.net.URL; -import java.text.DateFormat; -import java.text.ParseException; -import java.util.*; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.xml.XMLConstants; -import javax.xml.parsers.*; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.*; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; -public class SymbianSDK implements ISymbianSDK { +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.osgi.framework.Version; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.traversal.NodeIterator; +import org.xml.sax.SAXException; + +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISymbianSDKModifier; +import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DeviceType; +import com.nokia.carbide.cpp.sdk.core.ISDKBuildInfo; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +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.sun.org.apache.xpath.internal.XPathAPI; + +public class SymbianSDK implements ISymbianSDK, ISymbianSDKModifier { public static final String MANIFEST_XML_LOCATION = "/epoc32/kit/manifest.xml"; //$NON-NLS-1$ // manifest.xml attributes - private static final String PATH_ID_EPOC32DIR = "epoc32Dir"; //$NON-NLS-1$ private static final String PATH_ID_INCLUDEDIR = "includeDir"; //$NON-NLS-1$ private static final String PATH_ID_TOOLSDIR = "toolsDir"; //$NON-NLS-1$ private static final String PATH_ID_SRCDIR = "srcDir"; //$NON-NLS-1$ - private static final String INCLUDE = "include"; //$NON-NLS-1$ private static final String RELEASE = "release"; //$NON-NLS-1$ - private static final String TOOLS = "tools"; //$NON-NLS-1$ - private static final String EPOC32_DIR = "epoc32"; //$NON-NLS-1$ - private static final String INCLUDE_SUBDIR = "epoc32/" + INCLUDE; //$NON-NLS-1$ - private static final String RELEASE_SUBDIR = "epoc32/" + RELEASE; //$NON-NLS-1$ - private static final String TOOLS_SUBDIR = "epoc32/" + TOOLS; //$NON-NLS-1$ - private static final String VARIANT_CFG_FILE = "epoc32/tools/variant/variant.cfg"; //$NON-NLS-1$ - private static final String SPP_VARIANT_CFG_FILE = "epoc32/tools/variant/spp_variant.cfg"; //$NON-NLS-1$ + public static final String VARIANT_CFG_FILE = "epoc32/tools/variant/variant.cfg"; //$NON-NLS-1$ + public static final String SPP_VARIANT_CFG_FILE = "epoc32/tools/variant/spp_variant.cfg"; //$NON-NLS-1$ private static final String TARGETTYPE_PM_FILE = "epoc32/tools/trgtype.pm"; //$NON-NLS-1$ private static final String BUILD_INFO_TXT_FILE = "epoc32/data/buildinfo.txt"; //$NON-NLS-1$ private static final String BUILD_INFO_KEYWORD = "ManufacturerSoftwareBuild"; @@ -74,86 +80,32 @@ protected DeviceType deviceEntry = null; private boolean enabled = true; - private boolean wasScanned = false; private Version osVersion; private Version sdkVersion; - private String sdkOSBranch; + private List supportedTargetTypesList = new ArrayList(); + private Map buildInfoMap = new HashMap(); + private Map prefixFileMap = new HashMap(); + @SuppressWarnings("rawtypes") + private Set sdkFeatures = new HashSet(); - private File licenseFile; - private File prefixFile; - - private List variantHRHMacros = null; - private List bsfContextList = new ArrayList(0); - - private List binaryVariantContextList = new ArrayList(0); - - private Date createDate; - private URL publisherURL; - private String sdkDescription; - private String publisherName; - - private boolean supportsWINSCW_UREL; - - List supportedTargetTypesList = new ArrayList(); + // greedy match means the filename is in the last group + public static Pattern VARIANT_HRH_LINE_PATTERN = Pattern.compile("(?i)(.*)(/|\\\\)(.*hrh)"); - private IBSFCatalog bsfCatalog; - private ISBVCatalog sbvCatalog; - - private Map> cachedPlatformMacros = new HashMap>(); - - // greedy match means the filename is in the last group - private static Pattern VARIANT_HRH_LINE_PATTERN = Pattern.compile("(?i)(.*)(/|\\\\)(.*hrh)"); - - private long hrhFileTimeStamp = 0; - public SymbianSDK(DeviceType device) { deviceEntry = device; + setBuildInfo(new SBSv1BuildInfo(this), ISymbianBuilderID.SBSV1_BUILDER); + setBuildInfo(new SBSv2BuildInfo(this), ISymbianBuilderID.SBSV2_BUILDER); scanSDK(); } - - public void scanSDK(){ - - cachedPlatformMacros.clear(); - variantHRHMacros = null; - - if (!setDataFromManifestXML()){ - // must derive the OS and SDK version - if (!deriveOSVersionFromDeviceId()){ - //need to scan SDK files for OS and SDK version - scanSDKForVersionInfo(); - } - } - - IPath prefixFileFullPath = getPrefixFromVariantCfg(); - if (prefixFileFullPath != null){ - setPrefixFile(prefixFileFullPath); - } - - // Trick for SEMC. Try to set the SDK version based on a UIQ HRH file - // if there's is no SDK version - if (getSDKVersion().getMajor() == 0 && getName().equalsIgnoreCase(ISymbianSDK.UIQ_SDK_NAME)){ - // This might be an SEMC CustKit, get the version from the HRH file - if (getPrefixFile() != null){ - String prefixFileStr = getPrefixFile().toString(); - if (prefixFileStr.indexOf("UIQ_") != -1 && prefixFileStr.indexOf(".hrh") != -1){ - prefixFileStr = prefixFileStr.substring(prefixFileStr.indexOf("UIQ_")+4, prefixFileStr.indexOf(".hrh")); - if (prefixFileStr.length() == 3 && prefixFileStr.contains(".")){ - setSDKVersion(new Version(prefixFileStr)); - } - } - } - } - - scanForWINSCW_UREL(); - } - - public List getAvailablePlatforms() { - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - return sdkMgr.getSymbianMacroStore().getSupportedPlatforms(getOSVersion(), getSDKOSBranch(), getBSFCatalog()); + + @SuppressWarnings("unchecked") + public void addSupportedFeature(Object feature) { + sdkFeatures.add(feature); } - public Date getCreationDate() { - return createDate; + public ISDKBuildInfo getBuildInfo(String builderId) { + ISDKBuildInfo buildInfo = buildInfoMap.get(builderId); + return buildInfo; } public String getEPOCROOT() { @@ -183,26 +135,13 @@ return ""; } - public boolean isEnabled() { - if (!SDKCorePlugin.SUPPORTS_SBSV1_BUILDER && - (getOSVersion().getMajor() < 9 || - (getOSVersion().getMajor() == 9 && getOSVersion().getMinor() <= 4))){ - return false; - } - return enabled; - } - - public void setEnabled(boolean enable) { - enabled = enable; - } - public String getFamily() { String[] parts = getName().split("\\."); if (parts.length == 3){ - if (getSDKVersion().getMajor() == 5 && getName().equalsIgnoreCase(NOKIA_SF_SDK_NAME)){ + if (getSDKVersion().getMajor() == 5 && getName().equalsIgnoreCase(ISBSv1BuildInfo.NOKIA_SF_SDK_NAME)){ // A vendor of "symbian" and SDK major version 5 is the same as prior naming for "com.nokia.s60" & 5th Edition. // Return "s60" so that project template generation continues to work as it's a S60 5th ed. SDK. - return ISymbianSDK.S60_FAMILY_ID; + return ISBSv1BuildInfo.S60_FAMILY_ID; } else { return parts[2]; } @@ -210,161 +149,6 @@ return ""; } - - - public List getTargetTypeMacros(String targettype) { - // this is based on \epoc32\tools\trgtype.pm which changes from - // OS version to OS version, but largely remains constant with - // regards to the basic type. - List macros = new ArrayList(); - - // if it's not one of these then it's a DLL - if (targettype.compareToIgnoreCase("EPOCEXE") == 0) { - macros.add("__EXEDLL__"); - } else if (targettype.compareToIgnoreCase("EXEDLL") == 0) { - macros.add("__EXEDLL__"); - } else if (targettype.compareToIgnoreCase("EXE") == 0) { - macros.add("__EXE__"); - } else if (targettype.compareToIgnoreCase("EXEXP") == 0) { - macros.add("__EXE__"); - } else if (targettype.compareToIgnoreCase("IMPLIB") == 0) { - macros.add("__IMPLIB__"); - } else if (targettype.compareToIgnoreCase("KLIB") == 0) { - macros.add("__LIB__"); - } else if (targettype.compareToIgnoreCase("LIB") == 0) { - macros.add("__LIB__"); - } else { - macros.add("__DLL__"); - } - return macros; - } - - - public List getUnfilteredBuildConfigurations() { - - List buildTargets = new ArrayList(); - - // note that this gets variant platforms but not regular BSF's - List buildPlats = getAvailablePlatforms(); - - if (buildPlats.size() == 0){ - return Collections.emptyList(); - } - - buildTargets.add(new SymbianBuildContext(this, ISymbianBuildContext.EMULATOR_PLATFORM, ISymbianBuildContext.DEBUG_TARGET)); - - if (supportsWINSCW_UREL()){ - buildTargets.add(new SymbianBuildContext(this, ISymbianBuildContext.EMULATOR_PLATFORM, ISymbianBuildContext.RELEASE_TARGET)); - } - - for (String currPlat : buildPlats){ - - if (currPlat.equals(ISymbianBuildContext.EMULATOR_PLATFORM) ) { - // emulation targets already determined (some SDKs don't get WISNCW UREL - continue; - } - - buildTargets.add(new SymbianBuildContext(this, currPlat, ISymbianBuildContext.DEBUG_TARGET)); - - // everything gets release except for WINSCW - buildTargets.add(new SymbianBuildContext(this, currPlat, ISymbianBuildContext.RELEASE_TARGET)); - } - - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - if (sdkMgr.getBSFScannerEnabled()){ - buildTargets.addAll(getBSFPlatformContexts()); - buildTargets.addAll(getBinaryVariationPlatformContexts()); // Symbian Binary Variation (.var) - } - - return buildTargets; - } - - public List getBSFPlatformContexts(){ - - synchronized (bsfContextList) { - if (!bsfContextList.isEmpty()){ - return bsfContextList; - } - - IBSFCatalog catalog = getBSFCatalog(); - for (IBSFPlatform platform : catalog.getPlatforms()) { - // only return non-variant style BSF's. see boog #4533 for details. - if (!platform.isVariant()) { - bsfContextList.add(new SymbianBuildContext(this, platform.getName().toUpperCase(), ISymbianBuildContext.DEBUG_TARGET)); - bsfContextList.add(new SymbianBuildContext(this, platform.getName().toUpperCase(), ISymbianBuildContext.RELEASE_TARGET)); - } - } - } - - return bsfContextList; - } - -public List getBinaryVariationPlatformContexts(){ - - synchronized (binaryVariantContextList) { - if (!binaryVariantContextList.isEmpty()){ - return binaryVariantContextList; - } - - ISBVCatalog catalog = getSBVCatalog(); - for (ISBVPlatform sbvPlatform : catalog.getPlatforms()) { - // Currently only variation of ARMV5 is supported... So just hard code the variated platform - // 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)); - } - } - } - - return binaryVariantContextList; - } - - public List getFilteredBuildConfigurations() { - // This is probably a bug, but the filtering only uses SBSv1 preferences if SBSv1 is enabled... - List filteredContexts; - if (SBSv2Utils.enableSBSv1Support()) { - filteredContexts = getSBSv1FilteredBuildConfigurations(); - } else { - if (SBSv2Utils.enableSBSv2Support()) { - filteredContexts = SBSv2Utils.getFilteredSBSv2BuildContexts(this); - } else { - // be optimistic in this case... SBSv3? ;) - filteredContexts = getUnfilteredBuildConfigurations(); - } - } - return filteredContexts; - } - - protected List getSBSv1FilteredBuildConfigurations() { - List buildContexts = getUnfilteredBuildConfigurations(); - - if (buildContexts.size() == 0){ - return Collections.emptyList(); - } - - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - List platFilterList = sdkMgr.getPlatformList(); - - Iterator li = buildContexts.iterator(); - - while(li.hasNext()){ - ISymbianBuildContext currContext = li.next(); - for (BuildPlat currPlat : platFilterList){ // see which ones need to be filtered out. - - if (currPlat.getPlatName().equals(currContext.getPlatformString())){ - if (!currPlat.isEnabled()){ - if (isEKA2() && currPlat.getOsIdentifier().equals(BuildPlat.EKA2_IDENTIFIER)){ - li.remove(); // filtered out in UI, don't show - break; - } - } - } - } - } - - return buildContexts; - } public IPath getIncludePath() { String epocRoot = getEPOCROOT(); @@ -380,10 +164,6 @@ return null; } - public File getLicenseFile() { - return licenseFile; - } - public String getName() { if (deviceEntry != null) { return deviceEntry.getName(); @@ -397,39 +177,12 @@ } return osVersion; } - - public Version getSDKVersion() { - if (sdkVersion == null){ - return new Version("0.0"); - } - return sdkVersion; - } - public List getPlatformMacros(String platform) { - List platformMacros = cachedPlatformMacros.get(platform.toUpperCase()); - if (platformMacros == null) { - synchronized (cachedPlatformMacros) { - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - platformMacros = sdkMgr.getSymbianMacroStore().getPlatformMacros(getOSVersion(), getSDKOSBranch(), getBSFCatalog(), platform); - cachedPlatformMacros.put(platform.toUpperCase(), platformMacros); - } - } - return platformMacros; - } - - public List getVendorSDKMacros() { - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - return sdkMgr.getSymbianMacroStore().getVendorMacros(getSDKVersion(), getName()); - } - - public File getPrefixFile() { + public File getPrefixFile(String builderId) { + File prefixFile = prefixFileMap.get(builderId); return prefixFile; } - public URL getPublisherURL() { - return publisherURL; - } - public IPath getReleaseRoot() { String epocRoot = getEPOCROOT(); if (epocRoot.length() > 0) { @@ -444,161 +197,18 @@ return null; } - public String getSDKDescription() { - if (sdkDescription == null){ - return ""; - } - return sdkDescription; - } - - public String getSDKOSBranch() { - if (sdkOSBranch == null){ - return ""; + public Version getSDKVersion() { + if (sdkVersion == null){ + return new Version("0.0"); } - - return sdkOSBranch; - } - - public IPath getToolsPath() { - String epocRoot = getEPOCROOT(); - if (epocRoot.length() > 0) { - IPath epoc32ToolsPath = new Path(epocRoot).append("epoc32/tools"); - // try to canonicalize it so it matches actual file system case - try { - epoc32ToolsPath = new Path(epoc32ToolsPath.toFile().getCanonicalPath()); - } catch (IOException e) { - } - return epoc32ToolsPath; - } - return null; - } - - public String getUniqueId() { - if (deviceEntry != null) { - return deviceEntry.getId(); - } - return ""; - } - - public String getVendor() { - String[] parts = getName().split("\\."); - if (parts.length == 3) - return parts[1]; - - return ""; + return sdkVersion; } - public List getProjectVariantHRHDefines() { - // this is deprecated. should use the one in ISymbianBuildContext instead. + @SuppressWarnings("rawtypes") + public Set getSupportedFeatures() { + return sdkFeatures; + } - long hrhTime = 0; - if (getPrefixFile() != null){ - hrhTime = getPrefixFile().lastModified(); - } - - if (variantHRHMacros == null || variantHRHMacros.size() == 0 || hrhTime != hrhFileTimeStamp) { - synchronized (this) { - hrhFileTimeStamp = hrhTime; // update time stamp to latest - List macros = new ArrayList(); - Map namedMacros = new HashMap(); - File file = getPrefixFile(); - if (file != null){ - - // Note: MacroScanner argument 'BasicIncludeFileLocation' can take - // paramaters for user/system includes, however, for getting macros - // from the prefix file it should not be necessary. - MacroScanner scanner = new MacroScanner( - new BasicIncludeFileLocator(null, null), - DefaultModelDocumentProvider.getInstance(), - DefaultTranslationUnitProvider.getInstance()); - scanner.scanFile(file); - - List scannedMacros = (List)scanner.getMacroDefinitions(); - for (IDefine scannedMacro : scannedMacros){ - // we don't want duplicate macros, so check to see if it's already there. - // if it is, remove it and then add the newer one. this is consistent with - // how it would be from a compiler standpoint. - IDefine macro = namedMacros.get(scannedMacro.getName()); - if (macro != null) { - macros.remove(macro); - } - - macros.add(scannedMacro); - namedMacros.put(scannedMacro.getName(), scannedMacro); - } - - List variantCFGMacros = getVariantCFGMacros(); - for (String cfgMacros : variantCFGMacros){ - // we don't want duplicate macros, so check to see if it's already there. - IDefine existingMacro = namedMacros.get(cfgMacros); - if (existingMacro != null) { - macros.remove(existingMacro); - } - - IDefine macro = DefineFactory.createSimpleFreeformDefine(cfgMacros); - macros.add(macro); - namedMacros.put(macro.getName(), macro); - } - } - variantHRHMacros = macros; - } - } - - return variantHRHMacros; - } - - public List getProjectVariantHRHMacros() { - // this API is deprecated, so don't cache this - List defines = getProjectVariantHRHDefines(); - List macros = new ArrayList(defines.size()); - for (IDefine define : defines) { - macros.add(define.getDefinitionText()); - } - return macros; - } - - @SuppressWarnings("unchecked") - public List getVariantCFGMacros(){ - - List variantCFGMacros = new ArrayList(); - File epocRoot = new File(getEPOCROOT()); - File variantCfg; - variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE); - if (!variantCfg.exists()) { - variantCfg = new File(epocRoot, VARIANT_CFG_FILE); - if (!variantCfg.exists()) - return Collections.EMPTY_LIST; - } - - try { - char[] cbuf = new char[(int) variantCfg.length()]; - Reader reader = new FileReader(variantCfg); - reader.read(cbuf); - reader.close(); - String[] lines = new String(cbuf).split("\r\n|\r|\n"); - for (int i = 0; i < lines.length; i++) { - // skip comments and blank lines - String line = removeComments(lines[i]); - if (line.matches("\\s*#.*") || line.trim().length() == 0) - continue; - - // parse the variant line, which is an EPOCROOT-relative - // path to a bldvariant.hrh file - Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line); - if (matcher.matches()) { - continue; // Skip this it's the file - } else { - // all other patterns are assumed to be macro - variantCFGMacros.add(line.trim()); - } - } - } catch (IOException e) { - } - - return variantCFGMacros; - } - - public List getSupportedTargetTypes() { synchronized (supportedTargetTypesList) { @@ -641,44 +251,169 @@ return supportedTargetTypesList; } - - public boolean isDefaultSDK() { - if (deviceEntry == null) { + + public IPath getToolsPath() { + String epocRoot = getEPOCROOT(); + if (epocRoot.length() > 0) { + IPath epoc32ToolsPath = new Path(epocRoot).append("epoc32/tools"); + // try to canonicalize it so it matches actual file system case + try { + epoc32ToolsPath = new Path(epoc32ToolsPath.toFile().getCanonicalPath()); + } catch (IOException e) { + } + return epoc32ToolsPath; + } + return null; + } + + public String getUniqueId() { + if (deviceEntry != null) { + return deviceEntry.getId(); + } + return ""; + } + + @SuppressWarnings("unchecked") + public List getVariantCFGMacros(){ + + List variantCFGMacros = new ArrayList(); + File epocRoot = new File(getEPOCROOT()); + File variantCfg; + variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE); + if (!variantCfg.exists()) { + variantCfg = new File(epocRoot, VARIANT_CFG_FILE); + if (!variantCfg.exists()) + return Collections.EMPTY_LIST; + } + + try { + char[] cbuf = new char[(int) variantCfg.length()]; + Reader reader = new FileReader(variantCfg); + reader.read(cbuf); + reader.close(); + String[] lines = new String(cbuf).split("\r\n|\r|\n"); + for (int i = 0; i < lines.length; i++) { + // skip comments and blank lines + String line = removeComments(lines[i]); + if (line.matches("\\s*#.*") || line.trim().length() == 0) + continue; + + // parse the variant line, which is an EPOCROOT-relative + // path to a bldvariant.hrh file + Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line); + if (matcher.matches()) { + continue; // Skip this it's the file + } else { + // all other patterns are assumed to be macro + variantCFGMacros.add(line.trim()); + } + } + } catch (IOException e) { + } + + return variantCFGMacros; + } + + public String getVendor() { + String[] parts = getName().split("\\."); + if (parts.length == 3) + return parts[1]; + + return ""; + } + + public boolean isEnabled() { + if (!SDKCorePlugin.SUPPORTS_SBSV1_BUILDER && + (getOSVersion().getMajor() < 9 || + (getOSVersion().getMajor() == 9 && getOSVersion().getMinor() <= 4))){ return false; } + return enabled; + } + + /** + * Remove single line C-style comments, multi-line C++-style comments and blank lines + */ + public static String removeComments(String aIntermediateContent) { + // Strip out comments. There are uncovered cases here where this regex approach fails + // when combining cpp and c style comments. + String lNewline = "(\\r\\n|\\r|\\n)"; - if (deviceEntry.getDefault().equals(DefaultType.YES_LITERAL)){ - return true; - } else { - return false; + // Note: we used to use the regex below for cpp comments (from http://ostermiller.org/findcomment.html ) + // String lCppStyleComments = "/\\*(?:.|[\\n\\r])*?\\*/"; + // but it throws StackOverFlowExceptions for large inputs + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5050507 + // suggests that regex OR is the cause - therefore use dotall mode: (?s) instead + + String lCStyleComments = "(?m)//(.*)$"; + String lCppStyleComments = "(?s)/\\*.*?\\*/"; + String lBlankLines = "(?m)(^(\\s)*$"+lNewline+")+"; + aIntermediateContent = aIntermediateContent.replaceAll(lCStyleComments, ""); + aIntermediateContent = aIntermediateContent.replaceAll(lCppStyleComments, ""); + aIntermediateContent = aIntermediateContent.replaceAll(lBlankLines,""); + return aIntermediateContent; + } + + public void scanSDK(){ + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + + sbsv1BuildInfo.clearPlatformMacros(); + + if (!setDataFromManifestXML()){ + //need to scan SDK files for OS and SDK version + scanSDKForVersionInfo(); + } + + setPrefixFile(sbsv1BuildInfo.getPrefixFromVariantCfg(), ISymbianBuilderID.SBSV1_BUILDER); + setPrefixFile(sbsv2BuildInfo.getPrefixFromVariantCfg(), ISymbianBuilderID.SBSV2_BUILDER); + + setSupportFeatures(); + } + + public void setBuildInfo(ISDKBuildInfo buildInfo, String builderId) { + buildInfoMap.put(builderId, buildInfo); + } + + public void setEnabled(boolean enable) { + enabled = enable; + } + + public void setEPOCROOT(String epocRoot) { + deviceEntry.setEpocroot(epocRoot); + } + + public void setName(String name) { + if (deviceEntry != null) { + deviceEntry.setName(name); } } - public boolean isValid() { - // TODO: What makes us valid? We only need a valid devices.xml entry - // to do a build, but we need the other data for most everything else. - // this should probably return false unless we get everything we need. - return false; - } - - public List validationErrors() { - // TODO return error strings for everything that is not setup - // properly. - return null; + public void setOSVersion(Version osVer) { + this.osVersion = osVer; } - private boolean setDataFromManifestXML(){ - if (hasManifestXML()){ - - if (processManifest(new File(deviceEntry.getEpocroot(), MANIFEST_XML_LOCATION))){ - return true; - } else { - return false; - } - - } else { - return false; - } + public void setSDKVersion(Version sdkVers) { + sdkVersion = sdkVers; + } + + public void setPrefixFile(IPath prefixFile, String builderId) { + if (prefixFile == null) + return; + File file = new File(prefixFile.toOSString()); + prefixFileMap.put(builderId, file); + } + + public void setUniqueId(String id) { + deviceEntry.setId(id); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return getUniqueId(); } private boolean hasManifestXML(){ @@ -703,71 +438,60 @@ // XML Valiation code from: http://java.sun.com/developer/technicalArticles/xml/validationxpath/ try { - // Parse an XML document into a DOM tree. - DocumentBuilder parser = - DocumentBuilderFactory.newInstance().newDocumentBuilder(); - doc = parser.parse(manifestFile); - - // Create a SchemaFactory capable of understanding WXS schemas. - SchemaFactory factory = - SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - - // Load a WXS schema, represented by a Schema instance. - String tempStr = manifestFile.getAbsolutePath(); - int index = tempStr.lastIndexOf(File.separator); - tempStr = tempStr.substring(0, index); - tempStr += File.separator + "sdkManifest.xsd"; - Source schemaFile = new StreamSource(new File(tempStr)); - Schema schema = factory.newSchema(schemaFile); - - // Create a Validator object, which can be used to validate - // an instance document. - Validator validator = schema.newValidator(); + // Parse an XML document into a DOM tree. + DocumentBuilder parser = + DocumentBuilderFactory.newInstance().newDocumentBuilder(); + doc = parser.parse(manifestFile); + + // Create a SchemaFactory capable of understanding WXS schemas. + SchemaFactory factory = + SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + + // Load a WXS schema, represented by a Schema instance. + String tempStr = manifestFile.getAbsolutePath(); + int index = tempStr.lastIndexOf(File.separator); + tempStr = tempStr.substring(0, index); + tempStr += File.separator + "sdkManifest.xsd"; + Source schemaFile = new StreamSource(new File(tempStr)); + Schema schema = factory.newSchema(schemaFile); + + // Create a Validator object, which can be used to validate + // an instance document. + Validator validator = schema.newValidator(); + + // Validate the DOM tree. + // Don't use new DOMSource(doc) for manifest, that requires namespace + // and some (e.g. S60) manifest.xml says xsi:noNamespaceSchemaLocation. + // Failure will show in Java 6 + // see detail in XERCESJ-1163 boog report + // http://issues.apache.org/jira/browse/XERCESJ-1163?page=all + validator.validate(new StreamSource(manifestFile)); - // Validate the DOM tree. - // Don't use new DOMSource(doc) for manifest, that requires namespace - // and some (e.g. S60) manifest.xml says xsi:noNamespaceSchemaLocation. - // Failure will show in Java 6 - // see detail in XERCESJ-1163 boog report - // http://issues.apache.org/jira/browse/XERCESJ-1163?page=all - validator.validate(new StreamSource(manifestFile)); - - } catch (ParserConfigurationException e) { - ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.getPluginId(), IStatus.ERROR, "SDK Manifest could not be parsed correctly.", e)); - hasParseError = true; - } catch (SAXException e) { - ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.getPluginId(), IStatus.ERROR, "SDK Manifest failed schema validation.", e)); - hasParseError = true; - // exception handling - document not valid! - } catch (IOException e) { - // This SDK has not manifest, don't post error - hasParseError = true; - } + } catch (ParserConfigurationException e) { + ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.getPluginId(), IStatus.ERROR, "SDK Manifest could not be parsed correctly.", e)); + hasParseError = true; + } catch (SAXException e) { + ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.getPluginId(), IStatus.ERROR, "SDK Manifest failed schema validation.", e)); + hasParseError = true; + // exception handling - document not valid! + } catch (IOException e) { + // This SDK has not manifest, don't post error + hasParseError = true; + } - // if there were any parse errors, throw an exception so that suitable defaults - // can be calculated from the devices.xml entry. - if (hasParseError) { - return false; - } + // if there were any parse errors, throw an exception so that suitable defaults + // can be calculated from the devices.xml entry. + if (hasParseError) { + return false; + } + + try { - try { - + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); Node node = XPathAPI.selectSingleNode(doc, "sdk/paths"); for (NodeIterator nodeIter = XPathAPI.selectNodeIterator(doc, "sdk"); (node = nodeIter.nextNode()) != null;) { NamedNodeMap attribs = node.getAttributes(); - node = XPathAPI.selectSingleNode(doc, "sdk/@id"); - if (node != null) { - // currently ignored... - String tempStr = node.getNodeValue(); - - - } - - // name is currently ignored - node = attribs.getNamedItem("name"); - String sdkFamily = node == null ? null : node.getNodeValue(); - node = XPathAPI.selectSingleNode(doc, "sdk/paths/@root"); String path = node == null ? null : node.getNodeValue(); if (null != path) { @@ -782,68 +506,30 @@ // Loop through the sdk:paths:root elements and pick out check all the 'id' attriutes for matches... attribs = node.getAttributes(); String rootType = attribs.getNamedItem("id").getNodeValue(); - if (rootType.equals(PATH_ID_INCLUDEDIR)) { - node = attribs.getNamedItem("path"); - /*if (null!=node){ - setIncludePath(new Path(path + node.getNodeName())); - }*/ - } else if (rootType.equals(RELEASE)) { - node = attribs.getNamedItem("path"); - /*if (null!=node){ - setReleaseRoot(new Path(path + node.getNodeName())); - }*/ - } else if (rootType.equals(PATH_ID_TOOLSDIR)) { - node = attribs.getNamedItem("path"); - /*if (null!=node){ - setToolsPath(new Path(path + node.getNodeName())); - }*/ - } else if (rootType.equals(PATH_ID_SRCDIR)) { - node = attribs.getNamedItem("path"); - /*if (null!=node){ - setSourcePath(new Path(path + node.getNodeName())); - }*/ - } /* - else if (rootType.equals(PATH_ID_EPOC32DIR)) { - node = attribs.getNamedItem("path"); - if (null!=node){ - set(new File(path, node.getNodeName())); - } - } - */ + if (rootType.equals(PATH_ID_INCLUDEDIR)) { + node = attribs.getNamedItem("path"); + /*if (null!=node){ + setIncludePath(new Path(path + node.getNodeName())); + }*/ + } else if (rootType.equals(RELEASE)) { + node = attribs.getNamedItem("path"); + /*if (null!=node){ + setReleaseRoot(new Path(path + node.getNodeName())); + }*/ + } else if (rootType.equals(PATH_ID_TOOLSDIR)) { + node = attribs.getNamedItem("path"); + /*if (null!=node){ + setToolsPath(new Path(path + node.getNodeName())); + }*/ + } else if (rootType.equals(PATH_ID_SRCDIR)) { + node = attribs.getNamedItem("path"); + /*if (null!=node){ + setSourcePath(new Path(path + node.getNodeName())); + }*/ } + } } - - node = XPathAPI.selectSingleNode(doc, "sdk/paths/license/@file"); - if (node != null){ - String licenseStr = node.getNodeValue(); - this.setLicenseFile(new File(path, licenseStr)); - } - // Get the general SDK description... - node = XPathAPI.selectSingleNode(doc, "sdk/description"); - if (null != node) { - setSDKDescription(node.getTextContent()); - } - - // Get the build configuration to use... - /* - node = XPathAPI.selectSingleNode(doc, "sdk/buildConfig"); - if (null != node) { - sdkManifest.setSDKBuildConfig(node.getTextContent()); - this.id = sdkManifest.getSDKBuildConfig(); - } - */ - - // Get the SDK Version... - node = XPathAPI.selectSingleNode(doc, "sdk/sdkVersion"); - if (null != node) { - try { - setSDKVersion(new Version(node.getTextContent())); - } - catch (IllegalArgumentException e){ - // ignored...improper format - } - } - + // Get the osInfo node = XPathAPI.selectSingleNode(doc, "sdk/osInfo"); if (null != node){ @@ -858,159 +544,26 @@ // ignored...improper format } } - node = attribs.getNamedItem("branch"); - if (null != node) - { - if (getOSVersion().getMajor() == 9){ - setOSSDKBranch(""); - }else { - setOSSDKBranch(node.getNodeValue()); - } - } - } - // Get the creation time/date - node = XPathAPI.selectSingleNode(doc, "sdk/createdDate"); - if (null != node){ - try { - // Get the default MEDIUM/SHORT DateFormat - DateFormat format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT); - setCreateDate(format.parse(node.getTextContent())); - } - catch (ParseException pe) { - // ignore, we're just using the date for info, not critical if missing - } } - // Get the publisher - node = XPathAPI.selectSingleNode(doc, "sdk/publisher"); - if (null != node){ - attribs = node.getAttributes(); - node = attribs.getNamedItem("link"); - if (null != node) - { - try { - setPublisherURL(new URL(node.getNodeValue())); - } - catch (IllegalArgumentException e){ - // ignored...improper format - } + // Get the SDK Version... + node = XPathAPI.selectSingleNode(doc, "sdk/sdkVersion"); + if (null != node) { + try { + setSDKVersion(new Version(node.getTextContent())); } - node = attribs.getNamedItem("logo"); - /*if (null != node){ - setPublisherLogo(new File(path, node.getNodeValue())); - }*/ - node = attribs.getNamedItem("name"); - if (null != node) - { - setPublisherName(node.getNodeValue()); - } - } + catch (IllegalArgumentException e){ + // ignored...improper format + } + } } - } catch (TransformerException e){ e.printStackTrace(); - } catch (MalformedURLException e){ - e.printStackTrace(); } return true; } - - public void setLicenseFile(File licenseFile) { - this.licenseFile = licenseFile; - } - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - - public void setIsDefaultSDK(boolean isDefault) { - if (isDefault){ - deviceEntry.setDefault(DefaultType.YES_LITERAL); - } else { - deviceEntry.setDefault(DefaultType.NO_LITERAL); - } - - } - - public void setOSSDKBranch(String branch) { - sdkOSBranch = branch; - - } - - public void setOSVersion(Version osVer) { - this.osVersion = osVer; - - } - - public void setPrefixFile(IPath prefixFile) { - this.prefixFile = new File(prefixFile.toOSString()); - } - - - public void setPublisherURL(URL publisherURL) { - this.publisherURL = publisherURL; - } - - public void setSDKVersion(Version sdkVers) { - sdkVersion = sdkVers; - } - - public void setSDKDescription(String sdkDescription) { - this.sdkDescription = sdkDescription; - } - - public void setPublisherName(String publisherName) { - this.publisherName = publisherName; - } - - private boolean deriveOSVersionFromDeviceId(){ - boolean foundOSVersion = false; - - if (getUniqueId().equals("S60_3rd")){ - setOSVersion(new Version("9.1.0")); - setSDKVersion(new Version("3.0.0")); - foundOSVersion = true; - } else if (getUniqueId().equals("UIQ3") || getUniqueId().equals("UIQ_3_PB2")){ - setOSVersion(new Version("9.1.0")); - setSDKVersion(new Version("3.0.0")); - foundOSVersion = true; - } else if (getUniqueId().equals("Series60_1_2_CW")){ - setOSVersion(new Version("6.1.0")); - setSDKVersion(new Version("1.2.0")); - foundOSVersion = true; - } else if (getUniqueId().equals("Series60_2_0_CW")){ - setOSVersion(new Version("7.0.0")); - setSDKVersion(new Version("2.0.0")); - foundOSVersion = true; - } else if (getUniqueId().equals("Series60_v21_CW")){ - setOSVersion(new Version("7.0.0")); - setSDKVersion(new Version("2.1.0")); - foundOSVersion = true; - } else if (getUniqueId().equals("S60_2nd_FP2_CW")){ - setOSVersion(new Version("8.0.0")); - setSDKVersion(new Version("2.6.0")); - setOSSDKBranch(EKA1_A_BRANCH_IDENTIFIER); - foundOSVersion = true; - } else if (getUniqueId().equals("S60_2nd_FP3") || getUniqueId().equals("S60_2nd_FP3_CW") || getUniqueId().equals("S60_2nd_FP3_B")){ - setOSVersion(new Version("8.1.0")); - setSDKVersion(new Version("2.8.0")); - setOSSDKBranch(EKA1_A_BRANCH_IDENTIFIER); - foundOSVersion = true; - } else if (getUniqueId().equals("UIQ_21")){ - setOSVersion(new Version("7.0.15")); - setSDKVersion(new Version("2.1.0")); - foundOSVersion = true; - } else if (getUniqueId().equals("Series80_DP2_0_SDK_CW")){ - setOSVersion(new Version("7.0.0")); - setSDKVersion(new Version("2.0.0")); - foundOSVersion = true; - } - return foundOSVersion; - - } - /** * Scans the SDK's epoc32\data\buildinfo.txt file and tries to build the Version * and branch identifiers. This should not be called when a manifest.xml file exits @@ -1026,6 +579,7 @@ setOSVersion(new Version("9.5.0")); // Set a default version that will work with all EKA2 try { + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); char[] cbuf = new char[(int) bldInfoFile.length()]; Reader reader = new FileReader(bldInfoFile); reader.read(cbuf); @@ -1044,31 +598,27 @@ if (versionTokens[2].toUpperCase().contains("TB92SF")){ setOSVersion(new Version("9.5.0")); - setSDKVersion(new Version("5.2.0")); + if (sbsv1BuildInfo != null) { + setSDKVersion(new Version("5.2.0")); + } break; } else if (versionTokens[2].toUpperCase().contains("TB101SF")){ setOSVersion(new Version("9.6.0")); - setSDKVersion(new Version("6.0.0")); + if (sbsv1BuildInfo != null) { + setSDKVersion(new Version("6.0.0")); + } break; } else if (versionTokens[2].toUpperCase().contains("TB102SF")){ setOSVersion(new Version("9.6.0")); - setSDKVersion(new Version("6.0.0")); + if (sbsv1BuildInfo != null) { + setSDKVersion(new Version("6.0.0")); + } break; } else if (versionTokens[2].lastIndexOf("v") > 0){ int index = versionTokens[2].lastIndexOf("v"); String osVersionString = versionTokens[2].substring(index+1, versionTokens[2].length()); - if (osVersionString.endsWith(EKA1_A_BRANCH_IDENTIFIER) || - osVersionString.endsWith(EKA2_B_BRANCH_IDENTIFIER) || - osVersionString.endsWith(EKA1_S_BRANCH_IDENTIFIER)){ - - String branch = osVersionString.substring(osVersionString.length()-1, osVersionString.length()); - if (branch != null){ - setOSSDKBranch(branch); - } - } - // Set the version, split on alphanumeric to get rid of any junk at the end String[] tempStr = osVersionString.split("[a-zA-Z_]"); if (tempStr.length != 0){ @@ -1089,178 +639,41 @@ } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return getUniqueId(); - } - - /** - * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg - * @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. - */ - public IPath getPrefixFromVariantCfg(){ - File epocRoot = new File(getEPOCROOT()); - File variantCfg; - variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE); - if (!variantCfg.exists()) { - variantCfg = new File(epocRoot, VARIANT_CFG_FILE); - if (!variantCfg.exists()) - return null; - } - - String variantDir = null; - String variantFile = null; - try { - char[] cbuf = new char[(int) variantCfg.length()]; - Reader reader = new FileReader(variantCfg); - reader.read(cbuf); - reader.close(); - String[] lines = new String(cbuf).split("\r\n|\r|\n"); - for (int i = 0; i < lines.length; i++) { - // skip comments and blank lines - String line = removeComments(lines[i]); - if (line.matches("\\s*#.*") || line.trim().length() == 0) - continue; - - // parse the variant line, which is an EPOCROOT-relative - // path to a bldvariant.hrh file - Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line); - if (matcher.matches()) { - variantDir = matcher.group(1); - variantFile = matcher.group(3); - File variantFullPathFile = new File(epocRoot, variantDir + File.separator + variantFile); - IPath variantFilePath = new Path(PathUtils.convertPathToUnix(variantFullPathFile.getAbsolutePath())); - return variantFilePath; - } - } - } catch (IOException e) { - } - - return null; // can't find the file... - } - - /** - * Remove single line C-style comments, multi-line C++-style comments and blank lines - */ - private static String removeComments(String aIntermediateContent) { - // Strip out comments. There are uncovered cases here where this regex approach fails - // when combining cpp and c style comments. - String lNewline = "(\\r\\n|\\r|\\n)"; - - // Note: we used to use the regex below for cpp comments (from http://ostermiller.org/findcomment.html ) - // String lCppStyleComments = "/\\*(?:.|[\\n\\r])*?\\*/"; - // but it throws StackOverFlowExceptions for large inputs - // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5050507 - // suggests that regex OR is the cause - therefore use dotall mode: (?s) instead - - String lCStyleComments = "(?m)//(.*)$"; - String lCppStyleComments = "(?s)/\\*.*?\\*/"; - String lBlankLines = "(?m)(^(\\s)*$"+lNewline+")+"; - aIntermediateContent = aIntermediateContent.replaceAll(lCStyleComments, ""); - aIntermediateContent = aIntermediateContent.replaceAll(lCppStyleComments, ""); - aIntermediateContent = aIntermediateContent.replaceAll(lBlankLines,""); - return aIntermediateContent; - } - - public void setEPOCROOT(String epocRoot) { - deviceEntry.setEpocroot(epocRoot); - } - - public void setName(String name) { - deviceEntry.setName(name); - } - - public void setUniqueID(String id) { - deviceEntry.setId(id); - } - - @Deprecated - public boolean getRequiresRestart() { - return false; - } - - public String getPublisherName() { - return publisherName; - } - - public boolean isEKA1() { - return !isEKA2() && getOSVersion().getMajor() < 9 && getOSVersion().getMajor() >= 6; - } - - public boolean isEKA2() { - if (getOSVersion().getMajor() >= 9) { - return true; - } - if (getOSVersion().getMajor() == 8 - && getSDKOSBranch().equals(ISymbianSDK.EKA2_B_BRANCH_IDENTIFIER)){ - return true; - } - return false; - } - - public boolean isS60() { - return getFamily().equals(ISymbianSDK.S60_FAMILY_ID) - || getFamily().equals(ISymbianSDK.SERIES60_FAMILY_ID); - } - - public void setSupportsWINSCW_UREL(boolean isSupported) { - supportsWINSCW_UREL = isSupported; - } - - public boolean supportsWINSCW_UREL() { - return supportsWINSCW_UREL; - } - /** * Check to see whether or not we should support WINSCW UREL */ + @SuppressWarnings("unchecked") private void scanForWINSCW_UREL(){ - supportsWINSCW_UREL = false; 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()){ - supportsWINSCW_UREL = true; + sdkFeatures.add(ISymbianSDKFeatures.IS_WINSCW_UREL_SUPPORTED); } } } } - /* (non-Javadoc) - * @see com.nokia.carbide.cpp.sdk.core.ISymbianSDK#getBSFCatalog() - */ - public IBSFCatalog getBSFCatalog() { - synchronized (this) { - if (bsfCatalog == null) { - bsfCatalog = BSFCatalogFactory.createCatalog(this); + private boolean setDataFromManifestXML(){ + if (hasManifestXML()){ + + if (processManifest(new File(deviceEntry.getEpocroot(), MANIFEST_XML_LOCATION))){ + return true; + } else { + return false; } + + } else { + return false; } - return bsfCatalog; } - /* (non-Javadoc) - * @see com.nokia.carbide.cpp.sdk.core.ISymbianSDK#getBSFCatalog() - */ - public ISBVCatalog getSBVCatalog() { - synchronized (this) { - if (sbvCatalog == null) { - sbvCatalog = SBVCatalogFactory.createCatalog(this); - } - } - return sbvCatalog; + @SuppressWarnings("unchecked") + private void setSupportFeatures() { + scanForWINSCW_UREL(); + sdkFeatures.add(ISymbianSDKFeatures.IS_EKA2); } - public void setPreviouslyScanned(boolean wasScanned) { - this.wasScanned = wasScanned; - } - - public boolean isPreviouslyScanned() { - return wasScanned; - } - } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/processes/CheckS60CustKitSupport.java diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/scripting/SymbianSDKs.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/scripting/SymbianSDKs.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/scripting/SymbianSDKs.java Wed Jul 21 12:11:48 2010 -0500 @@ -41,8 +41,8 @@ for (ISymbianSDK sdk : sdkList){ Map mp = new HashMap(); mp.put(KEY_SDK_ID, sdk.getUniqueId()); + mp.put(KEY_SDK_EPOCROOT, sdk.getEPOCROOT()); mp.put(KEY_SDK_NAME, sdk.getName()); - mp.put(KEY_SDK_EPOCROOT, sdk.getEPOCROOT()); sdkMapArray.add(mp); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/xml/DevicesLoader.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/xml/DevicesLoader.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/xml/DevicesLoader.java Wed Jul 21 12:11:48 2010 -0500 @@ -109,7 +109,8 @@ boolean deviceExists = false; for (Iterator i = devicesList.iterator(); i.hasNext();) { DeviceType currDevice = (DeviceType)i.next(); - if (currDevice.getId().equals(sdk.getUniqueId())){ + if (currDevice.getId().equals(sdk.getUniqueId()) || + currDevice.getEpocroot().toLowerCase().equals(sdk.getEPOCROOT().toLowerCase())){ deviceExists = true; currDevice.setEpocroot(sdk.getEPOCROOT()); currDevice.setId(sdk.getUniqueId()); @@ -133,11 +134,7 @@ newDeviceEntry.setId(sdk.getUniqueId()); newDeviceEntry.setEpocroot(sdk.getEPOCROOT()); newDeviceEntry.setName(sdk.getName()); - if (sdk.isDefaultSDK() == true){ - newDeviceEntry.setDefault(DefaultType.YES_LITERAL); - } else { - newDeviceEntry.setDefault(DefaultType.NO_LITERAL); - } + newDeviceEntry.setDefault(DefaultType.NO_LITERAL); newDeviceEntry.setUserdeletable("no"); newDeviceEntry.setUserdeletetable(null); // just to be sure it doens't get written out devicesList.add(newDeviceEntry); // Add the new/modified config to the list so new data is written @@ -172,15 +169,7 @@ // Set the input sdk paramater's default to whatever it's default value is for (Iterator i = devicesList.iterator(); i.hasNext();) { DeviceType currDevice = (DeviceType)i.next(); - if (currDevice.getId().equals(sdk.getUniqueId())){ - if (sdk.isDefaultSDK()){ - currDevice.setDefault(DefaultType.YES_LITERAL); - } else { - currDevice.setDefault(DefaultType.NO_LITERAL); - } - }else { - currDevice.setDefault(DefaultType.NO_LITERAL); - } + currDevice.setDefault(DefaultType.NO_LITERAL); } // write to disk diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv1BuildContext.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv1BuildContext.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,25 @@ +package com.nokia.carbide.cpp.sdk.core; + +public interface ISBSv1BuildContext extends ISymbianBuildContext { + + /** + * Platform constants + */ + public static final String EMULATOR_PLATFORM = "WINSCW"; + public static final String GCCE_PLATFORM = "GCCE"; + public static final String ARMV5_PLATFORM = "ARMV5"; + public static final String ARMV6_PLATFORM = "ARMV6"; + public static final String ARMV5_ABIV2_PLATFORM = "ARMV5_ABIV2"; + public static final String ARMV6_ABIV2_PLATFORM = "ARMV6_ABIV2"; + + /** + * For Symbian Bianry Variation, platforms will be names . + * So in some cases you need to know only the platforms that the variant is based on. + * For example, a build platform name of "armv5.myvariant" will return "armv5". + * @return The base platform string. + * @see isSymbianBinaryVariation() + * @since 2.0 + */ + public String getBasePlatformForVariation(); + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2BuildContext.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2BuildContext.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,48 @@ +package com.nokia.carbide.cpp.sdk.core; + + +public interface ISBSv2BuildContext extends ISymbianBuildContext { + + public static final String BUILDER_ID = "com.nokia.carbide.builder.raptor"; + + public static final String TOOLCHAIN_ARM = "ARM"; + public static final String TOOLCHAIN_GCCE = "GCCE"; + public static final String TOOLCHAIN_WINSCW = "WINSCW"; + public static final String TOOLCHAIN_UNKNOWN = "UNKNOWN"; + + public static final String MACRO_ARM = "__ARMCC__"; + public static final String MACRO_GCCE = "__GCCE__"; + public static final String MACRO_WINSCW = "__WINSCW__"; + + /** + * Retrieve the build-able configuration; a valid command that cab be passed with Raptor's -c parameter. + * This should not be used and should return null for abld-configurations. + * @return the configuration name, or null if none. + */ + public String getSBSv2Alias(); + + /** + * Get the unique configuration ID for the SBSv2 build configuration. + * @return configuration ID + */ + public String getConfigID(); + + /** + * Get the implicit directory searched for *.def files by the DEFFILE statement. + * @return bare directory name (e.g. 'BWINS', 'BMARM', 'EABI') + */ + public String getDefaultDefFileDirectoryName(); + + /** + * Get stored result from Raptor config query. + * @return ISBSv2ConfigQueryData object + */ + public ISBSv2ConfigQueryData getConfigQueryData(); + + /** + * Get tool chain for the build context + * @return tool chain name (e.g. 'ARM', 'GCCE', 'WINSCW') + */ + public String getToolChain(); + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2ConfigQueryData.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2ConfigQueryData.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,16 @@ +package com.nokia.carbide.cpp.sdk.core; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +public interface ISBSv2ConfigQueryData extends Serializable { + public String getAlias(); + public String getBuildPrefix(); + public Map getBuildMacros(); + public String getConfigurationErrorMessage(); + public Map getMetaDataMacros(); + public List getMetaDataIncludes(); + public String getMetaDataVariantHRH(); + public String getOutputPathString(); +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKBuildInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKBuildInfo.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +*/ + +package com.nokia.carbide.cpp.sdk.core; + +import java.util.List; + +import org.eclipse.core.runtime.IPath; + +/** + * Interface for build related information of a Symbian SDK. + * + */ +public interface ISDKBuildInfo { + + /** + * Returns all available build configurations for a Symbian SDK. + * @return list of ISymbianBuildContext + */ + List getAllBuildConfigurations(); + + /** + * Returns platform-filtered build configurations for a Symbian SDK. + * @return list of ISymbianBuildContext + */ + List getFilteredBuildConfigurations(); + + /** + * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg + * @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. + */ + public IPath getPrefixFromVariantCfg(); + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKManager.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKManager.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKManager.java Wed Jul 21 12:11:48 2010 -0500 @@ -99,14 +99,6 @@ public void updateCarbideSDKCache(); /** - * Sets the default SDK attribute for the input SDK. - * Sets all other sdks in devcies.xml to 'default=false' - * @param sdk - ISymbianSDK object - */ - public void setDefaultSDK(ISymbianSDK sdk); - - - /** * Get whether or not the UI has enabled BSF scanning. * @return true if BSF scanning is enabled. */ diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java Wed Jul 21 12:11:48 2010 -0500 @@ -30,16 +30,6 @@ public interface ISymbianBuildContext { /** - * Platform constants - */ - public static final String EMULATOR_PLATFORM = "WINSCW"; - public static final String GCCE_PLATFORM = "GCCE"; - public static final String ARMV5_PLATFORM = "ARMV5"; - public static final String ARMV6_PLATFORM = "ARMV6"; - public static final String ARMV5_ABIV2_PLATFORM = "ARMV5_ABIV2"; - public static final String ARMV6_ABIV2_PLATFORM = "ARMV6_ABIV2"; - - /** * DEFAULT suffix to use for components that are specified as variant, but don't buid as variants. For example, plain ARMV5, when specified as * as a FEATUREVARIANT, will build as ARMV5.DEFAULT * @since 2.0 @@ -66,15 +56,6 @@ */ public String getPlatformString(); - /** - * For Symbian Bianry Variation, platforms will be names . - * So in some cases you need to know only the platforms that the variant is based on. - * For example, a build platform name of "armv5.myvariant" will return "armv5". - * @return The base platform string. - * @see isSymbianBinaryVariation() - * @since 2.0 - */ - public String getBasePlatformForVariation(); /** * The debug or release target the platform is building for. @@ -91,10 +72,9 @@ /** * Get the implicit directory searched for *.def files by the DEFFILE statement. - * @param isASSP true if targeting ASSP * @return bare directory name (e.g. 'BWINS', 'BMARM', 'EABI') */ - public String getDefaultDefFileDirectoryName(boolean isASSP); + public String getDefaultDefFileDirectoryName(); /** * Get the prefix file used at build time. This usually provides @@ -141,11 +121,5 @@ */ public boolean isSymbianBinaryVariation(); - /** - * Retrieve the build-able configuration; a valid command that cab be passed with Raptor's -c parameter. - * This should not be used and should return null for abld-configurations. - * @return the configuration name, or null if none. - */ - public String getSBSv2Alias(); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuilderID.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuilderID.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +*/ + +package com.nokia.carbide.cpp.sdk.core; + +/** + * A collection of Symbian builder IDs. + * + */ +public interface ISymbianBuilderID { + + public static final String SBSV1_BUILDER = "SBSv1Builder"; + public static final String SBSV2_BUILDER = "SBSv2Builder"; + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java Wed Jul 21 12:11:48 2010 -0500 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 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" @@ -12,12 +12,9 @@ */ package com.nokia.carbide.cpp.sdk.core; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; - import java.io.File; -import java.net.URL; -import java.util.Date; import java.util.List; +import java.util.Set; import org.eclipse.core.runtime.IPath; import org.osgi.framework.Version; @@ -35,49 +32,106 @@ public interface ISymbianSDK { - /** Branch identifier to note Beech branch, OS 8.1a and prior */ - public static final String EKA1_A_BRANCH_IDENTIFIER = "a"; - /** Branch identifier to note S branch, OS 7.0x */ - public static final String EKA1_S_BRANCH_IDENTIFIER = "s"; - /** Branch identifier to note Cedar branch, OS 8.0b and later (not used for OS 9.x and greater) */ - public static final String EKA2_B_BRANCH_IDENTIFIER = "b"; - - // Family Ids don't include the vendor - public static final String SERIES60_FAMILY_ID = "series60"; //deprecated - public static final String S60_FAMILY_ID = "s60"; - public static final String S80_FAMILY_ID = "Series80"; - public static final String UIQ_FAMILY_ID = "UIQ"; - public static final String TECHVIEW_FAMILY_ID = "TechView"; - public static final String SYMBIAN_FOUNDATION_FAMILY_ID = "symbian"; // Symbian Foundation, starting with Symbian^3 - - // Unique Ids include the vendor - public static final String SERIES60_SDK_NAME = "com.nokia." + SERIES60_FAMILY_ID; - public static final String S60_SDK_NAME = "com.nokia." + S60_FAMILY_ID; - public static final String NOKIA_SF_SDK_NAME = "com.nokia." + SYMBIAN_FOUNDATION_FAMILY_ID; // Nokia+Symbian Foundation SDK - public static final String S80_SDK_NAME = "com.nokia." + S80_FAMILY_ID; - public static final String UIQ_SDK_NAME = "com.symbian." + UIQ_FAMILY_ID; - public static final String TECHVIEW_SDK_NAME = "com.symbian." + TECHVIEW_FAMILY_ID; - - public static final String PUBLISHER_NOKIA = "Nokia, Inc."; - public static final String PUBLISHER_UIQ = "UIQ Technology"; - public static final String PUBLISHER_SYMBIAN = "Symbian, Ltd."; + /** + * Returns build info for a particular builder. + * @param builderId id string of a builder + * @return build info + */ + ISDKBuildInfo getBuildInfo(String builderId); /** - * Returns true if the SDK is configured properly, false otherwise. + * Returns the absolute path to the epoc32 directory of this SDK. This method is guaranteed to + * return the path with a trailing File.separator. + * + * @return the absolute path to the epoc32 directory. + */ + String getEPOCROOT(); + + /** + * Returns the family name of a SDK. This is parsed from the 'vendor' attribute from devices.xml. + */ + String getFamily(); + + /** + * Returns an IPath for the epoc32\include directory of a SDK. + * @return an IPath for the epoc32\include directory, or null. + */ + IPath getIncludePath(); + + /** + * Returns the display name of a SDK. This is the com.vendor.family identifier. + * @return the name of a sdk. + */ + String getName(); + + /** + * Returns the OS version string of this SDK. * - * @return true if the SDK is configured properly, and - * false otherwise + * @return the OS Version object. If the version cannot be determined it will be "0.0". + */ + Version getOSVersion(); + + /** + * Returns the prefix file for a particular builder. + * @param builderId id string of a builder + * @return the File object for the prefix file, or + * null if there isn't one for the SDK. + */ + File getPrefixFile(String builderId); + + /** + * Returns an IPath for the epoc32\release directory of a SDK. + * @return an IPath for the epoc32\release directory, or null. */ - boolean isValid(); + IPath getReleaseRoot(); + + /** + * Returns the SDK version string of a SDK. + * @param sdk Symbian SDK + * @return the SDK Version object. If the version cannot be determined it will be "0.0". + */ + Version getSDKVersion(); + + /** + * Returns a set of features supported by the SDK. + * Feature IDs are defined in ISymbianSDKFeatures. + * @return set of features + */ + @SuppressWarnings("rawtypes") + Set getSupportedFeatures(); /** - * Returns a list of human readable error strings desribing why the - * SDK is not configured properly. + * Get a list of supported targettypes listed by this SDK. This routine parses the + * \epoc32\tools\trgttype.pm file to build it's list. + * @return A list of targettype names that can be used in an MMP file + */ + List getSupportedTargetTypes(); + + /** + * Returns an IPath for the epoc32\tools directory of a SDK. + * @return an IPath for the epoc32\tools directory, or null. + */ + IPath getToolsPath(); + + /** + * Returns the unique id of this SDK. This is the devices.xml 'id' attribute. * - * @return a list of strings which may be empty. - * @see #isValid() + * @return the id string of this SDK. */ - List validationErrors(); + String getUniqueId(); + + /** + * Returns a list of the macros defined in the variant.cfg file. This is NOT the macros + * in the HRH file, but the actual maros written to the variant.cfg file. + * @return A String list of macros found as is, or an empty list if none. + */ + List getVariantCFGMacros(); + + /** + * Returns the vendor name of this SDK. This is parsed from the 'name' attribute from devices.xml. + * @return the vendor name of a sdk. + */ + String getVendor(); /** * Returns true if the SDK is enabled, false otherwise. @@ -88,300 +142,8 @@ boolean isEnabled(); /** - * Marks the SDK as enabled or disabled - * - * @param enable whether to enable or disable the SDK - */ - void setEnabled(boolean enable); - - /** - * Returns the list of all platform macros for this SDK. - *

- * This is somewhat equivalent to calling "bldmake plat" on the command line - * These are the macros that can be used in MMP and INF files. They are only given by name (no value) - *

- * @param platform the platform name - * @return a list of macros, which may be empty. - */ - List getPlatformMacros(String platform); - - - /** - * Returns the list of all vendor specific C/C++ macros for this SDK. The list of macros is defined in - * the variant configuration file inside \epoc32\tools\variant.cfg (or \epoc32\tools\spp_variant.cfg - * for platform variation SDKs). The file itself contains an HRH file entry and may also contain macro definitions - * thereafter. - *

- * Macros follow the form of a #define statement, excluding the "#define", e.g.:
- * "FOO", "BAR=1", "_INCLUDE_=\"\\mydir\\prefix.hrh\\\"", "INCLUDE(x)=\epoc32\include\##x" - *

- * - * @return a list of macros which may be empty. - * @deprecated use #getProjectVariantHRHDefines() which returns a list of IDefine instead. - */ - List getProjectVariantHRHMacros(); - - - /** - * Returns the list of all vendor specific C/C++ macros for this SDK. The list of macros is defined in - * the variant configuration file inside \epoc32\tools\variant.cfg (or \epoc32\tools\spp_variant.cfg - * for platform variation SDKs). The file itself contains an HRH file entry and may also contain macro definitions - * thereafter. - * @return a list of macros which may be empty. - * @deprecated use {@link ISymbianBuildContext#getVariantHRHDefines()} instead. This was moved because the include paths - * in which to find any header files included from the main .hrh file may be build configuration specific. - */ - List getProjectVariantHRHDefines(); - - /** - * Returns a list of the macros defined in the variant.cfg file. This is NOT the macros - * in the HRH file, but the actual maros written to the variant.cfg file. - * @return A String list of macros found as is, or an empty list if none. - */ - List getVariantCFGMacros(); - - /** - * Get a list of macros that are used to distinguish this SDK. Typically only - * S603rd edition SDKs contain this information and it's used to differentiate between - * varios S60 SDK releases. Other vendors, such as UIQ may put their macros in the variant HRH file. - * @return A list of macros just returned by name. - */ - public List getVendorSDKMacros(); - - /** - * Returns the list of all available platforms for this SDK. - * - * @return a list of platform names which may be empty. - */ - List getAvailablePlatforms(); - - /** - * Returns the filtered list of build configurations for this SDK. - *

- * Build configs to display can be filtered by the user using the SBSv1 or SBSv2 - * panes of the Platform Filtering Preferences global preference page. - *

- * If SBSv1 building is supported, the platforms are filtered with SBSv1 preferences. - * If SBSv2 building but not SBSv1 is supported, the platforms are filtered with SBSv2 preferences. - * If both builders are supported, SBSv1 preferences are used. - *

- * - * @return a list build configuration names which may be empty. - */ - List getFilteredBuildConfigurations(); - - /** - * Returns the unfiltered list of build configurations for this SDK. - * - * @return a list build configuration names which may be empty. - */ - List getUnfilteredBuildConfigurations(); - - /** - * Returns the unique id of this SDK. This is the devices.xml 'id' attribute. - * - * @return the id string of this sdk. - */ - String getUniqueId(); - - /** - * Returns the display name of this SDK. This is the com.vendor.family identifier. - * - * @return the name of this sdk. - */ - String getName(); - - /** - * Returns the vendor name of this SDK. This is parsed from the 'name' attribute from devices.xml. - * - * @return the vendor name of this sdk. - */ - String getVendor(); - - /** - * Returns the family name of this SDK. This is parsed from the 'vendor' attribute from devices.xml. - * - * @return the family name of this sdk. - */ - String getFamily(); - - /** - * Returns the absolute path to the epoc32 directory of this SDK. This method is guaranteed to - * return the path with a trailing File.separator. - * - * @return the absolute path to the epoc32 directory. - */ - String getEPOCROOT(); - - /** - * Returns whether or not this is the default SDK in the devices.xml file. - * - * @return true if the SDK is the default, and - * false otherwise - */ - boolean isDefaultSDK(); - - /** - * Returns the OS version string of this SDK. - * - * @return the OS Version object. If the version cannot be determined it will be "0.0". - */ - Version getOSVersion(); - - /** - * Returns the SDK version string of this SDK. - * - * @return the SDK Version object. If the version cannot be determined it will be "0.0". - */ - Version getSDKVersion(); - - /** - * Returns the File object for the prefix file for this SDK. - * - * @return the File object for the prefix file, or - * null if there isn't one for this SDK. - */ - File getPrefixFile(); - - /** - * Returns an IPath for the epoc32\tools directory of this SDK. - * - * @return an IPath for the epoc32\tools directory, or null. - */ - IPath getToolsPath(); - - /** - * Returns an IPath for the epoc32\release directory of this SDK. - * - * @return an IPath for the epoc32\release directory, or null. - */ - IPath getReleaseRoot(); - - /** - * Returns an IPath for the epoc32\include directory of this SDK. - * - * @return an IPath for the epoc32\include directory, or null. - */ - IPath getIncludePath(); - - /** - * Get the human readable description of the SDK. - * @return The description string, empty string for none. - */ - String getSDKDescription(); - - /** - * Get the creation date of the manifest.xml - * @return a Date object - */ - Date getCreationDate(); - - /** - * Get the licese file location in the SDK. Comes from manifest.xml. - * @return File, full path to the license file. - */ - File getLicenseFile(); - - /** - * Get the branch qualifier for the OS. Typically "a" or "b" to denote the Beech and Cedar code branchs respectively. - * This is typically used to denote EKA1 from EKA2. - * @return the branch, or empty string if none. - */ - String getSDKOSBranch(); - - /** - * Get the HTTP location for the SDK publisher. Comes from manifest.xml. - * @return A (hopefully) valid URL. - */ - URL getPublisherURL(); - - /** - * Get the publisher name present in manifest.xml - * @return The name entry or empty string if not present. - */ - String getPublisherName(); - - /** - * Get a list of supported targettypes listed by this SDK. This routine parses the - * \epoc32\tools\trgttype.pm file to build it's list. - * @return A list of targettype names that can be used in an MMP file - */ - List getSupportedTargetTypes(); - - /** - * Get a list of macros specific to the given target type, e.g. "__EXE__" or "__DLL__" - * @param targettype - * @return list of macro strings, may be empty - */ - List getTargetTypeMacros(String targettype); - - @Deprecated - public boolean getRequiresRestart(); - void setLicenseFile(File licenseFile); - void setPrefixFile(IPath prefixFile); - void setOSVersion(Version osVer); - void setSDKVersion(Version sdkVers); - void setPublisherURL(URL pubURL); - void setCreateDate(Date createDate); - void setOSSDKBranch(String branch); - void setIsDefaultSDK(boolean isDefault); - void setSDKDescription(String descr); - void setPublisherName(String pubName); - - void setUniqueID(String id); - void setEPOCROOT(String epocRoot); - void setName(String name); - - /** Tell if the SDK is EKA1 */ - boolean isEKA1(); - - /** Tell if the SDK is EKA2 */ - boolean isEKA2(); - - /** Tell if the SDK is Series60 */ - boolean isS60(); - - /** - * Get whether or not this SDK has WINSCW UREL binary support - * @return true if the SDK has the WINSCW/UREL folder with epoc.exe components. - */ - boolean supportsWINSCW_UREL(); - - /** - * Set the flag wheter or not this SDK has WINSCW UREL binary support - * @param isSuported - * @return - */ - void setSupportsWINSCW_UREL(boolean isSupported); - - /** * Scans/Rescans the SDK for info such as prefix file, variant macros, manifest.xml, etc. */ void scanSDK(); - - /** - * Get the BSF catalog for the SDK. - */ - IBSFCatalog getBSFCatalog(); - - /** - * Get the Symbian Binary Variation (SBV) catalog for the SDK. - * @since 2.0 - */ - ISBVCatalog getSBVCatalog(); - - /** - * Tells whether or not the plug-in installer has sniffed this SDK for eclipse plug-ins to install. - * @return true if the SDK was scanned. - * @since 2.0 - */ - boolean isPreviouslyScanned(); - - /** - * Set flag to tell whether or not the SDK was scanned for eclipse plugins to install. - * @param wasScanned was the SDK scanned for plugins? - * @since 2.0 - */ - void setPreviouslyScanned(boolean wasScanned); - + } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDKFeatures.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDKFeatures.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +*/ + +package com.nokia.carbide.cpp.sdk.core; + +/** + * A collection of Symbian SDK feature IDs. + * + */ +public interface ISymbianSDKFeatures { + + public static final String IS_QT_INSTALLED = "isQtInstalled"; + public static final String IS_AVKON_SUPPORTED = "isAvkonSupported"; + public static final String IS_WINSCW_UREL_SUPPORTED = "isWINSCWURELSupported"; + public static final String IS_EKA1 = "isEAK1"; + public static final String IS_EKA2 = "isEKA2"; + public static final String IS_FROM_DEVICES_XML = "isFromDevicesXml"; + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SDKCorePlugin.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SDKCorePlugin.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SDKCorePlugin.java Wed Jul 21 12:11:48 2010 -0500 @@ -12,9 +12,12 @@ */ package com.nokia.carbide.cpp.sdk.core; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Plugin; import org.osgi.framework.BundleContext; +import com.nokia.carbide.cpp.internal.api.sdk.SDKCacheUtils; import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManagerRaptorOnly; import com.nokia.cpp.internal.api.utils.core.HostOS; @@ -31,11 +34,15 @@ // The plug-in ID public static final String PLUGIN_ID = "com.nokia.carbide.cpp.sdk.core"; //$NON-NLS-1$ + public static final String CACHE_FOLDER_NAME = "CarbideSDKCache"; //$NON-NLS-1$ + // The shared instance private static SDKCorePlugin plugin; private static ISDKManager sdkManager; + private static SDKCacheUtils cache; + /** * The constructor */ @@ -56,6 +63,12 @@ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { + try { + if (cache != null) + cache.flushAll(); + } catch (Exception e) { + e.printStackTrace(); + } plugin = null; super.stop(context); } @@ -89,4 +102,17 @@ return sdkManager; } + /** + * Get the persistent cache this plugin. + * @return PersistentCache instance + */ + public static SDKCacheUtils getCache() { + if (cache == null) + { + IPath path = new Path(System.getProperty("user.home")); + cache = new SDKCacheUtils(path.append(CACHE_FOLDER_NAME)); + } + return cache; + } + } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SymbianSDKFactory.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SymbianSDKFactory.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SymbianSDKFactory.java Wed Jul 21 12:11:48 2010 -0500 @@ -40,33 +40,26 @@ String epocRoot, String name, Version osVersion, - String osBranch, - Version sdkVersion, - boolean isDefault){ + Version sdkVersion) { DeviceType newDeviceEntry = DevicesFactory.eINSTANCE.createDeviceType(); newDeviceEntry.setId(id); newDeviceEntry.setEpocroot(epocRoot); newDeviceEntry.setName(name); - if (isDefault){ - newDeviceEntry.setDefault(DefaultType.YES_LITERAL); - } else { - newDeviceEntry.setDefault(DefaultType.NO_LITERAL); - } + newDeviceEntry.setDefault(DefaultType.NO_LITERAL); SymbianSDK sdk = new SymbianSDK(newDeviceEntry); // create SDK and set the attribs found in devices.xml - // Set other essential paramaters not in devices.xml - - if (sdk.getOSVersion().getMajor() != 0){ + // Set other essential parameters not in devices.xml + if (sdk.getOSVersion().getMajor() != 0) { // use the version detected from the SDK creation } else { sdk.setOSVersion(osVersion); - sdk.setOSSDKBranch(osBranch); } - if (sdk.getSDKVersion().getMajor() == 0){ + if (sdk.getSDKVersion().getMajor() == 0) { sdk.setSDKVersion(sdkVersion); } return sdk; } + } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/META-INF/MANIFEST.MF --- a/core/com.nokia.carbide.cpp.sdk.ui/META-INF/MANIFEST.MF Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/META-INF/MANIFEST.MF Wed Jul 21 12:11:48 2010 -0500 @@ -10,6 +10,7 @@ org.eclipse.core.runtime, org.eclipse.core.resources, com.nokia.carbide.cpp.sdk.core, + com.nokia.carbide.cpp.ui, com.nokia.carbide.templatewizard, com.nokia.cpp.utils.core, com.nokia.cpp.utils.ui diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/plugin.properties --- a/core/com.nokia.carbide.cpp.sdk.ui/plugin.properties Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/plugin.properties Wed Jul 21 12:11:48 2010 -0500 @@ -1,7 +1,7 @@ // Copyright 2007 Nokia, Inc. -SDKUIPlugin.SDK_Preferences=SDK Preferences -SDKUIPlugin.Platform_Filtering_Preferences=Platform Filtering Preferences +SDKUIPlugin.SDK_Preferences=Symbian SDKs +SDKUIPlugin.Platform_Filtering_Preferences=Build Configuration Filtering #Keywords for Carbide preferences carbcPreference.common=carbide symbian c cpp cplusplus diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java Wed Jul 21 12:11:48 2010 -0500 @@ -53,15 +53,13 @@ GridData tabFolderGridData = new GridData(SWT.FILL, SWT.FILL, true, true); tabFolder.setLayoutData(tabFolderGridData); - if (SBSv2Utils.enableSBSv2Support()) { - TabItem sbsv2TabItem = new TabItem(tabFolder, SWT.NONE); - sbsv2TabItem.setText(Messages.getString("BuildPlatformFilterPage.SBSv2TabText")); //$NON-NLS-1$ - sbsv2TabItem.setToolTipText(Messages.getString("BuildPlatformFilterPage.SBSv2TabToolTip")); //$NON-NLS-1$ + TabItem sbsv2TabItem = new TabItem(tabFolder, SWT.NONE); + sbsv2TabItem.setText(Messages.getString("BuildPlatformFilterPage.SBSv2TabText")); //$NON-NLS-1$ + sbsv2TabItem.setToolTipText(Messages.getString("BuildPlatformFilterPage.SBSv2TabToolTip")); //$NON-NLS-1$ - sbsv2Tab = new SBSv2PlatformFilterComposite(tabFolder); - sbsv2Tab.createControls(); - sbsv2TabItem.setControl(sbsv2Tab); - } + sbsv2Tab = new SBSv2PlatformFilterComposite(tabFolder); + sbsv2Tab.createControls(); + sbsv2TabItem.setControl(sbsv2Tab); if (SBSv2Utils.enableSBSv1Support()) { TabItem sbsv1TabItem = new TabItem(tabFolder, SWT.NONE); diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Wed Jul 21 12:11:48 2010 -0500 @@ -18,11 +18,19 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.CheckboxTableViewer; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; @@ -30,47 +38,81 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.TableItem; import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2MinimumVersionException; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils; +import com.nokia.carbide.cpp.internal.sdk.ui.AddSBSv2ProductVariant; import com.nokia.carbide.cpp.internal.sdk.ui.Messages; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; /** * @since 1.4 */ +@SuppressWarnings("restriction") public class SBSv2PlatformFilterComposite extends Composite { - private CheckboxTableViewer tableViewer; + // TODO: Temporary map. We need a way to ensure we only get the alias map + // when needed and that the data we are getting is properly cached to avoid + // having to run Raptor queries too often + private static HashMap aliasMap = new HashMap(); + private static List productVariantList = new ArrayList(); + + private CheckboxTableViewer buildAliasTableViewer; + private ListViewer customVariantListViewer; private Button refreshButton; + private Button addVariantButton; + private Button removeVariantButton; - SBSv2PlatformFilterComposite(Composite parent) { super(parent, SWT.NONE); } public void createControls() { GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 2; setLayout(gridLayout); - Group platformsGroup = new Group(this, SWT.NONE); - platformsGroup.setText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupText")); //$NON-NLS-1$ - platformsGroup.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupToolTip")); //$NON-NLS-1$ - GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); - gd.widthHint = 350; - platformsGroup.setLayoutData(gd); - platformsGroup.setLayout(new GridLayout()); + GridData gd = new GridData(SWT.LEFT, SWT.LEFT, true, false); + gd.widthHint = 200; + gd.heightHint = 350; - tableViewer = CheckboxTableViewer.newCheckList(platformsGroup, SWT.BORDER); - tableViewer.getTable().setLayoutData(gd); - tableViewer.setContentProvider(new ArrayContentProvider()); - tableViewer.setLabelProvider(new LabelProvider()); + Label aliasBoxLabel = new Label(this, SWT.NONE); + aliasBoxLabel.setText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupText")); + aliasBoxLabel.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupToolTip")); + + Label variantBoxLabel = new Label(this, SWT.NONE); + variantBoxLabel.setText(Messages.getString("SBSv2PlatformFilterComposite.ProductsGroupText")); + variantBoxLabel.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.ProductsGroupToolTip")); + + buildAliasTableViewer = CheckboxTableViewer.newCheckList(this, SWT.BORDER); + buildAliasTableViewer.getTable().setLayoutData(gd); + buildAliasTableViewer.setContentProvider(new ArrayContentProvider()); + buildAliasTableViewer.setLabelProvider(new LabelProvider()); + + customVariantListViewer = new ListViewer(this); + customVariantListViewer.getList().setLayoutData(gd); + customVariantListViewer.setContentProvider(new ArrayContentProvider()); + customVariantListViewer.setLabelProvider(new LabelProvider()); + customVariantListViewer.addSelectionChangedListener( new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + if (customVariantListViewer.getSelection() != null && !customVariantListViewer.getSelection().isEmpty()){ + removeVariantButton.setEnabled(true); + } else { + removeVariantButton.setEnabled(false); + } + } + }); refreshButton = new Button(this, SWT.NONE); refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonText")); //$NON-NLS-1$ refreshButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonToolTip")); //$NON-NLS-1$ + refreshButton.addSelectionListener(new SelectionListener() { - + public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } @@ -81,41 +123,150 @@ }); + Composite variantButtonsComposite = new Composite(this, SWT.NONE); + gridLayout = new GridLayout(); + gridLayout.makeColumnsEqualWidth = true; + gridLayout.numColumns = 2; + variantButtonsComposite.setLayout(gridLayout); + GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false); + variantButtonsComposite.setLayoutData(gridData); + + addVariantButton = new Button(variantButtonsComposite, SWT.NONE); + addVariantButton.setText(Messages.getString("SBSv2PlatformFilterComposite.AddProductButtonText")); //$NON-NLS-1$ + addVariantButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.AddProductButtonToolTip")); //$NON-NLS-1$ + addVariantButton.setLayoutData(gridData); + addVariantButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) {widgetSelected(e);} + public void widgetSelected(SelectionEvent e) { + if (aliasMap.size() == 0){ + MessageDialog.openError(getShell(), "No build configurations found.", "No build configurations (aliases) were found from any SDKs. Attempted 'sbs --query=aliases' but found no results."); + } else if (productVariantList.size() == 0){ + MessageDialog.openError(getShell(), "No products found.", "No products were found from any SDKs. Attempted 'sbs --query=products' but found no results."); + } else { + String selectedAlias = ""; + ISelection selectedItem = buildAliasTableViewer.getSelection(); + + StructuredSelection selection = (StructuredSelection)selectedItem; + String stringSelection = (String)selection.getFirstElement(); + if (stringSelection != null){ + TableItem[] tableItems = buildAliasTableViewer.getTable().getItems(); + for (TableItem item : tableItems){ + if (stringSelection.equals(item.getText())){ + selectedAlias = item.getText(); + break; + } + } + } + AddSBSv2ProductVariant addVariantDlg = new AddSBSv2ProductVariant(getShell(), selectedAlias, aliasMap, productVariantList); + if (addVariantDlg.open() == TrayDialog.OK){ + if (customVariantListViewer.testFindItem(addVariantDlg.getUserCreatedVariant()) == null){ + // doesn't exist, add it. if it does exist just ignore it + List variantList = (List)customVariantListViewer.getInput(); + variantList.add(addVariantDlg.getUserCreatedVariant()); + customVariantListViewer.setInput(variantList); + customVariantListViewer.refresh(); + } + } + } + } + + }); + + removeVariantButton = new Button(variantButtonsComposite, SWT.NONE); + removeVariantButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RemoveProductButtonText")); //$NON-NLS-1$ + removeVariantButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.RemoveProductButtonToolTip")); //$NON-NLS-1$ + removeVariantButton.setLayoutData(gridData); + removeVariantButton.setEnabled(false); + removeVariantButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) {widgetSelected(e);} + public void widgetSelected(SelectionEvent e) { + ISelection selectedVariant = customVariantListViewer.getSelection(); + if (selectedVariant != null){ + StructuredSelection selection = (StructuredSelection)selectedVariant; + String stringSelection = (String)selection.getFirstElement(); + List data = (List)customVariantListViewer.getInput(); + data.remove(stringSelection); + customVariantListViewer.setInput(data); + customVariantListViewer.refresh(true); + removeVariantButton.setEnabled(false); + } + } + + }); + initTable(false); } public void performOk() { // save the list of unchecked configs - List uncheckedConfigs = new ArrayList(); - for (TableItem item : tableViewer.getTable().getItems()) { - if (!tableViewer.getChecked(item.getData())) { - uncheckedConfigs.add(item.getText()); + List checkedConfigs = new ArrayList(); + for (TableItem item : buildAliasTableViewer.getTable().getItems()) { + if (buildAliasTableViewer.getChecked(item.getData())) { + checkedConfigs.add(item.getText()); } } - SBSv2Utils.setSBSv2ConfigurationsToFilter(uncheckedConfigs.toArray(new String[uncheckedConfigs.size()])); + for (String variant : customVariantListViewer.getList().getItems()) { + checkedConfigs.add(variant); + } + + SBSv2Utils.setSBSv2FilteredConfigs(checkedConfigs.toArray(new String[checkedConfigs.size()])); } private void initTable(boolean refreshList) { SBSv2Utils.initDefaultConfigsToFilter(); - Object[] keySet = SBSv2Utils.getUnfilteredSBSv2BuildConfigurations(refreshList).keySet().toArray(); - List sbsAliases = new ArrayList(); - for (Object key : keySet) - sbsAliases.add((String)key); - Collections.sort(sbsAliases); - tableViewer.setInput(sbsAliases); + if (aliasMap.size() == 0){ + try { + aliasMap = SBSv2QueryUtils.getCompleteAliasList(); + } catch (SBSv2MinimumVersionException e) { + // Force a scan for version in case system was updated + SDKCorePlugin.getSDKManager().getSBSv2Version(true); + try { + // try, try again... + aliasMap = SBSv2QueryUtils.getCompleteAliasList(); + } catch (SBSv2MinimumVersionException e2) { + MessageDialog.openError(getShell(), "Minimum sbs version not met.", e.getMessage()); + } + } + } - // check all configs - tableViewer.setAllChecked(true); + if (productVariantList.size() == 0){ + try { + productVariantList = SBSv2QueryUtils.getCompleteProductVariantList(); + } catch (SBSv2MinimumVersionException e) { + + } + } + // get saved configs in the store + List checkedConfigsFromStore = SBSv2Utils.getSBSv2FilteredConfigPreferences(); + + List sbsAliases = new ArrayList(); // global build aliases + List savedVariants = new ArrayList(); // custom variants + for (String key : aliasMap.keySet()){ + sbsAliases.add(key); + } - // now uncheck the ones from the store - String[] uncheckedConfigs = SBSv2Utils.getSBSv2ConfigurationsToFilter(); - for (String config : uncheckedConfigs) { - for (TableItem item : tableViewer.getTable().getItems()) { - if (item.getText().equals(config)) { - tableViewer.setChecked(item.getData(), false); + for (String config : checkedConfigsFromStore){ + if (config.contains(".")){ + savedVariants.add(config); + } + } + + Collections.sort(sbsAliases); + buildAliasTableViewer.setInput(sbsAliases); + customVariantListViewer.setInput(savedVariants); + + // uncheck all configs to init + buildAliasTableViewer.setAllChecked(false); + + for (String config : checkedConfigsFromStore) { + for (TableItem item : buildAliasTableViewer.getTable().getItems()) { + if (item.getText().equals(config) && !item.getText().contains(".")) { + buildAliasTableViewer.setChecked(item.getData(), true); break; } } @@ -124,16 +275,16 @@ public void setDefaults(){ initTable(true); - for (TableItem item : tableViewer.getTable().getItems()) { - if (item.getText().toLowerCase().startsWith("tool") || - item.getText().toLowerCase().startsWith("gccxml") || - item.getText().toLowerCase().startsWith("armv6") || - item.getText().toLowerCase().startsWith("armv7") || - item.getText().toLowerCase().startsWith("armv7") || - item.getText().toLowerCase().startsWith("armv9")) { - tableViewer.setChecked(item.getData(), false); + for (TableItem item : buildAliasTableViewer.getTable().getItems()) { + if (item.getText().toLowerCase().equals("armv5_udeb") || + item.getText().toLowerCase().equals("armv5_urel") || + item.getText().toLowerCase().equals("armv5_udeb_gcce") || + item.getText().toLowerCase().equals("armv5_urel_gcce") || + item.getText().toLowerCase().equals("winscw_udeb") || + item.getText().toLowerCase().equals("winscw_urel")) { + buildAliasTableViewer.setChecked(item.getData(), true); } else { - tableViewer.setChecked(item.getData(), true); + buildAliasTableViewer.setChecked(item.getData(), false); } } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 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 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/TemplateUtils.java Wed Jul 21 12:11:48 2010 -0500 @@ -23,6 +23,7 @@ import org.osgi.framework.Version; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.template.engine.ITemplate; @@ -59,10 +60,10 @@ if (f1.equalsIgnoreCase(f2)) return true; - if ((f1.equalsIgnoreCase(ISymbianSDK.S60_FAMILY_ID) && - f2.equalsIgnoreCase(ISymbianSDK.SERIES60_FAMILY_ID)) || - (f2.equalsIgnoreCase(ISymbianSDK.S60_FAMILY_ID) && - f1.equalsIgnoreCase(ISymbianSDK.SERIES60_FAMILY_ID))) + 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; diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/AddSBSv2ProductVariant.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/AddSBSv2ProductVariant.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2007-2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.carbide.cpp.internal.sdk.ui; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; + +/** + * Dialog that allows the user to add a new SBSv2 custom variant configuration + */ +public class AddSBSv2ProductVariant extends TrayDialog { + + private CCombo aliasCombo; + private CCombo variantCombo; + private String newConfigString; + + private List aliasList = new ArrayList(); + private List variantList = new ArrayList(); + private String defaultAlias; + + /** + * Create the dialog + * @param parentShell + * @param selectedAlias + */ + public AddSBSv2ProductVariant(Shell parentShell, String selectedAlias, HashMap aliasMap, + List productVariantList) { + + super(parentShell); + for (String alias : aliasMap.keySet()){ + aliasList.add(alias); + } + variantList = productVariantList; + defaultAlias = selectedAlias; + } + + /** + * Create contents of the button bar + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, + true); + createButton(parent, IDialogConstants.CANCEL_ID, + IDialogConstants.CANCEL_LABEL, false); + + getButton(IDialogConstants.OK_ID).setEnabled(false); + } + + /** + * Create contents of the dialog + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + + Composite container = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 3; + container.setLayout(gridLayout); + + final Label aliasLabel = new Label(container, SWT.NONE); + aliasLabel.setToolTipText("Select a build alias."); + aliasLabel.setText("Select a build alias: "); //$NON-NLS-1$ + + aliasCombo = new CCombo(container, SWT.BORDER); + aliasCombo.setLayoutData(new GridData(263, SWT.DEFAULT)); + Collections.sort(aliasList); + aliasCombo.setItems((String[])aliasList.toArray(new String[aliasList.size()])); + aliasCombo.select(0); + aliasCombo.setEditable(false); + aliasCombo.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + validateData(); + } + public void widgetDefaultSelected(SelectionEvent e) { + // ignore + } + }); + aliasCombo.addKeyListener(new KeyListener() { + public void keyReleased(KeyEvent e) { + validateData(); + } + public void keyPressed(KeyEvent e) { + + } + }); + + + if (defaultAlias != null && defaultAlias.length() > 0) + aliasCombo.setText(defaultAlias); + + new Label(container, SWT.NONE); + + final Label variantLabel = new Label(container, SWT.NONE); + variantLabel.setToolTipText("Select a product variant."); //$NON-NLS-1$ + variantLabel.setText("Select a product variant: "); //$NON-NLS-1$ + + variantCombo = new CCombo(container, SWT.BORDER); + variantCombo.setLayoutData(new GridData(263, SWT.DEFAULT)); + Collections.sort(variantList); + variantCombo.setItems((String[])variantList.toArray(new String[variantList.size()])); + variantCombo.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + validateData(); + } + public void widgetDefaultSelected(SelectionEvent e) { + // ignore + } + }); + variantCombo.addKeyListener(new KeyListener() { + public void keyReleased(KeyEvent e) { + validateData(); + } + public void keyPressed(KeyEvent e) { + + } + }); + + + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, SDKUIHelpIds.SDK_ADD_DIALOG); + return container; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) + */ + protected void configureShell(Shell shell) { + super.configureShell(shell); + shell.setText("Add a custom product configuraiton."); //$NON-NLS-1$ + } + + /** + * Return the initial size of the dialog + */ + @Override + protected Point getInitialSize() { + return super.getInitialSize(); + } + + /* + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + @Override + protected void okPressed() { + + if (!isValidIDName()){ + return; + } + newConfigString = aliasCombo.getText() + "." + variantCombo.getText(); + super.okPressed(); + } + + + private boolean isValidIDName(){ + boolean isValid = true; + + if (aliasCombo.getText() == null || aliasCombo.getText().length() == 0 || + variantCombo.getText() == null || variantCombo.getText().length() == 0){ + MessageDialog.openError(getShell(), "Invalid Configuration Name", "Please supply both an alias and product variant to create a new configuration."); + return false; + } + + return isValid; + } + + public String getUserCreatedVariant() { + return newConfigString; + } + + private void validateData(){ + if (variantCombo.getText().length() > 0){ + getButton(IDialogConstants.OK_ID).setEnabled(true); + } else { + getButton(IDialogConstants.OK_ID).setEnabled(false); + return; + } + + if (aliasCombo.getText().length() > 0){ + getButton(IDialogConstants.OK_ID).setEnabled(true); + } else { + getButton(IDialogConstants.OK_ID).setEnabled(false); + return; + } + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/NewPluginChecker.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/NewPluginChecker.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/NewPluginChecker.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,21 +16,25 @@ */ package com.nokia.carbide.cpp.internal.sdk.ui; -import com.nokia.carbide.cpp.internal.sdk.core.model.DynamicFeatureInstaller; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; -import com.nokia.carbide.cpp.sdk.ui.SDKUIPlugin; -import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; +import java.io.File; +import java.util.List; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchWindow; -import java.io.File; -import java.util.List; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.sdk.core.model.DynamicFeatureInstaller; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.carbide.cpp.sdk.ui.SDKUIPlugin; +import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; @SuppressWarnings("restriction") public class NewPluginChecker { @@ -50,25 +54,26 @@ boolean installed = false; boolean oneSDKWasScanned = false; for (ISymbianSDK sdk : sdkList) { - - if (sdk.isPreviouslyScanned() == false) { - oneSDKWasScanned = true; - // XML was parsed, now try to run the feature installer - sdk.setPreviouslyScanned(true); - File featureDir = new File(sdk.getEPOCROOT() + SDK_FEATURE_SUBDIR); - try { - DynamicFeatureInstaller installer = new DynamicFeatureInstaller(featureDir, null); - if (installer.install()) { - installed = true; + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + if (sbsv1BuildInfo != null) { + if (sbsv1BuildInfo.isPreviouslyScanned() == false) { + oneSDKWasScanned = true; + // XML was parsed, now try to run the feature installer + sbsv1BuildInfo.setPreviouslyScanned(true); + File featureDir = new File(sdk.getEPOCROOT() + SDK_FEATURE_SUBDIR); + try { + DynamicFeatureInstaller installer = new DynamicFeatureInstaller(featureDir, null); + if (installer.install()) { + installed = true; + } + } catch (Exception e) { + // Boog 8383: We should fail silently, since this will not break anything and may SDKs will not have any documentation + // Otherwise, these errors will be logged every time this check is done (workspace is opened) + // Originally, this was used to install MBS build support, but now is only used for SDK documentation + // ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e)); } - } catch (Exception e) { - // Boog 8383: We should fail silently, since this will not break anything and may SDKs will not have any documentation - // Otherwise, these errors will be logged every time this check is done (workspace is opened) - // Originally, this was used to install MBS build support, but now is only used for SDK documentation - // ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e)); } } - } if (oneSDKWasScanned) { diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java Wed Jul 21 12:11:48 2010 -0500 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 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" @@ -16,543 +16,687 @@ */ package com.nokia.carbide.cpp.internal.sdk.ui; -import java.io.*; -import java.util.*; +import java.io.File; +import java.text.MessageFormat; +import java.util.Iterator; import java.util.List; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.IJobChangeListener; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.viewers.*; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.CheckboxTableViewer; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.ColumnViewerEditor; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableColorProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TableViewerEditor; +import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.eclipse.ui.*; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContextDataCache; import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; -import com.nokia.carbide.cpp.sdk.core.*; +import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK; +import com.nokia.carbide.cpp.sdk.core.ISDKManager; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.cpp.sdk.ui.SDKUIPlugin; import com.nokia.carbide.cpp.sdk.ui.shared.AddSDKDialog; +import com.nokia.carbide.cpp.ui.TextAndDialogCellEditor; +import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; public class SDKPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - ISDKManager sdkMgr; + private class SDKLabelProvider extends LabelProvider implements ITableLabelProvider, ITableColorProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + ISymbianSDK sdk = (ISymbianSDK) element; + switch (columnIndex) { + case 1: + return sdk.getUniqueId(); + case 2: + return sdk.getEPOCROOT(); + default: + return ""; + } + } + + public Color getForeground(Object element, int columnIndex) { + ISymbianSDK sdk = (ISymbianSDK) element; + return updateSDKcolor(sdk); + } + + public Color getBackground(Object element, int columnIndex) { + return white; + } + } + + private class IdEditingSupport extends EditingSupport { + private TextCellEditor editor; + + public IdEditingSupport(ColumnViewer viewer) { + super(viewer); + editor = new TextCellEditor((Composite) viewer.getControl()); + } + + @Override + protected boolean canEdit(Object element) { + if (element instanceof ISymbianSDK) { + return true; + } + return false; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected Object getValue(Object element) { + ISymbianSDK sdk = (ISymbianSDK) element; + return sdk.getUniqueId(); + } + + @Override + protected void setValue(Object element, Object value) { + String sdkID = value.toString(); + + // check for spaces in ID + if (sdkID.contains(" ")){ //$NON-NLS-1$ + MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Invalid_SDK_ID"), Messages.getString("AddSDKDialog.SDK_ID_No_Spaces")); //$NON-NLS-1$ //$NON-NLS-2$ + return; + } + + ISymbianSDK sdk = (ISymbianSDK) element; + ((SymbianSDK)sdk).setUniqueId(sdkID); + SDKCorePlugin.getSDKManager().updateSDK(sdk); + getViewer().refresh(); + } + } + + private class LocationEditingSupport extends EditingSupport { + private LocationCellEditor editor; + + public LocationEditingSupport(ColumnViewer viewer) { + super(viewer); + editor = new LocationCellEditor((Composite) viewer.getControl()); + } + + @Override + protected boolean canEdit(Object element) { + if (element instanceof ISymbianSDK) { + return true; + } + return false; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected Object getValue(Object element) { + ISymbianSDK sdk = (ISymbianSDK) element; + return sdk.getEPOCROOT(); + } + + @Override + protected void setValue(Object element, Object value) { + ISymbianSDK sdk = (ISymbianSDK) element; + ((SymbianSDK)sdk).setEPOCROOT(value.toString()); + SDKCorePlugin.getSDKManager().updateSDK(sdk); + getViewer().refresh(); + } + } + + private class LocationCellEditor extends TextAndDialogCellEditor { + private Button button; + private Text text; + + public LocationCellEditor(Composite parent) { + super(parent); + } + + @Override + protected Control createContents(Composite parent) { + text = (Text) super.createContents(parent); + return text; + } + + @Override + protected Control createControl(Composite parent) { + Control control = super.createControl(parent); + button = getButton(); + button.setText(Messages.getString("SDKPreferencePage.Browse_Location_Label")); //$NON-NLS-1$ + return control; + } + + @Override + protected Object openDialogBox(Control cellEditorWindow) { + DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN); + BrowseDialogUtils.initializeFrom(dialog, text); + return dialog.open(); + } + } + + private class SDKViewerStrategy extends ColumnViewerEditorActivationStrategy { + public SDKViewerStrategy(ColumnViewer viewer) { + super(viewer); + } + + @Override + protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { + return (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION); + } + } + + private class ScanJobListener implements IJobChangeListener { + public void done(IJobChangeEvent event) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + finishRescanning(); + } + }); + } + + public void aboutToRun(IJobChangeEvent event) {} + public void awake(IJobChangeEvent event) {} + public void running(IJobChangeEvent event) {} + public void scheduled(IJobChangeEvent event) {} + public void sleeping(IJobChangeEvent event) {} + + } + + private IPreferenceStore prefsStore; + private ISDKManager sdkMgr; + private List sdkList; + private ScanJobListener scanJobListner; + private boolean scanForNewPlugins; private CheckboxTableViewer sdkListTableViewer; - private List sdkList; - private Button sdkpropertiesButton; - private Button removeSdkButton; - private Button addNewSdkButton; - private Button rescanNowButton; - - private Label epocrootLabel; - private Label availablePlatformsLabel; - private Label osVersionLabel; - private Label diagnosticCheckLabel; - - private Button listenForDevicesXMLChangeButton; - - private static final String EPOCROOT_LABEL = "EPOCROOT: "; //$NON-NLS-1$ - private static final String PLATFORMS_LABEL = "Available Platforms: "; //$NON-NLS-1$ - private static final String DIAGNOSTIC_CHECK_LABEL = "Diagnostic Check: "; //$NON-NLS-1$ - private static final String OS_VERSION_LABEL = "OS Version: "; //$NON-NLS-1$ - - private Color RED; - private Color BLACK; - private Color GRAY; - Shell shell; - + private Button addButton; + private Button deleteButton; + private Button propertiesButton; + private Button scanForNewPluginsButton; + private Button rescanButton; + private Label iconLabel; + private Label statusLabel; + + private Color black; + private Color gray; + private Color red; + private Color white; + + /** + * Constructor. + */ public SDKPreferencePage() { super(); - - } - - @Override - protected Control createContents(Composite parent) { - return null; +// scanJobListner = new ScanJobListener(); } - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) + /* + * (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) */ - public void init(IWorkbench workbench) { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - - IPreferenceStore prefsStore = SDKUIPlugin.getDefault().getPreferenceStore(); + public void createControl(Composite parent){ + prefsStore = SDKUIPlugin.getDefault().getPreferenceStore(); sdkMgr = SDKCorePlugin.getSDKManager(); if (sdkMgr == null){ return; } - - shell = parent.getShell(); sdkList = sdkMgr.getSDKList(); - RED = shell.getDisplay().getSystemColor(SWT.COLOR_RED); - BLACK = shell.getDisplay().getSystemColor(SWT.COLOR_BLACK); - GRAY = shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); - - // check that devices.xml actually exists - if (sdkMgr instanceof SDKManager) - ((SDKManager) sdkMgr).checkDevicesXMLExistAndCreate(); - - Composite content = new Composite(parent, SWT.NONE); - setControl(content); - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 2; - content.setLayout(gridLayout); - - final Group availableSymbianOsGroup = new Group(content, SWT.NONE); - availableSymbianOsGroup.setToolTipText(Messages.getString("SDKPreferencePage.OS_Group_ToolTip")); //$NON-NLS-1$ - final GridData availableSymbianOsGridData = new GridData(SWT.FILL, SWT.CENTER, true, false); - availableSymbianOsGridData.widthHint = 350; - availableSymbianOsGroup.setText(Messages.getString("SDKPreferencePage.Available_SDKs_Label")); //$NON-NLS-1$ - availableSymbianOsGroup.setLayoutData(availableSymbianOsGridData); - availableSymbianOsGroup.setLayout(new GridLayout()); - - sdkListTableViewer = CheckboxTableViewer.newCheckList(availableSymbianOsGroup, SWT.BORDER); - sdkListTableViewer.getTable().setLayoutData(availableSymbianOsGridData); - - final Composite composite = new Composite(content, SWT.NONE); - composite.setLayoutData(new GridData()); - final GridLayout gridLayout_1 = new GridLayout(); - gridLayout_1.makeColumnsEqualWidth = true; - composite.setLayout(gridLayout_1); + if (sdkMgr instanceof SDKManager) { + SDKManager mgr = (SDKManager) sdkMgr; +// mgr.addScanJobListner(scanJobListner); + } - removeSdkButton = new Button(composite, SWT.NONE); - removeSdkButton.setToolTipText(Messages.getString("SDKPreferencePage.Delete_SDK_ToolTip")); //$NON-NLS-1$ - final GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false); - removeSdkButton.setLayoutData(gridData); - removeSdkButton.setText(Messages.getString("SDKPreferencePage.Remove_SDK_Label")); //$NON-NLS-1$ - addButtonListener(removeSdkButton); - - addNewSdkButton = new Button(composite, SWT.NONE); - addNewSdkButton.setToolTipText(Messages.getString("SDKPreferencePage.Add_New_SDK_ToolTip")); //$NON-NLS-1$ - addNewSdkButton.setLayoutData(gridData); - addNewSdkButton.setText(Messages.getString("SDKPreferencePage.Add_New_SDK_Label")); //$NON-NLS-1$ - addButtonListener(addNewSdkButton); - - sdkpropertiesButton = new Button(composite, SWT.NONE); - sdkpropertiesButton.setToolTipText(Messages.getString("SDKPreferencePage.SDK_Props_Button_ToolTip")); //$NON-NLS-1$ - sdkpropertiesButton.setLayoutData(gridData); - sdkpropertiesButton.setText(Messages.getString("SDKPreferencePage.SDK_Props_Button_Label")); //$NON-NLS-1$ - addButtonListener(sdkpropertiesButton); - - final Group sdkInformationGroup = new Group(content, SWT.NONE); - sdkInformationGroup.setToolTipText(Messages.getString("SDKPreferencePage.SDK_Info_ToolTip")); //$NON-NLS-1$ - final GridData sdkInfoGridData = new GridData(SWT.FILL, SWT.FILL, true, true); - sdkInfoGridData.widthHint = 350; - sdkInformationGroup.setText(Messages.getString("SDKPreferencePage.SDK_Info_Label")); //$NON-NLS-1$ - sdkInformationGroup.setLayoutData(sdkInfoGridData); - sdkInformationGroup.setLayout(new GridLayout()); - - epocrootLabel = new Label(sdkInformationGroup, SWT.WRAP); - epocrootLabel.setToolTipText(Messages.getString("SDKPreferencePage.EPOC32_Loc_ToolTip")); //$NON-NLS-1$ - epocrootLabel.setLayoutData(new GridData(300, SWT.DEFAULT)); - epocrootLabel.setText("EPOCROOT:"); //$NON-NLS-1$ + super.createControl(parent); - osVersionLabel = new Label(sdkInformationGroup, SWT.WRAP); - osVersionLabel.setToolTipText(Messages.getString("SDKPreferencePage.OSVesions_ToolTip")); //$NON-NLS-1$ - osVersionLabel.setLayoutData(new GridData(300, SWT.DEFAULT)); - osVersionLabel.setText(Messages.getString("SDKPreferencePage.OSVersion_Label")); //$NON-NLS-1$ - - availablePlatformsLabel = new Label(sdkInformationGroup, SWT.WRAP); - availablePlatformsLabel.setToolTipText(Messages.getString("SDKPreferencePage.Platforms_ToolTip")); //$NON-NLS-1$ - availablePlatformsLabel.setLayoutData(new GridData(300, SWT.DEFAULT)); - availablePlatformsLabel.setText(Messages.getString("SDKPreferencePage.Available_Platforms")); //$NON-NLS-1$ - - diagnosticCheckLabel = new Label(sdkInformationGroup, SWT.WRAP); - diagnosticCheckLabel.setToolTipText(Messages.getString("SDKPreferencePage.Diagnostic_Check_ToolTip")); //$NON-NLS-1$ - diagnosticCheckLabel.setLayoutData(sdkInfoGridData); - diagnosticCheckLabel.setText(Messages.getString("SDKPreferencePage.Diagnostic_Check_Label")); //$NON-NLS-1$ - new Label(content, SWT.NONE); + // Hide "Restore Defaults" button + getDefaultsButton().setVisible(false); - listenForDevicesXMLChangeButton = new Button(content, SWT.CHECK); - listenForDevicesXMLChangeButton.setText(Messages.getString("SDKPreferencePage.listerForDevicesXML")); - listenForDevicesXMLChangeButton.setToolTipText(Messages.getString("SDKPreferencePage.listerForDevicesXML_Tooltip")); //$NON-NLS-1$ - listenForDevicesXMLChangeButton.setSelection(prefsStore.getBoolean(SDKUIPreferenceConstants.LISTEN_FOR_DEVICES_XML_CHANGE)); - - new Label(content, SWT.WRAP); // filler - - rescanNowButton = new Button(content, SWT.NONE); - rescanNowButton.setToolTipText(Messages.getString("SDKPreferencePage.Rescan_Button_ToolTip")); //$NON-NLS-1$ - rescanNowButton.setLayoutData(new GridData()); - rescanNowButton.setText(Messages.getString("SDKPreferencePage.Rescan_Button_Label")); //$NON-NLS-1$ - addButtonListener(rescanNowButton); - new Label(content, SWT.NONE); - - // Build the checked table of SDKs - addSDKComponentTableItems(); - - ISymbianSDK sdk = (ISymbianSDK)sdkListTableViewer.getElementAt(0); - if (sdk != null){ - sdkListTableViewer.setSelection(new StructuredSelection(sdk), true); - setSelectedSDKInfoText(sdk); - } - - PlatformUI.getWorkbench().getHelpSystem().setHelp(super.getControl(), SDKUIHelpIds.SDK_PREFERENCES_PAGE); } - + + /* + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.DialogPage#dispose() + */ + public void dispose() { + if (sdkMgr != null && sdkMgr instanceof SDKManager){ + SDKManager mgr = (SDKManager) sdkMgr; + mgr.removeScanJobLisner(scanJobListner); + } + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) + */ + public void init(IWorkbench arg0) { + } + + /* + * (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#performOk() + */ public boolean performOk() { - - IPreferenceStore prefsStore = SDKUIPlugin.getDefault().getPreferenceStore(); - prefsStore.setValue(SDKUIPreferenceConstants.LISTEN_FOR_DEVICES_XML_CHANGE, listenForDevicesXMLChangeButton.getSelection()); - + // Save preference page specific values; + prefsStore.setValue(SDKUIPreferenceConstants.SCAN_FOR_NEW_PLUGINS, scanForNewPluginsButton.getSelection()); + + // Remember which SDK is enabled for (ISymbianSDK sdk : sdkMgr.getSDKList()){ - sdk.setEnabled(false); + ((SymbianSDK)sdk).setEnabled(false); } Object[] sdkObjects = sdkListTableViewer.getCheckedElements(); for (Object currObj : sdkObjects){ if (currObj instanceof ISymbianSDK){ ISymbianSDK sdk = (ISymbianSDK)currObj; - sdk.setEnabled(true); + ((SymbianSDK)sdk).setEnabled(true); } } - - ISDKManager sdkMgr =SDKCorePlugin.getSDKManager(); - sdkMgr.updateCarbideSDKCache(); - - return super.performOk(); - } - - private void addSDKComponentTableItems() { - sdkListTableViewer.setContentProvider(new SDKTableComponentsContentProvider()); - sdkListTableViewer.setLabelProvider(new SDKTableComponentsLabelProvider()); - Table lTable = sdkListTableViewer.getTable(); - - sdkList = SDKCorePlugin.getSDKManager().getSDKList(); - sdkListTableViewer.setInput(sdkList); - lTable.setToolTipText(Messages.getString("SDKPreferencePage.List_of_Available_SDKs_ToolTip")); //$NON-NLS-1$ - lTable.setVisible(true); - addSDKTableViewerSelectionListener(); - //lTable.setLayoutData(grid); - if (sdkList == null || sdkList.size() == 0){ - diagnosticCheckLabel.setText(DIAGNOSTIC_CHECK_LABEL + Messages.getString("SDKPreferencePage.No_SDKs_Available")); //$NON-NLS-1$ - diagnosticCheckLabel.setForeground(RED); - diagnosticCheckLabel.setBackground(GRAY); - } else { - setCheckBoxes(sdkList); - } - } - - /** - * Sets the checkbox state for enabled SDKs. - */ - private void setCheckBoxes(List sdkList) { - List sdkListCopy = new ArrayList(); - for (ISymbianSDK sdkCheck : sdkList){ - if (sdkCheck.isEnabled()){ - sdkListCopy.add(sdkCheck); - } - } - sdkListTableViewer.setCheckedElements(sdkListCopy.toArray(new ISymbianSDK[sdkListCopy.size()])); - } - - /** - * Extends LabelProvider with the default implementation - * and implementsITableLabelProvider with the methods - * to provide the text and/or image for each column of a given element. - * Used by table viewers. - */ - - static class SDKTableComponentsLabelProvider extends LabelProvider implements ITableLabelProvider, ITableColorProvider { - - /** - * Returns the label image for the given column of the given element. - * The default implementation returns null. - * - * @return image object - */ - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - /** - * Returns the label text for the given column of the given element. - * - * @return string is the label text for the given column. - */ - public String getColumnText(Object arg0, int column) { - if (arg0 instanceof ISymbianSDK){ - ISymbianSDK sdk = (ISymbianSDK)arg0; - return sdk.getUniqueId(); - } - - return ""; //$NON-NLS-1$ - } + // Update cached SDK info + sdkMgr.updateCarbideSDKCache(); + return super.performOk(); + } - private Color lBlack = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); - private Color lRed = Display.getDefault().getSystemColor(SWT.COLOR_RED); - - public Color getForeground(Object obj, int index) { - if (obj instanceof ISymbianSDK) { - ISymbianSDK sdk = (ISymbianSDK)obj; - File epocRootTest = new File(sdk.getEPOCROOT()); - if ((sdk.getAvailablePlatforms().size() <= 0) || !epocRootTest.exists()) { - // There are no build configs and/or no epocroot exists - return lRed; - } else { - return lBlack; - } - } - return null; - } - - public Color getBackground(Object element, int columnIndex) { - return null; - } - } - - /** - * This implementation of IStructuredContentProvider handles - * the case where the viewer input is an unchanging array or collection of elements. - * + /* + * (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) */ - static class SDKTableComponentsContentProvider implements IStructuredContentProvider { - + @Override + protected Control createContents(Composite parent) { + // Set up colors used in this preference page + Shell shell = parent.getShell(); + black = shell.getDisplay().getSystemColor(SWT.COLOR_BLACK); + gray = shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); + red = shell.getDisplay().getSystemColor(SWT.COLOR_RED); + white = shell.getDisplay().getSystemColor(SWT.COLOR_WHITE); + + Composite content = new Composite(parent, SWT.NONE); + GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 2; + content.setLayout(gridLayout); + + // SDK table + sdkListTableViewer = CheckboxTableViewer.newCheckList(content, + SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); + createSDKTable(); - /** - * Returns the elements in the input - * - * @return array of objects. - */ - public Object[] getElements(Object arg0) { - if (arg0 instanceof ArrayList) { - return ((ArrayList)arg0).toArray(); - } - return new Object[0]; - } + // Buttons composite + Composite composite1 = new Composite(content, SWT.NONE); + gridLayout = new GridLayout(); + gridLayout.makeColumnsEqualWidth = true; + composite1.setLayout(gridLayout); + GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false); + composite1.setLayoutData(gridData); - public void dispose() { - } + // Add button + addButton = new Button(composite1, SWT.NONE); + addButton.setLayoutData(gridData); + addButton.setText(Messages.getString("SDKPreferencePage.Add_Button_Label")); //$NON-NLS-1$ + addButton.setToolTipText(Messages.getString("SDKPreferencePage.Add_Button_ToolTip")); //$NON-NLS-1$ + addButtonListener(addButton); + + // Delete button + deleteButton = new Button(composite1, SWT.NONE); + deleteButton.setLayoutData(gridData); + deleteButton.setText(Messages.getString("SDKPreferencePage.Delete_Button_Label")); //$NON-NLS-1$ + deleteButton.setToolTipText(Messages.getString("SDKPreferencePage.Delete_Button_ToolTip")); //$NON-NLS-1$ + addButtonListener(deleteButton); + + // Properties button + propertiesButton = new Button(composite1, SWT.NONE); + propertiesButton.setLayoutData(gridData); + propertiesButton.setText(Messages.getString("SDKPreferencePage.Properties_Button_Label")); //$NON-NLS-1$ + propertiesButton.setToolTipText(Messages.getString("SDKPreferencePage.Properties_Button_ToolTip")); //$NON-NLS-1$ + addButtonListener(propertiesButton); - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - //do nothing - } + // Status and Rescan composite + Composite composite2 = new Composite(content, SWT.NONE); + gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); + gridData.widthHint = 350; + gridData.heightHint = 50; + composite2.setLayoutData(gridData); + gridLayout = new GridLayout(); + gridLayout.numColumns = 2; + composite2.setLayout(gridLayout); + + // IStatus icon label + iconLabel = new Label(composite2, SWT.NONE); + // IStatus text label + statusLabel = new Label(composite2, SWT.WRAP); + gridData = new GridData(SWT.LEFT, SWT.TOP, true, false); + gridData.verticalSpan = 2; + statusLabel.setLayoutData(gridData); + + new Label(content, SWT.WRAP); // filler + + // Scan SDK checkbox + scanForNewPluginsButton = new Button(content, SWT.CHECK); + scanForNewPluginsButton.setText(Messages.getString("SDKPreferencePage.ScanForNewPlugins_Button_Label")); //$NON-NLS-1$ + scanForNewPluginsButton.setSelection(prefsStore.getBoolean(SDKUIPreferenceConstants.SCAN_FOR_NEW_PLUGINS)); + addButtonListener(scanForNewPluginsButton); + + + new Label(content, SWT.WRAP); // filler + + // Rescan button + rescanButton = new Button(content, SWT.NONE); + rescanButton.setToolTipText(Messages.getString("SDKPreferencePage.Rescan_Button_ToolTip")); //$NON-NLS-1$ + rescanButton.setText(Messages.getString("SDKPreferencePage.Rescan_Button_Label")); //$NON-NLS-1$ + addButtonListener(rescanButton); + + // Populate SDK table + addSDKComponentTableItems(); + selectSDKEntry(0); + + return content; } - - /** - * Sets the listener event to a button. - * - * @param aButton - */ - private void addButtonListener( final Button aButton ) { + + private void addButtonListener(final Button aButton) { SelectionListener listener = new SelectionAdapter() { - public void widgetSelected( SelectionEvent e ) { - if (e.getSource().equals(sdkpropertiesButton)) { - sdkpropertiesButtonAction(); - } else if (e.getSource().equals(addNewSdkButton)) { - addNewSdkButtonAction(); - } else if (e.getSource().equals(removeSdkButton)) { - removeSdkButtonAction(); - } else if (e.getSource().equals(rescanNowButton)) { - rescanNowButtonAction(); + public void widgetSelected(SelectionEvent e) { + if (e.getSource().equals(addButton)) { + handleAddButton(); + } else if (e.getSource().equals(deleteButton)) { + handleDeleteButton(); + } else if (e.getSource().equals(propertiesButton)) { + handlePropertiesButton(); + } else if (e.getSource().equals(scanForNewPluginsButton)) { + handleScanForNewPluginsButton(); + } else if (e.getSource().equals(rescanButton)) { + handleRescanButton(); } - } }; aButton.addSelectionListener(listener); } - - private void sdkpropertiesButtonAction(){ + + private void addSDKComponentTableItems() { + sdkListTableViewer.setLabelProvider(new SDKLabelProvider()); + sdkListTableViewer.setContentProvider(new ArrayContentProvider()); + sdkList = sdkMgr.getSDKList(); + sdkListTableViewer.setInput(sdkList.toArray()); + Table table = sdkListTableViewer.getTable(); + int count = table.getItemCount(); + if (count < 10) { // min. number of rows + count = 10; + } else + if (count > 20) { // max. number of rows + count = 20; + } + table.setToolTipText(Messages.getString("SDKPreferencePage.List_of_Available_SDKs_ToolTip")); //$NON-NLS-1$ + GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); + gridData.widthHint = 350; + gridData.heightHint = table.getItemHeight() * (count + 2); + table.setLayoutData(gridData); + setCheckedElements(); + addSDKTableViewerListeners(); + if (sdkList == null || sdkList.size() == 0){ + statusError(Messages.getString("SDKPreferencePage.No_SDKs_Available_Message")); //$NON-NLS-1$ + } + } + + private void addSDKTableViewerListeners(){ + sdkListTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + if(event.getSelection() instanceof IStructuredSelection) { + IStructuredSelection selection = (IStructuredSelection)event.getSelection(); + if (selection.size() == 1){ + ISymbianSDK sdk = (ISymbianSDK)selection.getFirstElement(); + deleteButton.setEnabled(true); + propertiesButton.setEnabled(true); + updateSDKStatus(sdk); + } + else { + deleteButton.setEnabled(false); + propertiesButton.setEnabled(false); + } + } + } + }); + } + + private void createSDKTable() { + Table table = sdkListTableViewer.getTable(); + table.setHeaderVisible(true); + table.setLinesVisible(false); + + SDKViewerStrategy strategy = new SDKViewerStrategy(sdkListTableViewer); + TableViewerEditor.create(sdkListTableViewer, strategy, ColumnViewerEditor.DEFAULT); + + TableViewerColumn enabledCol = new TableViewerColumn(sdkListTableViewer, SWT.LEFT); + enabledCol.getColumn().setText(Messages.getString("SDKPreferencePage.SDK_Table_Enabled_Column_Label")); //$NON-NLS-1$ + enabledCol.getColumn().setWidth(50); + + TableViewerColumn idCol = new TableViewerColumn(sdkListTableViewer, SWT.LEFT); + idCol.setEditingSupport(new IdEditingSupport(sdkListTableViewer)); //$NON-NLS-1$ + idCol.getColumn().setText(Messages.getString("SDKPreferencePage.SDK_Table_ID_Column_Label")); + idCol.getColumn().setWidth(160); + + TableViewerColumn locationCol = new TableViewerColumn(sdkListTableViewer, SWT.LEFT); + locationCol.setEditingSupport(new LocationEditingSupport(sdkListTableViewer)); + locationCol.getColumn().setText(Messages.getString("SDKPreferencePage.SDK_Table_Location_Column_Label")); //$NON-NLS-1$ + locationCol.getColumn().setWidth(170); + } + + private void handleAddButton() { + AddSDKDialog dialog = new AddSDKDialog(getShell()); + if (dialog.open() == AddSDKDialog.OK){ + sdkList = sdkMgr.getSDKList(); + sdkListTableViewer.setInput(sdkList.toArray()); + setCheckedElements(); + sdkListTableViewer.refresh(); + selectSDKEntry(sdkList.size() - 1); + } + } + + private void handleDeleteButton() { ISymbianSDK sdk = (ISymbianSDK)((IStructuredSelection)sdkListTableViewer.getSelection()).getFirstElement(); + int index = sdkListTableViewer.getTable().getSelectionIndex(); if (sdk != null){ - SDKPropertiesDialog sdkPropDlg = new SDKPropertiesDialog(getShell(), this, sdk); - if (sdkPropDlg.open() == SDKPropertiesDialog.OK){ + if (sdkMgr.removeSDK(sdk.getUniqueId())){ + sdkList = sdkMgr.getSDKList(); + sdkListTableViewer.setInput(sdkList.toArray()); + if (index > 0) { + selectSDKEntry(index - 1); + } else { + selectSDKEntry(index); + } sdkListTableViewer.refresh(); - setSelectedSDKInfoText(sdk); - // forcible rescan; dump cache - SymbianBuildContextDataCache.refreshForSDKs(new ISymbianSDK[] { sdk }); - rescanSDKs(false); } + } + } + + private void handlePropertiesButton() { + ISymbianSDK sdk = (ISymbianSDK)((IStructuredSelection)sdkListTableViewer.getSelection()).getFirstElement(); + int index = sdkListTableViewer.getTable().getSelectionIndex(); + if (sdk != null){ + SDKPropertiesDialog sdkPropDlg = new SDKPropertiesDialog(getShell(), sdk); + sdkPropDlg.open(); + selectSDKEntry(index); } else { MessageDialog.openError(getShell(), Messages.getString("SDKPreferencePage.No_SDK_Selected"), Messages.getString("SDKPreferencePage.No_selected_SDK_detected")); //$NON-NLS-1$ //$NON-NLS-2$ } - } - - private void removeSdkButtonAction(){ - ISymbianSDK sdk = (ISymbianSDK)((IStructuredSelection)sdkListTableViewer.getSelection()).getFirstElement(); - if (sdk != null){ - if (MessageDialog.openConfirm(getShell(), Messages.getString("SDKPreferencePage.Confirm_Delete") + sdk.getUniqueId() , Messages.getString("SDKPreferencePage.Confirm_Delete_Msg"))){ //$NON-NLS-1$ //$NON-NLS-2$ - if (sdkMgr.removeSDK(sdk.getUniqueId())){ - sdkList.remove(sdk); - sdkListTableViewer.refresh(); - sdk = (ISymbianSDK)sdkListTableViewer.getElementAt(0); - if (sdk != null){ - sdkListTableViewer.setSelection(new StructuredSelection(sdk), true); - setSelectedSDKInfoText(sdk); - } - } - } - } + + private void handleScanForNewPluginsButton() { + scanForNewPlugins = scanForNewPluginsButton.getSelection(); } - - private void addNewSdkButtonAction(){ - - AddSDKDialog dialog = new AddSDKDialog(getShell()); - if (dialog.open() == AddSDKDialog.OK){ - addSDKComponentTableItems(); - sdkListTableViewer.refresh(); - } - } - - private void rescanNowButtonAction(){ + + private void handleRescanButton() { // forcible rescan; dump cache SymbianBuildContextDataCache.refreshForSDKs(null); - rescanSDKs(true); + startRescanning(); + sdkMgr.scanSDKs(); + finishRescanning(); } - - private void rescanSDKs(boolean scanForNewPlugins){ + + private void startRescanning() { + rescanButton.setText(Messages.getString("SDKPreferencePage.Rescanning_Button_Label")); //$NON-NLS-1$ + rescanButton.setEnabled(false); + } + + private void finishRescanning(){ sdkListTableViewer.getTable().clearAll(); sdkListTableViewer.refresh(); sdkList.clear(); - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - sdkMgr.scanSDKs(); sdkList = sdkMgr.getSDKList(); addSDKComponentTableItems(); sdkListTableViewer.refresh(); - - ISymbianSDK sdk = (ISymbianSDK)sdkListTableViewer.getElementAt(0); - if (sdk != null){ - sdkListTableViewer.setSelection(new StructuredSelection(sdk), true); - setSelectedSDKInfoText(sdk); - } - + selectSDKEntry(0); + rescanButton.setText(Messages.getString("SDKPreferencePage.Rescan_Button_Label")); //$NON-NLS-1$ + rescanButton.setEnabled(true); + if (scanForNewPlugins){ NewPluginChecker.checkForNewlyInstalledPlugins(SDKUIPlugin.getDefault().getWorkbench()); } } - - /** - * Sets the selection listener action event to the CheckboxTableViewer. - * - * @param sdkTable - */ - private void addSDKTableViewerSelectionListener(){ - sdkListTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { + + private void selectSDKEntry(int index) { + ISymbianSDK sdk = (ISymbianSDK)sdkListTableViewer.getElementAt(index); + if (sdk != null){ + sdkListTableViewer.setSelection(new StructuredSelection(sdk), true); + sdkListTableViewer.getTable().setFocus(); + } + updateSDKStatus(sdk); + } - if(event.getSelection() instanceof IStructuredSelection) { - IStructuredSelection selection = (IStructuredSelection)event.getSelection(); - if (selection.size() == 1){ - ISymbianSDK sdk = (ISymbianSDK)selection.getFirstElement(); - sdkpropertiesButton.setEnabled(true); - removeSdkButton.setEnabled(true); - setSelectedSDKInfoText(sdk); - - }else { - sdkpropertiesButton.setEnabled(false); - removeSdkButton.setEnabled(false); - } - } - } - } ); + private void setCheckedElements() { + Iterator iterator = sdkList.iterator(); + while (iterator.hasNext()) { + ISymbianSDK sdk = iterator.next(); + sdkListTableViewer.setChecked(sdk, sdk.isEnabled()); + } + } + + private void statusClear() { + iconLabel.setImage(null); + statusLabel.setText(""); + } + + private void statusError(String msg) { + String errorMsg = "Error : " + msg; + iconLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK)); + statusLabel.setText(errorMsg); + statusLabel.setForeground(red); + statusLabel.setBackground(gray); + statusLabel.update(); + statusLabel.getParent().layout(true); } - - private void setSelectedSDKInfoText(ISymbianSDK sdk){ - boolean sdkHasError = false; + + private void statusWarning(String msg) { + String warningMsg = "Warning : " + msg; //$NON-NLS-1$ + iconLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK)); + statusLabel.setText(warningMsg); + statusLabel.setForeground(black); + statusLabel.setBackground(gray); + statusLabel.update(); + statusLabel.getParent().layout(true); + } + + private void statusInfo(String msg) { + String infoMsg = "Info : " + msg; //$NON-NLS-1$ + iconLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK)); + statusLabel.setText(infoMsg); + statusLabel.setForeground(black); + statusLabel.setBackground(gray); + statusLabel.update(); + statusLabel.getParent().layout(true); + } + + private Color updateSDKcolor(ISymbianSDK sdk){ + Color color = black; + + // Check SDK EPOCROOT String epocRootStr = sdk.getEPOCROOT(); - File epocRootTest = new File(epocRootStr); - if (!epocRootTest.exists()) { - sdkHasError = true; - epocrootLabel.setText(EPOCROOT_LABEL + epocRootStr + Messages.getString("SDKPreferencePage.Path_Does_Not_Exist")); //$NON-NLS-1$ - epocrootLabel.setForeground(RED); - epocrootLabel.setBackground(GRAY); - } - else { - epocrootLabel.setText(EPOCROOT_LABEL + epocRootStr); - epocrootLabel.setForeground(BLACK); - epocrootLabel.setBackground(GRAY); - } - - // Set platforms - if (sdk.getAvailablePlatforms().size() == 0) { - sdkHasError = true; - availablePlatformsLabel.setText(PLATFORMS_LABEL + Messages.getString("SDKPreferencePage.Platforms_cannot_be_determined")); //$NON-NLS-1$ - availablePlatformsLabel.setForeground(RED); - availablePlatformsLabel.setBackground(GRAY); - } - else { - availablePlatformsLabel.setText(PLATFORMS_LABEL + sdk.getAvailablePlatforms().toString()); - availablePlatformsLabel.setForeground(BLACK); - availablePlatformsLabel.setBackground(GRAY); + IPath epocRoot = new Path(epocRootStr); + epocRoot = epocRoot.append("epoc32"); + File epocRootFile = epocRoot.toFile(); + if (!epocRootFile.exists()) { + color = red; } - // Set OS Version - if (sdk.getOSVersion().getMajor() == 0) { - sdkHasError = true; - osVersionLabel.setText(OS_VERSION_LABEL + Messages.getString("SDKPreferencePage.OS_Version_Cannot_Be_Determined")); //$NON-NLS-1$ - osVersionLabel.setForeground(RED); - osVersionLabel.setBackground(GRAY); - } - else if (!SDKCorePlugin.SUPPORTS_SBSV1_BUILDER && - (sdk.getOSVersion().getMajor() < 9 || - (sdk.getOSVersion().getMajor() == 9 && sdk.getOSVersion().getMinor() <= 4))){ - sdkHasError = true; - osVersionLabel.setText(OS_VERSION_LABEL + "This OS version is not supported: " + sdk.getOSVersion()); - osVersionLabel.setForeground(RED); - osVersionLabel.setBackground(GRAY); - - } else { - if (sdk.getSDKOSBranch().length() > 0) { - osVersionLabel.setText(OS_VERSION_LABEL + sdk.getOSVersion().toString() + " (Branch = \"" + sdk.getSDKOSBranch() + "\")"); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - osVersionLabel.setText(OS_VERSION_LABEL + sdk.getOSVersion().toString()); - } - osVersionLabel.setForeground(BLACK); - osVersionLabel.setBackground(GRAY); - } - - // Get diagnostic check - //if (lsdk.getSomeError().size() <= 0) { - if (sdkHasError){ - diagnosticCheckLabel.setText(DIAGNOSTIC_CHECK_LABEL + Messages.getString("SDKPreferencePage.SDK_Cannot_Be_Used")); //$NON-NLS-1$ - diagnosticCheckLabel.setForeground(RED); - diagnosticCheckLabel.setBackground(GRAY); + // Check SDK OS Version + if ((sdk.getOSVersion().getMajor() < 9 || + (sdk.getOSVersion().getMajor() == 9 && sdk.getOSVersion().getMinor() < 4))) { + color = red; } - else { - // check for other types of errors: - if (!sdk.getToolsPath().toFile().exists()){ - diagnosticCheckLabel.setText(DIAGNOSTIC_CHECK_LABEL + Messages.getString("SDKPreferencePage.No_Tools_Path") + " " + sdk.getToolsPath().toOSString()); //$NON-NLS-1$ - diagnosticCheckLabel.setForeground(RED); - diagnosticCheckLabel.setBackground(GRAY); - } else if (!sdk.getIncludePath().toFile().exists()){ - diagnosticCheckLabel.setText(DIAGNOSTIC_CHECK_LABEL + Messages.getString("SDKPreferencePage.No_Include_Path") + " " + sdk.getIncludePath().toOSString()); //$NON-NLS-1$ - diagnosticCheckLabel.setForeground(RED); - diagnosticCheckLabel.setBackground(GRAY); - } else if ( ((sdk.getPrefixFile() == null) || (!sdk.getPrefixFile().exists())) && (sdk.getOSVersion().getMajor() >= 9)){ - diagnosticCheckLabel.setText(DIAGNOSTIC_CHECK_LABEL + Messages.getString("SDKPreferencePage.No_HRH_File")); //$NON-NLS-1$ - diagnosticCheckLabel.setForeground(RED); - diagnosticCheckLabel.setBackground(GRAY); - } else if ( ((sdk.isS60()) && sdk.getSDKVersion().getMajor() == 0)){ - diagnosticCheckLabel.setText(DIAGNOSTIC_CHECK_LABEL + Messages.getString("SDKPreferencePage.No_SDK_Version")); //$NON-NLS-1$ - diagnosticCheckLabel.setForeground(RED); - diagnosticCheckLabel.setBackground(GRAY); - } else { - // Everything is OK.... - diagnosticCheckLabel.setText(DIAGNOSTIC_CHECK_LABEL + "OK\r\n "); //$NON-NLS-1$ - diagnosticCheckLabel.setForeground(BLACK); - diagnosticCheckLabel.setBackground(GRAY); + + return color; + } + + private void updateSDKStatus(ISymbianSDK sdk){ + // No SDK selected + if (sdk == null) { + statusWarning(Messages.getString("SDKPreferencePage.No_SDKs_Available_Message")); //$NON-NLS-1$ + return; + } else { + // Check SDK EPOCROOT + String epocRootStr = sdk.getEPOCROOT(); + IPath epocRoot = new Path(epocRootStr); + epocRoot = epocRoot.append("epoc32"); + File epocRootFile = epocRoot.toFile(); + if (!epocRootFile.exists()) { + statusError(Messages.getString("SDKPreferencePage.Invalid_Location_Message")); //$NON-NLS-1$ + return; } + + // Check SDK OS Version + if ((sdk.getOSVersion().getMajor() < 9 || + (sdk.getOSVersion().getMajor() == 9 && sdk.getOSVersion().getMinor() < 4))) { + statusError(MessageFormat.format( + Messages.getString("SDKPreferencePage.Invalid_SDK_Message"), //$NON-NLS-1$ + sdk.getOSVersion().toString())); //$NON-NLS-1$ + return; + } + + // No error + statusClear(); } - } - - protected List getSDKList(){ - return sdkList; } - - protected ISDKManager getSDKManager(){ - return sdkMgr; - } + } \ No newline at end of file diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPropertiesDialog.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPropertiesDialog.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPropertiesDialog.java Wed Jul 21 12:11:48 2010 -0500 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 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" @@ -16,20 +16,9 @@ */ package com.nokia.carbide.cpp.internal.sdk.ui; -import java.io.File; -import java.net.URL; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.eclipse.core.runtime.IPath; import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.TrayDialog; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.TableEditor; -import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -40,41 +29,25 @@ import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; -import org.osgi.framework.Version; -import com.nokia.carbide.cpp.sdk.core.ISDKManager; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; public class SDKPropertiesDialog extends TrayDialog { - SDKPreferencePage sdkPrefs; ISymbianSDK sdk; - private CCombo osVersionCombo; - private CCombo sdkVersionCombo; - private CCombo sdkNameCombo; - private CCombo isDefaultCombo; - private Text sdkIDText; - private Text epocRootText; -// private Button browseEPOCROOTButton; private Table propsTable; - private static String DEFAULT_DEVICE_YES = "yes"; //$NON-NLS-1$ - private static String DEFAULT_DEVICE_NO = "no"; //$NON-NLS-1$ - /** * Create the dialog * @param parentShell */ - public SDKPropertiesDialog(Shell parentShell, SDKPreferencePage sdkPrefs, ISymbianSDK sdk) { + public SDKPropertiesDialog(Shell parentShell, ISymbianSDK sdk) { super(parentShell); - this.sdkPrefs = sdkPrefs; this.sdk = sdk; setShellStyle(getShellStyle() | SWT.RESIZE); } - + /* (non-Javadoc) * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ @@ -112,82 +85,15 @@ sdkPropCol2.setWidth(287); sdkPropCol2.setText(Messages.getString("SDKPropertiesDialog.Value")); //$NON-NLS-1$ - // SDK ID at Row 1. - TableItem itemSDKId = new TableItem(propsTable, SWT.NONE); - itemSDKId.setText(new String[] { Messages.getString("SDKPropertiesDialog.SDK_ID"), "" }); //$NON-NLS-1$ //$NON-NLS-2$ - - // SDK Name at Row 2. - TableItem itemSDKName = new TableItem(propsTable, SWT.NONE); - itemSDKName.setText(new String[] { Messages.getString("SDKPropertiesDialog.SDK_Name"), "" }); //$NON-NLS-1$ //$NON-NLS-2$ - - // SDK Name at Row 3. - TableItem itemEPOCROOTName = new TableItem(propsTable, SWT.NONE); - itemEPOCROOTName.setText(new String[] { "EPOCROOT", "", "" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - // OS Version at Row 4. + // OS Version at Row 1. TableItem itemOSVersion = new TableItem(propsTable, SWT.NONE); - itemOSVersion.setText(new String[] { Messages.getString("SDKPropertiesDialog.OS_Version"), "" }); //$NON-NLS-1$ //$NON-NLS-2$ - - // SDK Version at Row 5. - TableItem itemSDKVersion = new TableItem(propsTable, SWT.NONE); - itemSDKVersion.setText(new String[] { Messages.getString("SDKPropertiesDialog.SDK_Version"), "" }); //$NON-NLS-1$ //$NON-NLS-2$ - - // Is default at Row 6. - TableItem itemDefaultDevice = new TableItem(propsTable, SWT.NONE); - itemDefaultDevice.setText(new String[] { Messages.getString("SDKPropertiesDialog.Default_SDK"), "" }); //$NON-NLS-1$ //$NON-NLS-2$ - - TableItem itemPrefixFile = new TableItem(propsTable, SWT.NONE); - if ((sdk.getPrefixFile() != null) && (sdk.getPrefixFile().toString().length() > 0)){ - itemPrefixFile.setText(new String[] { Messages.getString("SDKPropertiesDialog.Prefix_File"), sdk.getPrefixFile().toString()}); //$NON-NLS-1$ - } else { - itemPrefixFile.setText(new String[] { Messages.getString("SDKPropertiesDialog.Prefix_File"), "unknown"}); //$NON-NLS-1$ //$NON-NLS-2$ - } - - - IPath incPath = sdk.getIncludePath(); - if (incPath != null){ - TableItem itemIncPath = new TableItem(propsTable, SWT.NONE); - itemIncPath.setText(new String[] { Messages.getString("SDKPropertiesDialog.Include_Dir"), incPath.toOSString()}); //$NON-NLS-1$ - } + itemOSVersion.setText(new String[] {Messages.getString("SDKPropertiesDialog.OS_Version"), //$NON-NLS-2$ + sdk.getOSVersion().toString()}); //$NON-NLS-1$ - IPath toolsPath = sdk.getToolsPath(); - if (toolsPath != null){ - TableItem itemToolsPath = new TableItem(propsTable, SWT.NONE); - itemToolsPath.setText(new String[] { Messages.getString("SDKPropertiesDialog.Tools_Dir"), toolsPath.toOSString()}); //$NON-NLS-1$ - } - - IPath relRoot = sdk.getReleaseRoot(); - if (relRoot != null){ - TableItem itemRelRootPath = new TableItem(propsTable, SWT.NONE); - itemRelRootPath.setText(new String[] { Messages.getString("SDKPropertiesDialog.Release_Dir"), relRoot.toOSString()}); //$NON-NLS-1$ - } - - Date createDate = sdk.getCreationDate(); - if (createDate != null){ - TableItem itemDate = new TableItem(propsTable, SWT.NONE); - itemDate.setText(new String[] { Messages.getString("SDKPropertiesDialog.SDK_Create_Date"), createDate.toString()}); //$NON-NLS-1$ - } - - URL url =sdk.getPublisherURL(); - if (url != null){ - TableItem itemURL = new TableItem(propsTable, SWT.NONE); - itemURL.setText(new String[] { Messages.getString("SDKPropertiesDialog.Publisher_URL"), url.toString()}); //$NON-NLS-1$ - } - - String pubName = sdk.getPublisherName(); - if (pubName != null && pubName.length() > 0){ - TableItem itemVendor = new TableItem(propsTable, SWT.NONE); - itemVendor.setText(new String[] { Messages.getString("SDKPropertiesDialog.Publisher_Name"), pubName}); //$NON-NLS-1$ - } - - String descr = sdk.getSDKDescription(); - if (descr != null && descr.length() > 0){ - TableItem itemSDKDescr = new TableItem(propsTable, SWT.NONE); - itemSDKDescr.setText(new String[] { Messages.getString("SDKPropertiesDialog.SDK_Description"), descr}); //$NON-NLS-1$ - } - - // Set up the editable fields - setUpTableEditFields(); + // SDK Version at Row 2. + TableItem itemSDKVersion = new TableItem(propsTable, SWT.NONE); + String sdkVersion = sdk.getSDKVersion().toString(); + itemSDKVersion.setText(new String[] {Messages.getString("SDKPropertiesDialog.SDK_Version"), sdkVersion}); //$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, SDKUIHelpIds.SDK_PROPERTIES_DIALOG); @@ -202,8 +108,6 @@ protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - createButton(parent, IDialogConstants.CANCEL_ID, - IDialogConstants.CANCEL_LABEL, false); } /** @@ -213,207 +117,5 @@ protected Point getInitialSize() { return new Point(418, 375); } - - private void setUpTableEditFields(){ - TableItem[] items = propsTable.getItems(); - TableEditor editor = new TableEditor(propsTable); - - // Add the SDK ID editor to the 1st row, seonds column - sdkIDText = new Text(propsTable, SWT.NONE); - sdkIDText.setText(sdk.getUniqueId()); - editor.grabHorizontal = true; - editor.setEditor(sdkIDText, items[0], 1); - Color white = getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE); - sdkIDText.setBackground(white); - - // Add the SDK Name combo to the 2nd row, second column - editor = new TableEditor(propsTable); - sdkNameCombo = new CCombo(propsTable, SWT.NONE); - sdkNameCombo.setText(sdk.getName()); - sdkNameCombo.add(ISymbianSDK.S60_SDK_NAME); - sdkNameCombo.add(ISymbianSDK.S80_SDK_NAME); - sdkNameCombo.add(ISymbianSDK.TECHVIEW_SDK_NAME); - sdkNameCombo.add(ISymbianSDK.UIQ_SDK_NAME); - editor.grabHorizontal = true; - editor.setEditor(sdkNameCombo, items[1], 1); - sdkIDText.setBackground(white); - - /* - * ??? HOW DO YOU ADD A BUTTON TO A CELL WITH ANOTHER CONTROL - editor = new TableEditor(propsTable); - browseEPOCROOTButton = new Button(propsTable, SWT.RIGHT); - browseEPOCROOTButton.setBounds(5, 5, 5, 5); - browseEPOCROOTButton.setToolTipText("Choose the folder where 'epoc32' exists."); - browseEPOCROOTButton.setText("..."); - editor.grabHorizontal = true; - editor.setEditor(browseEPOCROOTButton, items[2], 1); - //addButtonListener(browseEPOCROOTButton); - */ - // Add the EPOCROOT text to the 3rd row, second column - editor = new TableEditor(propsTable); - epocRootText = new Text(propsTable, SWT.NONE); - epocRootText.setText(sdk.getEPOCROOT()); - editor.grabHorizontal = true; - editor.setEditor(epocRootText, items[2], 1); - epocRootText.setBackground(white); - - // Add the OS Version combo to the 4th row, second column - editor = new TableEditor(propsTable); - osVersionCombo = new CCombo(propsTable, SWT.NONE); - osVersionCombo.setText(sdk.getOSVersion().toString() + sdk.getSDKOSBranch()); - List supportedOSVersions = new ArrayList(); - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - supportedOSVersions = sdkMgr.getSymbianMacroStore().getSupportedOSVersions(); - for (String currVer : supportedOSVersions){ - osVersionCombo.add(currVer); - } - editor.grabHorizontal = true; - editor.setEditor(osVersionCombo, items[3], 1); - osVersionCombo.setBackground(white); - osVersionCombo.setEditable(false); - - // Add the SDK Version combo to the 5th row, second column - editor = new TableEditor(propsTable); - sdkVersionCombo = new CCombo(propsTable, SWT.NONE); - sdkVersionCombo.setText(sdk.getSDKVersion().toString()); - List sdkVersions = new ArrayList(); - sdkVersions = sdkMgr.getSymbianMacroStore().getSDKVersions(); - for (String currVer : sdkVersions){ - sdkVersionCombo.add(currVer); - } - editor.grabHorizontal = true; - editor.setEditor(sdkVersionCombo, items[4], 1); - sdkVersionCombo.setBackground(white); - - // Add the default combo to the 6th row, second column - editor = new TableEditor(propsTable); - isDefaultCombo = new CCombo(propsTable, SWT.NONE); - editor.grabHorizontal = true; - editor.setEditor(isDefaultCombo, items[5], 1); - isDefaultCombo.add(DEFAULT_DEVICE_YES); - isDefaultCombo.add(DEFAULT_DEVICE_NO); - if (sdk.isDefaultSDK()){ - isDefaultCombo.setText(DEFAULT_DEVICE_YES); - } else { - isDefaultCombo.setText(DEFAULT_DEVICE_NO); - } - } - - @Override - protected void okPressed() { - - if (!validateData()){ - return; - } - - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - if (!sdk.getUniqueId().equals(sdkIDText.getText())){ - // SDK ID has changed, we'll need to delete the old ID from devices.xml - sdkMgr.removeSDK(sdk.getUniqueId()); - } - sdk.setUniqueID(sdkIDText.getText()); - if (sdk.getEPOCROOT().compareTo(epocRootText.getText()) != 0){ - // EPOCROOT has changed, re-scan the SDK. - sdk.setEPOCROOT(epocRootText.getText()); - sdk.scanSDK(); - } - - sdk.setName(sdkNameCombo.getText()); - - String osVerString = osVersionCombo.getText(); - int len = osVerString.length(); - if (Character.isLetter(osVerString.charAt(len-1))){ - String branch = osVerString.substring(len-1); - sdk.setOSSDKBranch(branch); - osVerString = osVerString.substring(0, len-1); - } else { - sdk.setOSSDKBranch(""); //$NON-NLS-1$ - } - - sdk.setOSVersion(Version.parseVersion(osVerString)); - - try { - sdk.setSDKVersion(Version.parseVersion(sdkVersionCombo.getText())); - } catch (NumberFormatException e) { - MessageDialog.openError(getShell(), Messages.getString("SDKPropertiesDialog.Illegal_Verion_Title"), Messages.getString("SDKPropertiesDialog.Illegal_SDKVerion_Msg")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - - if (isDefaultCombo.getText().equals(DEFAULT_DEVICE_YES)){ - sdk.setIsDefaultSDK(true); - } else { - sdk.setIsDefaultSDK(false); - } - sdkMgr.updateSDK(sdk); - sdkMgr.setDefaultSDK(sdk); - - super.okPressed(); - } - - private boolean validateData(){ - boolean isOK = true; - - // make sure id is not null and is not a duplicate - if ((sdkIDText.getText().length() > 0) ){ - if (!sdk.getUniqueId().equals(sdkIDText.getText())){ - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - List sdkList = sdkMgr.getSDKList(); - for (ISymbianSDK currSDK : sdkList){ - if (currSDK.getUniqueId().equalsIgnoreCase(sdkIDText.getText())){ - MessageDialog.openError(getShell(), Messages.getString("SDKPropertiesDialog.Duplicate_ID"), Messages.getString("SDKPropertiesDialog.Duplicate_ID_Message")); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - } - } - } else { - MessageDialog.openError(getShell(), Messages.getString("SDKPropertiesDialog.Zero_Len_ID"), Messages.getString("SDKPropertiesDialog.Zero_Len_ID_Msg")); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - - // make sure name is proper format - if (sdkNameCombo.getText().length() > 0){ - if (!isValidVendorName(sdkNameCombo.getText())){ - return false; - } - }else{ - MessageDialog.openError(getShell(), Messages.getString("SDKPropertiesDialog.Zero_Len_Name"), Messages.getString("SDKPropertiesDialog.Zero_Len_Name_Msg")); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - - // make sure epocroot exists - if (epocRootText.getText().length() > 0){ - if (!epocRootText.getText().equals(sdk.getEPOCROOT())){ - File rootFile = new File(epocRootText.getText()); - if (!rootFile.exists()){ - if (!MessageDialog.openQuestion(getShell(), Messages.getString("SDKPropertiesDialog.EPOCROOT_No_Exist"), Messages.getString("SDKPropertiesDialog.EPOCROOT_No_Exist_Msg"))){ //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - } - } - }else{ - MessageDialog.openError(getShell(), Messages.getString("SDKPropertiesDialog.Zero_Len_EPOCROOT"), Messages.getString("SDKPropertiesDialog.Zero_Len_EPOCROOT_Msg")); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - return isOK; - } - - private boolean isValidVendorName(String vendor){ - boolean isValid = true; - - String[] vendorSplit = vendor.split("[.]"); //$NON-NLS-1$ - if (vendorSplit.length == 3){ - if (!vendorSplit[0].toLowerCase().startsWith("com")){ //$NON-NLS-1$ - isValid = false; - } - } else { - isValid = false; - } - - if (isValid == false){ - MessageDialog.openError(getShell(), Messages.getString("SDKPropertiesDialog.Invalid_Name_Attrib"), Messages.getString("SDKPropertiesDialog.Invalid_Name_Attrib_Msg")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - return isValid; - } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIHelpIds.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIHelpIds.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIHelpIds.java Wed Jul 21 12:11:48 2010 -0500 @@ -28,5 +28,6 @@ public static final String SDK_PROPERTIES_DIALOG = SDKUIPlugin.PLUGIN_ID + ".sdk_properties_dialog"; //$NON-NLS-1$ public static final String SDK_BUILD_FILTER_PAGE = SDKUIPlugin.PLUGIN_ID + ".sdk_platform_filter_page"; //$NON-NLS-1$ public static final String BUILD_TARGETS_PAGE = SDKUIPlugin.PLUGIN_ID + ".build_targets_page"; //$NON-NLS-1$ + public static final String ADD_VARIANT_DIALOG = SDKUIPlugin.PLUGIN_ID + ".sdk_variant_dialog"; //$NON-NLS-1$ } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIPreferenceConstants.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIPreferenceConstants.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIPreferenceConstants.java Wed Jul 21 12:11:48 2010 -0500 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 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" @@ -27,4 +27,5 @@ public final static String PLAT_EKA2_ARMV5_ABIV1 = "platEKA2_ARMV5_ABIV1"; //$NON-NLS-1$ public final static String LISTEN_FOR_DEVICES_XML_CHANGE = "listenForDevicesXMLChange"; //$NON-NLS-1$ + public final static String SCAN_FOR_NEW_PLUGINS = "scanForNewPlugins"; //$NON-NLS-1$ } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIPreferenceInitializer.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIPreferenceInitializer.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIPreferenceInitializer.java Wed Jul 21 12:11:48 2010 -0500 @@ -34,6 +34,7 @@ IPreferenceStore store = SDKUIPlugin.getDefault().getPreferenceStore(); store.setDefault(SDKUIPreferenceConstants.ENABLE_BSF_SCANNER, false); store.setDefault(SDKUIPreferenceConstants.LISTEN_FOR_DEVICES_XML_CHANGE, true); + store.setDefault(SDKUIPreferenceConstants.SCAN_FOR_NEW_PLUGINS, false); store.setDefault(SDKUIPreferenceConstants.PLAT_EKA2_WINSCW, true); store.setDefault(SDKUIPreferenceConstants.PLAT_EKA2_GCCE, true); diff -r e17ab99b8f30 -r 03f5f8bf29b4 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 Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Wed Jul 21 12:11:48 2010 -0500 @@ -1,66 +1,29 @@ SDKPropertiesDialog.SDK_Properties_For=SDK Properties for -SDKPreferencePage.Available_SDKs_Label=Available Symbian OS SDKs SDKPropertiesDialog.Available_SDK_Properties=Available SDK properties: SDKPropertiesDialog.Property=Property SDKPropertiesDialog.Value=Value -SDKPropertiesDialog.SDK_ID=SDK ID -SDKPropertiesDialog.SDK_Name=SDK Name SDKPropertiesDialog.OS_Version=OS Version SDKPropertiesDialog.SDK_Version=SDK Version -SDKPropertiesDialog.Default_SDK=Default SDK -SDKPropertiesDialog.Prefix_File=Prefix File -SDKPropertiesDialog.Include_Dir=Include Dir -SDKPropertiesDialog.Tools_Dir=Tools Dir -SDKPropertiesDialog.Release_Dir=Release Dir -SDKPropertiesDialog.SDK_Create_Date=SDK Creation Date -SDKPropertiesDialog.Publisher_URL=Publisher URL -SDKPropertiesDialog.Illegal_Verion_Title=Illegal Version Format Exception -SDKPropertiesDialog.Illegal_SDKVerion_Msg=The SDK version is improperly formatted. Make sure it is of format major.minor[.increment]. -SDKPropertiesDialog.Publisher_Name=Publisher Name -SDKPreferencePage.OS_Group_ToolTip=List of the SDKs found from devices.xml. Checkboxes indicate which SDKs you want to be available for Carbide.c++ use. SDKs in red are not configured properly. -SDKPreferencePage.Remove_SDK_Label=Remove SDK -SDKPreferencePage.SDK_Info_ToolTip=Displays information for the selected SDK. -SDKPropertiesDialog.SDK_Description=SDK Description -SDKPropertiesDialog.Duplicate_ID=Duplicate ID -SDKPreferencePage.SDK_Info_Label=SDK Information -SDKPreferencePage.Confirm_Delete=Confirm Delete -SDKPropertiesDialog.Duplicate_ID_Message=The SDK ID you have chosen is not unique. Please enter a unique SDK ID. -SDKPreferencePage.SDK_Props_Button_Label=SDK Properties -SDKPreferencePage.Diagnostic_Check_Label=Diagnostic Check: -SDKPropertiesDialog.Zero_Len_ID=Zero Length ID -SDKPropertiesDialog.Zero_Len_ID_Msg=Please enter a unique SDK ID -SDKPreferencePage.Add_New_SDK_Label=Add New SDK -SDKPreferencePage.OSVesions_ToolTip=The Symbian OS version (and branch) the selected OS is based on. -SDKPreferencePage.Platforms_ToolTip=Platforms that are available in the SDK. -SDKPreferencePage.No_SDKs_Available=No SDKs are available. -SDKPropertiesDialog.Zero_Len_Name=Zero Length Name -SDKPreferencePage.OSVersion_Label=OS Version: -SDKPreferencePage.No_SDK_Selected=No SDK Selected -SDKPropertiesDialog.Zero_Len_Name_Msg=Please enter an SDK name or choose one from the pop-up menu. -SDKPropertiesDialog.EPOCROOT_No_Exist=EPOCROOT does not exist. -SDKPropertiesDialog.EPOCROOT_No_Exist_Msg=Do you want to add an EPOCROOT value that does not exist? -SDKPropertiesDialog.Zero_Len_EPOCROOT=Zero Length EPOCROOT -SDKPreferencePage.Delete_SDK_ToolTip=Deletes an SDK from Carbide.c++ and devices.xml. -SDKPreferencePage.Add_New_SDK_ToolTip=Adds a new SDK for use in Carbide.c++ and devices.xml. -SDKPreferencePage.EPOC32_Loc_ToolTip=Location of the 'epoc32' folder. -SDKPreferencePage.Available_Platforms=Available Platforms: + +SDKPreferencePage.Browse_Location_Label=... +SDKPreferencePage.Add_Button_Label=Add +SDKPreferencePage.Add_Button_ToolTip=Adds a new SDK for use in Carbide.c++. +SDKPreferencePage.Delete_Button_Label=Delete +SDKPreferencePage.Delete_Button_ToolTip=Delete an SDK from Carbide.c++. +SDKPreferencePage.Properties_Button_Label=Properties +SDKPreferencePage.Properties_Button_ToolTip=Show properties of the selected SDK. +SDKPreferencePage.ScanForNewPlugins_Button_Label=Scan SDKs for installable Eclipse plugins SDKPreferencePage.Rescan_Button_Label=Rescan All SDKs -SDKPreferencePage.Confirm_Delete_Msg=Are you sure you want to delete this SDK?\n\nThis entry will be removed from your devices.xml. -SDKPreferencePage.Path_Does_Not_Exist=\ <- Path does not exist. -SDKPreferencePage.SDK_Cannot_Be_Used=SDK cannot be used in Carbide.c++. Make sure your EPOCROOT is valid and the OS version is properly set. -SDKPropertiesDialog.Zero_Len_EPOCROOT_Msg=Please enter an EPOCROOT. -SDKPropertiesDialog.Invalid_Name_Attrib=Invalid 'name' attribute. SDKPreferencePage.Rescan_Button_ToolTip=Rebuilds all SDK entries (same as restarting the IDE). -SDKPropertiesDialog.Invalid_Name_Attrib_Msg=The SDK name must be of the format com.. -SDKPreferencePage.SDK_Props_Button_ToolTip=Shows editable and non-editable extended SDK properties for the selected SDK. -SDKPreferencePage.Diagnostic_Check_ToolTip=Displays miscellaneous errors and warnings that may indicate problems with an SDK installation. +SDKPreferencePage.Rescanning_Button_Label=Rescanning... +SDKPreferencePage.No_SDKs_Available_Message=No SDKs are available. SDKPreferencePage.No_selected_SDK_detected=No selected SDK detected. -SDKPreferencePage.No_Tools_Path=WARNING: Tools path does not exist: -SDKPreferencePage.No_Include_Path=WARNING: Include path does not exist: -SDKPreferencePage.No_HRH_File=WARNING: Cannot find pre-include (HRH) file from \\epoc32\\tools\\variant\\variant.cfg." -SDKPreferencePage.No_SDK_Version=WARNING: SDK version is not set. Some functionality may not work for this SDK. -SDKPreferencePage.listerForDevicesXML=Listen for devices.xml changes outside of Carbide -SDKPreferencePage.listerForDevicesXML_Tooltip=When enabled, Carbide will check for changes in the devices.xml file outside of Carbide and alert you when it has changed. +SDKPreferencePage.List_of_Available_SDKs_ToolTip=List of available SDKs. +SDKPreferencePage.SDK_Table_Enabled_Column_Label=Enabled +SDKPreferencePage.SDK_Table_ID_Column_Label=SDK ID +SDKPreferencePage.SDK_Table_Location_Column_Label=Location +SDKPreferencePage.Invalid_Location_Message=Invalid location. '\\epoc32\\' does not exist at specified location. +SDKPreferencePage.Invalid_SDK_Message=Invalid SDK. OS version {0} not supported. Must be verison 9.4 or higher. BuildPlatformFilterPage.Select_Platforms_Help=Select which platforms are visible when creating projects or new build configurations. BuildPlatformFilterPage.Specify_Platforms_Help=Specifies platforms to be displayed for OS 9.x and 8.1b @@ -69,9 +32,6 @@ BuildPlatformFilterPage.EKA1_Platforms_Label=EKA1 Platforms 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 NewPluginChecker.New_Plugins_Installed=New plugins have been installed from an SDK. NewPluginChecker.Restart_Msg=\n\nPress "Restart" to restart Carbide.c++ now or "Later" to apply changes next time you restart Carbide.c++. NewPluginChecker.Restart_Error=New plugins were installed into Carbide.c++ from an SDK. However, an error in the workbench prevented a Restart dialog from being displayed. You will need to restart Carbide in order to pick up the latest changes. @@ -79,8 +39,6 @@ RestartIDEDialog.Later=Later RestartIDEDialog.New_Plugin_Installed=New Plugins Installed AddSDKDialog.Add_New_SDK=Add New SDK -AddSDKDialog.Missing_Vendor_Name=Missing Vendor/Name -AddSDKDialog.Enter_Vendor_Name=Please enter an SDK vendor/name. AddSDKDialog.Missing_SDK_ID=Missing SDK ID. AddSDKDialog.Enter_SDK_ID=Please enter an SDK ID. AddSDKDialog.Malformed_EPOCROOT=Malformed EPOCROOT @@ -96,21 +54,11 @@ AddSDKDialog.SDK_ID_No_Spaces=SDK ID attribute cannot contain spaces. AddSDKDialog.Duplicate_ID=Duplicate device 'id' AddSDKDialog.Duplicate_ID_Msg=The SDK ID you have chosen already exists. Please choose another. -AddSDKDialog.Invalid_name_attrib=Invalid 'name' attribute. -AddSDKDialog.Invalid_name_attrib_msg=The SDK name must be of the format com.. AddSDKDialog.Enter_unique_id_for_sdk=Enter a unique identifier for the SDK you want to add. AddSDKDialog.SDK_ID=SDK ID: AddSDKDialog.Enter_location_where_epoc32_folder=Enter the location where the 'epoc32' folder exists. AddSDKDialog.Choose_folder_where_epoc32_exists=Choose the folder where 'epoc32' exists. AddSDKDialog.Browse=Browse... -AddSDKDialog.Enter_name_of_sdk=Enter the name of the sdk. Format is com.. -AddSDKDialog.Vendor=Vendor: -AddSDKDialog.default_label_tooltip=Defines the default SDK for command-line builds. Has no impact on Carbide.c++ builds. -AddSDKDialog.is_default=Is Default: -AddSDKDialog.os_version_tooltip=Select the OS version. This will determine the available platforms you can build for. -AddSDKDialog.os_version=OS Version: -AddSDKDialog.select_sdk_tooltip=Select the SDK version (optional). -AddSDKDialog.sdk_version=SDK Version: AddSDKDialog.Choose_location_for_EPOCROOT=Choose location for EPOCROOT. BuildTargetsPage.BuildTargetsTitle=Build Targets BuildTargetsPage.SymbianSDKS=Symbian OS SDKs @@ -123,16 +71,24 @@ BuildTargetsPage.NoBuildConfigsSelectedError=Please select at least one build configuration. BuildTargetsPage.DifferentDrivesError=There are known build problems when the bld.inf file and SDK are on different drives ({0}) BuildTargetsPage.NoDriveSpecWarning=You have chosen an SDK EPOCROOT without a drive specification. Building will work but other features such as the indexer and MMP editor may not fully function. -BuildTargetsPage.Select_Filtering_Prefs_Link=See Platform Filtering Preferences to configure displayed build configurations. +BuildTargetsPage.Select_Filtering_Prefs_Link=See Build Configuration Filtering Preferences to configure displayed build configurations. +BuildTargetsPage.Select_SymbianSDKs_Prefs_Link=See Symbian SDKs to manage your Symbian SDK installations. BuildPlatformFilterPage.SBSv1TabText=SBSv1 BuildPlatformFilterPage.SBSv1TabToolTip=Symbian OS Build System version 1 builder platform filtering BuildPlatformFilterPage.SBSv2TabText=SBSv2 BuildPlatformFilterPage.SBSv2TabToolTip=Symbian OS Build System version 2 builder platform filtering -SBSv2PlatformFilterComposite.PlatformsGroupText=SBSv2 Configurations Filter -SBSv2PlatformFilterComposite.PlatformsGroupToolTip=Uncheck the SBSv2 build configurations to hide from the list of available configurations when creating a project. -SBSv2PlatformFilterComposite.RefreshButtonText=Refresh -SBSv2PlatformFilterComposite.RefreshButtonToolTip=Forces the configuration xml files in SBSv2 to be parsed again. +SBSv2PlatformFilterComposite.PlatformsGroupText=Default Configurations +SBSv2PlatformFilterComposite.PlatformsGroupToolTip=Checked build build configurations (aliases) will be displayed for SDKs they apply to. +SBSv2PlatformFilterComposite.RefreshButtonText=Rescan Default Configurations +SBSv2PlatformFilterComposite.RefreshButtonToolTip=Queries your sbs and sdk installation for allowable build configurations. + +SBSv2PlatformFilterComposite.ProductsGroupText=Product Variant Configurations +SBSv2PlatformFilterComposite.ProductsGroupToolTip=Checked configurations will be displayed under the SDK where they are valid. Unchecked configurations will be removed from this preference page. +SBSv2PlatformFilterComposite.AddProductButtonText=Add Variant +SBSv2PlatformFilterComposite.AddProductButtonToolTip=Create a new build alias with a product variant you can use as a build configuration. Only applies to SDKs that support variants. +SBSv2PlatformFilterComposite.RemoveProductButtonText=Remove Variant +SBSv2PlatformFilterComposite.RemoveProductButtonToolTip=Removes a selected product variant. diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKUIPlugin.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKUIPlugin.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKUIPlugin.java Wed Jul 21 12:11:48 2010 -0500 @@ -27,11 +27,11 @@ import com.nokia.carbide.cpp.internal.api.sdk.ICarbideDevicesXMLChangeListener; import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal; import com.nokia.carbide.cpp.internal.api.sdk.ui.SBSv1PlatformFilterComposite; -import com.nokia.carbide.cpp.internal.sdk.ui.NewPluginChecker; import com.nokia.carbide.cpp.internal.sdk.ui.SDKUIPreferenceConstants; -import com.nokia.carbide.cpp.sdk.core.*; +import com.nokia.carbide.cpp.sdk.core.ISDKManager; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.cpp.internal.api.utils.ui.QueryWithTristatePrefDialog; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; -import com.nokia.cpp.internal.api.utils.ui.QueryWithTristatePrefDialog; /** * The activator class controls the plug-in life cycle @@ -58,7 +58,6 @@ */ public void start(BundleContext context) throws Exception { super.start(context); - NewPluginChecker.checkForNewlyInstalledPlugins(getWorkbench()); ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); sdkMgr.setPlatformList(SBSv1PlatformFilterComposite.getPlatFilterPrefsStore()); diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/AddSDKDialog.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/AddSDKDialog.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/AddSDKDialog.java Wed Jul 21 12:11:48 2010 -0500 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2007-2010 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" @@ -18,7 +18,6 @@ package com.nokia.carbide.cpp.sdk.ui.shared; import java.io.File; -import java.util.ArrayList; import java.util.List; import org.eclipse.jface.dialogs.IDialogConstants; @@ -32,7 +31,6 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.DirectoryDialog; @@ -42,9 +40,10 @@ import org.eclipse.ui.PlatformUI; import org.osgi.framework.Version; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK; import com.nokia.carbide.cpp.internal.sdk.ui.Messages; import com.nokia.carbide.cpp.internal.sdk.ui.SDKUIHelpIds; -import com.nokia.carbide.cpp.sdk.core.ISDKManager; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory; @@ -57,18 +56,10 @@ */ public class AddSDKDialog extends TrayDialog { - private Combo sdkVersionCombo; - private Combo osVersionCombo; - private Combo isDefaultCombo; - private Combo vendorCombo; private Text deviceIDtext; private Text epocRootText; private Button browseEPOCROOTButton; - - public static final String DEFAULT_YES = "yes"; //$NON-NLS-1$ - public static final String DEFAULT_NO = "no"; //$NON-NLS-1$ - public static final String AUTO_DETECT = "(Auto-Detect)"; //$NON-NLS-1$ - + /** * Create the dialog * @param parentShell @@ -76,155 +67,17 @@ public AddSDKDialog(Shell parentShell) { super(parentShell); } - - /* (non-Javadoc) - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) + + /** + * Create contents of the button bar + * @param parent */ - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText(Messages.getString("AddSDKDialog.Add_New_SDK")); //$NON-NLS-1$ - } - @Override - protected void okPressed() { - - if (deviceIDtext.getText().length() > 0){ - if (!isValidIDName(deviceIDtext.getText())){ - return; - } - - if (vendorCombo.getText().length() > 0){ - if (!isValidVendorName(vendorCombo.getText())){ - return; - } - } else { - MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Missing_Vendor_Name"), Messages.getString("AddSDKDialog.Enter_Vendor_Name")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - } else { - MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Missing_SDK_ID"), Messages.getString("AddSDKDialog.Enter_SDK_ID")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - - if (epocRootText.getText().length() > 1){ - if (HostOS.IS_WIN32 && epocRootText.getText().charAt(1) != ':'){ - MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Malformed_EPOCROOT"), Messages.getString("AddSDKDialog.EPOCROOT_drive_spec")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - - if (epocRootText.getText().toUpperCase().endsWith("EPOC32") || epocRootText.getText().toUpperCase().endsWith("EPOC32\\")){ //$NON-NLS-1$ //$NON-NLS-2$ - if (!MessageDialog.openConfirm(getShell(), Messages.getString("AddSDKDialog.Possible_wrong_epocroot"), Messages.getString("AddSDKDialog.EPOCROOT_Should_Point"))){ //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - } else { - File epocRootFile = new File(epocRootText.getText()); - if (!epocRootFile.exists()){ - if (!MessageDialog.openConfirm(getShell(), Messages.getString("AddSDKDialog.EPOCROOT_does_not_exist"), Messages.getString("AddSDKDialog.EPOCROOT_does_not_exist_msg"))){ //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - } - if (epocRootFile.toString().indexOf(" ") != -1){ - // Paths should not have spaces... - MessageDialog.openError(getShell(), "EPOC Root Contains Spaces", Messages.getString("AddSDKDialog.EPOCROOT_contains_spaces")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - - } - } - } else { - if (epocRootText.getText().length() == 1 && epocRootText.getText().charAt(0) == '\\'){ - // OK - Currently accept only a '\'. May need to reconsider side-effects - } else { - MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Missing_EPOCROOT"), Messages.getString("AddSDKDialog.Please_enter_an_EPOCROOT")); //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - } - - // No objections raised, write the new device entry - String osVersionText = osVersionCombo.getText(); - Version osVersion; - String osBranch = ""; //$NON-NLS-1$ - if (osVersionText.equals(AUTO_DETECT)){ - osVersion = new Version("0.0"); //$NON-NLS-1$ - } else { - int len = osVersionText.length(); - if (Character.isLetter(osVersionText.charAt(len-1))){ - osBranch = osVersionText.substring(len-1); - osVersionText = osVersionText.substring(0, len-1); - osVersion = new Version(osVersionText); - } else { - osVersion = new Version(osVersionText); - } - } - - Version sdkVersion = new Version("0.0"); //$NON-NLS-1$ - if (!sdkVersionCombo.getText().equals(AUTO_DETECT)){ - sdkVersion = new Version(sdkVersionCombo.getText()); - } - - ISymbianSDK sdk = SymbianSDKFactory.createInstance(deviceIDtext.getText(), - epocRootText.getText(), - vendorCombo.getText(), - osVersion, - osBranch, - sdkVersion, - false); - - SDKCorePlugin.getSDKManager().addSDK(sdk); - - List sdkList = SDKCorePlugin.getSDKManager().getSDKList(); - if (sdkList != null){ - sdkList.add(sdk); - } - - if (isDefaultCombo.getText().equals(DEFAULT_YES)){ - sdk.setIsDefaultSDK(true); - SDKCorePlugin.getSDKManager().setDefaultSDK(sdk); - } else { - sdk.setIsDefaultSDK(false); - } - - super.okPressed(); - } - - private boolean isValidIDName(String sdkID){ - boolean isValid = true; - - - // check for spaces in ID - if (sdkID.contains(" ")){ //$NON-NLS-1$ - MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Invalid_SDK_ID"), Messages.getString("AddSDKDialog.SDK_ID_No_Spaces")); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - - // check that the ID is unique... - for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){ - if (sdk.getUniqueId().equalsIgnoreCase(sdkID)){ - // id already exists, choose a different one... - MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Duplicate_ID"), Messages.getString("AddSDKDialog.Duplicate_ID_Msg")); //$NON-NLS-1$ //$NON-NLS-2$ - return false; - } - } - - return isValid; - } - - private boolean isValidVendorName(String vendor){ - boolean isValid = true; - - String[] vendorSplit = vendor.split("[.]"); //$NON-NLS-1$ - if (vendorSplit.length == 3){ - if (!vendorSplit[0].toLowerCase().startsWith("com")){ //$NON-NLS-1$ - isValid = false; - } - } else { - isValid = false; - } - - if (isValid == false){ - MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Invalid_name_attrib"), Messages.getString("AddSDKDialog.Invalid_name_attrib_msg")); //$NON-NLS-1$ //$NON-NLS-2$ - } - - return isValid; + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, + true); + createButton(parent, IDialogConstants.CANCEL_ID, + IDialogConstants.CANCEL_LABEL, false); } /** @@ -257,81 +110,17 @@ browseEPOCROOTButton.setToolTipText(Messages.getString("AddSDKDialog.Choose_folder_where_epoc32_exists")); //$NON-NLS-1$ browseEPOCROOTButton.setText(Messages.getString("AddSDKDialog.Browse")); //$NON-NLS-1$ addButtonListener(browseEPOCROOTButton); - - final Label vendorLabel = new Label(container, SWT.NONE); - vendorLabel.setToolTipText(Messages.getString("AddSDKDialog.Enter_name_of_sdk")); //$NON-NLS-1$ - vendorLabel.setText(Messages.getString("AddSDKDialog.Vendor")); //$NON-NLS-1$ - vendorCombo = new Combo(container, SWT.NONE); - vendorCombo.setLayoutData(new GridData(250, SWT.DEFAULT)); - new Label(container, SWT.NONE); - vendorCombo.add(ISymbianSDK.S60_SDK_NAME); - vendorCombo.add(ISymbianSDK.S80_SDK_NAME); - vendorCombo.add(ISymbianSDK.UIQ_SDK_NAME); - vendorCombo.add(ISymbianSDK.TECHVIEW_SDK_NAME); - - final Label isDefaultLabel = new Label(container, SWT.NONE); - isDefaultLabel.setToolTipText(Messages.getString("AddSDKDialog.default_label_tooltip")); //$NON-NLS-1$ - isDefaultLabel.setText(Messages.getString("AddSDKDialog.is_default")); //$NON-NLS-1$ - - isDefaultCombo = new Combo(container, SWT.READ_ONLY); - isDefaultCombo.setLayoutData(new GridData(250, SWT.DEFAULT)); - new Label(container, SWT.NONE); - isDefaultCombo.add(DEFAULT_YES); - isDefaultCombo.add(DEFAULT_NO); - isDefaultCombo.select(1); - - final Label osVersionLabel = new Label(container, SWT.NONE); - osVersionLabel.setToolTipText(Messages.getString("AddSDKDialog.os_version_tooltip")); //$NON-NLS-1$ - osVersionLabel.setText(Messages.getString("AddSDKDialog.os_version")); //$NON-NLS-1$ - //ISymbianMacroStore sms = - List osVersions = new ArrayList(); - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - osVersions = sdkMgr.getSymbianMacroStore().getSupportedOSVersions(); - - osVersionCombo = new Combo(container, SWT.READ_ONLY); - osVersionCombo.setLayoutData(new GridData(250, SWT.DEFAULT)); - new Label(container, SWT.NONE); - osVersionCombo.add(AUTO_DETECT); - - for (String currVer : osVersions){ - osVersionCombo.add(currVer); - } - osVersionCombo.select(0); - - final Label sdkVersionLabel = new Label(container, SWT.NONE); - sdkVersionLabel.setToolTipText(Messages.getString("AddSDKDialog.select_sdk_tooltip")); //$NON-NLS-1$ - sdkVersionLabel.setText(Messages.getString("AddSDKDialog.sdk_version")); //$NON-NLS-1$ - - sdkVersionCombo = new Combo(container, SWT.READ_ONLY); - sdkVersionCombo.setLayoutData(new GridData(250, SWT.DEFAULT)); - sdkVersionCombo.add(AUTO_DETECT); - sdkVersionCombo.select(0); - - List sdkVerList = new ArrayList(); - sdkVerList = sdkMgr.getSymbianMacroStore().getSDKVersions(); - for (String currVer : sdkVerList){ - sdkVersionCombo.add(currVer); - } - - new Label(container, SWT.NONE); - PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, SDKUIHelpIds.SDK_ADD_DIALOG); - - return container; } - /** - * Create contents of the button bar - * @param parent + /* (non-Javadoc) + * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ - @Override - protected void createButtonsForButtonBar(Composite parent) { - createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, - true); - createButton(parent, IDialogConstants.CANCEL_ID, - IDialogConstants.CANCEL_LABEL, false); + protected void configureShell(Shell shell) { + super.configureShell(shell); + shell.setText(Messages.getString("AddSDKDialog.Add_New_SDK")); //$NON-NLS-1$ } /** @@ -342,15 +131,80 @@ //return new Point(428, 256); return super.getInitialSize(); } - + + /* + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + @Override + protected void okPressed() { + + if (deviceIDtext.getText().length() > 0){ + if (!isValidIDName(deviceIDtext.getText())){ + return; + } + } else { + MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Missing_SDK_ID"), Messages.getString("AddSDKDialog.Enter_SDK_ID")); //$NON-NLS-1$ //$NON-NLS-2$ + return; + } + + if (epocRootText.getText().length() > 1){ + if (HostOS.IS_WIN32 && epocRootText.getText().charAt(1) != ':'){ + MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Malformed_EPOCROOT"), Messages.getString("AddSDKDialog.EPOCROOT_drive_spec")); //$NON-NLS-1$ //$NON-NLS-2$ + return; + } + if (epocRootText.getText().toUpperCase().endsWith("EPOC32") || epocRootText.getText().toUpperCase().endsWith("EPOC32\\")){ //$NON-NLS-1$ //$NON-NLS-2$ + if (!MessageDialog.openConfirm(getShell(), Messages.getString("AddSDKDialog.Possible_wrong_epocroot"), Messages.getString("AddSDKDialog.EPOCROOT_Should_Point"))){ //$NON-NLS-1$ //$NON-NLS-2$ + return; + } + } else { + File epocRootFile = new File(epocRootText.getText()); + if (!epocRootFile.exists()){ + if (!MessageDialog.openConfirm(getShell(), Messages.getString("AddSDKDialog.EPOCROOT_does_not_exist"), Messages.getString("AddSDKDialog.EPOCROOT_does_not_exist_msg"))){ //$NON-NLS-1$ //$NON-NLS-2$ + return; + } + } + if (epocRootFile.toString().indexOf(" ") != -1){ + // Paths should not have spaces... + MessageDialog.openError(getShell(), "EPOC Root Contains Spaces", Messages.getString("AddSDKDialog.EPOCROOT_contains_spaces")); //$NON-NLS-1$ //$NON-NLS-2$ + return; + } + } + } else { + if (epocRootText.getText().length() == 1 && epocRootText.getText().charAt(0) == '\\'){ + // OK - Currently accept only a '\'. May need to reconsider side-effects + } else { + MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Missing_EPOCROOT"), Messages.getString("AddSDKDialog.Please_enter_an_EPOCROOT")); //$NON-NLS-1$ //$NON-NLS-2$ + return; + } + } + + // No objections raised, write the new device entry + String vendorName = ISBSv1BuildInfo.S60_SDK_NAME; + Version osVersion = new Version("9.4.0"); //$NON-NLS-1$ + Version sdkVersion = new Version("5.0"); //$NON-NLS-1$ + ISymbianSDK sdk = SymbianSDKFactory.createInstance(deviceIDtext.getText(), + epocRootText.getText(), + vendorName, + osVersion, + sdkVersion); + ((SymbianSDK)sdk).setEnabled(true); + SDKCorePlugin.getSDKManager().addSDK(sdk); + List sdkList = SDKCorePlugin.getSDKManager().getSDKList(); + if (sdkList != null){ + sdkList.add(sdk); + } + super.okPressed(); + } + /** * Sets the listener event to a button. * * @param aButton */ - private void addButtonListener( final Button aButton ) { + private void addButtonListener(final Button aButton) { SelectionListener listener = new SelectionAdapter() { - public void widgetSelected( SelectionEvent e ) { + public void widgetSelected(SelectionEvent e) { if (e.getSource().equals(browseEPOCROOTButton)) { browseEPOCROOT(); } @@ -358,7 +212,7 @@ }; aButton.addSelectionListener(listener); } - + private void browseEPOCROOT(){ DirectoryDialog browseDir = new DirectoryDialog(getShell(), SWT.OPEN); browseDir.setMessage(Messages.getString("AddSDKDialog.Choose_location_for_EPOCROOT")); //$NON-NLS-1$ @@ -369,4 +223,25 @@ } } + private boolean isValidIDName(String sdkID){ + boolean isValid = true; + + // check for spaces in ID + if (sdkID.contains(" ")){ //$NON-NLS-1$ + MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Invalid_SDK_ID"), Messages.getString("AddSDKDialog.SDK_ID_No_Spaces")); //$NON-NLS-1$ //$NON-NLS-2$ + return false; + } + + // check that the ID is unique... + for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){ + if (sdk.getUniqueId().equalsIgnoreCase(sdkID)){ + // id already exists, choose a different one... + MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Duplicate_ID"), Messages.getString("AddSDKDialog.Duplicate_ID_Msg")); //$NON-NLS-1$ //$NON-NLS-2$ + return false; + } + } + + return isValid; + } + } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java Wed Jul 21 12:11:48 2010 -0500 @@ -18,15 +18,17 @@ package com.nokia.carbide.cpp.sdk.ui.shared; +import java.io.File; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.eclipse.jface.viewers.TreeNode; import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; +import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; import com.nokia.carbide.cpp.sdk.core.ISDKManager; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; @@ -34,8 +36,11 @@ * A tree node representing a Symbian OS SDK. This node's children will be the * list of available build configurations. */ +@SuppressWarnings("restriction") public class BuildTargetTreeNode extends TreeNode { + public static final String SDK_NODE_ERROR_EPOCROOT_INVALID = " -- SDK location does not exist! Check Symbian SDKs!"; //$NON-NLS + /** * Constructs a new tree node for the given SDK * @param value the SDK to create the tree node for @@ -52,8 +57,13 @@ public BuildTargetTreeNode(ISymbianSDK value, boolean sbsv2Project) { super(value); - List configurations = sbsv2Project ? SBSv2Utils.getFilteredSBSv2BuildContexts(value) : value.getFilteredBuildConfigurations(); - + List configurations = sbsv2Project ? + value.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER).getFilteredBuildConfigurations() : + value.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getFilteredBuildConfigurations(); + + if (configurations == null){ + return; + } TreeNode[] children = new TreeNode[configurations.size()]; int index = 0; for (ISymbianBuildContext config : configurations) { @@ -61,7 +71,16 @@ @Override public String toString() { ISymbianBuildContext context = (ISymbianBuildContext)getValue(); - return context.getDisplayString(); + String sdkId = context.getSDK().getUniqueId(); + String newDisplayString = context.getDisplayString().replace("[" + sdkId + "]", ""); + if (context instanceof ISBSv2BuildContext){ + ISBSv2BuildContext v2Context = (ISBSv2BuildContext)context; + if (v2Context.getConfigQueryData().getConfigurationErrorMessage() != null && + v2Context.getConfigQueryData().getConfigurationErrorMessage().length() > 0){ + newDisplayString += " ERROR: " + v2Context.getConfigQueryData().getConfigurationErrorMessage(); + } + } + return newDisplayString; } }; } @@ -73,6 +92,10 @@ */ public String toString() { ISymbianSDK value = (ISymbianSDK) getValue(); + File f = new File(value.getEPOCROOT()); + if (!f.exists()){ + return value.getUniqueId() + SDK_NODE_ERROR_EPOCROOT_INVALID; + } return value.getUniqueId(); } @@ -126,10 +149,10 @@ BuildTargetTreeNode[] input = new BuildTargetTreeNode[sdkListCopy.size()]; int index = 0; - for (Iterator iter = sdkListCopy.iterator(); iter.hasNext();) { + for (ISymbianSDK sdk : sdkListCopy) { - BuildTargetTreeNode treeNode = new BuildTargetTreeNode(iter.next(), sbsv2Project); - if (treeNode.getChildren() != null){ + BuildTargetTreeNode treeNode = new BuildTargetTreeNode(sdk, sbsv2Project); + if (treeNode.getChildren() != null || sbsv2Project){ input[index++] = treeNode; } } @@ -144,4 +167,5 @@ } return realInput; } + } diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetsPage.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetsPage.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetsPage.java Wed Jul 21 12:11:48 2010 -0500 @@ -29,6 +29,7 @@ import org.eclipse.jface.dialogs.IDialogPage; import org.eclipse.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.IColorProvider; import org.eclipse.jface.viewers.IFilter; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; @@ -40,6 +41,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -61,6 +63,7 @@ import com.nokia.carbide.template.engine.ITemplate; import com.nokia.cpp.internal.api.utils.core.Check; import com.nokia.cpp.internal.api.utils.core.HostOS; +import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; /** * Wizard page used to select a list of Carbide.c++ build configurations. Currently used @@ -228,15 +231,34 @@ addOtherControls(parent); - Link fLink = new Link(parent, SWT.WRAP); - fLink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - fLink.setText(Messages.getString("BuildTargetsPage.Select_Filtering_Prefs_Link")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - fLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); - fLink.addSelectionListener(new SelectionAdapter() { + Link fConfigPrefsLink = new Link(parent, SWT.WRAP); + fConfigPrefsLink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + fConfigPrefsLink.setText(Messages.getString("BuildTargetsPage.Select_Filtering_Prefs_Link")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + fConfigPrefsLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); + fConfigPrefsLink.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // I don't see a way to open it to a specific tab, only the page if (Window.OK == PreferencesUtil.createPreferenceDialogOn(getShell(), "com.nokia.carbide.cpp.sdk.ui.preferences.BuildPlatformFilterPage", null, null, 0).open()){ //$NON-NLS-1$ - + inited = false; + setVisible(true); + TemplateSDKFilter filter = filterCheckbox.getSelection() ? templateFilter : null; + filteringContentProviderWrapper.setFilter(filter); + viewer.getTree().clearAll(true); + viewer.refresh(); + setPageComplete(validatePage()); + } + } + + }); + + Link fSDKLink = new Link(parent, SWT.WRAP); + fSDKLink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + fSDKLink.setText(Messages.getString("BuildTargetsPage.Select_SymbianSDKs_Prefs_Link")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + fSDKLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); + fSDKLink.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + // I don't see a way to open it to a specific tab, only the page + if (Window.OK == PreferencesUtil.createPreferenceDialogOn(getShell(), "com.nokia.carbide.cpp.sdk.ui.preferences.SDKPreferences", null, null, 0).open()){ //$NON-NLS-1$ inited = false; setVisible(true); TemplateSDKFilter filter = filterCheckbox.getSelection() ? templateFilter : null; @@ -256,7 +278,27 @@ viewer = new ContainerCheckedTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.setLabelProvider(new LabelProvider()); + class SDKNodeLabelProvider extends LabelProvider implements IColorProvider { + + public Color getForeground(Object element) { + if (element instanceof BuildTargetTreeNode){ + BuildTargetTreeNode treeNode = (BuildTargetTreeNode)element; + if (treeNode.getValue() instanceof ISymbianSDK){ + if (treeNode.toString().contains(BuildTargetTreeNode.SDK_NODE_ERROR_EPOCROOT_INVALID)){ + return WorkbenchUtils.getSafeShell().getDisplay().getSystemColor(SWT.COLOR_RED); + } + } + } + + return null; + } + + public Color getBackground(Object element) { + return null; + } + } + + viewer.setLabelProvider(new SDKNodeLabelProvider()); TreeNodeContentProvider treeNodeContentProvider = new TreeNodeContentProvider(); filteringContentProviderWrapper = diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp.ui/src/com/nokia/carbide/cpp/ui/TextAndDialogCellEditor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.ui/src/com/nokia/carbide/cpp/ui/TextAndDialogCellEditor.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,221 @@ +/******************************************************************************* + * Copyright (c) 2010 Nokia Corporation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nokia - initial API and implementation + *******************************************************************************/ + +package com.nokia.carbide.cpp.ui; + +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.*; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.widgets.*; + +/** + * This class allows a CellEditor to provide editable text as well + * as a button which will launch a dialog to edit the data in a different way. + * @author dpodwall + * @author ddubrow + * @author eswartz + */ +public abstract class TextAndDialogCellEditor extends DialogCellEditor { + + private TextAndDialogCellEditor.CustomTextCellEditor textCellEditor; + private Text text; + private Button dialogButton; + + public TextAndDialogCellEditor(Composite parent) { + super(parent); + } + + @Override + protected Control createContents(Composite parent) { + textCellEditor = new CustomTextCellEditor(parent); + text = (Text) textCellEditor.getControl(); + + // Forward all events from the TextCellEditor to + // this cell editor's listener + textCellEditor.addListener(new ICellEditorListener() { + + public void applyEditorValue() { + // Ignore + } + + public void cancelEditor() { + fireCancelEditor(); + } + + public void editorValueChanged(boolean oldValidState, boolean newValidState) { + fireEditorValueChanged(oldValidState, newValidState); + } + }); + + textCellEditor.addPropertyChangeListener(new IPropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent event) { + // text cell editor uses fireEnablementChanged + fireEnablementChanged(event.getProperty()); + } + + }); + + return text; + } + + @Override + protected Button createButton(Composite parent) { + dialogButton = super.createButton(parent); + return dialogButton; + } + + protected Button getButton() { + return dialogButton; + } + + void applyEditorValueAndDeactivate() { + String newValue = (String)getValue(); + + doSetValue(newValue); + markDirty(); + setValueValid(true); + fireApplyEditorValue(); + deactivate(); + } + + protected void keyReleaseOccured(KeyEvent keyEvent) { + if (keyEvent.character == '\r') { // Enter character + applyEditorValueAndDeactivate(); + } + else if (keyEvent.character == '\u001b') { // Escape character + fireCancelEditor(); + } + else if (keyEvent.character == '\t') { // tab key + applyEditorValueAndDeactivate(); + } + } + + @Override + protected void updateContents(Object value) { + textCellEditor.setValue(value != null ? value : ""); //$NON-NLS-1$ + } + + @Override + protected void doSetFocus() { + text.setVisible(true); + textCellEditor.setFocus(); + } + + @Override + protected Object doGetValue() { + String result = (String) textCellEditor.getValue(); + return result; + } + + @Override + protected void doSetValue(Object value) { + textCellEditor.setValue(value); + } + + @Override + protected void focusLost() { + super.focusLost(); + } + + public boolean isCopyEnabled() { + return textCellEditor.isCopyEnabled(); + } + + public boolean isCutEnabled() { + return textCellEditor.isCutEnabled(); + } + + public boolean isDeleteEnabled() { + return textCellEditor.isDeleteEnabled(); + } + + public boolean isFindEnabled() { + return textCellEditor.isFindEnabled(); + } + + public boolean isPasteEnabled() { + return textCellEditor.isPasteEnabled(); + } + + public boolean isRedoEnabled() { + return textCellEditor.isRedoEnabled(); + } + + public boolean isSaveAllEnabled() { + return textCellEditor.isSaveAllEnabled(); + } + + public boolean isSelectAllEnabled() { + return textCellEditor.isSelectAllEnabled(); + } + + public boolean isUndoEnabled() { + return textCellEditor.isUndoEnabled(); + } + + public boolean isValueValid() { + return textCellEditor.isValueValid(); + } + + public void performCopy() { + textCellEditor.performCopy(); + } + + public void performCut() { + textCellEditor.performCut(); + } + + public void performDelete() { + textCellEditor.performDelete(); + } + + public void performFind() { + textCellEditor.performFind(); + } + + public void performPaste() { + textCellEditor.performPaste(); + } + + public void performRedo() { + textCellEditor.performRedo(); + } + + public void performSelectAll() { + textCellEditor.performSelectAll(); + } + + public void performUndo() { + textCellEditor.performUndo(); + } + + static class CustomTextCellEditor extends TextCellEditor { + + public CustomTextCellEditor(Composite parent) { + super(parent); + } + + @Override + protected void focusLost() { + // don't deactivate everything when focus is lost, + // it will be handled in the outer cell editor + if (isActivated()) { + fireApplyEditorValue(); + } + } + } + +} + + + diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp/splash.bmp diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp/themes/carbide/graphics/contentpage/background.jpg diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.cpp/themes/carbide/graphics/root/background.jpg diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.carbide.templatewizard.symbian.tests/src/com/nokia/carbide/templatewizard/symbian/tests/TestSymbianSDK.java --- a/core/com.nokia.carbide.templatewizard.symbian.tests/src/com/nokia/carbide/templatewizard/symbian/tests/TestSymbianSDK.java Wed Jul 21 11:32:00 2010 -0500 +++ b/core/com.nokia.carbide.templatewizard.symbian.tests/src/com/nokia/carbide/templatewizard/symbian/tests/TestSymbianSDK.java Wed Jul 21 12:11:48 2010 -0500 @@ -20,222 +20,125 @@ package com.nokia.carbide.templatewizard.symbian.tests; import java.io.File; -import java.net.URL; -import java.util.*; +import java.util.List; +import java.util.Set; import org.eclipse.core.runtime.IPath; import org.osgi.framework.Version; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; -import com.nokia.carbide.cpp.sdk.core.*; +import com.nokia.carbide.cpp.internal.api.sdk.ISymbianSDKModifier; +import com.nokia.carbide.cpp.sdk.core.ISDKBuildInfo; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -class TestSymbianSDK implements ISymbianSDK { +class TestSymbianSDK implements ISymbianSDK, ISymbianSDKModifier { - - public List getVariantCFGMacros() { - return null; + private String framework; + private Version sdkVersion; + private String family; + + public TestSymbianSDK(String frameWork, String sdkVersionString) { + this.framework = frameWork; + setSDKVersion(Version.parseVersion(sdkVersionString)); + setFamily(framework); } - public List getVendorSDKMacros() { + + public void addSupportedFeature(Object feature) { + } + + public ISDKBuildInfo getBuildInfo(String builderId) { return null; } - public boolean isEKA1() { - return false; - } - public boolean isEKA2() { - return false; - } - public boolean isS60() { - return false; - } - public void setEPOCROOT(String epocRoot) { - - } - public void setName(String name) { - - } - public void setUniqueID(String id) { - - } - private String framework; - private Version sdkVersion; - public TestSymbianSDK(String frameWork, String sdkVersionString) { - this.framework = frameWork; - this.sdkVersion = Version.parseVersion(sdkVersionString); - } - public List getAllMacros() { - return null; - } - public List getAvailablePlatforms() { - return null; - } - public Date getCreationDate() { - return null; - } + public String getEPOCROOT() { return "C:\\"; } - public boolean isEnabled() { - return false; - } + public String getFamily() { - return framework; + return family; } - public List getFilteredBuildConfigurations() { - return null; - } + public IPath getIncludePath() { return null; } - public File getLicenseFile() { - return null; - } + public String getName() { return null; } - + public Version getOSVersion() { return null; } - public List getPlatformMacros(String platform) { - return null; - } - public File getPrefixFile() { + + public File getPrefixFile(String builderId) { return null; } - public File getPublisherLogo() { - return null; - } - public URL getPublisherURL() { - return null; - } + public IPath getReleaseRoot() { return null; } - public String getSDKDescription() { - return null; - } - public String getSDKOSBranch() { - return null; - } + public Version getSDKVersion() { return sdkVersion; } + + public Set getSupportedFeatures() { + return null; + } + + public List getSupportedTargetTypes() { + return null; + } + public IPath getToolsPath() { return null; } - public List getUnfilteredBuildConfigurations() { - return null; - } + public String getUniqueId() { return null; } + + public List getVariantCFGMacros() { + return null; + } + public String getVendor() { return null; } - - public boolean isDefaultSDK() { + + public void setEPOCROOT(String epocRoot) { + } + + public boolean isEnabled() { return false; } - public boolean isValid() { - return false; + + public void setBuildInfo(ISDKBuildInfo buildInfo, String builderId) { } + public void setEnabled(boolean enable) { } - public List validationErrors() { - return null; - } - public void setCreateData(Date createDate) { - } - public void setIncludePath(IPath incPath) { + + public void setFamily(String family) { + this.family = family; } - public void setIsDefaultSDK(boolean isDefault) { + + public void setName(String name) { } - public void setLicenseFile(File licenseFile) { - } - public void setOSSDKBranch(String branch) { - } + public void setOSVersion(Version osVer) { } - public void setPrefixFile(IPath prefixFile) { - } - public void setPublisherLogo(File logoFile) { - } - public void setPublisherName(String pubName) { - } - public void setPublisherURL(URL pubURL) { - } - public void setReleaseRoot(IPath releaseRootPath) { - } - public void setSDKDescription(String descr) { - } - public void setSDKVersion(Version sdkVers) { - } - public void setSourcePath(IPath srcPath) { - } - public void setToolsPath(IPath toolPath) { - } - public void setAvailablePlatforms(List platList) { + + public void setPrefixFile(IPath prefixFile, String builderId) { } - public List getSupportedTargetTypes() { - return null; - } - public void setOSMacros(List osMacros) { - } - public void setPlatformMacros(String platform, List platMacros) { - } - public List getProjectVariantHRHMacros() { - return null; - } - public List getTargetTypeMacros(String targettype) { - return null; - } - public boolean getRequiresRestart() { - return false; - } - - public String getPublisherName() { - return null; + + public void setSDKVersion(Version sdkVers) { + sdkVersion = sdkVers; } - public void setCreateDate(Date createDate) { - } - public void setSupportsWINSCW_UREL(boolean isSupported) { - - } - public boolean supportsWINSCW_UREL() { - return false; - } - public void scanSDK() { - - } - /* (non-Javadoc) - * @see com.nokia.carbide.cpp.sdk.core.ISymbianSDK#getBSFCatalog() - */ - public IBSFCatalog getBSFCatalog() { - return null; + public void setUniqueId(String id) { } - - /* (non-Javadoc) - * @see com.nokia.carbide.cpp.sdk.core.ISymbianSDK#getProjectVariantHRHDefines() - */ - public List getProjectVariantHRHDefines() { - return Collections.EMPTY_LIST; + + public void scanSDK() { } - - /* (non-Javadoc) - * @see com.nokia.carbide.cpp.sdk.core.ISymbianSDK#getSBVCatalog() - */ - public ISBVCatalog getSBVCatalog() { - return null; - } - public boolean isPreviouslyScanned() { - // TODO Auto-generated method stub - return false; - } - public void setPreviouslyScanned(boolean wasScanned) { - // TODO Auto-generated method stub - - } - - + } \ No newline at end of file diff -r e17ab99b8f30 -r 03f5f8bf29b4 core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheUtils.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,181 @@ +/******************************************************************************* + * Copyright (c) 2010 Nokia and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nokia - Initial API and implementation + *******************************************************************************/ + +package com.nokia.cpp.internal.api.utils.core; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamClass; +import java.io.Serializable; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.IPath; + +import com.nokia.cpp.utils.core.noexport.UtilsCorePlugin; + +public class CacheUtils { + + protected class CacheEntry { + + private String identifier; + private long freshness; + private Serializable data; + private IPath location; + + public CacheEntry(String identifier, Serializable data, long freshness) { + this.identifier = identifier; + this.freshness = freshness; + this.data = data; + this.location = getDefaultLocation().append(Integer.toString(identifier.hashCode())).addFileExtension("txt");; + } + + public CacheEntry(ObjectInputStream ois) throws Exception { + this.identifier = (String) ois.readObject(); + this.freshness = (Long) ois.readObject(); + this.data = (Serializable) ois.readObject(); + this.location = getDefaultLocation().append(Integer.toString(identifier.hashCode())).addFileExtension("txt");; + } + + public IPath getLocation() { + return location; + } + + @SuppressWarnings("unchecked") + private T getData(Class expectedClass) { + if (expectedClass.isInstance(data)) + return (T) data; + else + return null; + } + + private long getFreshness() { + return freshness; + } + + private void flush() throws Exception { + File cacheFile = getLocation().toFile(); + if (!cacheFile.exists()) { + cacheFile.getParentFile().mkdirs(); + cacheFile.createNewFile(); + } + FileOutputStream fos = new FileOutputStream(cacheFile); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(identifier); + oos.writeObject(freshness); + oos.writeObject(data); + fos.close(); + } + + public void delete() { + File cacheFile = getLocation().toFile(); + if (cacheFile.exists()) { + cacheFile.delete(); + } + } + + } + + private Map caches = Collections.synchronizedMap(new HashMap()); + private IPath defaultLocation; + + public CacheUtils(IPath defaultLocation) { + this.defaultLocation = defaultLocation; + } + + public CacheEntry getCache(String identifier) { + CacheEntry result = caches.get(identifier); + return result; + } + + public void removeCache(String identifier) { + caches.remove(identifier); + } + + public T getCachedData(String cacheIdentifier, Class expectedClass, long freshness) { + // freshness = 0; + CacheEntry cache = caches.get(cacheIdentifier); + + if (cache == null) + cache = loadCachedData(getDefaultLocation(), cacheIdentifier); + + if (cache != null) { + long cachedFreshness = cache.getFreshness(); + T result = cache.getData(expectedClass); + if (cachedFreshness == freshness && result != null) + { + return result; + } + else + { + caches.remove(cache); + cache.delete(); + } + } + return null; + } + + protected CacheEntry loadCachedData(IPath location, String cacheIdentifier) { + IPath flushPath = location.append(Integer.toString(cacheIdentifier.hashCode())).addFileExtension("txt"); + + if (flushPath.toFile().exists()) { + try { + final ClassLoader classLoader = UtilsCorePlugin.getDefault().getClass().getClassLoader(); + FileInputStream fis = new FileInputStream(flushPath.toFile()); + ObjectInputStream ois = new ObjectInputStream(fis) { + + @Override + protected Class resolveClass(ObjectStreamClass desc) + throws IOException, ClassNotFoundException { + String name = desc.getName(); + try { + return classLoader.loadClass(name); + } catch (ClassNotFoundException e) { + return super.resolveClass(desc); + } + }}; + return new CacheEntry(ois); + } catch (Exception e) { + e.printStackTrace(); + } + } + + return null; + } + + public void putCachedData(String cacheIdentifier, Serializable data, long freshness) { + CacheEntry cache = new CacheEntry(cacheIdentifier, data, freshness); + caches.put(cacheIdentifier, cache); + } + + public void flushAll() throws Exception { + Collection allCaches = caches.values(); + for (CacheEntry entry : allCaches) { + entry.flush(); + } + caches.clear(); + } + + public IPath getDefaultLocation() { + return defaultLocation; + } + + public void setDefaultLocation(IPath defaultLocation) { + this.defaultLocation = defaultLocation; + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 debuggercdi/com.nokia.carbide.cpp.debug.capabilities/plugin.xml diff -r e17ab99b8f30 -r 03f5f8bf29b4 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnection.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnection.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,31 @@ +/* +* 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.carbide.trk.support.connection; + +import com.nokia.carbide.remoteconnections.interfaces.IConnectionType; + +import java.util.Map; + +public class TCFUSBConnection extends TCPIPConnection { + + public TCFUSBConnection(IConnectionType connectionType, Map settings) { + super(connectionType, settings); + } + + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnectionType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/TCFUSBConnectionType.java Wed Jul 21 12:11:48 2010 -0500 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +package com.nokia.carbide.trk.support.connection; + +import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory; +import com.nokia.carbide.trk.support.Messages; + +/** + * Implementation of IConnectionType for USB TCF connections. This also uses Nokia TCF but + * is given a unique identifier for now so we can debug it differently. + */ +public class TCFUSBConnectionType implements IUSBConnectionType { + + public static final String ID = "com.nokia.carbide.connection.TCFUSBConnectionType"; //$NON-NLS-1$ + + public IConnectionFactory getConnectionFactory() { + return new SerialConnectionFactory(this, true); + } + + public String getDescription() { + return Messages.getString("TCFUSBConnectionType.Desc"); //$NON-NLS-1$ + } + + public String getDisplayName() { + return Messages.getString("TCFUSBConnectionType.Label"); //$NON-NLS-1$ + } + + public String getHelpContext() { + return null; + } + + public String getIdentifier() { + return ID; + } + +} diff -r e17ab99b8f30 -r 03f5f8bf29b4 debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/SettingsData.java --- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/SettingsData.java Wed Jul 21 11:32:00 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/SettingsData.java Wed Jul 21 12:11:48 2010 -0500 @@ -60,8 +60,11 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; 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.remoteconnections.interfaces.IConnection; import com.nokia.carbide.remoteconnections.internal.registry.Registry; @@ -257,13 +260,11 @@ // make sure the selected build configuration of the current project // is an emulator build, otherwise warn them that we can't set default values. - if (buildConfig.getPlatformString().compareTo(ISymbianBuildContext.EMULATOR_PLATFORM) == 0) { + if (buildConfig.getPlatformString().compareTo(ISBSv1BuildContext.EMULATOR_PLATFORM) == 0) { configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, mainExeHostPath == null ? "" : mainExeHostPath.toOSString()); if (isEmulatorRequired(buildConfig, mainExeHostPath, mainExeWorkspaceRelativeMMPPath)) { - IPath releaseRoot = buildConfig.getSDK().getReleaseRoot(); - String winscwudeb = releaseRoot.toOSString() + File.separator + "WINSCW" + File.separator + buildConfig.getTargetString(); //$NON-NLS-1$ //$NON-NLS-2$ - + String winscwudeb = buildConfig.getSDK().getReleaseRoot().toOSString() + File.separator + "WINSCW" + File.separator + buildConfig.getTargetString(); //$NON-NLS-1$ //$NON-NLS-2$ String emulatorPath = winscwudeb + File.separator + "epoc.exe"; //$NON-NLS-1$ configuration.setAttribute(DebuggerCommonData.Host_App_Path, getCanonicalPath(emulatorPath)); } @@ -377,7 +378,7 @@ // make sure the selected build configuration of the current project is not an emulator build // otherwise warn them that we can't set default values. - if (buildConfig.getPlatformString().compareTo(ISymbianBuildContext.EMULATOR_PLATFORM) != 0) { + if (buildConfig.getPlatformString().compareTo(ISBSv1BuildContext.EMULATOR_PLATFORM) != 0) { configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, mainExeHostPath == null ? "" : mainExeHostPath.toOSString()); configuration.setAttribute(PreferenceConstants.J_PN_RemoteProcessToLaunch, mainExeTargetPath == null ? "" : PathUtils.convertPathToWindows(mainExeTargetPath)); } else { @@ -412,7 +413,7 @@ // make sure the selected build configuration of the current project is not an emulator build // otherwise warn them that we can't set default values. - if (buildConfig.getPlatformString().compareTo(ISymbianBuildContext.EMULATOR_PLATFORM) != 0) { + if (buildConfig.getPlatformString().compareTo(ISBSv1BuildContext.EMULATOR_PLATFORM) != 0) { configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, mainExeHostPath == null ? "" : mainExeHostPath.toOSString()); } else { displayWarningDialog(Messages.getString("SettingsData.37")); //$NON-NLS-1$ @@ -483,7 +484,7 @@ ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); String defaultTargetPath = "C:\\"; //$NON-NLS-1$ - if (buildConfig.getSDK().isEKA2()) { + if (buildConfig.getSDK().getSupportedFeatures().contains(ISymbianSDKFeatures.IS_EKA2)) { // C:\\sys\bin for eka2 defaultTargetPath += "sys\\bin\\"; //$NON-NLS-1$ } @@ -790,10 +791,13 @@ for (ISymbianSDK currSDK : sdkList){ if (new Path(currSDK.getEPOCROOT()).isPrefixOf(mainExeHostPath)) { - // Apparently this only works correctly with the S60 emulator. - if (!currSDK.isS60() && - !currSDK.getFamily().equalsIgnoreCase(ISymbianSDK.TECHVIEW_FAMILY_ID)) - return true; + // Apparently this only works correctly with the S60 emulator. + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)currSDK.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + if (sbsv1BuildInfo != null) { + if (!sbsv1BuildInfo.isS60() && + !currSDK.getFamily().equalsIgnoreCase(ISBSv1BuildInfo.TECHVIEW_FAMILY_ID)) + return true; + } if ("exe".equalsIgnoreCase(mainExeHostPath.getFileExtension())) { //$NON-NLS-1$ Version version = currSDK.getOSVersion(); diff -r e17ab99b8f30 -r 03f5f8bf29b4 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java Wed Jul 21 11:32:00 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java Wed Jul 21 12:11:48 2010 -0500 @@ -71,7 +71,7 @@ import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.IService; import com.nokia.cdt.debug.cw.symbian.SettingsData; @@ -270,7 +270,7 @@ } // just check the platform for the default config - if (buildConfig.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (buildConfig.getPlatformString().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { isX86 = true; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianProjectPropertyTester.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianProjectPropertyTester.java Wed Jul 21 11:32:00 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianProjectPropertyTester.java Wed Jul 21 12:11:48 2010 -0500 @@ -31,7 +31,7 @@ import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; /** * A property tester that determines if a file is an executable. @@ -109,7 +109,7 @@ if (cpi != null) { ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); // just check the platform for the default config - if (buildConfig.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (buildConfig.getPlatformString().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { return true; } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/InstallationTab.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/InstallationTab.java Wed Jul 21 11:32:00 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/InstallationTab.java Wed Jul 21 12:11:48 2010 -0500 @@ -54,6 +54,7 @@ import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; @@ -420,7 +421,7 @@ for (ICarbideBuildConfiguration buildConfig : cpi.getBuildConfigurations()) { if (buildConfig.getDisplayString().equals(buildConfigName)) { // enable the controls for EKA2 configs - if (buildConfig.getSDK().isEKA2()) { + if (buildConfig.getSDK().getSupportedFeatures().contains(ISymbianSDKFeatures.IS_EKA2)) { puLabel.setVisible(true); puPath.setVisible(true); puLink.setVisible(true); diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/TestsPlugin.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/TestsPlugin.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/TestsPlugin.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,14 +16,21 @@ */ package com.nokia.carbide.cpp.epoc.engine.tests; -import com.nokia.carbide.cpp.sdk.core.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import junit.framework.TestCase; import org.eclipse.core.runtime.Plugin; import org.osgi.framework.BundleContext; -import java.util.*; - -import junit.framework.TestCase; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; /** * The main plugin class to be used in the desktop. @@ -68,7 +75,11 @@ */ public static List getUsableBuildConfigs() { for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) { - List contexts = sdk.getUnfilteredBuildConfigurations(); + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + List contexts = new ArrayList(); + contexts.addAll(sbsv1BuildInfo.getAllBuildConfigurations()); + contexts.addAll(sbsv2BuildInfo.getAllBuildConfigurations()); if (contexts.size() > 0) { return contexts.subList(0, Math.min(contexts.size(), 8)); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/BaseMMPViewTest.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/BaseMMPViewTest.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/BaseMMPViewTest.java Wed Jul 21 12:11:48 2010 -0500 @@ -93,7 +93,7 @@ return parserConfig; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { return defFileBase; } public boolean isEmulatorBuild() { @@ -117,7 +117,7 @@ public IViewParserConfiguration getViewParserConfiguration() { return parserConfig; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { return defFileBase; } public boolean isEmulatorBuild() { diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestMMPView3.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestMMPView3.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestMMPView3.java Wed Jul 21 12:11:48 2010 -0500 @@ -17,25 +17,27 @@ package com.nokia.carbide.cpp.epoc.engine.tests.model; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Version; + import com.nokia.carbide.cdt.builder.DefaultMMPViewConfiguration; import com.nokia.carbide.cdt.builder.DefaultViewParserConfiguration; import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement; import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPView; import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter; import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefineFactory; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory; import com.nokia.cpp.internal.api.utils.core.PathUtils; -import org.eclipse.core.runtime.*; -import org.osgi.framework.Version; - -import java.util.ArrayList; -import java.util.List; - /** * Test MMP view manipulation * @@ -55,7 +57,7 @@ sdk = null; if (!Platform.isRunning()) { sdk = SymbianSDKFactory.createInstance("S60_3rd", "c:\\symbian\\9.1\\S60_3rd", "com.nokia.s60", - new Version(9,0,0), null, null, false); + new Version(9,0,0), new Version(0,0,0)); // add to memory for standalone test, hopefully only affecting my system SDKCorePlugin.getSDKManager().addSDK(sdk); } else { @@ -68,9 +70,9 @@ } } if (sdk != null) { - winscwContext = new SymbianBuildContext(sdk, "WINSCW", "UDEB"); - armv5Context = new SymbianBuildContext(sdk, "ARMV5", "UDEB"); - gcceContext = new SymbianBuildContext(sdk, "GCCE", "UREL"); + winscwContext = new BuildContextSBSv1(sdk, "WINSCW", "UDEB"); + armv5Context = new BuildContextSBSv1(sdk, "ARMV5", "UDEB"); + gcceContext = new BuildContextSBSv1(sdk, "GCCE", "UREL"); buildContexts.add(winscwContext); buildContexts.add(armv5Context); buildContexts.add(gcceContext); diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestModelProvider.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestModelProvider.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestModelProvider.java Wed Jul 21 12:11:48 2010 -0500 @@ -121,7 +121,7 @@ return true; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { return "BWINS"; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestStandaloneModelProvider.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestStandaloneModelProvider.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestStandaloneModelProvider.java Wed Jul 21 12:11:48 2010 -0500 @@ -123,7 +123,7 @@ return true; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { return "BWINS"; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/parser/TestSystemMMPs.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/parser/TestSystemMMPs.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/parser/TestSystemMMPs.java Wed Jul 21 12:11:48 2010 -0500 @@ -123,7 +123,7 @@ return parserConfig; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { return "BWINS"; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/workspace/BaseProjectTests.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/workspace/BaseProjectTests.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/workspace/BaseProjectTests.java Wed Jul 21 12:11:48 2010 -0500 @@ -134,7 +134,7 @@ return true; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { return defFileBase; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/mmp/IMMPViewConfiguration.java --- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/mmp/IMMPViewConfiguration.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/mmp/IMMPViewConfiguration.java Wed Jul 21 12:11:48 2010 -0500 @@ -31,12 +31,11 @@ /** * Get the default directory used for .def file exports. - * @param isASSP true if this is an ASSP build * @return the name of the directory used for platform-specific defs * (e.g. "BWINS", "EABI", ...). This directory, if present, is removed from * the path before setting DEFFILE. May be null if unknown. */ - String getDefaultDefFileBase(boolean isASSP); + String getDefaultDefFileBase(); /** * Tell if this is an emulator build. Used for .def filepath calculation. diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/ViewDataCache.java --- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/ViewDataCache.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/ViewDataCache.java Wed Jul 21 12:11:48 2010 -0500 @@ -299,7 +299,10 @@ if (DEBUG_VERBOSE) { System.out.println("Found entry for " + key); //$NON-NLS-1$ } - cacheHits.put(key, cacheHits.get(key) + 1); + if ((cacheHits.get(key) != null)){ + cacheHits.put(key, cacheHits.get(key) + 1); + } + data = statefulData.second; } return data; diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/mmp/MMPView.java --- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/mmp/MMPView.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/mmp/MMPView.java Wed Jul 21 12:11:48 2010 -0500 @@ -973,7 +973,7 @@ String theDefFile = singleArgumentSettings.get(EMMPStatement.DEFFILE);; return convertMMPDefFileToProjectOrFullPath( theDefFile, isDefFileInFixedDirectory(), - viewConfiguration.getDefaultDefFileBase(isASSP()), + viewConfiguration.getDefaultDefFileBase(), viewConfiguration.isEmulatorBuild()); } @@ -989,7 +989,7 @@ //Check.checkState(ModelSynchronizer.FORCE_NEW_CONTENT_TO_MAIN_DOCUMENT); IMMPViewConfiguration viewConfiguration = (IMMPViewConfiguration) getViewConfiguration(); String newDefFile = convertPhysicalFileToMMPDefFile(path, - viewConfiguration.getDefaultDefFileBase(isASSP()), + viewConfiguration.getDefaultDefFileBase(), viewConfiguration.isEmulatorBuild(), isFixedDirectory); singleArgumentSettings.put(EMMPStatement.DEFFILE, newDefFile); diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/MissingSdkTest.java --- a/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/MissingSdkTest.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/MissingSdkTest.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,23 +16,30 @@ */ package com.nokia.carbide.cpp.project.core.tests; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.util.ArrayList; import java.util.List; import junit.framework.TestCase; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; import com.nokia.carbide.cpp.internal.api.sdk.SDKManagerInternalAPI; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; -import com.nokia.carbide.cpp.sdk.core.*; +import com.nokia.carbide.cpp.sdk.core.ISDKManager; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; public class MissingSdkTest extends TestCase { @@ -83,7 +90,7 @@ // put up to 4 configs among each SDK in devices.xml (to improve speed with custkits) List allConfigs = new ArrayList(); for (ISymbianSDK sdk : sdkList) { - List sdkConfigs = sdk.getFilteredBuildConfigurations(); + List sdkConfigs = sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getFilteredBuildConfigurations(); if (sdkConfigs == null) continue; if (sdkConfigs.size() <= 0) @@ -108,8 +115,10 @@ // check we only have those configs in the removed SDK in the missing list List configList = cpi.getBuildConfigurations(); int badCount = 0; - for (ICarbideBuildConfiguration config: configList) { - if (SDKManagerInternalAPI.getMissingSdk(SymbianBuildContext.getSDKIDFromConfigName(config.getDisplayString())) != null) { + for (ICarbideBuildConfiguration config: configList) { + // TODO: Hack to use static method for prototyping BuildContextSBSv1.getSDKIDFromConfigName + // Should be no static calls on those classes. + if (SDKManagerInternalAPI.getMissingSdk(BuildContextSBSv1.getSDKIDFromConfigName(config.getDisplayString())) != null) { badCount++; } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/TestBldInfImportDataLoader.java --- a/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/TestBldInfImportDataLoader.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/TestBldInfImportDataLoader.java Wed Jul 21 12:11:48 2010 -0500 @@ -37,7 +37,7 @@ import com.nokia.carbide.cpp.api.test.support.gen.InfImportTestData.InfComponentType; import com.nokia.carbide.cpp.api.test.support.gen.InfImportTestData.MakMakeRefType; import com.nokia.carbide.cpp.api.test.support.xml.BldInfImportDataLoader; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; import com.nokia.carbide.cpp.internal.project.utils.BldInfImportWrapper; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; @@ -88,7 +88,7 @@ for (BuildConfigType currConfigData : currInfData.getBuildConfigurations().getBuildConfig()){ String plat = currConfigData.getPlatform(); String target = currConfigData.getTarget().getName(); - SymbianBuildContext context = new SymbianBuildContext(sdk, plat, target); + BuildContextSBSv1 context = new BuildContextSBSv1(sdk, plat, target); buildConfigs.add(context); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/TestsPlugin.java --- a/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/TestsPlugin.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/TestsPlugin.java Wed Jul 21 12:11:48 2010 -0500 @@ -76,7 +76,7 @@ */ public static List getUsableBuildConfigs() { for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) { - List contexts = sdk.getUnfilteredBuildConfigurations(); + List contexts = sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations(); if (contexts.size() > 0) return contexts.subList(0, Math.min(contexts.size(), 8)); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.core/src/com/nokia/carbide/cpp/internal/api/project/core/ProjectCorePluginUtility.java --- a/project/com.nokia.carbide.cpp.project.core/src/com/nokia/carbide/cpp/internal/api/project/core/ProjectCorePluginUtility.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.core/src/com/nokia/carbide/cpp/internal/api/project/core/ProjectCorePluginUtility.java Wed Jul 21 12:11:48 2010 -0500 @@ -30,6 +30,7 @@ import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; import com.nokia.carbide.cdt.internal.api.builder.SISBuilderInfo2; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; public class ProjectCorePluginUtility { @@ -94,7 +95,7 @@ if (pkgFilePath != null) { SISBuilderInfo2 sisInfo = new SISBuilderInfo2(projDes.getProject()); sisInfo.setPKGFile(pkgFilePath); - if (config.getSDK().isEKA2()) { + if (config.getSDK().getSupportedFeatures().contains(ISymbianSDKFeatures.IS_EKA2)) { // set to self signing sisInfo.setSigningType(ISISBuilderInfo.SELF_SIGN); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.core/src/com/nokia/carbide/cpp/internal/api/project/core/ResourceChangeListener.java --- a/project/com.nokia.carbide.cpp.project.core/src/com/nokia/carbide/cpp/internal/api/project/core/ResourceChangeListener.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.core/src/com/nokia/carbide/cpp/internal/api/project/core/ResourceChangeListener.java Wed Jul 21 12:11:48 2010 -0500 @@ -454,7 +454,7 @@ } // check the extensions - BldInfViewPathHelper helper = new BldInfViewPathHelper(infView, cpi.getDefaultConfiguration()); + BldInfViewPathHelper helper = new BldInfViewPathHelper(infView, cpi.getDefaultConfiguration().getBuildContext()); for (IExtension extension : infView.getAllExtensions()) { IPath path = infPathHelper.convertToProject(helper.convertExtensionTemplateToFilesystem(extension.getTemplatePath())); if (path != null) { @@ -939,7 +939,7 @@ } // check the extensions - BldInfViewPathHelper helper = new BldInfViewPathHelper(infView, cpi.getDefaultConfiguration()); + BldInfViewPathHelper helper = new BldInfViewPathHelper(infView, cpi.getDefaultConfiguration().getBuildContext()); List extensions = infView.getExtensions(); for (Iterator iter = extensions.iterator(); iter.hasNext();) { IPath path = infPathHelper.convertToProject(helper.convertExtensionTemplateToFilesystem(iter.next().getTemplatePath())); diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/AIFOutputFileParametersComposite.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/AIFOutputFileParametersComposite.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/AIFOutputFileParametersComposite.java Wed Jul 21 12:11:48 2010 -0500 @@ -135,7 +135,7 @@ emptyIfNull(aifInfo.getResource()), EMMPPathContext.AIF_SOURCE, editorContext.getMMPViewPathHelper(), - editorContext.getBuildContext(), + editorContext.getCarbideBuildConfiguration(), editorContext.getRSSFiles(), new String[] { "*.rss" }, //$NON-NLS-1$ Messages.getString("AIFOutputFileParametersComposite.ResourceFilePathLabel")); //$NON-NLS-1$ diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/MultiImageEditorContext.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/MultiImageEditorContext.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/MultiImageEditorContext.java Wed Jul 21 12:11:48 2010 -0500 @@ -132,7 +132,7 @@ this.generatedExtension = "mif"; //$NON-NLS-1$ this.imagePathHelper = new ImageMakefileViewPathHelper( (IImageMakefileView) view, - new ISymbianBuildContext[] { getBuildContext() }); + new ISymbianBuildContext[] { getCarbideBuildConfiguration().getBuildContext() }); } commonInit(); @@ -367,7 +367,7 @@ public boolean supportsHeaderOnlyFlag() { if (imageFileType == MBM_FILE) { // flag added in 9.2 - ISymbianBuildContext buildContext = getBuildContext(); + ISymbianBuildContext buildContext = getCarbideBuildConfiguration().getBuildContext(); if (buildContext == null) return false; Version version = buildContext.getSDK().getOSVersion(); diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/MultiImageEditorContextBase.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/MultiImageEditorContextBase.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/MultiImageEditorContextBase.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,26 +16,22 @@ */ package com.nokia.carbide.cpp.internal.project.ui.editors.images; -import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; -import com.nokia.carbide.cdt.builder.ImageMakefileViewPathHelper; -import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; -import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -import com.nokia.carbide.cpp.epoc.engine.image.*; -import com.nokia.carbide.cpp.epoc.engine.model.*; -import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; -import com.nokia.carbide.cpp.internal.project.ui.images.*; -import com.nokia.carbide.cpp.internal.project.ui.images.providers.ThumbnailImageLabelProvider; -import com.nokia.carbide.cpp.internal.ui.images.CachingImageLoader; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.cpp.ui.images.IImageLoader; -import com.nokia.carbide.cpp.ui.images.IImageModel; -import com.nokia.cpp.internal.api.utils.core.CacheMap; +import java.util.ArrayList; +import java.util.regex.Pattern; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.*; +import org.eclipse.core.commands.operations.DefaultOperationHistory; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.IOperationHistoryListener; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.commands.operations.OperationHistoryEvent; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; import org.eclipse.jface.dialogs.DialogSettings; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.swt.graphics.Image; @@ -44,8 +40,34 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.ui.PlatformUI; -import java.util.ArrayList; -import java.util.regex.Pattern; +import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.ImageMakefileViewPathHelper; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.carbide.cpp.epoc.engine.image.IBitmapSourceReference; +import com.nokia.carbide.cpp.epoc.engine.image.IImageSource; +import com.nokia.carbide.cpp.epoc.engine.image.IImageSourceReference; +import com.nokia.carbide.cpp.epoc.engine.image.ISVGSourceReference; +import com.nokia.carbide.cpp.epoc.engine.image.ImageFormat; +import com.nokia.carbide.cpp.epoc.engine.model.IModel; +import com.nokia.carbide.cpp.epoc.engine.model.IModelProvider; +import com.nokia.carbide.cpp.epoc.engine.model.IView; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; +import com.nokia.carbide.cpp.internal.project.ui.images.CarbideImageModelFactory; +import com.nokia.carbide.cpp.internal.project.ui.images.IImageResolver; +import com.nokia.carbide.cpp.internal.project.ui.images.IImageSourceModel; +import com.nokia.carbide.cpp.internal.project.ui.images.IImageSourceReferenceModel; +import com.nokia.carbide.cpp.internal.project.ui.images.ISymbianImageContainerModel; +import com.nokia.carbide.cpp.internal.project.ui.images.providers.ThumbnailImageLabelProvider; +import com.nokia.carbide.cpp.internal.ui.images.CachingImageLoader; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; +import com.nokia.carbide.cpp.ui.images.IImageLoader; +import com.nokia.carbide.cpp.ui.images.IImageModel; +import com.nokia.cpp.internal.api.utils.core.CacheMap; public abstract class MultiImageEditorContextBase { private static final Pattern LEGAL_FILENAME_PATTERN = Pattern.compile("[A-Za-z0-9_]+"); //$NON-NLS-1$ @@ -247,7 +269,7 @@ * Get the default build context. * @return build context or null */ - public ICarbideBuildConfiguration getBuildContext() { + public ICarbideBuildConfiguration getCarbideBuildConfiguration() { IProject project = getProject(); if (project == null) return null; @@ -401,10 +423,10 @@ * @return */ public boolean isEKA2() { - ISymbianBuildContext buildContext = getBuildContext(); + ISymbianBuildContext buildContext = getCarbideBuildConfiguration().getBuildContext(); ISymbianSDK sdk = buildContext != null ? buildContext.getSDK() : null; if (sdk != null) { - return sdk.isEKA2(); + return sdk.getSupportedFeatures().contains(ISymbianSDKFeatures.IS_EKA2); } return false; } @@ -414,10 +436,11 @@ * @return */ public boolean isS60() { - ISymbianBuildContext buildContext = getBuildContext(); + ISymbianBuildContext buildContext = getCarbideBuildConfiguration().getBuildContext(); ISymbianSDK sdk = buildContext != null ? buildContext.getSDK() : null; if (sdk != null) { - return sdk.isS60(); + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + return sbsv1BuildInfo.isS60(); } return false; diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/BldInfEditor.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/BldInfEditor.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/BldInfEditor.java Wed Jul 21 12:11:48 2010 -0500 @@ -197,7 +197,7 @@ editorContext.bldInfView = null; } BldInfEditorViewConfiguration viewConfig = new BldInfEditorViewConfiguration( - editorContext.activeBuildConfig, getProject()); + editorContext.activeBuildConfig.getBuildContext(), getProject()); editorContext.bldInfView = editorContext.bldInfModel.createView(viewConfig); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/images/CarbideImageModelFactory.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/images/CarbideImageModelFactory.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/images/CarbideImageModelFactory.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,22 +16,32 @@ */ package com.nokia.carbide.cpp.internal.project.ui.images; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; + import com.nokia.carbide.cdt.builder.ImageMakefileViewPathHelper; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -import com.nokia.carbide.cpp.epoc.engine.image.*; +import com.nokia.carbide.cpp.epoc.engine.image.IImageSource; +import com.nokia.carbide.cpp.epoc.engine.image.IImageSourceReference; +import com.nokia.carbide.cpp.epoc.engine.image.IMultiImageSource; +import com.nokia.carbide.cpp.epoc.engine.image.ImageFormat; import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPAIFInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; import com.nokia.carbide.cpp.internal.ui.images.CachingImageLoader; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.cpp.ui.images.*; +import com.nokia.carbide.cpp.ui.images.IImageContainerEditorProvider; +import com.nokia.carbide.cpp.ui.images.IImageContainerModel; +import com.nokia.carbide.cpp.ui.images.IImageContainerModelListener; +import com.nokia.carbide.cpp.ui.images.IImageLoader; +import com.nokia.carbide.cpp.ui.images.IImageModel; +import com.nokia.carbide.cpp.ui.images.ImageContainerModelBase; +import com.nokia.carbide.cpp.ui.images.ImageModelFactory; import com.nokia.cpp.internal.api.utils.core.ProjectUtils; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.osgi.framework.Version; - -import java.util.*; - /** * Factory for Carbide-specific image models and containers * @@ -280,30 +290,8 @@ * @return flag */ public static boolean doesProjectSupportSVG(ICarbideProjectInfo projectInfo) { - boolean supportsSVG = false; - if (projectInfo == null) - return true; - - List buildConfigurations = projectInfo.getBuildConfigurations(); - for (ICarbideBuildConfiguration buildConfiguration : buildConfigurations) { - ISymbianSDK sdk = buildConfiguration.getSDK(); - if (sdk.isS60()) { - Version version = sdk.getSDKVersion(); - if (version != null) { - if (version.compareTo(new Version(2, 8, 0)) >= 0) { - supportsSVG = true; - break; - } - } - } - if (sdk.getFamily().equals(ISymbianSDK.UIQ_FAMILY_ID)) { - Version version = sdk.getSDKVersion(); - supportsSVG |= version != null && version.compareTo(new Version(3, 1, 0)) >= 0; - if (supportsSVG) - break; - } - } - return supportsSVG; + // SVG supported after 2.8 on S60 + return true; } /** @@ -317,8 +305,7 @@ if (projectInfo != null) { List buildConfigurations = projectInfo.getBuildConfigurations(); for (ICarbideBuildConfiguration buildConfiguration : buildConfigurations) { - ISymbianSDK sdk = buildConfiguration.getSDK(); - if (sdk.getFamily().equals(ISymbianSDK.UIQ_FAMILY_ID)) { + if (buildConfiguration.getSDK().getFamily().equals(ISBSv1BuildInfo.UIQ_FAMILY_ID)) { imageConverterFactory = new UIQImageConverterFactory(); break; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/images/providers/ImageTableLabelProvider.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/images/providers/ImageTableLabelProvider.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/images/providers/ImageTableLabelProvider.java Wed Jul 21 12:11:48 2010 -0500 @@ -60,7 +60,7 @@ if (view instanceof IImageMakefileView) { this.imageViewPathHelper = new ImageMakefileViewPathHelper( (IImageMakefileView) view, - new ISymbianBuildContext[] { editorContext.getBuildContext() }); + new ISymbianBuildContext[] { editorContext.getCarbideBuildConfiguration().getBuildContext() }); } COLUMN_THUMB = 0; COLUMN_FORMAT = 1; diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ImporterBuildTargetsPage.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ImporterBuildTargetsPage.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ImporterBuildTargetsPage.java Wed Jul 21 12:11:48 2010 -0500 @@ -24,7 +24,15 @@ import org.eclipse.jface.viewers.TreeNode; import org.eclipse.swt.widgets.TreeItem; -import com.nokia.carbide.cpp.sdk.core.*; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; +import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISDKManager; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.cpp.sdk.ui.shared.BuildTargetsPage; public class ImporterBuildTargetsPage extends BuildTargetsPage { @@ -67,7 +75,14 @@ for (int i=0; i 0){ + IBSFCatalog bsfCatalog = null; + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + if (sbsv1BuildInfo != null) { + // SBSv1 only + bsfCatalog = sbsv1BuildInfo.getBSFCatalog(); + } + if (sdkMgr.getBSFScannerEnabled() || (bsfCatalog != null && bsfCatalog.getVirtualVariantPlatforms().length > 0)){ // Check and see if any of the configs in the SDK // match any configuration that has been selected before // for this SDK. @@ -121,7 +136,13 @@ ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); for (ISymbianBuildContext currContext : selectedConfigs){ ISymbianSDK sdk = currContext.getSDK(); - if (sdk.getBSFCatalog().getVirtualVariantPlatforms().length > 0 || sdkMgr.getBSFScannerEnabled()){ + IBSFCatalog bsfCatalog = null; + if (currContext instanceof ISBSv1BuildContext) { + // SBSv1 only + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + bsfCatalog = sbsv1BuildInfo.getBSFCatalog(); + } + if (sdkMgr.getBSFScannerEnabled() || (bsfCatalog != null && bsfCatalog.getVirtualVariantPlatforms().length > 0)){ // this setting needs to be persisted. settingsNeedUpdate = true; selectedConfigsToSave.add(currContext); diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/LibrarySectionPart.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/LibrarySectionPart.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/LibrarySectionPart.java Wed Jul 21 12:11:48 2010 -0500 @@ -220,7 +220,7 @@ @SuppressWarnings("unchecked") //$NON-NLS-1$ protected void addButtonPressed() { - Set sdkLibraries = EpocEngineHelper.getSDKLibrariesForBuildContext(editorContext.activeBuildConfig); + Set sdkLibraries = EpocEngineHelper.getSDKLibrariesForBuildContext(editorContext.activeBuildConfig.getBuildContext()); // remove already included libraries from the list so we don't show them as candidates for adding List includedList = (List) tableViewer.getInput(); sdkLibraries.removeAll(includedList); diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/MMPEditor.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/MMPEditor.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/MMPEditor.java Wed Jul 21 12:11:48 2010 -0500 @@ -219,7 +219,7 @@ editorContext.mmpView = null; } MMPEditorViewConfiguration viewConfig = new MMPEditorViewConfiguration( - editorContext.activeBuildConfig, getProject()); + editorContext.activeBuildConfig.getBuildContext(), getProject()); editorContext.mmpView = editorContext.mmpModel.createView(viewConfig); } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/views/SPNViewContentProvider.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/views/SPNViewContentProvider.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/views/SPNViewContentProvider.java Wed Jul 21 12:11:48 2010 -0500 @@ -16,40 +16,105 @@ */ package com.nokia.carbide.cpp.internal.project.ui.views; -import com.nokia.carbide.cdt.builder.*; -import com.nokia.carbide.cdt.builder.project.*; -import com.nokia.carbide.cpp.epoc.engine.*; -import com.nokia.carbide.cpp.epoc.engine.image.*; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.*; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExtension; -import com.nokia.carbide.cpp.epoc.engine.model.makefile.image.IImageMakefileData; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.*; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.*; -import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.cpp.ui.CarbideUIPlugin; -import com.nokia.carbide.cpp.ui.ICarbideSharedImages; -import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.DependencyScanner; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Set; -import org.eclipse.cdt.core.model.*; +import org.eclipse.cdt.core.model.CModelException; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.CoreModelUtil; +import org.eclipse.cdt.core.model.ElementChangedEvent; +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ICElementDelta; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.IElementChangedListener; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.internal.core.model.ExternalTranslationUnit; import org.eclipse.cdt.ui.CElementGrouping; import org.eclipse.cdt.ui.CElementSorter; import org.eclipse.core.filesystem.URIUtil; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.core.runtime.IAdapterManager; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.*; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.ui.*; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.model.BaseWorkbenchContentProvider; import org.eclipse.ui.model.IWorkbenchAdapter; -import java.io.*; -import java.util.*; +import com.nokia.carbide.cdt.builder.BldInfViewPathHelper; +import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.DefaultImageMakefileViewConfiguration; +import com.nokia.carbide.cdt.builder.DefaultMMPViewConfiguration; +import com.nokia.carbide.cdt.builder.DefaultViewConfiguration; +import com.nokia.carbide.cdt.builder.EMMPPathContext; +import com.nokia.carbide.cdt.builder.EpocEnginePathHelper; +import com.nokia.carbide.cdt.builder.ImageMakefileViewPathHelper; +import com.nokia.carbide.cdt.builder.MMPViewPathHelper; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +import com.nokia.carbide.cdt.builder.project.ICarbideConfigurationChangedListener; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectPropertyChangedListener; +import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; +import com.nokia.carbide.cpp.epoc.engine.BldInfDataRunnableAdapter; +import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; +import com.nokia.carbide.cpp.epoc.engine.ImageMakefileDataRunnableAdapter; +import com.nokia.carbide.cpp.epoc.engine.MMPDataRunnableAdapter; +import com.nokia.carbide.cpp.epoc.engine.image.IBitmapSource; +import com.nokia.carbide.cpp.epoc.engine.image.IBitmapSourceReference; +import com.nokia.carbide.cpp.epoc.engine.image.IImageSource; +import com.nokia.carbide.cpp.epoc.engine.image.IMultiImageSource; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfData; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExtension; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMMPReference; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakMakeReference; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakefileReference; +import com.nokia.carbide.cpp.epoc.engine.model.makefile.image.IImageMakefileData; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPAIFInfo; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPResource; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefaultModelDocumentProvider; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefaultTranslationUnitProvider; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.IIncludeFileLocator; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; +import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.ui.CarbideUIPlugin; +import com.nokia.carbide.cpp.ui.ICarbideSharedImages; +import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.DependencyScanner; /** * Content provider for the SymbianProjectNavigatorView @@ -684,7 +749,7 @@ } EpocEnginePlugin.runWithBldInfData(cpi.getWorkspaceRelativeBldInfPath(), - new DefaultViewConfiguration(project, cpi.getDefaultConfiguration(), new AcceptedNodesViewFilter()), + new DefaultViewConfiguration(project, cpi.getDefaultConfiguration().getBuildContext(), new AcceptedNodesViewFilter()), new BldInfDataRunnableAdapter() { public Object run(IBldInfData view) { @@ -845,7 +910,7 @@ // get the list of extension makefiles BldInfViewPathHelper pathHelper = new BldInfViewPathHelper(view, - cpi.getDefaultConfiguration()); + cpi.getDefaultConfiguration().getBuildContext()); Set visitedPaths = new HashSet(); @@ -1299,7 +1364,7 @@ final ICarbideBuildConfiguration defaultConfig = cpi.getDefaultConfiguration(); final IFile mmpFile = parentFile; EpocEnginePlugin.runWithMMPData(parentFile.getFullPath(), - new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration(), new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration().getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData data) { @@ -1407,7 +1472,7 @@ final ICarbideBuildConfiguration defaultConfig = cpi.getDefaultConfiguration(); EpocEnginePlugin.runWithMMPData(parentFile.getFullPath(), - new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration(), new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration().getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData view) { @@ -1473,7 +1538,7 @@ return resources; EpocEnginePlugin.runWithMMPData(parentFile.getFullPath(), - new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration(), new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration().getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData view) { @@ -1697,7 +1762,7 @@ return includes; EpocEnginePlugin.runWithMMPData(parentFile.getFullPath(), - new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration(), new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration().getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { private MMPViewPathHelper helper = new MMPViewPathHelper(cpi.getDefaultConfiguration()); @@ -1776,7 +1841,7 @@ return mbmContainers; EpocEnginePlugin.runWithMMPData(parentFile.getFullPath(), - new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration(), new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration().getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData view) { @@ -1856,7 +1921,7 @@ return documents; EpocEnginePlugin.runWithMMPData(parentFile.getFullPath(), - new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration(), new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration().getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData view) { @@ -1901,7 +1966,7 @@ return defs; EpocEnginePlugin.runWithMMPData(parentFile.getFullPath(), - new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration(), new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration().getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData view) { @@ -1959,7 +2024,7 @@ return mbmSources; EpocEnginePlugin.runWithMMPData(parentFile.getFullPath(), - new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration(), new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration().getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData view) { @@ -2041,9 +2106,13 @@ public Object run(IImageMakefileData data) { List configs = cpi.getBuildConfigurations(); + List buildContexs = new ArrayList(); + for (ICarbideBuildConfiguration config : configs){ + buildContexs.add(config.getBuildContext()); + } ImageMakefileViewPathHelper helper = new ImageMakefileViewPathHelper( data, - (ICarbideBuildConfiguration[]) configs.toArray(new ICarbideBuildConfiguration[configs.size()])); + (ISymbianBuildContext[]) configs.toArray(new ISymbianBuildContext[buildContexs.size()])); List images = data.getMultiImageSources(); for (IMultiImageSource image : images) { if (image.getTargetFilePath().equals(targetFilePath)) { @@ -2171,7 +2240,7 @@ return aifs; EpocEnginePlugin.runWithMMPData(parentFile.getFullPath(), - new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration(), new AcceptedNodesViewFilter()), + new DefaultMMPViewConfiguration(project, cpi.getDefaultConfiguration().getBuildContext(), new AcceptedNodesViewFilter()), new MMPDataRunnableAdapter() { public Object run(IMMPData view) { diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/ImporterScritpingUtils.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/ImporterScritpingUtils.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/ImporterScritpingUtils.java Wed Jul 21 12:11:48 2010 -0500 @@ -10,11 +10,13 @@ import org.eclipse.core.runtime.Path; import com.nokia.carbide.cdt.builder.EpocEngineHelper; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; import com.nokia.carbide.cpp.internal.project.utils.BldInfImportWrapper; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; public class ImporterScritpingUtils { @@ -116,12 +118,16 @@ // Validate target and context strings against ISymbianBuildContext // AssertTestCase.assertTrue("!Invalid build target, should be ARMV5, GCCE, WINSCW, etc.. but was: " + buildTarget, validateBuildTarget(buildTarget)); // AssertTestCase.assertTrue("!Invalid build context, should be UREL or UDEB, but was: " + buildContext, validateBuildContext(buildContext)); - ISymbianBuildContext context = new SymbianBuildContext(sdk, buildTarget, buildContext); + BuildContextSBSv1 context = new BuildContextSBSv1(sdk, buildTarget, buildContext); selectedConfigs.add(context); } } else { - selectedConfigs = sdk.getFilteredBuildConfigurations(); + selectedConfigs = new ArrayList(); + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + selectedConfigs.addAll(sbsv1BuildInfo.getFilteredBuildConfigurations()); + selectedConfigs.addAll(sbsv1BuildInfo.getFilteredBuildConfigurations()); } return selectedConfigs; } diff -r e17ab99b8f30 -r 03f5f8bf29b4 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/SymbianProject.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/SymbianProject.java Wed Jul 21 11:32:00 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/SymbianProject.java Wed Jul 21 12:11:48 2010 -0500 @@ -23,7 +23,7 @@ import org.eclipse.core.resources.IProject; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; import com.nokia.carbide.cpp.sdk.core.ISDKManager; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; @@ -51,7 +51,7 @@ // " is not on the same drive as SDK: " + sdkName // + " and could not import: " + projectName); } - contexts.add(new SymbianBuildContext(sdk, currMap + contexts.add(new BuildContextSBSv1(sdk, currMap .get(KEY_PLATFORM), currMap.get(KEY_TARGET))); } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtFilter.java --- a/qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtFilter.java Wed Jul 21 11:32:00 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtFilter.java Wed Jul 21 12:11:48 2010 -0500 @@ -18,20 +18,22 @@ import java.io.File; +import org.eclipse.core.runtime.IPath; import org.eclipse.jface.viewers.IFilter; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; public abstract class QtFilter implements IFilter { protected File getLibFile(ISymbianBuildContext context) { - - if (context.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { - return context.getSDK().getReleaseRoot().append(context.getPlatformString()). + IPath releaseRoot = context.getSDK().getReleaseRoot(); + if (context.getPlatformString().toUpperCase().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { + return releaseRoot.append(context.getPlatformString()). append(context.getTargetString()).append("QtCore.dll").toFile(); //$NON-NLS-1$ } else { // for non-emulator targets, check in the armv5/lib directory (ARMV5 and GCCE) - return context.getSDK().getReleaseRoot().append("armv5/lib/QtCore.lib").toFile(); //$NON-NLS-1$ + return releaseRoot.append("armv5/lib/QtCore.lib").toFile(); //$NON-NLS-1$ } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtSDKUtils.java --- a/qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtSDKUtils.java Wed Jul 21 11:32:00 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtSDKUtils.java Wed Jul 21 12:11:48 2010 -0500 @@ -101,17 +101,19 @@ refreshQtStoredSDKs(); - if (qtSDKList.size() == 0){ - return null; - } - - for (QtSDK qtSDK : qtSDKList){ - File currBinPath = new File(qtSDK.binPath); - File currIncPath = new File(qtSDK.incPath); + synchronized(qtSDKList) { + if (qtSDKList.size() == 0){ + return null; + } - if ( (currBinPath.equals(oldQtBinPath) && currIncPath.equals(qtIncPath)) || - (currBinPath.equals(newQtBinPath) && currIncPath.equals(qtIncPath))){ - return qtSDK.name; + for (QtSDK qtSDK : qtSDKList){ + File currBinPath = new File(qtSDK.binPath); + File currIncPath = new File(qtSDK.incPath); + + if ( (currBinPath.equals(oldQtBinPath) && currIncPath.equals(qtIncPath)) || + (currBinPath.equals(newQtBinPath) && currIncPath.equals(qtIncPath))){ + return qtSDK.name; + } } } @@ -170,33 +172,34 @@ * Update the internal list of Qt-SDKs found in the Qt global preferences */ static void refreshQtStoredSDKs(){ - - qtSDKList.clear(); - - IPreferenceStore store = QtProjectPlugin.getDefault().getPreferenceStore(); - int count = store.getInt(PreferenceConstants.QTVERSION_COUNT); - for (int i = 0; i < count; i++) { - String nameKey = PreferenceConstants.QTVERSION_NAME + "." - + Integer.toString(i); - String binpathKey = PreferenceConstants.QTVERSION_BINPATH + "." - + Integer.toString(i); - String includepathKey = PreferenceConstants.QTVERSION_INCLUDEPATH - + "." + Integer.toString(i); - String name = ""; - String binPath = ""; - String incPath = ""; - if (store.contains(nameKey)) { - name = store.getString(nameKey); + synchronized(qtSDKList) { + qtSDKList.clear(); + + IPreferenceStore store = QtProjectPlugin.getDefault().getPreferenceStore(); + int count = store.getInt(PreferenceConstants.QTVERSION_COUNT); + for (int i = 0; i < count; i++) { + String nameKey = PreferenceConstants.QTVERSION_NAME + "." + + Integer.toString(i); + String binpathKey = PreferenceConstants.QTVERSION_BINPATH + "." + + Integer.toString(i); + String includepathKey = PreferenceConstants.QTVERSION_INCLUDEPATH + + "." + Integer.toString(i); + String name = ""; + String binPath = ""; + String incPath = ""; + if (store.contains(nameKey)) { + name = store.getString(nameKey); + } + if (store.contains(binpathKey)) { + binPath = store.getString(binpathKey); + } + if (store.contains(includepathKey)) { + incPath = store.getString(includepathKey); + } + + QtSDK qtSDK = new QtSDK(name, incPath, binPath); + qtSDKList.add(qtSDK); } - if (store.contains(binpathKey)) { - binPath = store.getString(binpathKey); - } - if (store.contains(includepathKey)) { - incPath = store.getString(includepathKey); - } - - QtSDK qtSDK = new QtSDK(name, incPath, binPath); - qtSDKList.add(qtSDK); } } diff -r e17ab99b8f30 -r 03f5f8bf29b4 qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QMakeEnvironmentModifier.java --- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QMakeEnvironmentModifier.java Wed Jul 21 11:32:00 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QMakeEnvironmentModifier.java Wed Jul 21 12:11:48 2010 -0500 @@ -40,7 +40,7 @@ if (cpi != null) { ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); if (config != null) { - ISymbianSDK sdk = config.getSDK(); + ISymbianSDK sdk = config.getBuildContext().getSDK(); if (sdk != null) { // set EPOCROOT for the SDK of the current build configuration IPath epocRoot = new Path(sdk.getEPOCROOT()); diff -r e17ab99b8f30 -r 03f5f8bf29b4 qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QtUIPlugin.java --- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QtUIPlugin.java Wed Jul 21 11:32:00 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QtUIPlugin.java Wed Jul 21 12:11:48 2010 -0500 @@ -46,7 +46,7 @@ import com.nokia.carbide.cpp.internal.qt.core.QtCorePlugin; import com.nokia.carbide.cpp.internal.qt.core.QtSDKUtils; import com.nokia.carbide.cpp.internal.qt.ui.wizard.Messages; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; public class QtUIPlugin extends AbstractUIPlugin implements ICarbideConfigurationChangedListener, ISDKManagerLoadedHook { @@ -109,7 +109,7 @@ IFile file = project.getFile(project.getName() + underscore + config.getPlatformString().toLowerCase() + underscore + config.getTargetString().toLowerCase() + ".pkg"); //$NON-NLS-1$ - if (file == null || !file.exists() && !config.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (file == null || !file.exists() && !config.getPlatformString().toUpperCase().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { // Qt 4.6 only creates one PKG file per project. Do not add for WINSCW file = project.getFile(project.getName() + underscore + template + ".pkg"); //$NON-NLS-1$ } diff -r e17ab99b8f30 -r 03f5f8bf29b4 qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtImporterBuildTargetsPage.java --- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtImporterBuildTargetsPage.java Wed Jul 21 11:32:00 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtImporterBuildTargetsPage.java Wed Jul 21 12:11:48 2010 -0500 @@ -21,8 +21,13 @@ import org.eclipse.jface.dialogs.IDialogSettings; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; +import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; +import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISDKManager; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; @@ -59,7 +64,13 @@ ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); for (ISymbianBuildContext currContext : selectedConfigs){ ISymbianSDK sdk = currContext.getSDK(); - if (sdk.getBSFCatalog().getVirtualVariantPlatforms().length > 0 || sdkMgr.getBSFScannerEnabled()){ + IBSFCatalog bsfCatalog = null; + if (currContext instanceof ISBSv1BuildContext) { + // SBSv1 only + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + bsfCatalog = sbsv1BuildInfo.getBSFCatalog(); + } + if (bsfCatalog != null && bsfCatalog.getVirtualVariantPlatforms().length > 0 || sdkMgr.getBSFScannerEnabled()){ // this setting needs to be persisted. settingsNeedUpdate = true; selectedConfigsToSave.add(currContext);