# HG changeset patch # User timkelly # Date 1282752513 18000 # Node ID c71aea166ff8d9a875df428c24b1741deec88745 # Parent 5486b48b06ad0dc7fb842d3e26cecf2327f5e199# Parent 6507baa94ab88b8b776d3fdbb8a11366771da731 merge from default diff -r 6507baa94ab8 -r c71aea166ff8 .branch.txt diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder.test/plugin.xml --- a/builder/com.nokia.carbide.cdt.builder.test/plugin.xml Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/plugin.xml Wed Aug 25 11:08:33 2010 -0500 @@ -1,9 +1,10 @@ + - + diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/AllTests.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/AllTests.java Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/AllTests.java Wed Aug 25 11:08:33 2010 -0500 @@ -36,7 +36,9 @@ suite.addTestSuite(TestProjectExportsGatherer.class); suite.addTestSuite(BuilderPrefConstantsTest.class); suite.addTestSuite(TestEnvironmentModifier.class); + suite.addTestSuite(TestCarbideProjectSettingsModifier.class); suite.addTestSuite(TestEpocEngineHelper.class); + suite.addTestSuite(SBSv2QueryTests.class); // error parser tests.... suite.addTestSuite(com.nokia.carbide.cdt.builder.test.errorParsers.TestMakmakeErrorParser.class); diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/ProjectPropertiesTest.java Wed Aug 25 11:08:33 2010 -0500 @@ -26,15 +26,16 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.NullProgressMonitor; -import com.nokia.carbide.cdt.builder.BuildArgumentsInfo; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; -import com.nokia.carbide.cdt.builder.project.IBuildArgumentsInfo; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; 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.BuildArgumentsInfo; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; +import com.nokia.carbide.cpp.internal.api.sdk.IBuildArgumentsInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; @@ -171,11 +172,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); @@ -270,11 +271,12 @@ assertNotNull("Ooops, ICarbideProjectInfo is null, something bad happened.", cpi); ICarbideBuildConfiguration defaultConfig = cpi.getDefaultConfiguration(); - BuildArgumentsInfo argInfoCopyOrig = defaultConfig.getBuildArgumentsInfoCopy(); - BuildArgumentsInfo argInfoCopyMod = defaultConfig.getBuildArgumentsInfoCopy(); + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)defaultConfig.getBuildContext(); + BuildArgumentsInfo argInfoCopyOrig = sbsv1Context.getBuildArgumentsInfoCopy(); + BuildArgumentsInfo argInfoCopyMod = sbsv1Context.getBuildArgumentsInfoCopy(); // Just sanity check to make sure deprecated methods still exist. - IBuildArgumentsInfo testDeprecation = defaultConfig.getBuildArgumentsInfo(); + IBuildArgumentsInfo testDeprecation = sbsv1Context.getBuildArgumentsInfo(); /*String test =*/ testDeprecation.getAbldBuildArgs(); @@ -290,10 +292,10 @@ argInfoCopyMod.abldTargetArgs += target_ARG; // set the argument - defaultConfig.setBuildArgumentsInfo(argInfoCopyMod); + sbsv1Context.setBuildArgumentsInfo(argInfoCopyMod); // read the args from memory, make sure it's OK - BuildArgumentsInfo argInfoCopyVerify = defaultConfig.getBuildArgumentsInfoCopy(); + BuildArgumentsInfo argInfoCopyVerify = sbsv1Context.getBuildArgumentsInfoCopy(); assertTrue("Failed to re-read build args", argInfoCopyVerify.abldBuildArgs.contains(build_ARG)); assertTrue("Failed to re-read clean args", argInfoCopyVerify.abldCleanArgs.contains(clean_ARG)); assertTrue("Failed to re-read export args", argInfoCopyVerify.abldExportArgs.contains(export_ARG)); @@ -310,7 +312,7 @@ // now read again // no work, how to know if it loads from disk.... - BuildArgumentsInfo argInfoFromDisk = defaultConfig.getBuildArgumentsInfoCopy(); + BuildArgumentsInfo argInfoFromDisk = sbsv1Context.getBuildArgumentsInfoCopy(); // read the args now that were pulled from disk, make sure it's OK assertTrue("Failed to re-read build args", argInfoFromDisk.abldBuildArgs.contains(build_ARG)); @@ -324,10 +326,10 @@ assertTrue("Failed to re-read target args", argInfoFromDisk.abldTargetArgs.contains(target_ARG)); // Now restore the settings, write to disk and verify - defaultConfig.setBuildArgumentsInfo(argInfoCopyOrig); + sbsv1Context.setBuildArgumentsInfo(argInfoCopyOrig); defaultConfig.saveConfiguration(false); // write to disk defaultConfig = cpi.getDefaultConfiguration(); - argInfoCopyVerify = defaultConfig.getBuildArgumentsInfoCopy(); + argInfoCopyVerify = sbsv1Context.getBuildArgumentsInfoCopy(); assertFalse("Failed to re-read build args after restore", argInfoCopyVerify.abldBuildArgs.contains(build_ARG)); assertFalse("Failed to re-read clean args after restore", argInfoCopyVerify.abldCleanArgs.contains(clean_ARG)); assertFalse("Failed to re-read export args after restore", argInfoCopyVerify.abldExportArgs.contains(export_ARG)); diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/SBSv2QueryTests.java Wed Aug 25 11:08:33 2010 -0500 @@ -17,15 +17,17 @@ */ 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.ISBSv2BuildContext; +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.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 +35,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 +43,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 +55,39 @@ 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(); + SBSv2QueryUtils.removeAllCachedQueries(); // ensure sbs needs to build an entirely new cache - 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)); + ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(SDK_ID1, true); + assertNotNull(sdk); + + 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()); + } + + assertTrue(sbsv2Context.getConfigQueryData().getTargettypes().size() > 0); + } } - - - /** - * 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 +96,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 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestCarbideProjectSettingsModifier.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestCarbideProjectSettingsModifier.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,96 @@ +/* +* 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.cdt.builder.test; + +import java.util.ArrayList; + +import junit.framework.TestCase; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.dom.IPDOMManager; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.NullProgressMonitor; + +import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.extension.ICarbidePrefsModifier; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; + + +public class TestCarbideProjectSettingsModifier extends TestCase { + static IProject project; + static ISymbianSDK symbianSDKS60_30; + + protected static final String PROJECT_NAME = "test-prj-modifier-project"; + + private static final String ABLD_BUILD_ARG_SETTING = "ABLD_BUILD_ARG_SETTING"; + + // First thing we have to do is actually create a project in a workspace... + protected void setUp() throws Exception { + if (project == null){ + // turn off the indexer + CCorePlugin.getIndexManager().setDefaultIndexerId(IPDOMManager.ID_NO_INDEXER); + + project = ProjectCorePlugin.createProject(PROJECT_NAME, null); + + ProjectCorePlugin.postProjectCreatedActions(project, "group/bld.inf", TestPlugin.getUsableBuildConfigs(), new ArrayList(), "Debug MMP", null, new NullProgressMonitor()); + } + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + // Make sure the project nature is there + @SuppressWarnings("deprecation") + public void testModifier() throws Exception{ + assertNotNull(project); + + ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); + assertNotNull(cpi); + + // get + ICarbidePrefsModifier extProvider = CarbideBuilderPlugin.getBuildManager().getPrefsModifier(); + + // this will be false once abld is deprecated + assertTrue(extProvider.isSupportedConfigurationPrefId(cpi.getDefaultConfiguration(), ICarbidePrefsModifier.ABLD_BUILD_ARG_SETTING)); + + assertFalse(extProvider.isSupportedConfigurationPrefId(cpi.getDefaultConfiguration(), "bad_id")); + + assertNotNull(extProvider); // will be null when SBSv1 support is removed + + String original = extProvider.getConfigurationValue(cpi.getDefaultConfiguration(), ABLD_BUILD_ARG_SETTING); + assertTrue(original.equals("")); + + extProvider.setConfigurationValue(cpi.getDefaultConfiguration(), "FOO", ABLD_BUILD_ARG_SETTING); + + cpi.getDefaultConfiguration().saveConfiguration(false); + + String test = extProvider.getConfigurationValue(cpi.getDefaultConfiguration(), ABLD_BUILD_ARG_SETTING); + assertTrue(test.equals("FOO")); + + extProvider.setConfigurationValue(cpi.getDefaultConfiguration(), original, ABLD_BUILD_ARG_SETTING); + + cpi.getDefaultConfiguration().saveConfiguration(false); + test = extProvider.getConfigurationValue(cpi.getDefaultConfiguration(), ABLD_BUILD_ARG_SETTING); + assertTrue(original.equals(test)); + } + + +} diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java Wed Aug 25 11:08:33 2010 -0500 @@ -44,6 +44,8 @@ import com.nokia.carbide.cpp.epoc.engine.MMPViewRunnableAdapter; 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.epoc.engine.preprocessor.IDefine; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.cpp.internal.api.utils.core.FileUtils; @@ -193,4 +195,21 @@ } } + public void testProjectMaroRetrieval() throws Exception { + ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(carbideProject); + + List projectDefines = EpocEngineHelper.getGlobalDefinesForConfiguration(cpi.getDefaultConfiguration(), null); + + boolean testSpecificMacro = false; + for (IDefine define: projectDefines){ + if (define.getName().equals("__SUPPORT_CPP_EXCEPTIONS__")){ + testSpecificMacro = true; + break; + } + } + assertTrue(testSpecificMacro); + + assertTrue(cpi.getDefaultConfiguration().getCompileTimeMacros().size() > 0); + } + } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPlugin.java Wed Aug 25 11:08:33 2010 -0500 @@ -17,17 +17,21 @@ */ package com.nokia.carbide.cdt.builder.test; -import com.nokia.carbide.cpp.sdk.core.*; - -import org.eclipse.ui.plugin.*; -import org.eclipse.jface.resource.ImageDescriptor; -import org.osgi.framework.BundleContext; - +import java.io.File; import java.util.Collections; import java.util.List; import junit.framework.TestCase; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +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 TestPlugin extends AbstractUIPlugin { //The shared instance. @@ -79,9 +83,12 @@ */ public static List getUsableBuildConfigs() { for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) { - List contexts = sdk.getUnfilteredBuildConfigurations(); - if (contexts.size() > 0) { - return contexts.subList(0, Math.min(contexts.size(), 8)); + if ((new File(sdk.getEPOCROOT()).exists())){ + // TODO: Convert to SBSv2 test + List contexts = sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations(); + if (contexts.size() > 0) { + return contexts.subList(0, Math.min(contexts.size(), 8)); + } } } TestCase.fail("No installed SDKs provide build configurations"); diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/CarbideErrorParserTestHarness.java --- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/CarbideErrorParserTestHarness.java Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/CarbideErrorParserTestHarness.java Wed Aug 25 11:08:33 2010 -0500 @@ -170,7 +170,6 @@ file = FileUtils.pluginRelativeFile(TestPlugin.getDefault(), "data/currentOutput.xml"); writeRegressionXMLFile(new java.io.PrintStream(file)); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -377,7 +376,6 @@ printStream.close(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/ErrorParserRegressionGenerator.java Wed Aug 25 11:08:33 2010 -0500 @@ -31,8 +31,10 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; 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); @@ -85,7 +87,7 @@ ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); harness = new CarbideErrorParserTestHarness(project, new NullProgressMonitor(), - CarbideCPPBuilder.getParserIdArray(buildConfig.getErrorParserId()), + buildConfig.getErrorParserList(), cpi.getINFWorkingDirectory()); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestGcceErrorParser.java Wed Aug 25 11:08:33 2010 -0500 @@ -30,8 +30,10 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; 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; } @@ -78,7 +80,7 @@ ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); harness = new CarbideErrorParserTestHarness(project, new NullProgressMonitor(), - CarbideCPPBuilder.getParserIdArray(buildConfig.getErrorParserId()), + buildConfig.getErrorParserList(), cpi.getINFWorkingDirectory()); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakeErrorParser.java Wed Aug 25 11:08:33 2010 -0500 @@ -30,8 +30,10 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; 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; @@ -40,7 +42,6 @@ public TestMakeErrorParser(String name) { super(name); - // TODO Auto-generated constructor stub } CarbideErrorParserTestHarness harness; @@ -57,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.EMULATOR_PLATFORM)) { + if (context.getPlatformString().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { contextList.add(context); break; } @@ -79,7 +80,7 @@ ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); harness = new CarbideErrorParserTestHarness(project, new NullProgressMonitor(), - CarbideCPPBuilder.getParserIdArray(buildConfig.getErrorParserId()), + buildConfig.getErrorParserList(), cpi.getINFWorkingDirectory()); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestMakmakeErrorParser.java Wed Aug 25 11:08:33 2010 -0500 @@ -31,8 +31,10 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; 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; } @@ -79,7 +81,7 @@ ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); harness = new CarbideErrorParserTestHarness(project, new NullProgressMonitor(), - CarbideCPPBuilder.getParserIdArray(buildConfig.getErrorParserId()), + buildConfig.getErrorParserList(), cpi.getINFWorkingDirectory()); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestRVCTErrorParser.java Wed Aug 25 11:08:33 2010 -0500 @@ -31,8 +31,10 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; 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; } @@ -81,7 +83,7 @@ ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); harness = new CarbideErrorParserTestHarness(project, new NullProgressMonitor(), - CarbideCPPBuilder.getParserIdArray(buildConfig.getErrorParserId()), + buildConfig.getErrorParserList(), cpi.getINFWorkingDirectory()); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/errorParsers/TestSBSv2ErrorParser.java Wed Aug 25 11:08:33 2010 -0500 @@ -31,8 +31,10 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.test.TestPlugin; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; import com.nokia.carbide.cpp.project.core.ProjectCorePlugin; 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; } @@ -79,7 +81,7 @@ ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration(); harness = new CarbideErrorParserTestHarness(project, new NullProgressMonitor(), - CarbideCPPBuilder.getParserIdArray(buildConfig.getErrorParserId()), + buildConfig.getErrorParserList(), cpi.getINFWorkingDirectory()); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 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 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/META-INF/MANIFEST.MF --- a/builder/com.nokia.carbide.cdt.builder/META-INF/MANIFEST.MF Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/META-INF/MANIFEST.MF Wed Aug 25 11:08:33 2010 -0500 @@ -25,8 +25,9 @@ Bundle-ActivationPolicy: lazy Export-Package: com.nokia.carbide.cdt.builder, com.nokia.carbide.cdt.builder.builder, + com.nokia.carbide.cdt.builder.extension, com.nokia.carbide.cdt.builder.project, com.nokia.carbide.cdt.internal.api.builder, com.nokia.carbide.cdt.internal.api.builder.ui, - com.nokia.carbide.cdt.builder.extension + com.nokia.carbide.cdt.internal.builder;x-friends:="com.nokia.carbide.cpp.builder.utils" Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/plugin.xml diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +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. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.carbide.cdt.builder; - -import com.nokia.carbide.cdt.builder.project.IBuildArgumentsInfo; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; - -/* - * Wrapper for the build arguments settings in Carbide Build Configuration preferences - */ -public class BuildArgumentsInfo implements IBuildArgumentsInfo { - - public static final String BLDMAKEBLDFILESARGSSTORAGE = "BLDMAKEBLDFILESARGSSTORAGE"; //$NON-NLS-1$ - public static final String BLDMAKECLEANARGSSTORAGE = "BLDMAKECLEANARGSSTORAGE"; //$NON-NLS-1$ - public static final String ABLDBUILDARGSSTORAGE = "ABLDBUILDARGSSTORAGE"; //$NON-NLS-1$ - public static final String ABLDEXPORTARGSSTORAGE = "ABLDEXPORTARGSSTORAGE"; //$NON-NLS-1$ - public static final String ABLDMAKEFILEARGSSTORAGE = "ABLDMAKEFILEARGSSTORAGE"; //$NON-NLS-1$ - public static final String ABLDLIBRARYARGSSTORAGE = "ABLDLIBRARYARGSSTORAGE"; //$NON-NLS-1$ - public static final String ABLDRESOURCEARGSSTORAGE = "ABLDRESOURCEARGSSTORAGE"; //$NON-NLS-1$ - public static final String ABLDTARGETARGSSTORAGE = "ABLDTARGETARGSSTORAGE"; //$NON-NLS-1$ - public static final String ABLDFINALARGSSTORAGE = "ABLDFINALARGSSTORAGE"; //$NON-NLS-1$ - public static final String ABLDCLEANARGSSTORAGE = "ABLDCLEANARGSSTORAGE"; //$NON-NLS-1$ - public static final String ABLDFREEZEARGSSTORAGE = "ABLDFREEZEARGSSTORAGE"; //$NON-NLS-1$ - - - public String bldmakeBldFilesArgs; - public String bldmakeCleanArgs; - public String abldBuildArgs; - public String abldExportArgs; - public String abldMakefileArgs; - public String abldLibraryArgs; - public String abldResourceArgs; - public String abldTargetArgs; - public String abldFinalArgs; - public String abldCleanArgs; - public String abldFreezeArgs; - - - public BuildArgumentsInfo(ISymbianSDK sdk) { - - this.bldmakeBldFilesArgs = ""; //$NON-NLS-1$ - this.bldmakeCleanArgs = ""; //$NON-NLS-1$ - this.abldBuildArgs = ""; //$NON-NLS-1$ - this.abldExportArgs = ""; //$NON-NLS-1$ - this.abldMakefileArgs = ""; //$NON-NLS-1$ - this.abldLibraryArgs = ""; //$NON-NLS-1$ - this.abldResourceArgs = ""; //$NON-NLS-1$ - this.abldTargetArgs = ""; //$NON-NLS-1$ - this.abldFinalArgs = ""; //$NON-NLS-1$ - this.abldCleanArgs = ""; //$NON-NLS-1$ - this.abldFreezeArgs = ""; //$NON-NLS-1$ - - if (sdk.isEKA2()) { - this.abldFreezeArgs = "-r"; //$NON-NLS-1$ - - } - } - - public BuildArgumentsInfo(String bldmakeBldFilesArgs, String bldmakeCleanArgs, String abldBuildArgs, String abldExportArgs, - String abldMakefileArgs, String abldLibraryArgs, String abldResourceArgs, String abldTargetArgs, String abldFinalArgs, - String abldCleanArgs, String abldFreezeArgs) { - - this.bldmakeBldFilesArgs = bldmakeBldFilesArgs; - this.bldmakeCleanArgs = bldmakeCleanArgs; - this.abldBuildArgs = abldBuildArgs; - this.abldExportArgs = abldExportArgs; - this.abldMakefileArgs = abldMakefileArgs; - this.abldLibraryArgs = abldLibraryArgs; - this.abldResourceArgs = abldResourceArgs; - this.abldTargetArgs = abldTargetArgs; - this.abldFinalArgs = abldFinalArgs; - this.abldCleanArgs = abldCleanArgs; - this.abldFreezeArgs = abldFreezeArgs; - } - - public BuildArgumentsInfo(BuildArgumentsInfo argInfo) { - - this.bldmakeBldFilesArgs = argInfo.bldmakeBldFilesArgs; - this.bldmakeCleanArgs = argInfo.bldmakeCleanArgs; - this.abldBuildArgs = argInfo.abldBuildArgs; - this.abldExportArgs = argInfo.abldExportArgs; - this.abldMakefileArgs = argInfo.abldMakefileArgs; - this.abldLibraryArgs = argInfo.abldLibraryArgs; - this.abldResourceArgs = argInfo.abldResourceArgs; - this.abldTargetArgs = argInfo.abldTargetArgs; - this.abldFinalArgs = argInfo.abldFinalArgs; - this.abldCleanArgs = argInfo.abldCleanArgs; - this.abldFreezeArgs = argInfo.abldFreezeArgs; - } - - public String getBldmakeBldFilesArgs() { - return bldmakeBldFilesArgs; - } - - public String getBldmakeCleanArgs() { - return bldmakeCleanArgs; - } - - public String getAbldBuildArgs() { - return abldBuildArgs; - } - - public String getAbldExportArgs() { - return abldExportArgs; - } - - public String getAbldMakefileArgs() { - return abldMakefileArgs; - } - - public String getAbldLibraryArgs() { - return abldLibraryArgs; - } - - public String getAbldResourceArgs() { - return abldResourceArgs; - } - - public String getAbldTargetArgs() { - return abldTargetArgs; - } - - public String getAbldFinalArgs() { - return abldFinalArgs; - } - - public String getAbldCleanArgs() { - return abldCleanArgs; - } - - public String getAbldFreezeArgs() { - return abldFreezeArgs; - } - -} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultGNUMakefileViewConfiguration.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultImageMakefileViewConfiguration.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultIncludeFileLocator.java Wed Aug 25 11:08:33 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,13 @@ } // get info from context - Check.checkState(buildContext instanceof SymbianBuildContext); + 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultMMPViewConfiguration.java Wed Aug 25 11:08:33 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.internal.api.sdk.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultViewConfiguration.java Wed Aug 25 11:08:33 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.ISBSv2BuildContext; +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.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,15 @@ public Collection getMacros() { List macros = new ArrayList(); if (context != null) { - - if (context.getSBSv2Alias() != null){ - macros.add(DefineFactory.createDefine("SBSV2", null)); + ISymbianSDK sdk = context.getSDK(); + + for (IDefine metaDataMacro : context.getMetadataMacros()) { + macros.add(metaDataMacro); } 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Wed Aug 25 11:08:33 2010 -0500 @@ -16,36 +16,85 @@ */ 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.CarbideProjectInfo; +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.epoc.engine.preprocessor.DefineFactory; +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.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildConfigInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContextDataCache; +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 { @@ -93,6 +142,7 @@ monitor.beginTask("Scanning bld.inf for mmp and make files", buildConfigs.size()); try { + // let cache know we're iterating a lot SymbianBuildContextDataCache.startProjectOperation(); @@ -369,7 +419,9 @@ && context.getSDK().getEPOCROOT() != null && new File(context.getSDK().getEPOCROOT()).exists()) { defaultContext = context; - if (defaultContext.getSDK().getPrefixFile() != null) + ISymbianSDK sdk = defaultContext.getSDK(); + + if (context.getPrefixFromVariantCfg() != null) break; } } @@ -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,17 +765,15 @@ return null; } - String releasePlatform = buildConfig.getSDK().getBSFCatalog().getReleasePlatform(buildConfig.getPlatformString()); - IPath path = buildConfig.getSDK().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.getSDK().getOSVersion().getMajor() < 9) { - String targetPath = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETPATH); - if (targetPath != null) { - path = path.append("z").append(targetPath); //$NON-NLS-1$ - } - } + 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()); } // adapt to variant, if needed @@ -736,7 +786,9 @@ } exePath = targetPath.toOSString(); + return exePath; + } }); } @@ -782,7 +834,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 +844,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; @@ -860,7 +912,8 @@ // adapt the exe filename to the variant, if any IPath tempPath = null; - if (isVariantBldInf(cpi.getAbsoluteBldInfPath()) || isFeatureVariantMMP(mmpData, cpi.getProject())) { + if ((isVariantBldInf(cpi.getAbsoluteBldInfPath()) || isFeatureVariantMMP(mmpData, cpi.getProject())) + && !CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject())) { tempPath = getBinaryVariantTargetName(mmpData, PathUtils.createPath(exePath), cpi.getProject()); if (tempPath == null){ return null; @@ -868,21 +921,46 @@ exePath = tempPath.lastSegment(); } - 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.getSDK().getOSVersion().getMajor() < 9) { - String targetPath = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETPATH); - if (targetPath != null) { - path = path.append("z").append(targetPath); //$NON-NLS-1$ - } + IPath path = null; + if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject()) && + isFeatureVariantMMP(mmpData, cpi.getProject())){ + + path = buildConfig.getTargetOutputDirectory(); + + } else { + // Not a variant + path = buildConfig.getTargetOutputDirectory(); + if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject())){ + // For SBSv2, it's not a variant, so it goes under the standard output dir + path = stripVariationFolder(path); } + } path = path.append(exePath); return path; } + + private IPath stripVariationFolder(IPath path) { + if (!path.toOSString().contains(".")){ + return path; + } + String[] segments = path.segments(); + int segmentCount = path.segmentCount(); + path = path.removeFirstSegments(segmentCount); + int count = 0; + path = path.addTrailingSeparator(); + for (String segment : segments){ + if (count == segmentCount - 2 && segment.contains(".")){ + path = path.append(segment.split("\\.")[0]); + } else { + path = path.append(segment); + } + count ++; + } + return path; + + } }); } @@ -916,9 +994,7 @@ // if the target path is not set then by default it will usually // be left blank. for EKA2 though binaries need to go in \sys\bin\ exePath = Path.ROOT.setDevice("C:"); //$NON-NLS-1$ - if (buildConfig.getSDK().getOSVersion().getMajor() > 8) { - exePath = exePath.append("sys/bin/"); //$NON-NLS-1$ - } + exePath = exePath.append("sys/bin/"); //$NON-NLS-1$ String targetName = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGET); if (targetName != null) { exePath = exePath.append(targetName); @@ -985,7 +1061,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 +1070,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) { @@ -1045,12 +1121,8 @@ if (targetPathStr != null) { targetPath = PathUtils.createPath(targetPathStr).makeAbsolute(); } else { - // for EKA1 just leave empty. for EKA2 use sys\bin\ - if (buildConfig.getSDK().getOSVersion().getMajor() > 8) { - targetPath = new Path("/sys/bin/"); //$NON-NLS-1$ - } else { - targetPath = Path.ROOT; //$NON-NLS-1$ - } + //for EKA2 use sys\bin\ + targetPath = new Path("/sys/bin/"); //$NON-NLS-1$ } IPath dataZDir = buildConfig.getSDK().getReleaseRoot().removeLastSegments(1).append("/data/z/"); //$NON-NLS-1$ @@ -1151,12 +1223,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 +1351,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 +1700,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 +1731,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 +1763,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 +1813,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,15 +1903,22 @@ 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) { for (final IMMPReference mmp : infView.getAllMMPReferences()) { - final IPath workspaceRelativeMMPPath = new Path(info.getProject().getName()).append(mmp.getPath()); + + IPath workspaceRelativeMMPPath1 = null; + if (info.getProjectRelativeBldInfPath().isAbsolute()){ + workspaceRelativeMMPPath1 = mmp.getPath(); + } else { + workspaceRelativeMMPPath1 = new Path(info.getProject().getName()).append(mmp.getPath()); + } + final IPath workspaceRelativeMMPPath = workspaceRelativeMMPPath1; 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 +2018,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 +2104,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) { @@ -2150,9 +2241,11 @@ if (cpi != null){ ICarbideBuildConfiguration defaultConfig = cpi.getDefaultConfiguration(); if (defaultConfig != null){ - if (defaultConfig.getBuildVariationName().length() > 0 && + if (defaultConfig.getBuildContext().getBuildVariationName().length() > 0 && mmpData.getFlags().contains(EMMPStatement.FEATUREVARIANT)) { - + isFeatureVariant = true; + } else if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project) && + mmpData.getFlags().contains(EMMPStatement.FEATUREVARIANT)){ isFeatureVariant = true; } } @@ -2238,10 +2331,11 @@ } /** - * Get the MD5 hash for a configuration if it is a true binary variation. + * Get the MD5 hash for a configuration if it is a true binary variation. This is for abld buidler only. * @param config - The Carbide build configuration to check against * @param mmpFullPath - The path to the MMP file that builds the binary * @return A string of the MD5 hash. Returns an empty string if the configuration is not a binary variant or cannot be determined. + * @deprecated - ABLD support to be removed vFuture */ static public String getMD5HashForBinaryVariant(final ICarbideBuildConfiguration config, final IPath mmpFullPath){ @@ -2263,7 +2357,13 @@ }); } - + /** + * NOTE: This only works for ABLD. Not SBSv2/Raptor! + * @param mmpData + * @param config + * @return + * @deprecated - Abld support to be be removed vFuture + */ private static File getMakeFileForSymbianBinaryVariant(IMMPData mmpData, ICarbideBuildConfiguration config){ IPath makefileDir = CarbideCPPBuilder.getBuilderMakefileDir(config); @@ -2272,8 +2372,13 @@ mmpFile = mmpFile.removeFileExtension(); String mmpRootName = mmpFile.lastSegment(); String plat = config.getPlatformString(); - String basePlat = config.getBasePlatformForVariation(); - String variantPlat = config.getBuildVariationName(); + String basePlat = ""; + if (config.getBuildContext() instanceof ISBSv2BuildConfigInfo){ + basePlat = ((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation(); + } else { + basePlat = config.getPlatformString(); + } + String variantPlat = config.getBuildContext().getBuildVariationName(); if (variantPlat.length() == 0){ plat = plat + "." + ISymbianBuildContext.DEFAULT_VARIANT; @@ -2287,13 +2392,14 @@ } /** - * Get the MD5 hash value for an existing configuration by parsing its makefile. + * Get the MD5 hash value for an existing configuration by parsing its makefile. Should only be used for ABLD build system. * @param makefile - The build makefile to parse to check for the MD5 * @param config - The build configuration to check under * @return The string for the MD5 hash. An empty string if it cannot be determined. + * @deprecated - abld support to be removed */ private static String getMD5VariantFromMakefile(File makefile, ICarbideBuildConfiguration config){ - // TODO: We can also use the .vmap in the release folder as well. + // We could also use the .vmap in the release folder as well. // we can parse the makefile and get the variant name for each in the comments: // //# FeatureVariantURELLabel d41d8cd98f00b204e9800998ecf8427e @@ -2309,7 +2415,7 @@ } String searchString = ""; - if (config.getTargetString().equals(SymbianBuildContext.DEBUG_TARGET)){ + if (config.getTargetString().equals(BuildContextSBSv1.DEBUG_TARGET)){ searchString = "# FeatureVariantUDEBLabel"; } else { searchString = "# FeatureVariantURELLabel"; @@ -2405,7 +2511,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 +2560,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 +2729,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) { @@ -2660,4 +2766,50 @@ return paths; } + + /** + * Retrieves all macros used for indexing a given ICarbideBuildConfiguration. + * @param config - The CarbideBuildConfiguration + * @param mmpFiles - null if for all MMPs in the project + * @return list of IDefine + * @since 3.0 + */ + public static List getGlobalDefinesForConfiguration(ICarbideBuildConfiguration config, List mmpFiles){ + + List projectDefines = config.getCompileTimeMacros(); + + if (mmpFiles == null){ + // get all macros from all mmps + mmpFiles = getMMPFilesForProject(config.getCarbideProject()); + } + + for (IPath mmpPath : mmpFiles){ + if (hasSTDCPPSupport(config.getCarbideProject(), mmpPath)){ + projectDefines.add(DefineFactory.createDefine("__SYMBIAN_STDCPP_SUPPORT__")); + break; + } + } + + if (((CarbideProjectInfo)config.getCarbideProject()).shouldUseMMPMacros()){ + // Only return the macros from the mmps if project pref Macro Settings + // is enabled (Use preprocessor symbols....) + for (IPath mmpPath : mmpFiles) { + + List mmpMacros = getMMPMacrosForBuildConfiguration( + mmpPath, config); + for (String macro : mmpMacros) { + // Symbian docs say they are converted to upper case always + projectDefines.add(DefineFactory.createDefine(macro.toUpperCase())); + } + } + } + + List targetTypes = getTargetTypesForBuildConfiguration(config); + if (targetTypes.size() > 0){ + projectDefines.add(config.getBuildContext().getTargetTypeMacro(targetTypes.get(0))); + } + + return projectDefines; + } + } diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/ICarbideBuildManager.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/ICarbideBuildManager.java Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/ICarbideBuildManager.java Wed Aug 25 11:08:33 2010 -0500 @@ -22,6 +22,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.core.resources.IProject; +import com.nokia.carbide.cdt.builder.extension.ICarbidePrefsModifier; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier; @@ -83,4 +84,12 @@ */ public void setProjectInfo(ICarbideProjectInfo newInfo); + /** + * Retrieve the ICarbidePrefsModifier interface to allow getting and setting + * of certain preferences by ID. This only sets values in memory, does not write + * to disk. + * @return ICarbidePrefsModifier + */ + ICarbidePrefsModifier getPrefsModifier(); + } diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/PKGViewPathHelper.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/PKGViewPathHelper.java Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/PKGViewPathHelper.java Wed Aug 25 11:08:33 2010 -0500 @@ -22,9 +22,7 @@ import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; -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.internal.api.sdk.ISBSv2BuildContext; import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGView; import com.nokia.cpp.internal.api.utils.core.Check; @@ -75,10 +73,7 @@ this.platform = buildConfig.getPlatformString(); if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(buildConfig.getCarbideProject().getProject())){ // Test is this is an SBSv2 build binary variant (changes the output directory) - ISBSv2BuildConfigInfo sbsv2Info = ((CarbideBuildConfiguration)buildConfig).getSBSv2BuildConfigInfo(); - if ( sbsv2Info != null && SBSv2Utils.getVariantOutputDirModifier(sbsv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT)) != null && !platform.contains(".") ){ - this.platform = this.platform + SBSv2Utils.getVariantOutputDirModifier(sbsv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT)); - } + this.platform = ((ISBSv2BuildContext)buildConfig.getBuildContext()).getPlatformReleaseDirName(); } this.target = buildConfig.getTargetString(); this.mainDirectory = pkgFilePath.removeLastSegments(1); diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java Wed Aug 25 11:08:33 2010 -0500 @@ -57,14 +57,12 @@ import com.nokia.carbide.cdt.builder.PKGViewPathHelper; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -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.cdt.internal.builder.CarbideBuildConfiguration; import com.nokia.carbide.cdt.internal.builder.CarbideSBSv1Builder; import com.nokia.carbide.cdt.internal.builder.CarbideSBSv2Builder; import com.nokia.carbide.cdt.internal.builder.ICarbideBuilder; -import com.nokia.carbide.cdt.internal.builder.ISBSv2BuildConfigInfo; import com.nokia.carbide.cdt.internal.builder.ui.BuilderPreferencePage; import com.nokia.carbide.cdt.internal.builder.ui.MMPSelectionDialog; import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; @@ -76,9 +74,9 @@ 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.SBSv2Utils; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; 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.ISymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; @@ -195,7 +193,7 @@ } if (defaultConfig != null) { - CarbideCommandLauncher launcher = new CarbideCommandLauncher(currentProject, monitor, getParserIdArray(defaultConfig.getErrorParserId()), cpi.getINFWorkingDirectory()); + CarbideCommandLauncher launcher = new CarbideCommandLauncher(currentProject, monitor, defaultConfig.getErrorParserList(), cpi.getINFWorkingDirectory()); launcher.showCommand(true); invokeBuild(defaultConfig, launcher, subMonitor.newChild(1), true); } else { @@ -340,7 +338,6 @@ // build ROM if necessary subMonitor = SubMonitor.convert(monitor, 1); - invokeROMBuilder(buildConfig, launcher, subMonitor.newChild(1)); } else { launcher.writeToConsole("\n***Errors were detected in build. See the Problems or Console view for details.\n"); @@ -382,7 +379,7 @@ getBuilder(cpi.getProject()).preCleanStep(buildConfig); - CarbideCommandLauncher launcher = new CarbideCommandLauncher(project, monitor, getParserIdArray(buildConfig.getErrorParserId()), cpi.getINFWorkingDirectory()); + CarbideCommandLauncher launcher = new CarbideCommandLauncher(project, monitor, buildConfig.getErrorParserList(), cpi.getINFWorkingDirectory()); launcher.showCommand(true); calculateComponentLists(buildConfig, launcher); @@ -425,7 +422,7 @@ ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); IProject project = cpi.getProject(); - CarbideCommandLauncher launcher = new CarbideCommandLauncher(project, monitor, getParserIdArray(buildConfig.getErrorParserId()), cpi.getINFWorkingDirectory()); + CarbideCommandLauncher launcher = new CarbideCommandLauncher(project, monitor, buildConfig.getErrorParserList(), cpi.getINFWorkingDirectory()); launcher.showCommand(true); // make sure the project is built @@ -461,7 +458,7 @@ ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); List buildConfigList = new ArrayList(1); - buildConfigList.add(buildConfig); + buildConfigList.add(buildConfig.getBuildContext()); if (clearMarkers) { try { @@ -623,7 +620,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 +716,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 +730,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()); @@ -821,6 +818,7 @@ * @param bldmakeArgs array of String arguments to be passed to bldmake * @param removeMarkers project markers will be removed when true * @return true if operation was successful, false otherwise + * @deprecated - Abld support to be be removed vFuture */ public static boolean invokeBldmakeCommand(ICarbideBuildConfiguration buildConfig, CarbideCommandLauncher launcher, String[] bldmakeArgs, boolean removeMarkers) { ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); @@ -844,6 +842,7 @@ * @param abldArgs array of String arguments to be passed to abld * @param removeMarkers project markers will be removed when true * @return true if operation was successful, false otherwise + * @deprecated - ABLD is deprecated */ public static boolean invokeAbldCommand(ICarbideBuildConfiguration buildConfig, CarbideCommandLauncher launcher, String[] abldArgs, boolean removeMarkers) { ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); @@ -899,16 +898,25 @@ * @param config the build configuration context * @param launcher the Carbide launcher * @return false if makefile generation was necessary but failed, true otherwise + * @deprecated - Abld support to be be removed vFuture */ public static boolean generateBldmakeMakefilesIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher) { + if (!(config.getBuildContext() instanceof ISBSv1BuildContext)){ + return false; // SBSv1 only! + } + if (needsBldmakeMakefileGeneration(config)) { 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(" ")) { + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)config.getBuildContext(); + + for (String arg : sbsv1Context.getBuildArgumentsInfo().getBldmakeBldFilesArgs().split(" ")) { argsList.add(arg); } @@ -928,6 +936,7 @@ * is newer than any of the makefiles, then returns true. * @param config - The build configuration to check the makefiles for * @return true if makefiles need to be regenerated (bldmake bldfiles platform) + * @deprecated - Abld support to be be removed vFuture */ protected static boolean needsBldmakeMakefileGeneration(ICarbideBuildConfiguration config) { return getBuilder(config.getCarbideProject().getProject()).needsBldmakeMakefileGeneration(config); @@ -985,6 +994,7 @@ * @param progress monitor to allow user to cancel * @return false if any makefile generation was necessary but failed, true otherwise * @since 2.0 + * @deprecated - Abld support to be be removed vFuture */ public static boolean generateAbldMakefilesIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, boolean calculateComponentLists, IProgressMonitor progress) { @@ -1007,7 +1017,7 @@ return true; } - + /** * Generates the abld makefile if necessary. * Generates the makefile for the given mmp file if: @@ -1021,26 +1031,7 @@ * @param componentPath the absolute file system path of the component * @param isTest true for test components, false otherwise * @return false if any makefile generation was necessary but failed, true otherwise - * - * @deprecated use {@link #generateAbldMakefileIfNecessary(ICarbideBuildConfiguration, CarbideCommandLauncher, IPath, boolean, IProgressMonitor)} instead - */ - protected static boolean generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest) { - return generateAbldMakefileIfNecessary(config, launcher, componentPath, isTest, new NullProgressMonitor()); - } - - /** - * Generates the abld makefile if necessary. - * Generates the makefile for the given mmp file if: - * 1) the makefile for the mmp does not exist - * 2) if the mmp or any of its includes is newer than the makefile - * 3) the makefile does not have the necessary Carbide changes - * - * The command used will be 'abld [test] makefile platform mmpname' - * @param config the build configuration context - * @param launcher the Carbide launcher - * @param componentPath the absolute file system path of the component - * @param isTest true for test components, false otherwise - * @return false if any makefile generation was necessary but failed, true otherwise + * @deprecated - Abld support to be be removed vFuture */ protected static boolean generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest, IProgressMonitor progress) { return getBuilder(config.getCarbideProject().getProject()).generateAbldMakefileIfNecessary(config, launcher, componentPath, isTest, progress); @@ -1352,7 +1343,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 +1617,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 +1701,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); @@ -1941,12 +1932,9 @@ // need to create a new PKG file, resolved... pkgFileStr = pkgFileStr.replace(PKG_SYMBOL_EPOCROOT, context.getSDK().getEPOCROOT()); String platSubst = context.getPlatformString().toLowerCase(); - if (context instanceof CarbideBuildConfiguration){ + if (context instanceof ISBSv2BuildContext){ // Test is this is an SBSv2 build binary variant (changes the output directory) - ISBSv2BuildConfigInfo sbsv2Info = ((CarbideBuildConfiguration)context).getSBSv2BuildConfigInfo(); - if (sbsv2Info != null && SBSv2Utils.getVariantOutputDirModifier(sbsv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT)) != null){ - platSubst = platSubst + SBSv2Utils.getVariantOutputDirModifier(sbsv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT)); - } + platSubst = ((ISBSv2BuildContext)context).getPlatformReleaseDirName(); } pkgFileStr = pkgFileStr.replace(PKG_SYMBOL_PLATFORM, platSubst); pkgFileStr = pkgFileStr.replace(PKG_SYMBOL_TARGET, context.getTargetString().toLowerCase()); @@ -1992,53 +1980,6 @@ return null; } - /** - * Invoke the ROM builder for the given build configuration - * @param config - The current configuration from where to get the settings from - * @param cmdLauncher - The object to use for the process execution - * @param monitor - An IProgressMonitor - */ - public static void invokeROMBuilder(ICarbideBuildConfiguration config, CarbideCommandLauncher cmdLauncher, IProgressMonitor monitor) { - - IROMBuilderInfo info = config.getROMBuildInfo(); - if (info != null) { - String commandLine = info.getCommandLine().trim(); - if (commandLine.length() > 0) { - - monitor.setTaskName("Building ROM Image"); - - IPath workingDir = config.getCarbideProject().getINFWorkingDirectory(); - String workingDirString = info.getWorkingDirectory().trim(); - if (workingDirString.length() > 0) { - workingDir = new Path(workingDirString); - } - - cmdLauncher.writeToConsole("\n***Building ROM Image ....\n"); - List args = tokenizeArgsWithQuotes(commandLine); - args.add(0, "/c"); - - cmdLauncher.setErrorParserManager(workingDir, getParserIdArray(ICarbideBuildConfiguration.ERROR_PARSERS_ROM_BUILDER)); - int retVal = cmdLauncher.executeCommand(CarbideCommandLauncher.getCmdExeLocation(), args.toArray(new String[args.size()]), getResolvedEnvVars(config), workingDir); - if (retVal != 0){ - cmdLauncher.writeToConsole("***Non-Zero Status: Specified rom build command returned with exit value = " + retVal); //$NON-NLS-1$ - CarbideBuilderPlugin.createCarbideProjectMarker(config.getCarbideProject().getProject(), IMarker.SEVERITY_ERROR, "Specified rom build command returned with exit value = " + retVal, IMarker.PRIORITY_LOW); //$NON-NLS-1$ - cmdLauncher.writeToConsole("\nRom build failed\n"); - } else { - cmdLauncher.writeToConsole("\nRom build completed\n"); //$NON-NLS-1$ - } - cmdLauncher.writeToConsole(cmdLauncher.getTimingStats()); - - - monitor.worked(1); - if (monitor.isCanceled()) { - return; - } - } - } - - monitor.done(); - } - /** * Returns a list of arguments as strings. The given string is basically split at spaces, but not if the space(s) * is contained in quotes. Arguments are typically quoted if they contain spaces. @@ -2067,59 +2008,6 @@ return allTokens; } - /** - * This method performs a build for a given Carbide build configuration. - * @param config - The Carbide configuration to build - * @param monitor - A progress monitor so user can cancel build (can be null) - * @param console - Where to pipe the output. If null, a new CConole will be created and existing console cleared. - * @param buildKind - FULL_BUILD, else incremental build assumed. - * - * @deprecated use {@link #invokeBuild(ICarbideBuildConfiguration, IConsole, IProgressMonitor)} instead - */ - public static void callAbldBuildForConfiguration(ICarbideBuildConfiguration config, IProgressMonitor monitor, IConsole console, int buildKind, boolean clearMarkers){ - - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - - if (console == null){ - console = CCorePlugin.getDefault().getConsole(); - } - - CarbideCommandLauncher launcher = new CarbideCommandLauncher(config.getCarbideProject().getProject(), monitor, console, getParserIdArray(config.getErrorParserId()), config.getCarbideProject().getINFWorkingDirectory()); - launcher.showCommand(true); - - invokeBuild(config, launcher, monitor, clearMarkers); - } - - /** - * Invoke bldmake bldfiles on the current bld.inf and SDK. - * @param config - Config to generate makefiles for. - * @param cmdLauncher - The process launcher - * @param monitor - The progress monitor - * @param console - The console to write the messages to. - * @param env - The array of environment variables to be used for the process - * @param workingDir - The full path to the bld.inf file to be used as the current working directory - * - * @deprecated use {@link #generateBldmakeMakefilesIfNecessary(ICarbideBuildConfiguration, CarbideCommandLauncher, IConsole, IProgressMonitor, boolean)} instead - */ - public static boolean invokeBldmakeBldFiles(ICarbideBuildConfiguration config, CarbideCommandLauncher cmdLauncher, IProgressMonitor monitor, IConsole console, String[] env, IPath workingDir ){ - return generateBldmakeMakefilesIfNecessary(config, cmdLauncher); - } - - /** - * Check to see if abld.bat and the SDK's platform makefile exists. If either don't exist, re-generate makefiles - * This also tests to make sure the makefile target is OLDER than the bld.inf file. - * @param bldInfDir - The working dir of the bld.inf file (should not contain 'bld.inf') - * @param defaultConfig - The ISymbianBuildConfiguration to be built. - * @return true if makefiles need to be regenerated - * - * @deprecated use {@link #needsBldmakeMakefileGeneration(ICarbideBuildConfiguration)} - */ - public static boolean projectNeedsMakefileGeneration(IPath bldInfDir, ICarbideBuildConfiguration defaultConfig){ - return needsBldmakeMakefileGeneration(defaultConfig); - } - /** * Checks the Problems view for any error markers. * @param project - IProject to check for problem markers @@ -2144,6 +2032,11 @@ return false; } + /** + * @deprecated - Abld support to be be removed vFuture + * @param config + * @return + */ public static IPath getBuilderMakefileDir(ICarbideBuildConfiguration config){ return getBuilder(config.getCarbideProject().getProject()).getMakefileDirectory(config); } diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/extension/ICarbidePrefsModifier.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/extension/ICarbidePrefsModifier.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,66 @@ +/* +* 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.cdt.builder.extension; + +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; + +/** + * Allows those using the Carbide Preferences Modifier extension point to to read + * and/or modify certain project preferences + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * since 3.0 + * + */ +public interface ICarbidePrefsModifier { + + /** + * @deprecated - limited support for abld, String will be removed in the future so reference + * with your own local String. + * @since 3.0 + */ + final String ABLD_BUILD_ARG_SETTING = "ABLD_BUILD_ARG_SETTING"; + + /** + * Get the project configuration setting by ID. + * @param ISymbianBuildContext + * @param prefID + * @return The String value. Or null if the the pref id is unknown or no longer in use. + * @since 3.0 + */ + String getConfigurationValue(ICarbideBuildConfiguration newParam, String prefID); + + /** + * Set the project configuration setting by ID. + * @param ISymbianBuildContext + * @param String - the argument value + * @param prefID + * @since 3.0 + */ + void setConfigurationValue(ICarbideBuildConfiguration context, String arg, String prefID); + + /** + * Test whether or not a particular prefID is supported for read/write. + * The ID tests support first by the ID, then, if configuration specific, by the ISymbianBuildContext + * @param config + * @param prefID + * @return true if the prefID is supported, false otherwise. + */ + boolean isSupportedConfigurationPrefId(ICarbideBuildConfiguration config, String prefID); + +} diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/IBuildArgumentsInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/IBuildArgumentsInfo.java Tue Aug 24 16:42:58 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +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. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.carbide.cdt.builder.project; - -/** - * IBuildArgumentsInfo represents one instance of configuration data for the Arguments tab. - * This interface only applies for the Symbian 'abld' build system (SBSv1) - * @see ICarbideBuildConfiguration - * - * @deprecated use BuildArgumentsInfo directly - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IBuildArgumentsInfo { - - /** - * Get the arguments to pass to bldmake bldfiles - * @return string of arguments which may be empty - */ - String getBldmakeBldFilesArgs(); - - /** - * Get the arguments to pass to bldmake clean - * @return string of arguments which may be empty - */ - String getBldmakeCleanArgs(); - - /** - * Get the arguments to pass to abld build - * @return string of arguments which may be empty - */ - String getAbldBuildArgs(); - - /** - * Get the arguments to pass to abld export - * @return string of arguments which may be empty - */ - String getAbldExportArgs(); - - /** - * Get the arguments to pass to abld makefile - * @return string of arguments which may be empty - */ - String getAbldMakefileArgs(); - - /** - * Get the arguments to pass to abld library - * @return string of arguments which may be empty - */ - String getAbldLibraryArgs(); - - /** - * Get the arguments to pass to abld resource - * @return string of arguments which may be empty - */ - String getAbldResourceArgs(); - - /** - * Get the arguments to pass to abld target - * @return string of arguments which may be empty - */ - String getAbldTargetArgs(); - - /** - * Get the arguments to pass to abld final - * @return string of arguments which may be empty - */ - String getAbldFinalArgs(); - - /** - * Get the arguments to pass to abld clean - * @return string of arguments which may be empty - */ - String getAbldCleanArgs(); - - /** - * Get the arguments to pass to abld freeze - * @return string of arguments which may be empty - */ - String getAbldFreezeArgs(); -} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideBuildConfiguration.java Wed Aug 25 11:08:33 2010 -0500 @@ -20,8 +20,10 @@ import org.eclipse.core.runtime.IPath; -import com.nokia.carbide.cdt.builder.BuildArgumentsInfo; +import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; +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 +31,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; @@ -47,8 +49,9 @@ public static final int ERROR_PARSERS_ALL = 99; /** - * Get a list of error parser ID's + * Get a list of error parser ID's for this configuration. * @return A full list of error parser IDs. Returns an empty array if none are specified + * @see {@link CarbideCPPBuilder#getParserIdArray(int)} */ String[] getErrorParserList(); @@ -66,29 +69,7 @@ */ List getSISBuilderInfoList(); - /** - * Get the (abld)build arguments info. Contains pref settings from the Arguments tab. - * This only applies when building with SBSv1 (bldmake, abld) - * @return IBuildArgumentsInfo instance, never null - * - * @deprecated use - */ - IBuildArgumentsInfo getBuildArgumentsInfo(); - - /** - * Get the (abld)build arguments info. Contains pref settings from the Arguments tab. - * This only applies when building with SBSv1 (bldmake, abld) - * @return A copy of BuildArgumentsInfo instance, never null - */ - BuildArgumentsInfo getBuildArgumentsInfoCopy(); - - /** - * Set the build arguments info for SBSv2 build arguments. This only sets values in memory, does - * not write settings to disk. See - * @return IBuildArgumentsInfo instance, never null - */ - void setBuildArgumentsInfo(BuildArgumentsInfo bldArgInfo); - + /** * Get the parent Carbide project of this configuration. * @return ICarbideProjectInfo @@ -101,34 +82,6 @@ */ IEnvironmentVarsInfo getEnvironmentVarsInfo(); - /** - * Get the id that specifies the array of error parsers to use for a given build platform. - * @return The integer ID of the parser to be use. - * @see CarbideCPPBuilder.getParserIds(int id) - */ - int getErrorParserId(); - - /** - * Returns the list of all built in macros for this configuration - *

- * Macros will be just a name, e.g. "_DEBUG", "__SYMBIAN32__", etc.. - *

- * - * @return a list of macros which may be empty. - */ - List getBuiltinMacros(); - - /** - * Returns the ROM builder info from the ROM Builder tab. - * @return - */ - IROMBuilderInfo getROMBuildInfo(); - - /** - * Compares two configurations to see if their display names are equivalent. - */ - boolean equals(Object obj); - /** Get the full path of the release directory into the SDK where binaries are built * NOTE: This does not account for whether or not a project has the FEATUREVARIANT keyword * @return IPath @@ -137,4 +90,38 @@ */ IPath getTargetOutputDirectory(); + /** + * Retrieve the build context specific info. + * @return ISymbianBuildContext + * @since 3.0 + */ + ISymbianBuildContext getBuildContext(); + + /** ISymbianBuildContext wrapper + * @since 3.0 */ + String getDisplayString(); + + /** ISymbianBuildContext wrapper + * @since 3.0 */ + ISymbianSDK getSDK(); + + /** ISymbianBuildContext wrapper + * @since 3.0 */ + String getPlatformString(); + + /** ISymbianBuildContext wrapper + * @since 3.0 */ + String getTargetString(); + + /** + * Provides a list of macros suitable for preprocessing a CPP source file. This includes + * macros from the compiler prefix, Symbian HRH, buit-in build macros, and metadata macros. + * Note: If you don't want the macro values from the preincludes, you should use the methods + * directly under ISymbianBuildContext for more specificity. + * @return a list of macro defines + * @since 3.0 + */ + List getCompileTimeMacros(); + + } diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java Wed Aug 25 11:08:33 2010 -0500 @@ -52,11 +52,12 @@ public static final int ACTION_LINK_ONLY = 1; public static final int ACTION_COMPILE_AND_LINK = 2; + /** * Load all the configurations associated with this project. If this is a new project, * then a dummy .settings file will be created which can be used to generate new build * configurations. - * @return A list of ICarbideBuildConfiguration objects, which may be empty + * @return A copy of the list of ICarbideBuildConfiguration objects, which may be empty. Modifying the result does not affect the project. */ public List getBuildConfigurations(); @@ -82,7 +83,7 @@ /** * Check whether or not all components of the inf are built or subcomponents. - * Building from inf means that only 'abld build' is invoked rather than invoking 'abld build' on specific MMP and makefiles + * Building from inf means that the build system is invoked on a single bld.inf, rather than build steps for individual MMPs * @return true when building from bld.inf */ public boolean isBuildingFromInf(); @@ -106,14 +107,6 @@ public IPath getWorkspaceRelativeBldInfPath(); /** - * Get the name of the MMP file that is used to calculate the target output (final artifact) for setting up launch configurations - * @return - * - * @deprecated no longer used in 1.3. now returns an empty string. - */ - public String getMMPTargetFile(); - - /** * Get the IProject for the Carbide.c++ project. * @return IProject object */ diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/IROMBuilderInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/IROMBuilderInfo.java Tue Aug 24 16:42:58 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.carbide.cdt.builder.project; - -/** - * IROMBuilderInfo represents one instance of configuration data for the ROM Builder tab. - * @see ICarbideBuildConfiguration - */ -public interface IROMBuilderInfo { - - /** - * Get the command line to build the ROM - * @return string which may be empty - */ - String getCommandLine(); - - /** - * Set the command line with which to build the ROM - * @param commandLine - */ - void setCommandLine(String commandLine); - - /** - * Get the working directory to run the build from - * @return string which may be empty - */ - String getWorkingDirectory(); - - /** - * Set the working directory from which to run the build - * @param workingDirectory - */ - void setWorkingDirectory(String workingDirectory); - -} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java Wed Aug 25 11:08:33 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,8 +40,8 @@ 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; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; @@ -56,8 +57,17 @@ 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.BuildArgumentsInfo; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv2; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildConfigInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.SBSv2BuilderInfo; 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 @@ -109,6 +119,7 @@ return baseData; } + @SuppressWarnings("restriction") @Override public CConfigurationData loadConfiguration(ICConfigurationDescription des, IProgressMonitor monitor) throws CoreException { @@ -119,9 +130,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 { + // 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 +166,75 @@ return null; } + @SuppressWarnings("restriction") + 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 sdkID = null; + if (rootStorage != null) { + for (ICStorageElement se : rootStorage.getChildren()) { + if (se.getName().equals( + ISBSv2BuildContext.SBSV2_DATA_ID)) { + + SBSv2BuilderInfo sbsv2BuilderInfo = new SBSv2BuilderInfo(); + sbsv2BuilderInfo.loadFromStorage(se); + platform = sbsv2BuilderInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATRRIB_CONFIG_BASE_PLATFORM); + target = sbsv2BuilderInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_CONFIG_TARGET); + buidAlias = sbsv2BuilderInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_BUILD_ALIAS); + displayString = sbsv2BuilderInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_CONFIG_DISPLAY_STRING); + sdkID = sbsv2BuilderInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_SDK_ID); + } + } + } else { + return null; + } + + ISymbianSDK sdk = null; + if (!configID.startsWith(ISBSv2BuildContext.BUILDER_ID)){ + // pre-C3 (Carbide 2.x) 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); + if (sdk != null){ + return new BuildContextSBSv2(sdk, platform, target, buidAlias, displayString, configID); + } else { + ISymbianSDK deadSDK = SymbianSDKFactory.createInstance(sdkID, ISymbianSDK.BAD_EPOCROOT, new Version("9.5")); + 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) { @@ -175,12 +270,14 @@ protected static void convertSettingsData(IProject project, CarbideBuilderConfigInfoType buildConfigType) { if (buildConfigType.getVersion() == CarbideBuildConfigurationLoader.SETTINGS_VERSION_0) { - // Iteraate through all the configurations and convert from version 0 to 1. + // Iterate through all the configurations and convert from version 0 to 1. // Reset all PATH, EPOCROOT, and MW* variables set back to their defaults // 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()); + + @SuppressWarnings("restriction") + ISymbianBuildContext context = BuildContextSBSv1.getBuildContextFromDisplayName(currConfig.getName()); IEnvironmentVarsInfo envSettings = new EnvironmentVarsInfo(project, context, currConfig.getEnvVars()); List varsFromSettings = envSettings.getModifiedEnvVarsListFromSettings(); List updatedEnvList = new ArrayList(); @@ -305,7 +402,8 @@ for (Iterator i = oldConfigInfo.getConfiguration().iterator(); i.hasNext();) { ConfigurationType currConfig = (ConfigurationType)i.next(); - ISymbianBuildContext context = SymbianBuildContext.getBuildContextFromDisplayName(currConfig.getName()); + @SuppressWarnings("restriction") + ISymbianBuildContext context = BuildContextSBSv1.getBuildContextFromDisplayName(currConfig.getName()); if (context != null) { configs.add(context); } @@ -340,8 +438,9 @@ EnvironmentVarsInfo oldEnvVars = new EnvironmentVarsInfo(project, context, currConfig.getEnvVars()); buildConfiguration.setEnvironmentVarsInfo(new EnvironmentVarsInfo2(oldEnvVars)); + if (context instanceof ISBSv1BuildContext) if (wasVerboseChecked) { - buildConfiguration.setBuildArgumentsInfo(new BuildArgumentsInfo("", "", "-v", "", "", "", "", "", "", "-v", "-v")); + ((ISBSv1BuildContext)context).setBuildArgumentsInfo(new BuildArgumentsInfo("", "", "-v", "", "", "", "", "", "", "-v", "-v")); } buildConfiguration.saveConfiguration(false); diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/BrokenConfigurationInProjectTreeNode.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/CarbidePrefsModifier.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/CarbidePrefsModifier.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,66 @@ +/* +* 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.cdt.internal.api.builder.ui; + +import com.nokia.carbide.cdt.builder.extension.ICarbidePrefsModifier; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +import com.nokia.carbide.cpp.internal.api.sdk.BuildArgumentsInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; + +public class CarbidePrefsModifier implements ICarbidePrefsModifier { + + @SuppressWarnings("deprecation") + public String getConfigurationValue(ICarbideBuildConfiguration config, String prefID) { + + if (prefID.equals(ICarbidePrefsModifier.ABLD_BUILD_ARG_SETTING)){ + if (config.getBuildContext() instanceof ISBSv1BuildContext){ + BuildArgumentsInfo info = ((ISBSv1BuildContext)config.getBuildContext()).getBuildArgumentsInfoCopy(); + return info.getAbldBuildArgs(); + } + } + + return null; + } + + @SuppressWarnings("deprecation") + public void setConfigurationValue(ICarbideBuildConfiguration config, String arg, String prefID) { + + if (prefID.equals(ICarbidePrefsModifier.ABLD_BUILD_ARG_SETTING)){ + if (config.getBuildContext() instanceof ISBSv1BuildContext){ + BuildArgumentsInfo info = ((ISBSv1BuildContext)config.getBuildContext()).getBuildArgumentsInfoCopy(); + info.abldBuildArgs = arg; + ((ISBSv1BuildContext)config.getBuildContext()).setBuildArgumentsInfo(info); + } + } + } + + @SuppressWarnings("deprecation") + public boolean isSupportedConfigurationPrefId( + ICarbideBuildConfiguration config, String prefID) { + + if (prefID.equals(ICarbidePrefsModifier.ABLD_BUILD_ARG_SETTING)){ + if (config.getBuildContext() instanceof ISBSv2BuildContext){ + return false; // SBSv1 only + } + return true; + } + + return false; + } + +} diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/MMPSelectionUI.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/MMPSelectionUI.java Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/MMPSelectionUI.java Wed Aug 25 11:08:33 2010 -0500 @@ -17,6 +17,7 @@ package com.nokia.carbide.cdt.internal.api.builder.ui; 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.epoc.engine.model.bldinf.IExtension; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; @@ -168,7 +169,7 @@ private Button excludeExtensionMakefilesCheckbox; private Button excludeTestComponentsCheckbox; private ListenerList listeners; - private List buildConfigs; + private List buildConfigs; private IPath bldInfFile; private final IRunnableContext runnableContext; private List data = Collections.emptyList(); @@ -370,12 +371,12 @@ * @param bldInfFile IPath * @param buildConfigs List */ - public void setBldInfFile(final IPath bldInfFile, final List buildConfigs, final boolean useSBSv2Builder) { + public void setBldInfFile(final IPath bldInfFile, final List buildContexts, final boolean useSBSv2Builder) { if (bldInfFile.equals(this.bldInfFile) && buildConfigs.equals(this.buildConfigs)) return; this.bldInfFile = bldInfFile; - this.buildConfigs = buildConfigs; + this.buildConfigs = buildContexts; this.useSBSv2Builder = useSBSv2Builder; try { diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Wed Aug 25 11:08:33 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; @@ -52,21 +55,25 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier; import com.nokia.carbide.cdt.internal.builder.ui.CarbideCPPBuilderUIHelpIds; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal; 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.internal.sdk.core.model.SDKManager; 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.core.HostOS; +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; @@ -142,12 +149,14 @@ this.cpi = cpi; setShellStyle(getShellStyle() | SWT.RESIZE); - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - if (!sdkMgr.checkDevicesXMLSynchronized()){ - if (sdkMgr instanceof ISDKManagerInternal){ - ISDKManagerInternal sdkMgrInternal = (ISDKManagerInternal)sdkMgr; - sdkMgrInternal.fireDevicesXMLChanged(); - } + if (HostOS.IS_WIN32){ + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + if (!((SDKManager)sdkMgr).checkDevicesXMLSynchronized()){ + if (sdkMgr instanceof ISDKManagerInternal){ + ISDKManagerInternal sdkMgrInternal = (ISDKManagerInternal)sdkMgr; + sdkMgrInternal.fireDevicesXMLChanged(); + } + } } } @@ -184,7 +193,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 +232,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 +251,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 +273,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 +295,122 @@ } /** + * 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(); + String sdkId = context.getSDK().getUniqueId(); + String newDisplayString = stripSDKIDFromConfigName(context.getDisplayString(), sdkId); + if (context instanceof ISBSv2BuildContext){ + ISBSv2BuildContext v2Context = (ISBSv2BuildContext)context; + if (v2Context.getConfigQueryData() == null){ + newDisplayString += " ERROR: " + "Unable to load configuration data because the query to sbs failed."; // $NON-NLS-N$ + } + else if (v2Context.getConfigQueryData().getConfigurationErrorMessage() != null && + v2Context.getConfigQueryData().getConfigurationErrorMessage().length() > 0){ + newDisplayString += " ERROR: " + v2Context.getConfigQueryData().getConfigurationErrorMessage(); + } + } + return newDisplayString; + } + }; + } + } + + // ... then add the project specific items... + for (ISymbianBuildContext newContext : configsToAdd){ + newConfigNodes[index++] = new TreeNode(newContext) { + @Override + public String toString() { + ISymbianBuildContext context = (ISymbianBuildContext)getValue(); + String sdkId = context.getSDK().getUniqueId(); + String newDisplayString = stripSDKIDFromConfigName(context.getDisplayString(), sdkId); + if (context instanceof ISBSv2BuildContext){ + ISBSv2BuildContext v2Context = (ISBSv2BuildContext)context; + if (v2Context.getConfigQueryData() == null){ + newDisplayString += " ERROR: " + "Unable to load configuration data because the query to sbs failed."; // $NON-NLS-N$ + } + else if (v2Context.getConfigQueryData().getConfigurationErrorMessage() != null && + v2Context.getConfigQueryData().getConfigurationErrorMessage().length() > 0){ + newDisplayString += " ERROR: " + v2Context.getConfigQueryData().getConfigurationErrorMessage(); + } + } + return newDisplayString; + } + }; + } + + sdkNode.setChildren(newConfigNodes); + + } + + } + + /** * Create contents of the button bar * @param parent */ @@ -309,17 +454,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 +483,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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java Wed Aug 25 11:08:33 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.internal.api.sdk.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; import com.nokia.cpp.internal.api.utils.core.TextUtils; /** @@ -125,12 +127,18 @@ @Override public String getId() { - return carbideBuildConfig.getDisplayString(); + if (carbideBuildConfig.getBuildContext() instanceof ISBSv1BuildContext){ + return carbideBuildConfig.getBuildContext().getDisplayString(); + } else if (carbideBuildConfig.getBuildContext() instanceof ISBSv2BuildContext) { + return ((ISBSv2BuildContext)carbideBuildConfig.getBuildContext()).getConfigID(); + } + + return null; } @Override public String getName() { - return carbideBuildConfig.getDisplayString(); + return carbideBuildConfig.getBuildContext().getDisplayString(); } @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.getBuildContext().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).getBuildContext().getConfigurationID()); if (configDes != null) { ICStorageElement storage = configDes.getStorage(CONFIG_DATA_CACHE, false); if (storage != null) { diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Wed Aug 25 11:08:33 2010 -0500 @@ -31,59 +31,57 @@ 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; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; -import com.nokia.carbide.cdt.builder.project.IBuildArgumentsInfo; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.project.IEnvironmentVarsInfo; -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.DefineFactory; +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.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; 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.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 { +@SuppressWarnings("deprecation") +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$ - + protected ISymbianBuildContext context; protected TrackedResource projectTracker; protected List sisBuilderInfoList; protected EnvironmentVarsInfo2 envVarsInfo; - protected BuildArgumentsInfo buildArgumentsInfo; + protected BuildConfigurationData buildConfigData; - protected ROMBuilderInfo romBuilderInfo; - protected SBSv2BuilderInfo sbsv2BuilderInfo; + protected boolean rebuildNeeded; 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); - buildArgumentsInfo = new BuildArgumentsInfo(getSDK()); + buildConfigData = new BuildConfigurationData(this); - romBuilderInfo = new ROMBuilderInfo(getSDK()); - if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project)){ - sbsv2BuilderInfo = new SBSv2BuilderInfo(context); - } + rebuildNeeded = true; } @@ -102,15 +100,11 @@ } } else if (se.getName().equals(ENV_VAR_DATA_ID)) { envVarsInfo.loadFromStorage(se); - } else if (se.getName().equals(ARGUMENTS_DATA_ID)) { - loadBuildArgsFromStorage(se); - } else if (se.getName().equals(ROM_BUILDER_DATA_ID)) { - romBuilderInfo.loadFromStorage(se); - } else if (se.getName().equals(SBSV2_DATA_ID)){ - if (sbsv2BuilderInfo != null){ - sbsv2BuilderInfo.loadFromStorage(se); - } - } + } + + // Load build context specific settings. + getBuildContext().loadConfigurationSettings(se); + } } else { throw new CoreException(new Status(IStatus.ERROR, CarbideBuilderPlugin.PLUGIN_ID, IStatus.OK, "Unable to load Carbide settings for project " + projectTracker.getProject().getName() + ", " + getDisplayString(), null)); @@ -128,115 +122,9 @@ } envVarsInfo.saveToStorage(rootStorage.createChild(ENV_VAR_DATA_ID)); - saveBuildArgsToStorage(rootStorage.createChild(ARGUMENTS_DATA_ID)); - romBuilderInfo.saveToStorage(rootStorage.createChild(ROM_BUILDER_DATA_ID)); - if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(getCarbideProject().getProject())){ - sbsv2BuilderInfo.saveToStorage(rootStorage.createChild(SBSV2_DATA_ID)); - } - } - } - - private void loadBuildArgsFromStorage(ICStorageElement rootStorage) { - String value = rootStorage.getAttribute(BuildArgumentsInfo.BLDMAKEBLDFILESARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.bldmakeBldFilesArgs = value; - } - - value = rootStorage.getAttribute(BuildArgumentsInfo.BLDMAKECLEANARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.bldmakeCleanArgs = value; - } - - value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDBUILDARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.abldBuildArgs = value; - } - - value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDEXPORTARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.abldExportArgs = value; - } - - value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDMAKEFILEARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.abldMakefileArgs = value; - } - - value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDLIBRARYARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.abldLibraryArgs = value; - } - - value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDRESOURCEARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.abldResourceArgs = value; - } - - value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDTARGETARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.abldTargetArgs = value; - } - - value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDFINALARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.abldFinalArgs = value; - } - - value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDCLEANARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.abldCleanArgs = value; - } - - value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDFREEZEARGSSTORAGE); - if (value != null) { - buildArgumentsInfo.abldFreezeArgs = value; - } - } - - public void saveBuildArgsToStorage(ICStorageElement rootStorage) { - if (buildArgumentsInfo.bldmakeBldFilesArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.BLDMAKEBLDFILESARGSSTORAGE, buildArgumentsInfo.bldmakeBldFilesArgs); - } - - if (buildArgumentsInfo.bldmakeCleanArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.BLDMAKECLEANARGSSTORAGE, buildArgumentsInfo.bldmakeCleanArgs); - } - - if (buildArgumentsInfo.abldBuildArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.ABLDBUILDARGSSTORAGE, buildArgumentsInfo.abldBuildArgs); - } - - if (buildArgumentsInfo.abldExportArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.ABLDEXPORTARGSSTORAGE, buildArgumentsInfo.abldExportArgs); - } - - if (buildArgumentsInfo.abldMakefileArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.ABLDMAKEFILEARGSSTORAGE, buildArgumentsInfo.abldMakefileArgs); - } - - if (buildArgumentsInfo.abldLibraryArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.ABLDLIBRARYARGSSTORAGE, buildArgumentsInfo.abldLibraryArgs); - } - - if (buildArgumentsInfo.abldResourceArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.ABLDRESOURCEARGSSTORAGE, buildArgumentsInfo.abldResourceArgs); - } - - if (buildArgumentsInfo.abldTargetArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.ABLDTARGETARGSSTORAGE, buildArgumentsInfo.abldTargetArgs); - } - - if (buildArgumentsInfo.abldFinalArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.ABLDFINALARGSSTORAGE, buildArgumentsInfo.abldFinalArgs); - } - - if (buildArgumentsInfo.abldCleanArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.ABLDCLEANARGSSTORAGE, buildArgumentsInfo.abldCleanArgs); - } - - if (buildArgumentsInfo.abldFreezeArgs.trim().length() > 0) { - rootStorage.setAttribute(BuildArgumentsInfo.ABLDFREEZEARGSSTORAGE, buildArgumentsInfo.abldFreezeArgs); + // Save build context specific settings. + this.getBuildContext().saveConfigurationSettings(rootStorage, getBuildContext()); } } @@ -255,7 +143,8 @@ try { ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(projectTracker.getProject()); if (projDes != null) { - ICConfigurationDescription configDes = projDes.getConfigurationById(getDisplayString()); + + ICConfigurationDescription configDes = projDes.getConfigurationById(getBuildContext().getConfigurationID()); if (configDes != null) { // save the CDT project description. this saves all configs but that's the // only thing CDT allows at this point. @@ -270,7 +159,7 @@ return false; } - + public List getSISBuilderInfoList() { return sisBuilderInfoList; } @@ -289,53 +178,32 @@ } } - public int getErrorParserId(){ + private 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; } - public List getBuiltinMacros() { - List macros = new ArrayList(); - - if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(getCarbideProject().getProject())){ - macros.add("SBSV2"); //$NON-NLS-1$ - } - - // add the macros that should always be defined - macros.add("__SYMBIAN32__"); //$NON-NLS-1$ - macros.add("_UNICODE"); //$NON-NLS-1$ - - ISymbianSDK sdk = getSDK(); - if (sdk != null && sdk.getOSVersion().getMajor() >= 9) { - macros.add("__SUPPORT_CPP_EXCEPTIONS__"); //$NON-NLS-1$ - } - - if (getTargetString().equals(DEBUG_TARGET)) { - macros.add("_DEBUG"); //$NON-NLS-1$ - } else { - macros.add("NDEBUG"); //$NON-NLS-1$ - } - - if (hasSTDCPPSupport()){ - macros.add("__SYMBIAN_STDCPP_SUPPORT__"); - } - - return macros; - } - public CConfigurationData getBuildConfigurationData() { return buildConfigData; } @@ -358,7 +226,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; @@ -374,34 +242,63 @@ return config; } - public IBuildArgumentsInfo getBuildArgumentsInfo() { - return (IBuildArgumentsInfo)buildArgumentsInfo; + public IPath getTargetOutputDirectory() { + if (context instanceof ISBSv2BuildContext){ + if (((ISBSv2BuildContext) context).getConfigQueryData() != null){ + return new Path(((ISBSv2BuildContext)context).getConfigQueryData().getOutputPathString()); + } else { + return new Path("/" + SBSv2QueryUtils.BAD_EPOCROOT); + } + } 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() { + return rebuildNeeded; } - public BuildArgumentsInfo getBuildArgumentsInfoCopy() { - return new BuildArgumentsInfo(buildArgumentsInfo); - } - - public void setBuildArgumentsInfo(BuildArgumentsInfo buildArgumentsInfo) { - this.buildArgumentsInfo = buildArgumentsInfo; + public void setRebuildNeeded(boolean value) { + rebuildNeeded = value; } - public IROMBuilderInfo getROMBuildInfo() { - return romBuilderInfo; + public ISymbianSDK getSDK() { + return context.getSDK(); + } + + public String getPlatformString() { + return context.getPlatformString(); + } + + public String getTargetString() { + return context.getTargetString(); } - public ISBSv2BuildConfigInfo getSBSv2BuildConfigInfo(){ - return sbsv2BuilderInfo; + public String getDisplayString() { + return context.getDisplayString(); } - private boolean hasSTDCPPSupport() { + public ISymbianBuildContext getBuildContext() { + return context; + } + + /** + * Check that at least one MMP in the project configuration has stdcpp support keyword + * @return + * @since 3.0 + */ + public boolean hasSTDCPPSupport() { - ICarbideProjectInfo cpi = getCarbideProject(); + ICarbideProjectInfo cpi = this.getCarbideProject(); 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){ @@ -413,28 +310,17 @@ return false; } - public ISBSv2BuildConfigInfo getSBSv2ConfigInfo() { - return sbsv2BuilderInfo; - } - - 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)); - } - } - return getSDK().getReleaseRoot().append(releasePlatform.toLowerCase()).append(getTargetString().toLowerCase()); - } - - public boolean getRebuildNeeded() { - return rebuildNeeded; - } - - public void setRebuildNeeded(boolean value) { - rebuildNeeded = value; + public List getCompileTimeMacros() { + + List defines = new ArrayList(); + + defines.addAll(context.getBuildMacros()); + defines.addAll(context.getCompilerPreincludeDefines()); + defines.addAll(context.getVariantHRHDefines()); + defines.addAll(context.getMetadataMacros()); + + return defines; + } } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java Wed Aug 25 11:08:33 2010 -0500 @@ -46,9 +46,11 @@ import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cdt.builder.ICarbideBuildManager; +import com.nokia.carbide.cdt.builder.extension.ICarbidePrefsModifier; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier; +import com.nokia.carbide.cdt.internal.api.builder.ui.CarbidePrefsModifier; import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; @@ -70,9 +72,15 @@ private Map projectInfoMap = new HashMap(); private MultiResourceChangeListenerDispatcher resourceChangedListener = new MultiResourceChangeListenerDispatcher(); + ICarbidePrefsModifier clientPrefsModifier; + public CarbideBuildManager() { SDKCorePlugin.getSDKManager().addInstalledSdkChangeListener(this); + + if (clientPrefsModifier == null){ + clientPrefsModifier = new CarbidePrefsModifier(); + } } public boolean isCarbideProject(IProject project) { @@ -389,20 +397,27 @@ 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); +// } +// } +// } } } + + public ICarbidePrefsModifier getPrefsModifier(){ + return clientPrefsModifier; + } } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java Wed Aug 25 11:08:33 2010 -0500 @@ -17,25 +17,46 @@ package com.nokia.carbide.cdt.internal.builder; import java.io.File; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +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.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; 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; /** @@ -132,11 +153,11 @@ Set macros = new HashSet(); macros.addAll(macroEntries); - for (IDefine define : carbideBuildConfig.getVariantHRHDefines()) { + for (IDefine define : carbideBuildConfig.getBuildContext().getVariantHRHDefines()) { macros.add(new CMacroEntry(define.getNameAndArguments(), define.getExpansion(), 0)); } - for (IDefine define : carbideBuildConfig.getCompilerMacros()) { + for (IDefine define : carbideBuildConfig.getBuildContext().getCompilerPreincludeDefines()) { macros.add(new CMacroEntry(define.getNameAndArguments(), define.getExpansion(), 0)); } @@ -174,10 +195,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) { @@ -212,6 +241,28 @@ includeEntries.add(new CIncludePathEntry(incPath, ICSettingEntry.LOCAL)); } } + + if (context instanceof ISBSv2BuildContext) { + // SBSv2 only system includes + if (((ISBSv2BuildContext)context).getSystemIncludes() != null){ + + for (IPath incPath : ((ISBSv2BuildContext)context).getSystemIncludes()) { + IPath projRelIncPath = FileUtils.removePrefixFromPath(projectPath, incPath); + if (projRelIncPath != null) { + includeEntries.add(new CIncludePathEntry(projectPath.append(projRelIncPath), 0)); + } else { + includeEntries.add(new CIncludePathEntry(incPath, 0)); + } + + // remove duplicate system includes + File inc = incPath.toFile(); + if (systemIncludes.contains(inc)) { + systemIncludes.remove(inc); + } + } + } + } + for (File inc : systemIncludes) { // convert the absolute path to project relative if possible IPath incPath = new Path(inc.toString()); @@ -224,8 +275,11 @@ } // add OEM dir - File oemDir = carbideBuildConfig.getSDK().getIncludePath().append("oem").toFile(); - if (oemDir.exists()) { + File oemDir = null; + if (sdk.getIncludePath() != null){ + oemDir = sdk.getIncludePath().append("oem").toFile(); + } + if (oemDir != null && oemDir.exists()) { includeEntries.add(new CIncludePathEntry(new Path(oemDir.getAbsolutePath()), 0)); } @@ -233,59 +287,31 @@ macroEntries = new ArrayList(0); lastUseMMPMacrosValue = cpi.shouldUseMMPMacros(); - - 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$ - } - - // built in macros - for (String builtinMacro : carbideBuildConfig.getBuiltinMacros()) { - 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$ - } - } // get the list of all mmp files selected for the build configuration // a null buildComponents list means all MMPs are included - so leave it null when indexing all files List buildComponents = null; if (!EpocEngineHelper.getIndexAllPreference()) buildComponents = carbideBuildConfig.getCarbideProject().isBuildingFromInf() ? null : carbideBuildConfig.getCarbideProject().getInfBuildComponents(); - - // if the pref option is enabled, then check the mmp's for MACRO's. - if (cpi.shouldUseMMPMacros()) { - List mmps = EpocEngineHelper.getMMPFilesForBuildConfiguration(carbideBuildConfig); - for (IPath mmp : mmps) { - if (buildComponents != null && !TextUtils.listContainsIgnoreCase(buildComponents, mmp.lastSegment())) - continue; - - List mmpMacros = EpocEngineHelper.getMMPMacrosForBuildConfiguration(mmp, carbideBuildConfig); - for (String mmpMacro : mmpMacros) { - // Symbian docs say they are converted to upper case always - macros.put(mmpMacro.toUpperCase(), ""); //$NON-NLS-1$ + + List mmpFiles = null; + List projectDefines = new ArrayList(); + if (buildComponents != null){ + // Get the list of mmp files we are building so we only get those macros + List tmpMMPFiles = EpocEngineHelper.getMMPFilesForBuildConfiguration(carbideBuildConfig); + mmpFiles = new ArrayList(); + for (IPath mmp : tmpMMPFiles){ + if (TextUtils.listContainsIgnoreCase(buildComponents, mmp.lastSegment())){ + mmpFiles.add(mmp); } } - } - + } + + projectDefines = EpocEngineHelper.getGlobalDefinesForConfiguration(carbideBuildConfig, mmpFiles); + // now create the path entries for the macros - for (String macro : macros.keySet()) { - macroEntries.add(new CMacroEntry(macro, macros.get(macro), 0)); + for (IDefine define : projectDefines) { + macroEntries.add(new CMacroEntry(define.getName(), define.getExpansion(), 0)); } // get the list of files the engine references when parsing the bld.inf and mmp files @@ -306,7 +332,7 @@ // the cache. cacheTimestamp = System.currentTimeMillis(); } - + private void persistCache() { // persist the cache between IDE launches. try { diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java Wed Aug 25 11:08:33 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,10 @@ ICConfigurationDescription config = projectDescription.getActiveConfiguration(); if (config != null) { CConfigurationData data = config.getConfigurationData(); + if (data == null){ + ICConfigurationDescription[] config2 = projectDescription.getConfigurations(); + data = config2[0].getConfigurationData(); + } if (data instanceof BuildConfigurationData) { return ((BuildConfigurationData)data).getConfiguration(); } @@ -322,6 +327,9 @@ } public IPath getAbsoluteBldInfPath(){ + if (projectRelativeBldInfPath.isAbsolute()){ + return projectRelativeBldInfPath; + } return CarbideBuilderPlugin.getProjectRoot(projectTracker.getProject()).append(projectRelativeBldInfPath); } @@ -330,13 +338,11 @@ } public IPath getWorkspaceRelativeBldInfPath(){ + if (projectRelativeBldInfPath.isAbsolute()){ + return projectRelativeBldInfPath; + } return new Path(projectTracker.getProject().getName()).append(projectRelativeBldInfPath); } - - public String getMMPTargetFile(){ - // now deprecated in 1.3 - return ""; - } public IProject getProject(){ return projectTracker.getProject(); diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java Wed Aug 25 11:08:33 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.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContextDataCache; 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java Wed Aug 25 11:08:33 2010 -0500 @@ -16,35 +16,77 @@ */ 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.ISBSv1BuildContext; +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.ISBVPlatform; +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.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 +140,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"); } } @@ -116,18 +162,20 @@ public boolean buildComponent(ICarbideBuildConfiguration buildConfig, IPath componentPath, boolean isTest, CarbideCommandLauncher launcher, IProgressMonitor monitor) { areWeManagingTheMakeFiles = shouldManageMakeFiles(buildConfig); - + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + + if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { return false; } 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 @@ -143,7 +191,7 @@ } args.add(EXPORT_CMD); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { args.add(arg); } @@ -179,7 +227,7 @@ args.add(buildPlatform); args.add(componentName); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldLibraryArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldLibraryArgs().split(" ")) { args.add(arg); } @@ -203,7 +251,7 @@ args.add(buildConfig.getTargetString().toLowerCase()); args.add(componentName); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { args.add(arg); } @@ -227,7 +275,7 @@ args.add(buildConfig.getTargetString().toLowerCase()); args.add(componentName); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { args.add(arg); } @@ -250,7 +298,7 @@ args.add(buildConfig.getTargetString().toLowerCase()); args.add(componentName); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { args.add(arg); } @@ -276,7 +324,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(componentName); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldBuildArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldBuildArgs().split(" ")) { argsList.add(arg); } @@ -298,18 +346,19 @@ public boolean cleanComponent(ICarbideBuildConfiguration buildConfig, IPath componentPath, boolean isTest, CarbideCommandLauncher launcher, IProgressMonitor monitor) { areWeManagingTheMakeFiles = shouldManageMakeFiles(buildConfig); - + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { return false; } 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); @@ -340,7 +389,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(componentName); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { argsList.add(arg); } @@ -361,18 +410,19 @@ public boolean freezeComponent(ICarbideBuildConfiguration buildConfig, IPath componentPath, boolean isTest, CarbideCommandLauncher launcher, IProgressMonitor monitor) { areWeManagingTheMakeFiles = shouldManageMakeFiles(buildConfig); - + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { return false; } 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 @@ -393,7 +443,7 @@ argsList.add(buildPlatform); argsList.add(componentName); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFreezeArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFreezeArgs().split(" ")) { argsList.add(arg); } @@ -425,7 +475,7 @@ } List buildConfigList = new ArrayList(1); - buildConfigList.add(buildConfig); + buildConfigList.add(buildConfig.getBuildContext()); List normalMakMakePaths = new ArrayList(); List testMakMakePaths = new ArrayList(); @@ -520,7 +570,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 +647,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) { @@ -608,12 +658,8 @@ IPath targetP = new Path(targetPath).makeRelative().addTrailingSeparator(); targetPath = targetP.toOSString(); } else { - // for EKA1 just leave empty. for EKA2 use sys\bin\ - if (buildConfig.getSDK().getOSVersion().getMajor() > 8) { - targetPath = "sys\\bin\\"; //$NON-NLS-1$ - } else { - targetPath = ""; //$NON-NLS-1$ - } + // for EKA2 use sys\bin\ + targetPath = "sys\\bin\\"; //$NON-NLS-1$ } String dataZDir = buildConfig.getSDK().getReleaseRoot().removeLastSegments(1).toOSString() + "\\Data\\z\\"; //$NON-NLS-1$ @@ -710,13 +756,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 +800,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; @@ -781,6 +828,8 @@ public boolean buildAllComponents(ICarbideBuildConfiguration buildConfig, List normalMakMakePaths, List testMakMakePaths, CarbideCommandLauncher launcher, IProgressMonitor monitor) { + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + //TODO: do we really want to bail if abld returns an error? is this the keepgoing flag? see what the command line builds do. // they bail on an individual build step, but keep building the other steps even if there's an error and keepgoing is not specified @@ -811,7 +860,7 @@ argsList.add(buildConfig.getPlatformString().toLowerCase()); argsList.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldBuildArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldBuildArgs().split(" ")) { argsList.add(arg); } @@ -835,7 +884,7 @@ argsList.add(buildConfig.getPlatformString().toLowerCase()); argsList.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldBuildArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldBuildArgs().split(" ")) { argsList.add(arg); } @@ -881,7 +930,7 @@ List args = new ArrayList(); args.add(EXPORT_CMD); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { args.add(arg); } @@ -916,7 +965,7 @@ args.add(LIBRARY_CMD); args.add(buildConfig.getPlatformString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldLibraryArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldLibraryArgs().split(" ")) { args.add(arg); } @@ -936,7 +985,7 @@ args.add(buildConfig.getPlatformString().toLowerCase()); args.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { args.add(arg); } @@ -956,7 +1005,7 @@ args.add(buildConfig.getPlatformString().toLowerCase()); args.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { args.add(arg); } @@ -975,7 +1024,7 @@ args.add(buildConfig.getPlatformString().toLowerCase()); args.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { args.add(arg); } @@ -997,7 +1046,7 @@ args.add(TEST_CMD); args.add(EXPORT_CMD); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { args.add(arg); } @@ -1020,7 +1069,7 @@ args.add(LIBRARY_CMD); args.add(buildConfig.getPlatformString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldLibraryArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldLibraryArgs().split(" ")) { args.add(arg); } @@ -1041,7 +1090,7 @@ args.add(buildConfig.getPlatformString().toLowerCase()); args.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { args.add(arg); } @@ -1062,7 +1111,7 @@ args.add(buildConfig.getPlatformString().toLowerCase()); args.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { args.add(arg); } @@ -1082,7 +1131,7 @@ args.add(buildConfig.getPlatformString().toLowerCase()); args.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { args.add(arg); } @@ -1101,6 +1150,8 @@ public boolean buildComponentSubset(ICarbideBuildConfiguration buildConfig, List normalMakMakePaths, List testMakMakePaths, CarbideCommandLauncher launcher, IProgressMonitor monitor) { + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + // need to run individual build steps when managing makefiles or doing concurrent builds if (!areWeManagingTheMakeFiles && !buildConfig.getCarbideProject().isConcurrentBuildingEnabled()) { // not using our dependency stuff. just call abld [test] build. note that we need @@ -1123,13 +1174,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(); @@ -1138,7 +1189,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldBuildArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldBuildArgs().split(" ")) { argsList.add(arg); } @@ -1155,13 +1206,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(); @@ -1171,7 +1222,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldBuildArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldBuildArgs().split(" ")) { argsList.add(arg); } @@ -1216,7 +1267,7 @@ List argsList = new ArrayList(); argsList.add(EXPORT_CMD); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { argsList.add(arg); } @@ -1250,13 +1301,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(); @@ -1264,7 +1315,7 @@ argsList.add(buildPlatform); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldLibraryArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldLibraryArgs().split(" ")) { argsList.add(arg); } @@ -1282,13 +1333,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(); @@ -1297,7 +1348,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { argsList.add(arg); } @@ -1315,13 +1366,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(); @@ -1330,7 +1381,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { argsList.add(arg); } @@ -1346,13 +1397,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(); @@ -1361,7 +1412,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { argsList.add(arg); } @@ -1380,7 +1431,7 @@ argsList.add(TEST_CMD); argsList.add(EXPORT_CMD); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { argsList.add(arg); } @@ -1400,13 +1451,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(); @@ -1415,7 +1466,7 @@ argsList.add(buildPlatform); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldLibraryArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldLibraryArgs().split(" ")) { argsList.add(arg); } @@ -1433,13 +1484,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(); @@ -1449,7 +1500,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { argsList.add(arg); } @@ -1467,13 +1518,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(); @@ -1483,7 +1534,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { argsList.add(arg); } @@ -1500,13 +1551,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(); @@ -1516,7 +1567,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { argsList.add(arg); } @@ -1538,6 +1589,8 @@ SubMonitor progress = SubMonitor.convert(monitor, 5); progress.setTaskName("Cleaning " + buildConfig.getDisplayString()); + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { return; } @@ -1572,7 +1625,7 @@ argsList.add(buildConfig.getPlatformString().toLowerCase()); argsList.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { argsList.add(arg); } @@ -1596,7 +1649,7 @@ argsList.add(buildConfig.getPlatformString().toLowerCase()); argsList.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { argsList.add(arg); } @@ -1618,7 +1671,7 @@ argsList.add(CLEAN_CMD); argsList.add(buildConfig.getPlatformString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getBldmakeCleanArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getBldmakeCleanArgs().split(" ")) { argsList.add(arg); } @@ -1636,6 +1689,8 @@ SubMonitor progress = SubMonitor.convert(monitor, 3 + normalMakMakePaths.size() + testMakMakePaths.size()); progress.setTaskName("Cleaning " + buildConfig.getDisplayString()); + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { return; } @@ -1669,13 +1724,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(); @@ -1684,7 +1739,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { argsList.add(arg); } @@ -1711,7 +1766,7 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { argsList.add(arg); } @@ -1732,7 +1787,7 @@ argsList.add(CLEAN_CMD); argsList.add(buildConfig.getPlatformString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getBldmakeCleanArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getBldmakeCleanArgs().split(" ")) { argsList.add(arg); } @@ -1749,7 +1804,8 @@ SubMonitor progress = SubMonitor.convert(monitor, 4); progress.setTaskName("Freezing " + buildConfig.getDisplayString()); - + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { return; } @@ -1775,7 +1831,7 @@ argsList.add(FREEZE_CMD); argsList.add(buildConfig.getPlatformString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFreezeArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFreezeArgs().split(" ")) { argsList.add(arg); } @@ -1798,7 +1854,7 @@ argsList.add(FREEZE_CMD); argsList.add(buildConfig.getPlatformString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFreezeArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFreezeArgs().split(" ")) { argsList.add(arg); } @@ -1818,7 +1874,8 @@ SubMonitor progress = SubMonitor.convert(monitor, 2 + normalMakMakePaths.size() + testMakMakePaths.size()); progress.setTaskName("Freezing " + buildConfig.getDisplayString()); - + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { return; } @@ -1844,13 +1901,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(); @@ -1858,7 +1915,7 @@ argsList.add(buildPlatform); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFreezeArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFreezeArgs().split(" ")) { argsList.add(arg); } @@ -1884,7 +1941,7 @@ argsList.add(buildConfig.getPlatformString().toLowerCase()); argsList.add(path.removeFileExtension().lastSegment()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFreezeArgs().split(" ")) { + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFreezeArgs().split(" ")) { argsList.add(arg); } @@ -2095,7 +2152,8 @@ argsList.add(buildConfig.getTargetString().toLowerCase()); argsList.add(componentName); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldCleanArgs().split(" ")) { argsList.add(arg); } @@ -2261,12 +2319,12 @@ } // we need to check the variant hrh files as well - File prefixFile = config.getSDK().getPrefixFile(); + File prefixFile = config.getBuildContext().getPrefixFromVariantCfg().toFile(); if (prefixFile != null && prefixFile.lastModified() > oldestMakefileTimestamp) { return true; } - for (File file : config.getPrefixFileIncludes()) { + for (File file : config.getBuildContext().getVariantHRHIncludes()) { if (file.lastModified() > oldestMakefileTimestamp) { return true; } @@ -2275,7 +2333,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()) { @@ -2303,12 +2361,12 @@ ICarbideProjectInfo cpi = config.getCarbideProject(); IPath workingDir = cpi.getINFWorkingDirectory(); - launcher.setErrorParserManager(workingDir, CarbideCPPBuilder.getParserIdArray(config.getErrorParserId())); + launcher.setErrorParserManager(workingDir, config.getErrorParserList()); launcher.writeToConsole("\n***Generating abld makefile.\n"); // 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,18 +2383,19 @@ } 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$ abldArgs.add(buildPlatform); abldArgs.add(componentPath.removeFileExtension().lastSegment()); - for (String arg : config.getBuildArgumentsInfo().getAbldMakefileArgs().split(" ")) { + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)config.getBuildContext(); + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldMakefileArgs().split(" ")) { abldArgs.add(arg); } @@ -2358,7 +2417,6 @@ } catch (CoreException e) { CarbideBuilderPlugin.log(e); e.printStackTrace(); - //TODO is this enough? } } } @@ -2382,12 +2440,12 @@ final long makefileTimestamp = makefile.lastModified(); // we need to check the variant hrh files as well - File prefixFile = config.getSDK().getPrefixFile(); + File prefixFile = config.getBuildContext().getPrefixFromVariantCfg().toFile(); if (prefixFile != null && prefixFile.lastModified() > makefileTimestamp) { return true; } - for (File file : config.getPrefixFileIncludes()) { + for (File file : config.getBuildContext().getVariantHRHIncludes()) { if (file.lastModified() > makefileTimestamp) { return true; } @@ -2395,7 +2453,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,12 +2523,12 @@ final long makefileTimestamp = makefile.lastModified(); // we need to check the variant hrh files as well - File prefixFile = config.getSDK().getPrefixFile(); + File prefixFile = config.getBuildContext().getPrefixFromVariantCfg().toFile(); if (prefixFile != null && prefixFile.lastModified() > makefileTimestamp) { return true; } - for (File file : config.getPrefixFileIncludes()) { + for (File file : config.getBuildContext().getVariantHRHIncludes()) { if (file.lastModified() > makefileTimestamp) { return true; } @@ -2478,7 +2536,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 +2605,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 +2665,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 +2682,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 +2697,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) { @@ -2747,7 +2805,7 @@ newRule = newRule + "\t" + cpp + " -undef -M -nostdinc "; // add the compiler prefix file if any - IPath compilerPrefix = config.getCompilerPrefixFile(); + IPath compilerPrefix = config.getBuildContext().getCompilerPrefixFile(); if (compilerPrefix != null) { newRule = newRule + "-include \"" + compilerPrefix.toOSString() + "\" "; } @@ -2778,7 +2836,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 +2851,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 +2893,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 = config.getBuildContext().getPrefixFromVariantCfg().toFile(); + if (sbvPlatform != null){ // might be an alternate HRH file to use IPath varVarHRH = sbvPlatform.getBuildVariantHRHFile(); @@ -2849,7 +2910,6 @@ newRule = newRule + "-include \"" + sdkPrefix.getAbsolutePath() + "\" "; } - newRule += " -o " + depFilePath + view.getEOL(); // for some reason cpp.exe doesn't like paths without the drive letter when working on a subst'ed drive. @@ -2906,8 +2966,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 +2979,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 +2998,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) { @@ -3056,4 +3116,6 @@ public IPath getMakefileDirectory(ICarbideBuildConfiguration config) { return new Path(config.getSDK().getEPOCROOT()).append(EPOC_BUILD_DIR).append(config.getCarbideProject().getAbsoluteBldInfPath().removeLastSegments(1).setDevice(null)); } + + } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Wed Aug 25 11:08:33 2010 -0500 @@ -28,10 +28,11 @@ import org.eclipse.core.runtime.SubMonitor; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; -import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; +import com.nokia.carbide.cdt.builder.EpocEngineHelper; 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.ISBSv2BuildContext; import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; public class CarbideSBSv2Builder implements ICarbideBuilder { @@ -47,10 +48,6 @@ SubMonitor progress = SubMonitor.convert(monitor, 3); progress.setTaskName(CarbideBuildManagerUtils.getBuildLabel(buildConfig, null)); - - if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { - return false; - } progress.worked(1); if (progress.isCanceled()) { @@ -87,36 +84,32 @@ } /** 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(); + protected String getConfigName(ICarbideBuildConfiguration buildConfig, IPath componentPath) { + 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(); } - ISBSv2BuildConfigInfo sbsv2Info = ((CarbideBuildConfiguration)buildConfig).getSBSv2BuildConfigInfo(); - if (sbsv2Info != null){ - String variant = sbsv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT); - if (variant != null && variant.length() > 1){ - buildAlias = buildAlias + variant; - } + + if (buildAlias.contains(".") && componentPath != null && + !EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), componentPath)){ + // This is a variant build, but the MMP is not a variant so just take the base alias. + buildAlias = buildAlias.split("\\.")[0]; } + return buildAlias; } public boolean buildComponent(ICarbideBuildConfiguration buildConfig, IPath componentPath, boolean isTest, CarbideCommandLauncher launcher, IProgressMonitor monitor) { String componentName = componentPath.lastSegment(); - if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { - return false; - } - SubMonitor progress = SubMonitor.convert(monitor, 1); progress.setTaskName(CarbideBuildManagerUtils.getBuildLabel(buildConfig, componentName)); List argsList = new ArrayList(); argsList.add(COMPONENT_ARG); - argsList.add(componentName); + argsList.add(componentPath.toOSString()); if (!invokeSBSCommand(buildConfig, launcher, argsList, isTest)) { return false; @@ -137,10 +130,6 @@ SubMonitor progress = SubMonitor.convert(monitor, 1 + normalMakMakePaths.size() + testMakMakePaths.size()); progress.setTaskName(CarbideBuildManagerUtils.getBuildLabel(buildConfig, null)); - if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { - return false; - } - progress.worked(1); if (progress.isCanceled()) { return false; @@ -191,10 +180,6 @@ SubMonitor progress = SubMonitor.convert(monitor, 3); progress.setTaskName("Cleaning " + buildConfig.getDisplayString()); - if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { - return; - } - progress.worked(1); if (progress.isCanceled()) { return; @@ -244,10 +229,6 @@ SubMonitor progress = SubMonitor.convert(monitor, 2); progress.setTaskName("Cleaning " + componentName); - if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { - return false; - } - int cleanLevel = buildConfig.getCarbideProject().getCleanLevel(); String cleanCmd = REALLYCLEAN_CMD; if (0 == cleanLevel) { @@ -257,7 +238,7 @@ List argsList = new ArrayList(); argsList.add(cleanCmd); argsList.add(COMPONENT_ARG); - argsList.add(componentName); + argsList.add(componentPath.toOSString()); if (!invokeSBSCommand(buildConfig, launcher, argsList, isTest)) { return false; @@ -278,10 +259,6 @@ SubMonitor progress = SubMonitor.convert(monitor, 1 + normalMakMakePaths.size() + testMakMakePaths.size()); progress.setTaskName("Cleaning " + buildConfig.getDisplayString()); - if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { - return; - } - progress.worked(1); if (progress.isCanceled()) { return; @@ -343,10 +320,6 @@ SubMonitor progress = SubMonitor.convert(monitor, 3); progress.setTaskName("Freezing " + buildConfig.getDisplayString()); - if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { - return; - } - progress.worked(1); if (progress.isCanceled()) { return; @@ -383,14 +356,11 @@ } public boolean freezeComponent(ICarbideBuildConfiguration buildConfig, IPath componentPath, boolean isTest, CarbideCommandLauncher launcher, IProgressMonitor monitor) { - if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { - return false; - } List argsList = new ArrayList(); argsList.add(FREEZE_CMD); argsList.add(COMPONENT_ARG); - argsList.add(componentPath.lastSegment()); + argsList.add(componentPath.toOSString()); if (!invokeSBSCommand(buildConfig, launcher, argsList, isTest)) { return false; @@ -410,10 +380,6 @@ SubMonitor progress = SubMonitor.convert(monitor, 1 + normalMakMakePaths.size() + testMakMakePaths.size()); progress.setTaskName("Freezing " + buildConfig.getDisplayString()); - if (!CarbideCPPBuilder.generateBldmakeMakefilesIfNecessary(buildConfig, launcher)) { - return; - } - progress.worked(1); if (progress.isCanceled()) { return; @@ -508,7 +474,13 @@ args.add("-b"); //$NON-NLS-1$ args.add(cpi.getAbsoluteBldInfPath().toOSString()); args.add("-c"); //$NON-NLS-1$ - String configName = getConfigName(buildConfig); + IPath componentPath = null; + if (sbsArgs.size() >= 2){ + componentPath = new Path(sbsArgs.get(sbsArgs.indexOf("-p")+ 1)); + sbsArgs.remove(1); + sbsArgs.add(componentPath.lastSegment()); + } + String configName = getConfigName(buildConfig, componentPath); if (isTest) { configName = configName + ".test"; //$NON-NLS-1$ @@ -516,6 +488,12 @@ args.add(configName); + if (!sbsArgs.contains("-p") && configName.contains(".")){ + // normal build, we also need to add an extra -c param for non-variation build + args.add("-c"); + args.add(configName.split("\\.")[0]); + } + //TODO this causes output to go to stdout, but only at the end of the build. should we specify a logfile name and tail the file? args.add("-f"); //$NON-NLS-1$ args.add("-"); //$NON-NLS-1$ @@ -590,7 +568,7 @@ ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); IPath workingDirectory = cpi.getINFWorkingDirectory(); - String configName = getConfigName(buildConfig); + String configName = getConfigName(buildConfig, fullMMPPath); String[] sbsArgs = new String[] {"--source-target=" + file.toOSString(), COMPILE_ARG, configName, COMPONENT_ARG, fullMMPPath.toFile().getName()}; launcher.setErrorParserManager(buildConfig.getCarbideProject().getINFWorkingDirectory(), buildConfig.getErrorParserList()); diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/EnvironmentVarsInfo.java Wed Aug 25 11:08:33 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.api.sdk.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.x86build.X86BuildPlugin; +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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/EnvironmentVarsInfo2.java Wed Aug 25 11:08:33 2010 -0500 @@ -16,10 +16,26 @@ */ package com.nokia.carbide.cdt.internal.builder; +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; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; + 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.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.ISBSv1BuildContext; 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; @@ -28,15 +44,6 @@ import com.nokia.cpp.internal.api.utils.core.PathUtils; import com.nokia.cpp.internal.api.utils.core.TrackedResource; -import org.eclipse.cdt.core.settings.model.ICStorageElement; -import org.eclipse.cdt.utils.spawner.EnvironmentReader; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -import java.io.File; -import java.util.*; - public class EnvironmentVarsInfo2 implements IEnvironmentVarsInfo { // NOTE: all the paths below use Win32 paths. We convert these to Unix format at the end of the @@ -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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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: -* -*/ -package com.nokia.carbide.cdt.internal.builder; - -/** - * Interface to SBSv2 build configuration specific data - */ -public interface ISBSv2BuildConfigInfo { - - // Data attribute id's saved in .cproject file - public final static String ATRRIB_CONFIG_BASE_PLATFORM = "CONFIG_BASE_PLATFORM"; //$NON-NLS-1$ - public final static String ATTRIB_CONFIG_TARGET = "CONFIG_TARGET"; //$NON-NLS-1$ - 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"; - - /** Retrieve a specfic .cproject SBSv2 data value from a given ID */ - String getSBSv2Setting(String id); - - /** - * Set a specific SBSv2 configuration specific data value - * @param id - * @param value - */ - void setSBSv2Setting(String id, String value); -} diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ROMBuilderInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ROMBuilderInfo.java Tue Aug 24 16:42:58 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +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. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.carbide.cdt.internal.builder; - -import java.io.File; - -import org.eclipse.cdt.core.settings.model.ICStorageElement; - -import com.nokia.carbide.cdt.builder.project.IROMBuilderInfo; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.cpp.internal.api.utils.core.HostOS; - - -public class ROMBuilderInfo implements IROMBuilderInfo { - - private static final String ROMBUILDCOMMANDLINESTORAGE = "ROMBUILDCOMMANDLINESTORAGE"; //$NON-NLS-1$ - private static final String ROMBUILDWORKINGDIRECTORYSTORAGE = "ROMBUILDWORKINGDIRECTORYSTORAGE"; //$NON-NLS-1$ - - - private String romBuildCommandLine; - private String romBuildWorkingDirectory; - - - public ROMBuilderInfo(ISymbianSDK sdk) { - - this.romBuildCommandLine = ""; //$NON-NLS-1$ - this.romBuildWorkingDirectory = HostOS.IS_WIN32 ? "C:\\" : "/tmp"; //$NON-NLS-1$ //$NON-NLS-2$ - - // now set epoc32\rom folder in the sdk as the default working dir - // this is most common folder that rom images are built from for most symbian kits.. - String dir = sdk.getEPOCROOT() + "epoc32/rom/"; //$NON-NLS-1$ - if (new File(dir).exists()) - romBuildWorkingDirectory = dir; - } - - public void loadFromStorage(ICStorageElement rootStorage) { - String value = rootStorage.getAttribute(ROMBUILDCOMMANDLINESTORAGE); - if (value != null) { - romBuildCommandLine = value; - } - - value = rootStorage.getAttribute(ROMBUILDWORKINGDIRECTORYSTORAGE); - if (value != null) { - romBuildWorkingDirectory = value; - } - } - - public void saveToStorage(ICStorageElement rootStorage) { - if (romBuildCommandLine.trim().length() > 0) { - rootStorage.setAttribute(ROMBUILDCOMMANDLINESTORAGE, romBuildCommandLine); - } - - if (romBuildWorkingDirectory.trim().length() > 0) { - rootStorage.setAttribute(ROMBUILDWORKINGDIRECTORYSTORAGE, romBuildWorkingDirectory); - } - } - - public String getCommandLine() { - return romBuildCommandLine; - } - - public String getWorkingDirectory() { - return romBuildWorkingDirectory; - } - - public void setCommandLine(String romBuildCommandLine) { - this.romBuildCommandLine = romBuildCommandLine; - } - - public void setWorkingDirectory(String romBuildWorkingDirectory) { - this.romBuildWorkingDirectory = romBuildWorkingDirectory; - } -} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +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: -* -*/ -package com.nokia.carbide.cdt.internal.builder; - -import java.util.HashMap; - -import org.eclipse.cdt.core.settings.model.ICStorageElement; - -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; - -public class SBSv2BuilderInfo implements ISBSv2BuildConfigInfo { - - HashMap sbsv2ConfigDataMap = new HashMap(); - -// private static String TRUE = "true"; -// private static String FALSE = "false"; - - ISymbianBuildContext context; - - public SBSv2BuilderInfo(ISymbianBuildContext 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.ATTRIB_CONFIG_TARGET, context.getTargetString()); - sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, context.getDisplayString()); - sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT, ""); - this.context = context; - } - - public void loadFromStorage(ICStorageElement rootStorage) { - - String value = rootStorage.getAttribute(ATRRIB_CONFIG_BASE_PLATFORM); - if (value != null) { - sbsv2ConfigDataMap.put(ATRRIB_CONFIG_BASE_PLATFORM, value); - } - - value = rootStorage.getAttribute(ATTRIB_SBSV2_VARIANT); - if (value != null) { - sbsv2ConfigDataMap.put(ATTRIB_SBSV2_VARIANT, value); - } - - value = rootStorage.getAttribute(ATTRIB_CONFIG_TARGET); - if (value != null) { - sbsv2ConfigDataMap.put(ATTRIB_CONFIG_TARGET, value); - } - - value = rootStorage.getAttribute(ATTRIB_SBSV2_BUILD_ALIAS); - if (value != null) { - sbsv2ConfigDataMap.put(ATTRIB_SBSV2_BUILD_ALIAS, value); - } - - value = rootStorage.getAttribute(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING); - if (value != null) { - sbsv2ConfigDataMap.put(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, value); - } - - } - - public void saveToStorage(ICStorageElement rootStorage) { - - String value = sbsv2ConfigDataMap.get(ATRRIB_CONFIG_BASE_PLATFORM); - if (value != null && value.trim().length() > 0){ - rootStorage.setAttribute(ATRRIB_CONFIG_BASE_PLATFORM, value); - } - - value = sbsv2ConfigDataMap.get(ATTRIB_SBSV2_VARIANT); - if (value != null && value.trim().length() > 0){ - rootStorage.setAttribute(ATTRIB_SBSV2_VARIANT, value); - } - - value = sbsv2ConfigDataMap.get(ATTRIB_CONFIG_TARGET); - if (value != null && value.trim().length() > 0){ - rootStorage.setAttribute(ATTRIB_CONFIG_TARGET, value); - } - - value = sbsv2ConfigDataMap.get(ATTRIB_SBSV2_BUILD_ALIAS); - if (value != null && value.trim().length() > 0){ - rootStorage.setAttribute(ATTRIB_SBSV2_BUILD_ALIAS, value); - } - - value = sbsv2ConfigDataMap.get(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING); - if (value != null && value.trim().length() > 0){ - rootStorage.setAttribute(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, value); - } - - } - - public String getSBSv2Setting(String id) { - return sbsv2ConfigDataMap.get(id); - } - - public void setSBSv2Setting(String id, String value) { - sbsv2ConfigDataMap.put(id, value); - } - -} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/SISBuilderInfo.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/ArgumentsTabComposite.java Wed Aug 25 11:08:33 2010 -0500 @@ -25,11 +25,13 @@ import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Text; -import com.nokia.carbide.cdt.builder.BuildArgumentsInfo; -import com.nokia.carbide.cdt.builder.project.IBuildArgumentsInfo; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.internal.builder.CarbideBuildConfiguration; +import com.nokia.carbide.cpp.internal.api.sdk.BuildArgumentsInfo; +import com.nokia.carbide.cpp.internal.api.sdk.IBuildArgumentsInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; /** * Arguments tab for the Carbide Build Configurations page @@ -159,7 +161,8 @@ } public void initData(ICarbideBuildConfiguration buildConfig) { - IBuildArgumentsInfo argsInfo = buildConfig.getBuildArgumentsInfo(); + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig.getBuildContext(); + IBuildArgumentsInfo argsInfo = sbsv1Context.getBuildArgumentsInfo(); bldMakeBldfilesEdit.setText(argsInfo.getBldmakeBldFilesArgs()); bldMakeCleanEdit.setText(argsInfo.getBldmakeCleanArgs()); abldBuildEdit.setText(argsInfo.getAbldBuildArgs()); @@ -176,7 +179,8 @@ public boolean compareConfigurationSettings(ICarbideBuildConfiguration selectedConfig, boolean writeToConfig) { boolean settingsEqual = true; - IBuildArgumentsInfo existingInfo = selectedConfig.getBuildArgumentsInfo(); + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)selectedConfig.getBuildContext(); + IBuildArgumentsInfo existingInfo = sbsv1Context.getBuildArgumentsInfo(); settingsEqual = existingInfo.getBldmakeBldFilesArgs().equals(bldMakeBldfilesEdit.getText()) && existingInfo.getBldmakeCleanArgs().equals(bldMakeCleanEdit.getText()) && existingInfo.getAbldBuildArgs().equals(abldBuildEdit.getText()) && @@ -190,7 +194,7 @@ existingInfo.getAbldFreezeArgs().equals(abldFreezeEdit.getText()); if (!settingsEqual && writeToConfig) { - ((CarbideBuildConfiguration)selectedConfig).setBuildArgumentsInfo(new BuildArgumentsInfo(bldMakeBldfilesEdit.getText(), bldMakeCleanEdit.getText(), + sbsv1Context.setBuildArgumentsInfo(new BuildArgumentsInfo(bldMakeBldfilesEdit.getText(), bldMakeCleanEdit.getText(), abldBuildEdit.getText(), abldExportEdit.getText(), abldMakefileEdit.getText(), abldLibraryEdit.getText(), abldResourceEdit.getText(), abldTargetEdit.getText(), abldFinalEdit.getText(), abldCleanEdit.getText(), abldFreezeEdit.getText())); } @@ -211,7 +215,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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideBuildConfigurationsPage.java Wed Aug 25 11:08:33 2010 -0500 @@ -151,12 +151,6 @@ // paths and symbols tab PathsAndSymbolsTabComposite pathsAndSymbolsTabComposite; - // rom builder tab - ROMBuilderTabComposite romBuilderTabComposite; - - // SBSv2 config data tab - SBSv2BuildConfigTabComposite sbsv2BuildConfigTabComposite; - // Configuration management/switching private IProject project; private BuildConfigCombo buildConfigurationCombo; @@ -226,20 +220,6 @@ data.horizontalIndent = 18; data.verticalIndent = 18; control.setLayoutData(data); - - //////////////////// SBSv2 Config Data Tab ///////////// - if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project)) { - - TabItem sbsV2TabItem = new TabItem(tabFolder, SWT.NONE); - sbsV2TabItem.setText(Messages.getString("CarbideBuildConfigurationsPage.SBSv2_Tab")); //$NON-NLS-1$ - sbsV2TabItem.setToolTipText(Messages.getString("CarbideBuildConfigurationsPage.Environement_Tab_ToolTip")); //$NON-NLS-1$ - - sbsv2BuildConfigTabComposite = new SBSv2BuildConfigTabComposite(sbsV2TabItem); - sbsv2BuildConfigTabComposite.createControls(); - sbsV2TabItem.setControl(sbsv2BuildConfigTabComposite); - } - //////////////////////////////////////////////////////// - ////////////////////// Environment Tab //////////////// TabItem envTabItem = new TabItem(tabFolder, SWT.NONE); @@ -364,15 +344,6 @@ pathsAndSymbolsTabComposite.createControls(); pathsAndSymbolsTabItem.setControl(pathsAndSymbolsTabComposite); - /////////////////// ROM Builder Tab ///////////////// - TabItem romBuilderTabItem = new TabItem(tabFolder, SWT.NONE); - romBuilderTabItem.setText(Messages.getString("CarbideRomBuilderTab.Title")); //$NON-NLS-1$ - romBuilderTabItem.setToolTipText(Messages.getString("CarbideRomBuilderTab.ToolTip")); //$NON-NLS-1$ - - romBuilderTabComposite = new ROMBuilderTabComposite(romBuilderTabItem); - romBuilderTabComposite.createControls(); - romBuilderTabItem.setControl(romBuilderTabComposite); - // read in the settings and populate the prefs... if (project != null) { loadConfigurationSettings(); @@ -381,14 +352,11 @@ ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); if (config != null) { sisFilesBlock.initData(config); - if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project)) { - sbsv2BuildConfigTabComposite.initData(config); - } + if (argumentsTabcomposite != null) { argumentsTabcomposite.initData(config); } pathsAndSymbolsTabComposite.initData(config); - romBuilderTabComposite.initData(config); } } setUpEnvVarsTable(new String[0], null); @@ -660,9 +628,7 @@ boolean sisSettingsEqual = sisFilesBlock.compareConfigurationSettings(selectedConfig, writeToConfig); boolean sbsv2ConfigEqual = true; - if (sbsv2BuildConfigTabComposite != null) { - sbsv2ConfigEqual = sbsv2BuildConfigTabComposite.compareConfigurationSettings(selectedConfig, writeToConfig); - } + // Compare envVars settings boolean envVarsSettingsEqual = envVarList.size() == envVarListOrig.size() && envVarList.equals(envVarListOrig); if (!envVarsSettingsEqual && writeToConfig) { @@ -676,9 +642,7 @@ boolean pathsAndSynmbolsSettingsEqual = pathsAndSymbolsTabComposite.compareConfigurationSettings(selectedConfig, writeToConfig); - boolean romBuilderSettingsEqual = romBuilderTabComposite.compareConfigurationSettings(selectedConfig, writeToConfig); - - return sisSettingsEqual && sbsv2ConfigEqual && envVarsSettingsEqual && argsSettingsEqual && pathsAndSynmbolsSettingsEqual && romBuilderSettingsEqual; + return sisSettingsEqual && sbsv2ConfigEqual && envVarsSettingsEqual && argsSettingsEqual && pathsAndSynmbolsSettingsEqual; } private void saveConfigurationSettings(ICarbideBuildConfiguration config) { @@ -981,15 +945,12 @@ ICarbideBuildConfiguration lastConfig = cpi.getNamedConfiguration(lastSelectedConfigName); if (lastConfig != null) { sisFilesBlock.initData(lastConfig); - if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project)) { - sbsv2BuildConfigTabComposite.initData(lastConfig); - } + setUpEnvVarsTable(new String[0], null); // refresh env vars info if (argumentsTabcomposite != null) { argumentsTabcomposite.initData(lastConfig); } pathsAndSymbolsTabComposite.initData(lastConfig); - romBuilderTabComposite.initData(lastConfig); } } @@ -1001,14 +962,13 @@ 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()); } pathsAndSymbolsTabComposite.performDefaults(cpi.getNamedConfiguration(lastSelectedConfigName).getSDK()); - romBuilderTabComposite.performDefaults(cpi.getNamedConfiguration(lastSelectedConfigName).getSDK()); super.performDefaults(); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPProjectSettingsPage.java Wed Aug 25 11:08:33 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(); } @@ -398,7 +401,11 @@ selectionUI.setLayoutData(gridData); // set the data - selectionUI.setBldInfFile(cpi.getAbsoluteBldInfPath(), cpi.getBuildConfigurations(), CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject())); + List buildContexts = new ArrayList(); + for (ICarbideBuildConfiguration config : cpi.getBuildConfigurations()){ + buildContexts.add(config.getBuildContext()); + } + selectionUI.setBldInfFile(cpi.getAbsoluteBldInfPath(), buildContexts, CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject())); // set checked state selectionUI.setAllChecked(false); diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/PathsAndSymbolsTabComposite.java Wed Aug 25 11:08:33 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)); @@ -256,7 +256,7 @@ ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(buildConfig.getCarbideProject().getProject()); if (projDes != null) { - ICConfigurationDescription configDes = projDes.getConfigurationById(buildConfig.getDisplayString()); + ICConfigurationDescription configDes = projDes.getConfigurationById(buildConfig.getBuildContext().getConfigurationID()); if (configDes != null) { CConfigurationData configData = configDes.getConfigurationData(); if (configData != null) { diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/ROMBuilderTabComposite.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/ROMBuilderTabComposite.java Tue Aug 24 16:42:58 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +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. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.carbide.cdt.internal.builder.ui; - -import java.io.File; - -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.Text; - -import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; -import com.nokia.carbide.cdt.builder.project.IROMBuilderInfo; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; - -/** - * Arguments tab for the Carbide Build Configurations page - * - */ -public class ROMBuilderTabComposite extends Composite { - - private Text cmdLineEdit; - private Text workingDirEdit; - private Button workingDirBrowse; - - - public ROMBuilderTabComposite(TabItem tabItem) { - super(tabItem.getParent(), SWT.NONE); - } - - public void createControls() { - setLayout(new GridLayout(3, false)); - - Label cmdLineLabel = new Label(this, SWT.NONE); - cmdLineLabel.setText(Messages.getString("CarbideRomBuilderTab.Cmd_Line")); //$NON-NLS-1$ - cmdLineLabel.setToolTipText(Messages.getString("CarbideRomBuilderTab.Cmd_Line_Tool_Tip")); //$NON-NLS-1$ - - cmdLineEdit = new Text(this, SWT.BORDER); - cmdLineEdit.setToolTipText(Messages.getString("CarbideRomBuilderTab.BldfilesArgumentsToolTip")); //$NON-NLS-1$ - cmdLineEdit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); - - Label workingDirLabel = new Label(this, SWT.NONE); - workingDirLabel.setText(Messages.getString("CarbideRomBuilderTab.Working_Dir")); //$NON-NLS-1$ - workingDirLabel.setToolTipText(Messages.getString("CarbideRomBuilderTab.Working_Dir_Tool_Tip")); //$NON-NLS-1$ - - workingDirEdit = new Text(this, SWT.BORDER); - workingDirEdit.setToolTipText(Messages.getString("CarbideRomBuilderTab.Working_Dir_Tool_Tip")); //$NON-NLS-1$ - workingDirEdit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - - workingDirBrowse = ControlFactory.createPushButton(this, Messages.getString("CarbideRomBuilderTab.Browse")); //$NON-NLS-1$ - workingDirBrowse.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE); - BrowseDialogUtils.initializeFrom(dialog, workingDirEdit); - - dialog.setText(Messages.getString("CarbideRomBuilderTab.Rom_Dir_Dialog_Title")); //$NON-NLS-1$ - String result = dialog.open(); - - if (result != null) { - workingDirEdit.setText(result); - } - } - }); - } - - public void initData(ICarbideBuildConfiguration buildConfig) { - IROMBuilderInfo romInfo = buildConfig.getROMBuildInfo(); - cmdLineEdit.setText(romInfo.getCommandLine()); - workingDirEdit.setText(romInfo.getWorkingDirectory()); - } - - public boolean compareConfigurationSettings(ICarbideBuildConfiguration selectedConfig, boolean writeToConfig) { - boolean settingsEqual = true; - - IROMBuilderInfo existingInfo = selectedConfig.getROMBuildInfo(); - settingsEqual = existingInfo.getCommandLine().equals(cmdLineEdit.getText()) && - existingInfo.getWorkingDirectory().equals(workingDirEdit.getText()); - - if (!settingsEqual && writeToConfig) { - existingInfo.setCommandLine(cmdLineEdit.getText()); - existingInfo.setWorkingDirectory(workingDirEdit.getText()); - } - - return settingsEqual; - } - - public void performDefaults(ISymbianSDK sdk) { - cmdLineEdit.setText(""); //$NON-NLS-1$ - workingDirEdit.setText("C:\\"); //$NON-NLS-1$ - - // now set epoc32\rom folder in the sdk as the default working dir - // this is most common folder that rom images are built from for most symbian kits.. - String dir = sdk.getEPOCROOT() + "epoc32\\rom\\"; //$NON-NLS-1$ - if (new File(dir).exists()) - workingDirEdit.setText(dir); - } -} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +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: -* -*/ -package com.nokia.carbide.cdt.internal.builder.ui; - -import java.io.File; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.Text; - -import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; -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.ISymbianSDK; - -public class SBSv2BuildConfigTabComposite extends Composite { - - private static final String configCmdLabelPrefixText = "Configuration Command: -c "; // $NON-NLS-N$ - private static final String releaseTreeLabelPrefixText = "Release Tree: "; // $NON-NLS-N$ - - Text variantEdit; - - Label configCmdLabel; - Label releaseTreeLabel; - private ICarbideBuildConfiguration config; - - public SBSv2BuildConfigTabComposite(TabItem tabItem) { - super(tabItem.getParent(), SWT.NONE); - } - - public void createControls() { - setLayout(new GridLayout(2, false)); - - Label variantLabel = new Label(this, SWT.NONE); - variantLabel.setText(Messages.getString("CarbideSBSv2ConfigTab.VariantLabel")); //$NON-NLS-1$ - variantLabel.setToolTipText(Messages.getString("CarbideSBSv2ConfigTab.VariantLabel_ToolTip")); //$NON-NLS-1$ - - variantEdit = new Text(this, SWT.BORDER); - variantEdit.setToolTipText(Messages.getString("CarbideSBSv2ConfigTab.VariantLabel_ToolTip")); //$NON-NLS-1$ - variantEdit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - SelectionListener listener; - variantEdit.addKeyListener( new KeyListener() { - - public void keyReleased(KeyEvent e) { - setVaraintDetailsText(); - } - - public void keyPressed(KeyEvent e) { - // ignore - } - }); - - Group emulatorBuildOptionsGroup; - emulatorBuildOptionsGroup = new Group(this, SWT.NONE); - emulatorBuildOptionsGroup.setLayout(new GridLayout(1, false)); - GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1); - emulatorBuildOptionsGroup.setLayoutData(gd); - emulatorBuildOptionsGroup.setText("Build Variant Details"); //$NON-NLS-1$ - - configCmdLabel = new Label(emulatorBuildOptionsGroup, SWT.CHECK); - configCmdLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - releaseTreeLabel = new Label(emulatorBuildOptionsGroup, SWT.CHECK); - releaseTreeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - } - - public void initData(ICarbideBuildConfiguration buildConfig) { - this.config = buildConfig; - ISBSv2BuildConfigInfo sbsv2ConfigInfo = ((CarbideBuildConfiguration)buildConfig).getSBSv2ConfigInfo(); - if (sbsv2ConfigInfo != null && sbsv2ConfigInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT) != null){ - variantEdit.setText(sbsv2ConfigInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT)); - } else { - variantEdit.setText(""); - } - - setVaraintDetailsText(); - } - - private void setVaraintDetailsText() { - - String configCmdText = configCmdLabelPrefixText; - if (config != null){ - if (config.getSBSv2Alias() == null){ - configCmdText += config.getPlatformString().toLowerCase() + "_" + config.getTargetString().toLowerCase() + variantEdit.getText(); - } else { - configCmdText += config.getSBSv2Alias() + variantEdit.getText(); - } - } - configCmdLabel.setText(configCmdText); - - String variantText = SBSv2Utils.getVariantOutputDirModifier(variantEdit.getText()); - if (variantText == null) variantText = ""; - String relTreeText = releaseTreeLabelPrefixText; - if (config != null){ - relTreeText += " " + config.getSDK().getEPOCROOT() + "epoc32" + File.separator + "release" + File.separator + config.getPlatformString().toLowerCase() + variantText + File.separator + config.getTargetString().toLowerCase(); - } - releaseTreeLabel.setText(relTreeText); - } - - - - public boolean compareConfigurationSettings(ICarbideBuildConfiguration selectedConfig, boolean writeToConfig) { - boolean settingsEqual = true; - - ISBSv2BuildConfigInfo currSBSv2Info = ((CarbideBuildConfiguration)selectedConfig).getSBSv2ConfigInfo(); - if (currSBSv2Info != null){ - settingsEqual = currSBSv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT).equals(variantEdit.getText()); - - if (!settingsEqual && writeToConfig) { - currSBSv2Info.setSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT, variantEdit.getText()); - } - } - - return settingsEqual; - } - - public void performDefaults(ISymbianSDK sdk) { - variantEdit.setText(""); - } -} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/SisFilesBlock.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ABLDCommandHandler.java --- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ABLDCommandHandler.java Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ABLDCommandHandler.java Wed Aug 25 11:08:33 2010 -0500 @@ -37,6 +37,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.ISBSv1BuildContext; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; public class ABLDCommandHandler extends ProjectCommandHandler { @@ -180,7 +181,8 @@ args.add(buildConfig.getPlatformString().toLowerCase()); args.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { //$NON-NLS-1$ + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig; + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldTargetArgs().split(" ")) { //$NON-NLS-1$ args.add(arg); } @@ -191,7 +193,8 @@ List args = new ArrayList(); args.add("export"); //$NON-NLS-1$ - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { //$NON-NLS-1$ + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig; + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldExportArgs().split(" ")) { //$NON-NLS-1$ args.add(arg); } @@ -204,7 +207,8 @@ args.add(buildConfig.getPlatformString().toLowerCase()); args.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { //$NON-NLS-1$ + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig; + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldResourceArgs().split(" ")) { //$NON-NLS-1$ args.add(arg); } @@ -217,7 +221,8 @@ args.add(buildConfig.getPlatformString().toLowerCase()); args.add(buildConfig.getTargetString().toLowerCase()); - for (String arg : buildConfig.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { //$NON-NLS-1$ + ISBSv1BuildContext sbsv1Context = (ISBSv1BuildContext)buildConfig; + for (String arg : sbsv1Context.getBuildArgumentsInfo().getAbldFinalArgs().split(" ")) { //$NON-NLS-1$ args.add(arg); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuildPKGCommandHandler.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuilderUtilsPropertyTester.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/CompileHandler.java --- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/CompileHandler.java Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/CompileHandler.java Wed Aug 25 11:08:33 2010 -0500 @@ -80,7 +80,7 @@ IProject lastProject = selectedFiles.get(0).getProject(); ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(lastProject); - String[] errorParserIds = CarbideCPPBuilder.getParserIdArray(cpi.getDefaultConfiguration().getErrorParserId()); + String[] errorParserIds = cpi.getDefaultConfiguration().getErrorParserList(); IPath workingDirectory = cpi.getINFWorkingDirectory(); // create the launcher for the first file's project. if there are files selected for other projects, change the @@ -104,7 +104,7 @@ if (lastProject != project && path != null) { lastProject = project; cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(lastProject); - errorParserIds = CarbideCPPBuilder.getParserIdArray(cpi.getDefaultConfiguration().getErrorParserId()); + errorParserIds = cpi.getDefaultConfiguration().getErrorParserList(); workingDirectory = cpi.getINFWorkingDirectory(); launcher = new CarbideCommandLauncher(lastProject, monitor, errorParserIds, workingDirectory); launcher.showCommand(true); diff -r 6507baa94ab8 -r c71aea166ff8 builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ComponentCommandHandler.java --- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ComponentCommandHandler.java Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ComponentCommandHandler.java Wed Aug 25 11:08:33 2010 -0500 @@ -242,7 +242,7 @@ IProject lastProject = selectedFiles.get(0).getProject(); ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(lastProject); - String[] errorParserIds = CarbideCPPBuilder.getParserIdArray(cpi.getDefaultConfiguration().getErrorParserId()); + String[] errorParserIds = cpi.getDefaultConfiguration().getErrorParserList(); IPath workingDirectory = cpi.getINFWorkingDirectory(); // create the launcher for the first file's project. if there are files selected for other projects, change the @@ -273,7 +273,7 @@ lastProject = project; cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(lastProject); - errorParserIds = CarbideCPPBuilder.getParserIdArray(cpi.getDefaultConfiguration().getErrorParserId()); + errorParserIds = cpi.getDefaultConfiguration().getErrorParserList(); workingDirectory = cpi.getINFWorkingDirectory(); launcher = new CarbideCommandLauncher(lastProject, monitor, errorParserIds, workingDirectory); launcher.showCommand(true); diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/PreprocessHandler.java Wed Aug 25 11:08:33 2010 -0500 @@ -73,6 +73,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.cdt.internal.builder.CarbideBuildConfiguration; import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; import com.nokia.carbide.cpp.epoc.engine.MMPDataRunnableAdapter; import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPLanguage; @@ -80,6 +81,7 @@ 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.IDefine; 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; @@ -128,7 +130,7 @@ e.printStackTrace(); } - CarbideCommandLauncher launcher = new CarbideCommandLauncher(project, monitor, CarbideCPPBuilder.getParserIdArray(buildConfig.getErrorParserId()), cpi.getINFWorkingDirectory()); + CarbideCommandLauncher launcher = new CarbideCommandLauncher(project, monitor, buildConfig.getErrorParserList(), cpi.getINFWorkingDirectory()); launcher.showCommand(true); String cppTool = "cpp" + HostOS.EXE_EXT; //$NON-NLS-1$ @@ -189,14 +191,15 @@ } // add the compiler prefix file if any - IPath compilerPrefix = buildConfig.getCompilerPrefixFile(); + IPath compilerPrefix = buildConfig.getBuildContext().getCompilerPrefixFile(); if (compilerPrefix != null) { args.add("-include"); //$NON-NLS-1$ args.add("\"" + compilerPrefix.toOSString() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ } // add the sdk prefix file if any - File sdkPrefix = buildConfig.getSDK().getPrefixFile(); + File sdkPrefix = buildConfig.getBuildContext().getPrefixFromVariantCfg().toFile(); + if (sdkPrefix != null && sdkPrefix.exists()) { args.add("-include"); //$NON-NLS-1$ args.add("\"" + sdkPrefix.getAbsolutePath() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ @@ -404,19 +407,18 @@ 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$ + List buildMacros = buildConfig.getBuildContext().getBuildMacros(); + for (IDefine define : buildMacros){ + macros.add(define.getName()); } - // built in macros - for (String builtinMacro : buildConfig.getBuiltinMacros()) { - macros.add(builtinMacro); + List metaDataMacros = buildConfig.getBuildContext().getMetadataMacros(); + for (IDefine define : metaDataMacros){ + macros.add(define.getName()); } - // vendor macros (e.g. __SERIES60_3x__) - for (String builtinMacro : buildConfig.getSDK().getVendorSDKMacros()) { - macros.add(builtinMacro); + if (((CarbideBuildConfiguration)buildConfig).hasSTDCPPSupport()){ + macros.add("__SYMBIAN_STDCPP_SUPPORT__"); } IProject project = buildConfig.getCarbideProject().getProject(); @@ -429,14 +431,14 @@ // 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) { String targetType = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE); if (targetType != null) { targetType = targetType.toUpperCase(); - macros.add(targetType); + macros.add("__" + targetType + "__"); } // mmp macros diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ProjectCommandHandler.java Wed Aug 25 11:08:33 2010 -0500 @@ -180,7 +180,7 @@ SubMonitor subMonitor = SubMonitor.convert(monitor, buildConfigList.size()); for (final ICarbideBuildConfiguration currConfig : buildConfigList) { - launcher.setErrorParserManager(cpi.getINFWorkingDirectory(), CarbideCPPBuilder.getParserIdArray(currConfig.getErrorParserId())); + launcher.setErrorParserManager(cpi.getINFWorkingDirectory(), currConfig.getErrorParserList()); if (monitor.isCanceled()) { return new Status(IStatus.CANCEL, "Carbide.c++ builder utils plugin", IStatus.CANCEL, "Build Cancelled", null); @@ -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 6507baa94ab8 -r c71aea166ff8 carbidesdk/com.nokia.carbide.cpp.sdk.doc.user/html/reference/api_Change_Notes.htm --- a/carbidesdk/com.nokia.carbide.cpp.sdk.doc.user/html/reference/api_Change_Notes.htm Tue Aug 24 16:42:58 2010 -0500 +++ b/carbidesdk/com.nokia.carbide.cpp.sdk.doc.user/html/reference/api_Change_Notes.htm Wed Aug 25 11:08:33 2010 -0500 @@ -107,13 +107,44 @@
  • Added com.nokia.carbide.cdt.builder.project.ISymbianBuildConfiguration#getTargetOutputDirectory( ).
  • -

    Since Carbide 3.0.0

    +

    Since Carbide 3.0.0 (C3)

      -
    • IConnectionsManager was updated to indicate it is not intended to be implemented by clients. + +
    • C3 is an API breaking release, primarily around areas of Symbian SDK management and Symbian build support. + This release removes support for Symbian OS versions prior to 9.4 (i.e. only support for Symbian^2 and up are supported). + Management of Symbian SDKs has been simplified and the APIs have been trimmed to reflect this.
    • + +
    • ISymbianSDK
    • +
        +
      • added getSupportedFeatures() - see com.nokia.carbide.cpp.sdk.core#ISymbianSDKFeatures for supported feature constants.
      • +
      • added ISDKBuildInfo getBuildInfo(String builderId) - This is used to get the base data (ISymbianBuildContext) for a build configuration, depending on the builder you are using (e.g. abld versus sbsv2). See also com.nokia.carbide.cpp.sdk.core#ISDKBuildInfo
      • +
      + +
    • com.nokia.carbide.cpp.sdk.core#ISDKBuildInfo was added.
    • +
    • com.nokia.carbide.cpp.sdk.core#ISBSv1BuildContext was added.
    • +
    • com.nokia.carbide.cpp.sdk.core#ISBSv2BuildContext was added.
    • +
    • com.nokia.carbide.cpp.sdk.core#ISBSv2BuiISymbianSDKFeatures was added.
    • + +
    • ICarbideBuildConfiguration
    • +
        +
      • added ISymbianBuildContext getBuildContext()
      • +
      • added getDisplayString() - A convenience wrapper for ISymbiabBuildContext
      • +
      • added getSDK() - A convenience wrapper for ISymbiabBuildContext
      • +
      • added getPlatformString() - A convenience wrapper for ISymbiabBuildContext
      • +
      • added getTargetString() - A convenience wrapper for ISymbiabBuildContext
      • +
      • added hasSTDCPPSupport()
      • +
      + +
    • ISymbianBuildContext - This interface is no longer implemented by ICarbideBuildConfiguration. Rather, it is now an abstracted interface for builders to provide base build data for an ICarbideBuildConfiguration instance
    • +

      +

        Due to this change, methods that take ISymbiabBuildContext as a parameter may have been using the ICarbideBuildConfiguraiton interface. For example, in com.nokia.carbide.cdt.builder#DefaultMMPViewConfiguration. + For these calls, simply add .getBuildContext() to the ICarbideBuildConfiguration instance to explicitly pass the ISymbianBuildContext.
      + +
    • IConnectionsManager was updated to indicate it is not intended to be implemented by clients.
    • Added several new methods to support automated connection/device discovery agents and default connections.
    • -
    • Deprecated IClientServiceSiteUI and adding new IClientServiceSiteUI2 to support concept of default connection +
    • Deprecated IClientServiceSiteUI and adding new IClientServiceSiteUI2 to support concept of default connection
        -
      • getSelectedConnection() and selectConnection() now use connection ids rather than connection objects +
      • getSelectedConnection() and selectConnection() now use connection ids rather than connection objects
      • Exposing new selection status to allow reporting when default connection is not supported by client service
    @@ -162,6 +193,12 @@
    • com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder#generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest)
    + +

    Since Carbide 3.0

    +
      +
    • ISymbiabSDK#getOSVersion - use ISymbianSDK#getSupportedFeatures instead to test for properties of an SDK.
    • +
    +

    Removed APIs

    The following Carbide APIs have been removed and are no longer available to plug-ins.

    Since Carbide 1.2.0

    @@ -192,6 +229,33 @@
  • None
  • +

    Since Carbide 3.0

    +
      +
    • com.nokia.carbide.cpp.sdk.core#ISymbianSDK removed several methods. Please refer to the source code.
    • +

      +

        +
      • getFilteredBuildConfigurations() has been removed. Please use ISymbianSDK#getBuildInfo(String builderId).getFilteredBuildConfigurations() instead.
      • +
      • getSDKVersion() has been removed. Users should not use SDK and OS version any longer but use ISymbianSDK#getSupportedFeatures() instead.
      • +
      + +
    • ICarbideBuildConfiguration no longer implements ISymbianBuildContext. You will need to use the ICarbideBuildConfiguration#getBuildContext() to access most build context specific data.
    • + +
    • com.nokia.carbide.cpp.sdk.core#ISDKManager removed several methods.
    • +

      +

        +
      • getSymbianMacroStore() has been removed.
      • +
      • getBSFScannerEnabled() has been removed.
      • +
      • enableBSFScanner(boolean enabled) has been removed.
      • +
      • setPlatformList(List platList) has been removed.
      • +
      • getPlatformList() has been removed.
      • +
      • getCSLArmToolchainInstallPathAndCheckReqTools() has been removed.
      • +
      • checkDevicesXMLSynchronized() has been removed.
      • +
      • getSBSv2Version(boolean forceScan) has been removed.
      • +
      • getMinimumSupportedSBSv2Version() has been removed.
      • +
      + +
    + diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/carbidesdk/com.nokia.carbide.cpp.sdk.examples/src/com/nokia/carbide/cpp/sdk/examples/jobs/NewProjectJob.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/carbidesdk/com.nokia.carbide.cpp.sdk.examples/src/com/nokia/carbide/cpp/sdk/examples/jobs/ProjectReportJob.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/CSScanner.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/kb/CSKbManager.java Wed Aug 25 11:08:33 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,9 @@ List buildConfigList = projectInfo.getBuildConfigurations(); for (Iterator iterator = buildConfigList.iterator(); iterator.hasNext();) { ICarbideBuildConfiguration buildConfig = iterator.next(); - ISymbianSDK sdk = buildConfig.getSDK(); - Version version = sdk.getSDKVersion(); + // TODO: What is SDK version used for for codescanner? +// Version version = buildConfig.getSDK().getSDKVersion(); + Version version = new Version("5.0.0"); sdkVersions.add(version); } } diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/bugs_fixed.htm diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/concepts/images/wnd_workspace_launcher.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/concepts/images/workbench.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/images/gold_header.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/images/views/perspective_debug.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_02.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_04.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_05.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_07.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_08.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_09.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_10.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_11.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_12.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_13.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/debugging_project_14.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dlg_build_project_progress.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_attach_to_process.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_build_project.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_change_debug_process.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_change_remote_connection.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_new_launch_config.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/dll_other_settings.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_build_project.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_debug.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_edit_settings.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_project_built.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_project_error_badge.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_project_warning_badge.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/icon_run.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/menu_new_proj_build_project.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_build_project_console_view.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_build_project_executables_view.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_build_project_problems_view.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_dll_project_02.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_dll_project_03.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_dll_project_04.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_dll_project_07.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_launch_config_03.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_launch_config_04.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_launch_config_05.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_launch_config_08.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_project_template_01.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_project_template_02.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/new_project_template_07.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/pref_cdt_build_console.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/run_mode_debug_01.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/run_mode_debug_02.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/run_mode_debug_05.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/run_mode_debug_06.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/images/run_mode_debug_07.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/launch/images/filter_launch_config.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/projects/launch/images/page_exceptions.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/MMP_wizard.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/MMP_wizard2.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/add_images_from_filesys.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/add_images_from_project.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/build_pkg_file.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/build_symbian_comp.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/carbide_build_config.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/carbide_macro_settings.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/carbide_proj_settings.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/carbide_proj_settings_sbsv1.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/clean_symbian_comp.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/icon_install_extensions.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/icon_periodic_testing.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/icon_show_overview.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/import_bld_inf_01.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/import_bld_inf_02.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/import_bld_inf_03.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/import_bld_inf_04.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/import_bld_inf_05.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/inf_editor_addMMP.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/inf_editor_addMake.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/inf_editor_overview.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_memory_rendering_options.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_symb_abld.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_symb_compile.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_symb_freeze_comp.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_symb_freeze_exports.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/menu_symb_preprocess.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/mmp_editor.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/mmp_editor_libraries.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/mmp_editor_mmpfile.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/mmp_editor_options.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/mmp_editor_sources.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/pref_indexer.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/pref_indexer_properties.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/pref_launch_config_filter.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/prefs_carbide_cpp.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/prefs_symbian_sdks.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_carbide_portal.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_install_extensions.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_memory.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_project_explorer.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_remote_connections.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_show_overview_popup.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_sym_proj_nav.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/view_system_search.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/wiz_new_class.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/wnd_ad_sdk.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/wnd_edit_mbm_contents.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/wnd_pref_code_styles.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/wnd_system_search.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/reference/images/wnd_system_search_prefs.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/release_notes.htm diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/images/menu_reformat_source_file.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/images/pref_code_style_differences.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/images/wnd_customize_perspective.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/images/wnd_customize_perspective_cmds.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/images/wnd_customize_perspective_menus.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/images/wnd_customize_perspective_shortcuts.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/projects/images/clean.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/sdks/images/wnd_sdk_platform_filter.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/sdks/images/wnd_sdk_platform_filter_sbsv2.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/start/images/debug_set_breakpoint.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/start/images/wnd_symbian_emulator_01.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/start/images/wnd_symbian_emulator_02.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.doc.user/html/tasks/start/images/wnd_symbian_emulator_03.png diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/AllTests.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/DevicesLoaderTest.java Wed Aug 25 11:08:33 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, osVersion); 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, osVersion); 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, osVersion); DevicesLoader.updateDevice(sdk, devicesFile.toURI().toURL()); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SDKCreationTest.java Wed Aug 25 11:08:33 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,22 +50,22 @@ 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(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(sdk.getSupportedTargetTypes().size() == 0); + assertTrue(sbsv1BuildInfo.getPlatformMacros("WINSCW").size() == 0); File epocRoot = new File(sdk.getEPOCROOT()); assertTrue(epocRoot.exists() == false); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SymbianContextTest.java Wed Aug 25 11:08:33 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,27 +60,18 @@ * @param sdk */ private void doTestSDK(ISymbianSDK sdk) { - if (sdk.getName().equals("S60_5th_Edition_SDK_v1.0")) { - // test that we get the SDK version - Version sdkVer = sdk.getSDKVersion(); - assertEquals(5,sdkVer.getMajor()); - assertEquals(0,sdkVer.getMinor()); - - // test that we get the OS version - Version osVer = sdk.getOSVersion(); - assertEquals(9,osVer.getMajor()); - assertEquals(4,osVer.getMinor()); - } + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); - 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 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,129 @@ +package com.nokia.carbide.cpp.sdk.core.test; + +import java.io.Serializable; +import java.util.HashMap; +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.SDKCacheUtils; +import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils; +import com.nokia.carbide.cpp.internal.sdk.core.model.AbstractSDKManager; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManagerCacheEntry; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory; + +public class TestCarbideSDKCache extends TestCase { + + private class TestSDKManager extends SDKManager { + + @SuppressWarnings("unchecked") + public TestSDKManager() { + Map cache = SDKCacheUtils.getCache().getCachedData(SDK_MANAGER_CACHE_KEY, Map.class, 0); + if (cache == null) { + cache = new HashMap(); + SDKCacheUtils.getCache().putCachedData(SDK_MANAGER_CACHE_KEY, (Serializable)cache, 0); + } + } + + public void clearCache() { + clearSDKCache(); + } + + @SuppressWarnings("unchecked") + public Map getCache() { + Map cache = SDKCacheUtils.getCache().getCachedData(SDK_MANAGER_CACHE_KEY, Map.class, 0); + if (cache == null) { + cache = new HashMap(); + SDKCacheUtils.getCache().putCachedData(SDK_MANAGER_CACHE_KEY, (Serializable)cache, 0); + } + return cache; + } + + public SDKManagerCacheEntry getCacheEntry(String id) { + return getSDKCacheEntry(id); + } + + 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(); + manager.clearCache(); + IJobChangeListener listener = new IJobChangeListener() { + + public void sleeping(IJobChangeEvent event) { + } + + public void scheduled(IJobChangeEvent event) { + } + + public void running(IJobChangeEvent event) { + } + + public void done(IJobChangeEvent event) { + Map cache = manager.getCache(); + assertNotNull(cache); + } + + 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(); + manager.scanSDKs(); + manager.getScanJob().join(); + assertTrue(manager.getSDKList().isEmpty() == manager.getCache().isEmpty()); + manager.clearCache(); + assertNull(SDKCacheUtils.getCache().getCache(AbstractSDKManager.SDK_MANAGER_CACHE_KEY)); + final String sdkId = "test"; + ISymbianSDK sdk = SymbianSDKFactory.createInstance(sdkId, "C:\\", new Version("9.5")); + manager.addSDK(sdk); + assertFalse(manager.getCache().isEmpty()); + assertNotNull(manager.getCacheEntry(sdkId)); + manager.updateSDK(sdk); + assertFalse(manager.getCache().isEmpty()); + assertNotNull(manager.getCacheEntry(sdkId)); + manager.removeSDK(sdkId); + assertNull(manager.getCacheEntry(sdkId)); + } + + public void testSBSv2QueryCache() throws Exception { + SBSv2QueryUtils.removeAllCachedQueries(); + assertNull(SDKCacheUtils.getCache().getCache(SBSv2QueryUtils.ALIAS_CACHE_KEY)); + assertNull(SDKCacheUtils.getCache().getCache(SBSv2QueryUtils.PRODUCT_CACHE_KEY)); + assertNull(SDKCacheUtils.getCache().getCache(SBSv2QueryUtils.CONFIG_CACHE_KEY)); + final TestSDKManager manager = new TestSDKManager(); + manager.scanSDKs(); + manager.getScanJob().join(); + assertNull(SDKCacheUtils.getCache().getCache(SBSv2QueryUtils.ALIAS_CACHE_KEY)); + assertNull(SDKCacheUtils.getCache().getCache(SBSv2QueryUtils.PRODUCT_CACHE_KEY)); + assertNull(SDKCacheUtils.getCache().getCache(SBSv2QueryUtils.CONFIG_CACHE_KEY)); + } + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestDevicesXMLListener.java Wed Aug 25 11:08:33 2010 -0500 @@ -16,7 +16,10 @@ */ package com.nokia.carbide.cpp.sdk.core.test; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; import java.net.URL; import junit.framework.TestCase; @@ -28,7 +31,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.SBSv2Utils; -import com.nokia.carbide.cpp.sdk.core.*; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; +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; /** * Tests the ICarbideDevicesXMLChangeListener class @@ -88,17 +95,17 @@ // Here we just changed the time stamp and not the contents so it should be OK. - assertTrue("Devices.xml has changed only timestamp, bad return value", sdkMgr.checkDevicesXMLSynchronized()); + assertTrue("Devices.xml has changed only timestamp, bad return value", ((SDKManager)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()); + assertTrue("Devices.xml should still be true with sdk update via APIs", ((SDKManager)sdkMgr).checkDevicesXMLSynchronized()); // copy a different devices.xml file over. copyFile (pluginRelativeFile(devicesTestFile), devicesFile); - assertFalse("Devices.xml has changed changed content, should reutrn false. ", sdkMgr.checkDevicesXMLSynchronized()); + assertFalse("Devices.xml has changed changed content, should reutrn false. ", ((SDKManager)sdkMgr).checkDevicesXMLSynchronized()); ISDKManagerInternal sdkMgrInternal = (ISDKManagerInternal)sdkMgr; sdkMgrInternal.fireDevicesXMLChanged(); diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 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.ISBSv2BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo; +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.getVariantHRHIncludes()); + for (Iterator itr = context.getVariantHRHIncludes().iterator(); itr.hasNext();) { + File includeFile = itr.next(); + assertTrue(includeFile.exists()); + } + + // getCompilerMacros() + assertNotNull(context.getCompilerPreincludeDefines()); + + // 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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF --- a/core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/META-INF/MANIFEST.MF Wed Aug 25 11:08:33 2010 -0500 @@ -16,14 +16,26 @@ 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.sdk.ui, + com.nokia.carbide.cdt.builder, + com.nokia.carbide.cdt.builder.test, + com.nokia.carbide.cpp.builder.utils, + com.nokia.carbide.cpp.project.ui, + com.nokia.carbide.cpp.qt.core, + com.nokia.carbide.cpp.qt.ui, + com.nokia.cdt.debug.cw.symbian, + com.nokia.cdt.debug.launch, + com.nokia.carbide.cpp.epoc.engine.tests", + 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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildArgumentsInfo.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/BuildArgumentsInfo.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,149 @@ +/* +* 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.cpp.internal.api.sdk; + +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 + */ +public class BuildArgumentsInfo implements IBuildArgumentsInfo { + + public static final String BLDMAKEBLDFILESARGSSTORAGE = "BLDMAKEBLDFILESARGSSTORAGE"; //$NON-NLS-1$ + public static final String BLDMAKECLEANARGSSTORAGE = "BLDMAKECLEANARGSSTORAGE"; //$NON-NLS-1$ + public static final String ABLDBUILDARGSSTORAGE = "ABLDBUILDARGSSTORAGE"; //$NON-NLS-1$ + public static final String ABLDEXPORTARGSSTORAGE = "ABLDEXPORTARGSSTORAGE"; //$NON-NLS-1$ + public static final String ABLDMAKEFILEARGSSTORAGE = "ABLDMAKEFILEARGSSTORAGE"; //$NON-NLS-1$ + public static final String ABLDLIBRARYARGSSTORAGE = "ABLDLIBRARYARGSSTORAGE"; //$NON-NLS-1$ + public static final String ABLDRESOURCEARGSSTORAGE = "ABLDRESOURCEARGSSTORAGE"; //$NON-NLS-1$ + public static final String ABLDTARGETARGSSTORAGE = "ABLDTARGETARGSSTORAGE"; //$NON-NLS-1$ + public static final String ABLDFINALARGSSTORAGE = "ABLDFINALARGSSTORAGE"; //$NON-NLS-1$ + public static final String ABLDCLEANARGSSTORAGE = "ABLDCLEANARGSSTORAGE"; //$NON-NLS-1$ + public static final String ABLDFREEZEARGSSTORAGE = "ABLDFREEZEARGSSTORAGE"; //$NON-NLS-1$ + + + public String bldmakeBldFilesArgs; + public String bldmakeCleanArgs; + public String abldBuildArgs; + public String abldExportArgs; + public String abldMakefileArgs; + public String abldLibraryArgs; + public String abldResourceArgs; + public String abldTargetArgs; + public String abldFinalArgs; + public String abldCleanArgs; + public String abldFreezeArgs; + + + public BuildArgumentsInfo(ISymbianSDK sdk) { + + this.bldmakeBldFilesArgs = ""; //$NON-NLS-1$ + this.bldmakeCleanArgs = ""; //$NON-NLS-1$ + this.abldBuildArgs = ""; //$NON-NLS-1$ + this.abldExportArgs = ""; //$NON-NLS-1$ + this.abldMakefileArgs = ""; //$NON-NLS-1$ + this.abldLibraryArgs = ""; //$NON-NLS-1$ + this.abldResourceArgs = ""; //$NON-NLS-1$ + this.abldTargetArgs = ""; //$NON-NLS-1$ + this.abldFinalArgs = ""; //$NON-NLS-1$ + this.abldCleanArgs = ""; //$NON-NLS-1$ + this.abldFreezeArgs = ""; //$NON-NLS-1$ + + if (sdk.getSupportedFeatures().contains(ISymbianSDKFeatures.IS_EKA2)) { + this.abldFreezeArgs = "-r"; //$NON-NLS-1$ + + } + } + + public BuildArgumentsInfo(String bldmakeBldFilesArgs, String bldmakeCleanArgs, String abldBuildArgs, String abldExportArgs, + String abldMakefileArgs, String abldLibraryArgs, String abldResourceArgs, String abldTargetArgs, String abldFinalArgs, + String abldCleanArgs, String abldFreezeArgs) { + + this.bldmakeBldFilesArgs = bldmakeBldFilesArgs; + this.bldmakeCleanArgs = bldmakeCleanArgs; + this.abldBuildArgs = abldBuildArgs; + this.abldExportArgs = abldExportArgs; + this.abldMakefileArgs = abldMakefileArgs; + this.abldLibraryArgs = abldLibraryArgs; + this.abldResourceArgs = abldResourceArgs; + this.abldTargetArgs = abldTargetArgs; + this.abldFinalArgs = abldFinalArgs; + this.abldCleanArgs = abldCleanArgs; + this.abldFreezeArgs = abldFreezeArgs; + } + + public BuildArgumentsInfo(BuildArgumentsInfo argInfo) { + + this.bldmakeBldFilesArgs = argInfo.bldmakeBldFilesArgs; + this.bldmakeCleanArgs = argInfo.bldmakeCleanArgs; + this.abldBuildArgs = argInfo.abldBuildArgs; + this.abldExportArgs = argInfo.abldExportArgs; + this.abldMakefileArgs = argInfo.abldMakefileArgs; + this.abldLibraryArgs = argInfo.abldLibraryArgs; + this.abldResourceArgs = argInfo.abldResourceArgs; + this.abldTargetArgs = argInfo.abldTargetArgs; + this.abldFinalArgs = argInfo.abldFinalArgs; + this.abldCleanArgs = argInfo.abldCleanArgs; + this.abldFreezeArgs = argInfo.abldFreezeArgs; + } + + public String getBldmakeBldFilesArgs() { + return bldmakeBldFilesArgs; + } + + public String getBldmakeCleanArgs() { + return bldmakeCleanArgs; + } + + public String getAbldBuildArgs() { + return abldBuildArgs; + } + + public String getAbldExportArgs() { + return abldExportArgs; + } + + public String getAbldMakefileArgs() { + return abldMakefileArgs; + } + + public String getAbldLibraryArgs() { + return abldLibraryArgs; + } + + public String getAbldResourceArgs() { + return abldResourceArgs; + } + + public String getAbldTargetArgs() { + return abldTargetArgs; + } + + public String getAbldFinalArgs() { + return abldFinalArgs; + } + + public String getAbldCleanArgs() { + return abldCleanArgs; + } + + public String getAbldFreezeArgs() { + return abldFreezeArgs; + } + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,709 @@ +/* +* 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.io.FileReader; +import java.io.IOException; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.eclipse.cdt.core.settings.model.ICStorageElement; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.osgi.framework.Version; + +import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefineFactory; +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.SDKManager; +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.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.cpp.internal.api.utils.core.PathUtils; + +/** + * @deprecated - Temporary support exists for abld on Symbian^2 but will be removed, vFuture + * + */ +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$ + + // Preference data + protected BuildArgumentsInfo buildArgumentsInfo; + protected final static String ARGUMENTS_DATA_ID = "ARGUMENTS_DATA_ID"; //$NON-NLS-1$ + + // --> variant.cfg info + // greedy match means the filename is in the last group + public static Pattern VARIANT_HRH_LINE_PATTERN = Pattern.compile("(?i)(.*)(/|\\\\)(.*hrh)"); + private IPath variantFilePath; + 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$ + // <-- + + 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() { + + 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() { + ISDKManager sdkManager = SDKCorePlugin.getSDKManager(); + IRVCTToolChainInfo[] installedRVCTTools = ((SDKManager)sdkManager).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 getVariantHRHIncludes() { + return getCachedData().getPrefixFileIncludes(); + } + + + public List getCompilerPreincludeDefines() { + // 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 void loadConfigurationSettings(ICStorageElement se) { + if (se.getName().equals(ARGUMENTS_DATA_ID)) { + loadBuildArgsFromStorage(se); + } + } + + public IBuildArgumentsInfo getBuildArgumentsInfo() { + return (IBuildArgumentsInfo)buildArgumentsInfo; + } + + public BuildArgumentsInfo getBuildArgumentsInfoCopy() { + return new BuildArgumentsInfo(buildArgumentsInfo); + } + + public void setBuildArgumentsInfo(BuildArgumentsInfo buildArgumentsInfo) { + this.buildArgumentsInfo = buildArgumentsInfo; + } + + private void loadBuildArgsFromStorage(ICStorageElement rootStorage) { + buildArgumentsInfo = new BuildArgumentsInfo(getSDK()); + String value = rootStorage.getAttribute(BuildArgumentsInfo.BLDMAKEBLDFILESARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.bldmakeBldFilesArgs = value; + } + + value = rootStorage.getAttribute(BuildArgumentsInfo.BLDMAKECLEANARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.bldmakeCleanArgs = value; + } + + value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDBUILDARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.abldBuildArgs = value; + } + + value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDEXPORTARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.abldExportArgs = value; + } + + value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDMAKEFILEARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.abldMakefileArgs = value; + } + + value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDLIBRARYARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.abldLibraryArgs = value; + } + + value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDRESOURCEARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.abldResourceArgs = value; + } + + value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDTARGETARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.abldTargetArgs = value; + } + + value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDFINALARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.abldFinalArgs = value; + } + + value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDCLEANARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.abldCleanArgs = value; + } + + value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDFREEZEARGSSTORAGE); + if (value != null) { + buildArgumentsInfo.abldFreezeArgs = value; + } + } + + public void saveBuildArgsToStorage(ICStorageElement rootStorage) { + if (buildArgumentsInfo == null){ + buildArgumentsInfo = new BuildArgumentsInfo(getSDK()); + } + + if (buildArgumentsInfo.bldmakeBldFilesArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.BLDMAKEBLDFILESARGSSTORAGE, buildArgumentsInfo.bldmakeBldFilesArgs); + } + + if (buildArgumentsInfo.bldmakeCleanArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.BLDMAKECLEANARGSSTORAGE, buildArgumentsInfo.bldmakeCleanArgs); + } + + if (buildArgumentsInfo.abldBuildArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.ABLDBUILDARGSSTORAGE, buildArgumentsInfo.abldBuildArgs); + } + + if (buildArgumentsInfo.abldExportArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.ABLDEXPORTARGSSTORAGE, buildArgumentsInfo.abldExportArgs); + } + + if (buildArgumentsInfo.abldMakefileArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.ABLDMAKEFILEARGSSTORAGE, buildArgumentsInfo.abldMakefileArgs); + } + + if (buildArgumentsInfo.abldLibraryArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.ABLDLIBRARYARGSSTORAGE, buildArgumentsInfo.abldLibraryArgs); + } + + if (buildArgumentsInfo.abldResourceArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.ABLDRESOURCEARGSSTORAGE, buildArgumentsInfo.abldResourceArgs); + } + + if (buildArgumentsInfo.abldTargetArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.ABLDTARGETARGSSTORAGE, buildArgumentsInfo.abldTargetArgs); + } + + if (buildArgumentsInfo.abldFinalArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.ABLDFINALARGSSTORAGE, buildArgumentsInfo.abldFinalArgs); + } + + if (buildArgumentsInfo.abldCleanArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.ABLDCLEANARGSSTORAGE, buildArgumentsInfo.abldCleanArgs); + } + + if (buildArgumentsInfo.abldFreezeArgs.trim().length() > 0) { + rootStorage.setAttribute(BuildArgumentsInfo.ABLDFREEZEARGSSTORAGE, buildArgumentsInfo.abldFreezeArgs); + } + } + + public void saveConfigurationSettings(ICStorageElement se, ISymbianBuildContext context) { + saveBuildArgsToStorage(se.createChild(ARGUMENTS_DATA_ID)); + } + + /** + * 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() { + return getDisplayString(); + } + + /** + * 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 (variantFilePath != null){ + return variantFilePath; + } + + File epocRoot = new File(getSDK().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 = 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 = 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); + variantFilePath = new Path(PathUtils.convertPathToUnix(variantFullPathFile.getAbsolutePath())); + return variantFilePath; + } + } + } catch (IOException e) { + } + + return null; // can't find the file... + } + + @SuppressWarnings("unchecked") + public List getVariantCFGMacros(){ + + List variantCFGMacros = new ArrayList(); + File epocRoot = new File(getSDK().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 = 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 = 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 getBuildMacros() { + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + List defines = new ArrayList(); + for (String builtinMacro : sbsv1BuildInfo.getVendorSDKMacros()) { + defines.add(DefineFactory.createDefine(builtinMacro)); + } + + for (String builtinMacro : sbsv1BuildInfo.getBuiltinMacros(this)) { + defines.add(DefineFactory.createDefine(builtinMacro)); + } + + for (String variantCFGMacro : getVariantCFGMacros()) { + defines.add(DefineFactory.createDefine(variantCFGMacro)); + } + + for (String platMacro : sbsv1BuildInfo.getPlatformMacros(getPlatformString())) { + defines.add(DefineFactory.createDefine("__" + platMacro + "__")); //$NON-NLS-1$ //$NON-NLS-2$ + } + + return defines; + } + + public List getMetadataMacros() { + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + List defines = new ArrayList(); + for (String platMacro : sbsv1BuildInfo.getPlatformMacros(getPlatformString())) { + defines.add(DefineFactory.createDefine(platMacro)); //$NON-NLS-1$ //$NON-NLS-2$ + } + + return defines; + } + + public IDefine getTargetTypeMacro(String targettype) { + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + return DefineFactory.createDefine(sbsv1BuildInfo.getTargetTypeMacro(targettype)); + } + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,426 @@ +package com.nokia.carbide.cpp.internal.api.sdk; + +import java.io.File; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.cdt.core.settings.model.ICStorageElement; +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.DefineFactory; +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.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.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 + + private boolean reportedSBSVersionError; + + // Raptor config query data + private ISBSv2ConfigQueryData configQueryData; + + // cconfiguration data store + private SBSv2BuilderInfo sbsv2BuildInfo; + + private IPath cachedVariantHRHFile = null; + + public BuildContextSBSv2(ISymbianSDK sdk, String platform, String target, String alias, String displayString, String configID) { + this.sdk = sdk; + if (platform == null){ + this.platform = "unknown_platform"; + } else { + this.platform = platform.toUpperCase(); + } + + if (target == null){ + this.target = "unknown_target"; + } else { + 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() + "]"; + } + + public ISymbianSDK getSDK() { + return sdk; + } + + 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; + } + + public String getTargetString() { + if (target == null){ + return configQueryData.getConfigurationErrorMessage(); + } + return target; + } + + public String getConfigID(){ + return configID; + } + + public String getDisplayString() { + Check.checkState(displayString != null); + return displayString; + } + + @Override + public String toString() { + return getConfigID(); + } + + 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; + } + + 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; + } + + public List getVariantHRHDefines() { + return getCachedData().getVariantHRHDefines(); + } + + public List getVariantHRHIncludes() { + return getCachedData().getPrefixFileIncludes(); + } + + public List getCompilerPreincludeDefines() { + IPath prefixFile = getCompilerPrefixFile(); + if (prefixFile == null || !prefixFile.toFile().exists()) { + return getCachedData().getCompilerMacros(null); + } + + return getCachedData().getCompilerMacros(prefixFile); + } + + public String getBuildVariationName() { + // Not needed for Raptor + return ""; + } + + 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(); + } + + + 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); + } + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((configID == null) ? 0 : configID.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; + BuildContextSBSv2 other = (BuildContextSBSv2) obj; + if (configID == null) { + if (other.configID != null) + return false; + } else if (!configID.equals(other.configID)) + return false; + return true; + } + + 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) { + reportedSBSVersionError = true; // only report once per IDE session. + PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { + public void run() { + if (!reportedSBSVersionError){ + 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; + } + + public ISBSv2ConfigQueryData getConfigQueryData() { + return configQueryData; + } + + 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; + } + + public List getSystemIncludes() { + if (configQueryData != null) { + List includes = configQueryData.getMetaDataIncludes(); + if (includes != null && !includes.isEmpty()) { + List includePaths = new ArrayList(); + for (Iterator itr = includes.iterator(); itr.hasNext();) { + String include = itr.next(); + if (include.length() == 0 || include.equals(".")) { + continue; + } + Path includePath = new Path(include); + if (!includePaths.contains(includePath)) { + includePaths.add(includePath); + } + } + return includePaths; + } + } + return null; + } + + public List getSupportedTargettypes() { + return configQueryData.getTargettypes(); + } + + + public void loadConfigurationSettings(ICStorageElement se) { + if (sbsv2BuildInfo == null){ + sbsv2BuildInfo = new SBSv2BuilderInfo(); + } + + sbsv2BuildInfo.loadFromStorage(se); + } + + public void saveConfigurationSettings(ICStorageElement se, ISymbianBuildContext context) { + sbsv2BuildInfo = new SBSv2BuilderInfo((ISBSv2BuildContext)context); + sbsv2BuildInfo.saveToStorage(se.createChild(SBSV2_DATA_ID)); + } + + /** + * Get the unique ID for this build configuration. + * For ABLD it is the display name, for SBSv2, it is the builder ID (cconfiguration 'id') + * @return + */ + public String getConfigurationID() { + return getConfigID(); + } + + /** + * 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(){ + ISBSv2BuildInfo sbsv2BldInfo = ((ISBSv2BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER)); + return sbsv2BldInfo.getPrefixFromVariantCfg(); + } + + public List getBuildMacros() { + ISBSv2BuildInfo sbsv2BldInfo = ((ISBSv2BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER)); + Map buildMacroMap = sbsv2BldInfo.getBuildMacros(getSBSv2Alias()); + List defines = new ArrayList(); + for (String macroName : buildMacroMap.keySet()){ + defines.add(DefineFactory.createDefine(macroName, buildMacroMap.get(macroName))); + } + + return defines; + } + + public List getMetadataMacros() { + ISBSv2BuildInfo sbsv2BldInfo = ((ISBSv2BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER)); + Map platMacroMap = sbsv2BldInfo.getMetadataMacros(getSBSv2Alias()); + List defines = new ArrayList(); + for (String macroName : platMacroMap.keySet()){ + defines.add(DefineFactory.createDefine(macroName, platMacroMap.get(macroName))); + } + + return defines; + } + + public IDefine getTargetTypeMacro(String targettype) { + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + return DefineFactory.createDefine(sbsv2BuildInfo.getTargetTypeMacro(targettype)); + } + + + +} diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/IBuildArgumentsInfo.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/IBuildArgumentsInfo.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,93 @@ +/* +* 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.cpp.internal.api.sdk; + +/** + * IBuildArgumentsInfo represents one instance of configuration data for the Arguments tab. + * This interface only applies for the Symbian 'abld' build system (SBSv1) + * @see ICarbideBuildConfiguration + * + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IBuildArgumentsInfo { + + /** + * Get the arguments to pass to bldmake bldfiles + * @return string of arguments which may be empty + */ + String getBldmakeBldFilesArgs(); + + /** + * Get the arguments to pass to bldmake clean + * @return string of arguments which may be empty + */ + String getBldmakeCleanArgs(); + + /** + * Get the arguments to pass to abld build + * @return string of arguments which may be empty + */ + String getAbldBuildArgs(); + + /** + * Get the arguments to pass to abld export + * @return string of arguments which may be empty + */ + String getAbldExportArgs(); + + /** + * Get the arguments to pass to abld makefile + * @return string of arguments which may be empty + */ + String getAbldMakefileArgs(); + + /** + * Get the arguments to pass to abld library + * @return string of arguments which may be empty + */ + String getAbldLibraryArgs(); + + /** + * Get the arguments to pass to abld resource + * @return string of arguments which may be empty + */ + String getAbldResourceArgs(); + + /** + * Get the arguments to pass to abld target + * @return string of arguments which may be empty + */ + String getAbldTargetArgs(); + + /** + * Get the arguments to pass to abld final + * @return string of arguments which may be empty + */ + String getAbldFinalArgs(); + + /** + * Get the arguments to pass to abld clean + * @return string of arguments which may be empty + */ + String getAbldCleanArgs(); + + /** + * Get the arguments to pass to abld freeze + * @return string of arguments which may be empty + */ + String getAbldFreezeArgs(); +} diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/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/internal/api/sdk/ISBSv1BuildContext.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,69 @@ +package com.nokia.carbide.cpp.internal.api.sdk; + +import java.util.List; + +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; + +/** + * Build Context specific information for the SBS/Raptor Symbian Builder. + * @see ICarbideBuildConfigation + * @since 3.0 + * @deprecated - Temporary support exists for abld on Symbian^2 but will be removed, vFuture + * + */ +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 + * @deprecated + */ + public String getBasePlatformForVariation(); + + /** + * Get the (abld)build arguments info. Contains pref settings from the Arguments tab. + * This only applies when building with SBSv1 (bldmake, abld) + * @return IBuildArgumentsInfo instance, never null + * @deprecated + */ + IBuildArgumentsInfo getBuildArgumentsInfo(); + + /** + * Get the (abld)build arguments info. Contains pref settings from the Arguments tab. + * This only applies when building with SBSv1 (bldmake, abld) + * @return A copy of BuildArgumentsInfo instance, never null + * @deprecated + */ + BuildArgumentsInfo getBuildArgumentsInfoCopy(); + + /** + * Set the build arguments info for SBSv2 build arguments. This only sets values in memory, does + * not write settings to disk. + * @return IBuildArgumentsInfo instance, never null + * @deprecated + */ + void setBuildArgumentsInfo(BuildArgumentsInfo bldArgInfo); + + /** + * 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. + */ + public List getVariantCFGMacros(); + + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,116 @@ +/* +* 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; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; + +/** + * Interface for SBSv1 specific build information. + * @since 3.0 + * @deprecated - Temporary support exists for abld on Symbian^2 but will be removed, vFuture + * + */ +public interface ISBSv1BuildInfo extends ISDKBuildInfo { + + /** + * Clears the list of macros specific to all abld build platforms + * @deprecated + */ + void clearPlatformMacros(); + + /** + * Returns the list of all available platforms for a SDK. + * @return a list of platform names which may be empty. + * @deprecated + */ + List getAvailablePlatforms(); + + /** + * Get the BSF catalog for a SDK. + * @deprecated + */ + 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. + * @deprecated + */ + List getPlatformMacros(String platform); + + /** + * Get the Symbian Binary Variation (SBV) catalog for a SDK. + * @deprecated + */ + ISBVCatalog getSBVCatalog(); + + /** + * Get the macro for the given target type, e.g. "__EXE__" or "__DLL__" + * @param targettype + * @return list of macro strings, may be empty + * @deprecated + */ + String getTargetTypeMacro(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. + * @deprecated + */ + 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 + * @deprecated + */ + boolean isPreviouslyScanned(); + + /** + * @deprecated + */ + void setPreviouslyScanned(boolean wasScanned); + + /** + * Returns the list of all built in macros for this configuration. This is ABLD specific. SBSv2 gets these macros from the --query=config. + *

    + * Macros will be just a name, e.g. "_DEBUG", "__SYMBIAN32__", etc.. + *

    + * + * @return a list of macros which may be empty. + * @deprecated + */ + List getBuiltinMacros(ISymbianBuildContext context); + + /** + * 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 + * @deprecated + */ + List getSupportedTargetTypes(); + +} diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv2BuildConfigInfo.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/ISBSv2BuildConfigInfo.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,40 @@ +/* +* 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.cpp.internal.api.sdk; + +/** + * Interface to SBSv2 build configuration specific data + */ +public interface ISBSv2BuildConfigInfo { + + // Data attribute id's saved in .cproject file + public final static String ATRRIB_CONFIG_BASE_PLATFORM = "CONFIG_BASE_PLATFORM"; //$NON-NLS-1$ + public final static String ATTRIB_CONFIG_TARGET = "CONFIG_TARGET"; //$NON-NLS-1$ + 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_SDK_ID = "ATTRIB_SBSV2_SDK_ID"; + + /** Retrieve a specfic .cproject SBSv2 data value from a given ID */ + String getSBSv2Setting(String id); + + /** + * Set a specific SBSv2 configuration specific data value + * @param id + * @param value + */ + void setSBSv2Setting(String id, String value); +} diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/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/internal/api/sdk/ISBSv2BuildContext.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,80 @@ +package com.nokia.carbide.cpp.internal.api.sdk; + +import java.util.List; + +import org.eclipse.core.runtime.IPath; + +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; + +/** + * Build Context specific information for the SBS/Raptor Symbian Builder. + * @see ICarbideBuildConfigation + * @since 3.0 + * + */ +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__"; + + // SBSv2 only config settings + public final static String SBSV2_DATA_ID = "SBSV2_DATA_ID"; //$NON-NLS-1$ + + /** + * 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(); + + /** + * Get system include paths returned by Raptor config query. + * @return list of include paths + */ + public List getSystemIncludes(); + + /** + * Retrieve the actual \epoc32\release directory a binary is targeted for. + * @return + */ + public String getPlatformReleaseDirName(); + + /** + * Get the supported targettypes for this build configuration + * @return + */ + public List getSupportedTargettypes(); + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,72 @@ +/* +* 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.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/metadata macros for a given build alias (sbs configuration). + *

    + * These are the <metadata/> macros from a query to Raptor with 'sbs --query=config[]. + * These are the macros that can be used in MMP and INF files. + *

    + * @param sbs build alias + * @return a map of macros and value pairs, which may be empty. + */ + Map getMetadataMacros(String buildAlias); + + /** + * Returns the list of all build macros fro a given build alias (sbs configuration). + *

    + * These are the <build/> macros from a query to Raptor with 'sbs --query=config[]. + * These are the macros that can be used in C/C++ files. + *

    + * @param buildAlias + * @return a map of macros and value pairs, which may be empty. + */ + public Map getBuildMacros(String buildAlias); + + /** + * 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 the macro for the given target type, e.g. "__EXE__" or "__DLL__" + * @param targettype + * @return list of macro strings, may be empty + */ + String getTargetTypeMacro(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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/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/internal/api/sdk/ISBSv2ConfigQueryData.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,21 @@ +package com.nokia.carbide.cpp.internal.api.sdk; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * Interface to interact directly with results for Raptor configuration query data (--query=config{<config>]) + * @since 3.0 + */ +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(); + public List getTargettypes(); +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,77 @@ +/* +* 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 unique id of a SDK. + * @param id id string of a SDK + */ + void setUniqueId(String id); + +} diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2BuilderInfo.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/SBSv2BuilderInfo.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,121 @@ +/* +* 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.cpp.internal.api.sdk; + +import java.util.HashMap; + +import org.eclipse.cdt.core.settings.model.ICStorageElement; + +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; + +public class SBSv2BuilderInfo implements ISBSv2BuildConfigInfo { + + HashMap sbsv2ConfigDataMap = new HashMap(); + + 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.getPlatformString()); + sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_CONFIG_TARGET, context.getTargetString()); + sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, context.getDisplayString()); + sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_SDK_ID, context.getSDK().getUniqueId()); + this.context = context; + } + + /** + * Using the default constructor presumes the sbsv2ConfigDataMap will be filled out by subsequent calls to loadFromStorage(ICStorageElement rootStorage) + * or setSBSv2Setting(String id, String value) + */ + public SBSv2BuilderInfo(){ + + } + + public void loadFromStorage(ICStorageElement rootStorage) { + + String value = rootStorage.getAttribute(ATRRIB_CONFIG_BASE_PLATFORM); + if (value != null) { + sbsv2ConfigDataMap.put(ATRRIB_CONFIG_BASE_PLATFORM, value); + } + + value = rootStorage.getAttribute(ATTRIB_CONFIG_TARGET); + if (value != null) { + sbsv2ConfigDataMap.put(ATTRIB_CONFIG_TARGET, value); + } + + value = rootStorage.getAttribute(ATTRIB_SBSV2_BUILD_ALIAS); + if (value != null) { + sbsv2ConfigDataMap.put(ATTRIB_SBSV2_BUILD_ALIAS, value); + } + + value = rootStorage.getAttribute(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING); + if (value != null) { + 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) { + + String value = sbsv2ConfigDataMap.get(ATRRIB_CONFIG_BASE_PLATFORM); + if (value != null && value.trim().length() > 0){ + rootStorage.setAttribute(ATRRIB_CONFIG_BASE_PLATFORM, value); + } + + value = sbsv2ConfigDataMap.get(ATTRIB_CONFIG_TARGET); + if (value != null && value.trim().length() > 0){ + rootStorage.setAttribute(ATTRIB_CONFIG_TARGET, value); + } + + value = sbsv2ConfigDataMap.get(ATTRIB_SBSV2_BUILD_ALIAS); + if (value != null && value.trim().length() > 0){ + rootStorage.setAttribute(ATTRIB_SBSV2_BUILD_ALIAS, value); + } + + value = sbsv2ConfigDataMap.get(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING); + 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); + } + + } + + /** + * @see {@link ISBSv2BuildConfigInfo} for id values + */ + public String getSBSv2Setting(String id) { + return sbsv2ConfigDataMap.get(id); + } + + /** + * @see {@link ISBSv2BuildConfigInfo} for id values + */ + public void setSBSv2Setting(String id, String value) { + sbsv2ConfigDataMap.put(id, value); + } + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Wed Aug 25 11:08:33 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 @@ -140,12 +84,11 @@ if (!enableSBSv1Support()) { supportedSDKs.addAll(sdks); } else { - //TODO need a better way to do this from Symbian. - // For now, just filter out anything older than 9.4 + // 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 +98,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 +137,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 +149,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()])); } } @@ -277,16 +176,14 @@ * @return true if SBSv1 is available, false otherwise */ - @SuppressWarnings("unused") public static boolean enableSBSv1Support() { + // hard-coded shut off if (!SDKCorePlugin.SUPPORTS_SBSV1_BUILDER) return false; - else if (!enableSBSv2Support()) - return true; - - else if (isSBSv1Supported()) + // check perl script + else if (isSBSv1Supported()) return true; return false; @@ -304,66 +201,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,107 +239,20 @@ } 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. - * For example, armv5_udeb.phone1 would return '.phone1'. If not variant that changes the release tree, then null - * NOTE: This method deals with variant text applied to the end of a build alias, specifically testing for - * variant text defined in the SBSv2 Build Configuration tab. - * @return null if not a variant or the value to append to the platform release tree directory - * @see com.nokia.carbide.cdt.internal.builder.ui#SBSv2BuildConfigTab - */ - public static String getVariantOutputDirModifier(String variantText) { - - String[] ignoredVariants = { "generic", "tracecompiler", "trace", "test", "savespace", - "bfc", "smp", "rvct2_2", "rvct4_0", "rvct3_1", "gcce4_3_2", "remove_freeze" }; + private static boolean isSBSv1Supported() { + if (HostOS.IS_UNIX){ + return false; + } - String newOutputDir = null; - if (variantText != null && variantText.length() > 1){ - String[] variantTok = variantText.split("\\."); - if (variantTok.length > 1){ - for (String ignore : ignoredVariants){ - if (variantTok[1].toLowerCase().equals(ignore)) - return null; - } - newOutputDir = "." + variantTok[1]; - } - } - return newOutputDir; - } - - private static boolean isSBSv1Supported() { ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); for (ISymbianSDK sdk : sdkMgr.getSDKList()) { File abld = new File(sdk.getEPOCROOT(), "epoc32/tools/abld.pl"); //$NON-NLS-1$ diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,71 @@ +/******************************************************************************* + * 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 org.eclipse.core.runtime.Path; + +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.cpp.internal.api.utils.core.CacheUtils; + +public class SDKCacheUtils extends CacheUtils { + + private static final String CACHE_FOLDER_NAME = "CarbideSDKCache"; //$NON-NLS-1$ + private static SDKCacheUtils cache; + + 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; + } + + 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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SDKManagerInternalAPI.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SDKManagerInternalAPI.java Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SDKManagerInternalAPI.java Wed Aug 25 11:08:33 2010 -0500 @@ -19,10 +19,18 @@ public class SDKManagerInternalAPI { + public static void addMissingSdk(ISymbianSDK sdk) { + ((AbstractSDKManager)SDKCorePlugin.getSDKManager()).addMissingSdk(sdk); + } + public static ISymbianSDK addMissingSdk(String uid) { return ((AbstractSDKManager)SDKCorePlugin.getSDKManager()).addMissingSdk(uid); } + public static void removeMissingSdk(ISymbianSDK sdk) { + ((AbstractSDKManager)SDKCorePlugin.getSDKManager()).removeMissingSdk(sdk); + } + public static void removeMissingSdk(String uid) { ((AbstractSDKManager)SDKCorePlugin.getSDKManager()).removeMissingSdk(uid); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java Wed Aug 25 11:08:33 2010 -0500 @@ -87,7 +87,16 @@ * @return */ private static String getBuildContextKey(ISymbianBuildContext context) { - String key = context.getPlatformString() + "/" + context.getTargetString() + "/"; + String key; + if (context instanceof ISBSv2BuildContext) { + // use config ID instead of platform + target since + // platform and target can be the same for different build contexts + ISBSv2BuildContext v2Context = (ISBSv2BuildContext) context; + key = v2Context.getConfigID() + "/"; + } + else { + key = context.getPlatformString() + "/" + context.getTargetString() + "/"; + } ISymbianSDK sdk = context.getSDK(); if (sdk != null) key += sdk.getEPOCROOT(); @@ -102,6 +111,7 @@ private ExternalFileInfoCollection compilerPrefixFileInfo = null; private List systemIncludes; private ISymbianSDK sdk; + private ISymbianBuildContext context; private IPath compilerPrefixFile; private String platformString; @@ -109,17 +119,28 @@ private String displayString; private String contextKey; - + + /** + * One of {@link ISymbianBuilderID} + */ + 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 +187,21 @@ List macros = new ArrayList(); Map namedMacros = new HashMap(); - File prefixFile = sdk.getPrefixFile(); + + File prefixFile = null; + if (context.getPrefixFromVariantCfg() != null){ + prefixFile = context.getPrefixFromVariantCfg().toFile(); + } + + 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 = context.getPrefixFromVariantCfg(); if (prefixCheck != null){ prefixFile = prefixCheck.toFile(); - sdk.setPrefixFile(prefixCheck); + ((SymbianSDK)sdk).setPrefixFile(prefixCheck, builderId); } } @@ -186,23 +213,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()])), @@ -230,18 +262,20 @@ hrhFilesParsed.add(inc); } - List variantCFGMacros = new ArrayList(); - variantCFGMacros = sdk.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); + if (buildInfo instanceof ISBSv1BuildInfo) { + // SBSv2 does not parse the variant.cfg file to collect macros. + List variantCFGMacros = ((ISBSv1BuildContext)context).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); } - - IDefine macro = DefineFactory.createSimpleFreeformDefine(cfgMacros); - macros.add(macro); - namedMacros.put(macro.getName(), macro); } } @@ -270,7 +304,8 @@ // we assume that the prefix file will not change often, // (if at all) for a build context, so dump the cache if the prefix file changes. - if (compilerPrefixFile != null && !compilerPrefixFile.equals(prefixFile)) { + if (compilerPrefixFile != null && prefixFile != null && + !compilerPrefixFile.equals(prefixFile)) { compilerPrefixFileInfo = null; } @@ -324,6 +359,22 @@ compilerPrefixFileInfo.setFiles(files); } + if (context instanceof ISBSv2BuildContext) { + // add macros from raptor query + ISBSv2BuildContext v2Context = (ISBSv2BuildContext) context; + ISBSv2ConfigQueryData configData = v2Context.getConfigQueryData(); + if (configData != null) { + Map buildMacros = configData.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 +405,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 +444,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 +477,10 @@ } // also search files in same folder as variant.hrh - File prefix = sdk.getPrefixFile(); + File prefix = null; + if (context.getPrefixFromVariantCfg() != null){ + prefix = context.getPrefixFromVariantCfg().toFile(); + } if (sbvPlatform != null){ // might be an alternate HRH file to use IPath varVarHRH = sbvPlatform.getBuildVariantHRHFile(); @@ -427,7 +488,7 @@ prefix = varVarHRH.toFile(); } } - if (prefix != null) { + if (prefix != null && prefix.getParentFile() != null) { systemIncludes.add(prefix.getParentFile()); } diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianMacroStore.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianMacroStore.java Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianMacroStore.java Wed Aug 25 11:08:33 2010 -0500 @@ -178,19 +178,31 @@ } /** - * Get a list of Macros for a given OS. Format will just be the name (e.g. "FOO") + * Get a list of Macros for a given OS. Format will just be the name (e.g. "FOO"). * @param osVersion - A version object. Only the major and minor rev are checked. * @param branch - An OS branch (e.g. 'a' or 'b') or an empty string if none. * @return A full list of define macro names (no values). Returns an empty list if the OS version is not in the store + * @deprecated - use getOSMacros(Version osVersion) */ public List getOSMacros(Version osVersion, String branch){ + return getOSMacros(osVersion); + } + + /** + * Get a list of Macros for a given OS. Format will just be the name (e.g. "FOO"). + * @param osVersion - A version object. Only the major and minor rev are checked. + * @param branch - An OS branch (e.g. 'a' or 'b') or an empty string if none. + * @return A full list of define macro names (no values). Returns an empty list if the OS version is not in the store + * @deprecated - use {@link ISymbianBuildContext#getVariantHRHDefines()} + */ + public List getOSMacros(Version osVersion){ List osMacroList = new ArrayList(); String majStr = String.valueOf(osVersion.getMajor()); String minStr = String.valueOf(osVersion.getMinor()); if (majStr.length() > 0 && minStr.length() > 0){ String osVerStr = majStr + "." + minStr; - osMacroList = osMacros.get(osVerStr + branch); + osMacroList = osMacros.get(osVerStr); } if (osMacroList == null){ @@ -200,6 +212,7 @@ } + /** * Get a hash map of all the platforms and their associated macros for a given OS version * For OS version, only major/minor are checked in the store. diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 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.internal.api.sdk.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 List targettypes = 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); + } + + public String getAlias() { + return alias; + } + + public String getBuildPrefix() { + return buildPrefix; + } + + public Map getBuildMacros() { + return buildMacros; + } + + public List getTargettypes() { + return targettypes; + } + + public String getConfigurationErrorMessage() { + return configurationErrorMessage; + } + + public Map getMetaDataMacros() { + return metaDataMacros; + } + + public List getMetaDataIncludes() { + return metaDataIncludes; + } + + public String getMetaDataVariantHRH() { + return metaDataVariantHRH; + } + + 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) && meaning != null){ + continue; + } + if (configNode.getTextContent() != null && configNode.getTextContent().trim().length() > 0){ + configurationErrorMessage = configNode.getTextContent().trim(); + 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(); + } else if (buildChild.getNodeName().equals("targettype")){ + String targettype = attribs.getNamedItem("name").getNodeValue(); + if (targettype != null && targettype.length() > 0){ + targettypes.add(targettype); + } + } + } catch (Exception e) { + // skip it + e.printStackTrace(); + } + } + } + } + + break; + } + } + + } catch (Exception e) { + e.printStackTrace(); + Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); + } + } + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,39 @@ +/* +* 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. + * @since 3.0 + */ +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 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,486 @@ +/* +* 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.internal.api.sdk.SDKCacheUtils; +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.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 = SDKCacheUtils.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); + SDKCacheUtils.getCache().putCachedData(ALIAS_CACHE_KEY, (Serializable)aliasesMap, 0); + return aliases; + } + + @SuppressWarnings("unchecked") + public static List getProductVariantsForSDK(ISymbianSDK sdk) throws SBSv2MinimumVersionException { + List products; + Map> productsMap = SDKCacheUtils.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); + SDKCacheUtils.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 = SDKCacheUtils.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 = SDKCacheUtils.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); + SDKCacheUtils.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{ + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + Version sbsVers = sdkMgr.getSBSv2Version(false); + if (sbsVers.compareTo(sdkMgr.getMinimumSupportedSBSv2Version()) >= 0) + return true; + else { + String message = "Raptor/SBSv2 minimum version supported in Carbide.c++ is " + sdkMgr.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() { + SDKCacheUtils.getCache().removeCache(ALIAS_CACHE_KEY, true); + } + + public static void removeCachedProducts() { + SDKCacheUtils.getCache().removeCache(PRODUCT_CACHE_KEY, true); + } + + public static void removeCachedConfigurations() { + SDKCacheUtils.getCache().removeCache(CONFIG_CACHE_KEY, true); + } + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Wed Aug 25 11:08:33 2010 -0500 @@ -13,26 +13,15 @@ package com.nokia.carbide.cpp.internal.sdk.core.model; import java.io.BufferedReader; -import java.io.File; import java.io.IOException; import java.io.InputStreamReader; -import java.net.MalformedURLException; -import java.net.URL; +import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Result; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; +import java.util.Map; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -41,52 +30,46 @@ 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.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.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.SDKCacheUtils; 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.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.cpp.internal.api.utils.core.FileUtils; +import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory; import com.nokia.cpp.internal.api.utils.core.ListenerList; 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.ui.WorkbenchUtils; -import com.sun.org.apache.xpath.internal.XPathAPI; public abstract class AbstractSDKManager implements ISDKManager, ISDKManagerInternal { 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"; - protected static final String SDK_CACHE_ENABLED_ATTRIB = "isEnabled"; - protected static final String SDK_CACHE_OS_VERSION_ATTRIB = "osVersion"; - protected static final String SDK_CACHE_OS_BRANCH_ATTRIB = "osBranch"; - protected static final String SDK_CACHE_SDK_VERSION_ATTRIB = "sdkVersion"; - protected static final String SDK_SCANNED_FOR_PLUGINS = "sdkScanned"; - - protected static final String SDK_CACHE_EPOCROOT_ATTRIB = "epocroot"; + public static final String SDK_MANAGER_CACHE_KEY = "sdk_manager_cache"; protected static final String EMPTY_STRING = ""; protected static boolean enableBSFScanner; @@ -104,7 +87,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 +105,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 +135,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,14 +153,13 @@ sdkList.clear(); } - if (!doScanSDKs()) - return; - + if (!doScanSDKs(monitor)) + return Status.OK_STATUS;; + // now these SDK's are newly added, remove from internal list for (ISymbianSDK sdk : sdkList) { if (SDKManagerInternalAPI.getMissingSdk(sdk.getUniqueId()) != null) { - SDKManagerInternalAPI.removeMissingSdk(sdk - .getUniqueId()); + SDKManagerInternalAPI.removeMissingSdk(sdk); } } @@ -164,29 +174,27 @@ } } if (found == false) { - SDKManagerInternalAPI.addMissingSdk(oldSdk - .getUniqueId()); + SDKManagerInternalAPI.addMissingSdk(oldSdk); // flush cache 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 +203,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,9 +257,9 @@ synchronized(sdkList) { try { + sdkList.add(sdk); updateSDK(sdk); - sdkList.add(sdk); - SDKManagerInternalAPI.removeMissingSdk(sdk.getUniqueId()); + SDKManagerInternalAPI.removeMissingSdk(sdk); // tell others about it fireInstalledSdkChanged(SDKChangeEventType.eSDKAdded); } @@ -259,12 +279,15 @@ if (currSDK.getUniqueId().equals(sdkId)){ sdkList.remove(currSDK); - SDKManagerInternalAPI.addMissingSdk(currSDK.getUniqueId()); + SDKManagerInternalAPI.addMissingSdk(currSDK); // 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,215 +305,45 @@ abstract protected boolean doRemoveSDK(String sdkId); protected void scanCarbideSDKCache(){ - - DocumentBuilder docBuilder = null; - try { - docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - } catch (ParserConfigurationException e) { - ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e)); - 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(); + List idList = getSDKCacheIdList(); + for (Iterator itr = idList.iterator(); itr.hasNext();) { + String id = itr.next(); + SDKManagerCacheEntry entry = getSDKCacheEntry(id); + ISymbianSDK sdk = getSDK(id, false); + if (sdk == null) { + Version osVersion = new Version(entry.getOsVersion()); + if (osVersion.getMajor() == 0) { + osVersion = new Version("9.5"); + } + sdk = SymbianSDKFactory.createInstance(id, + entry.getEpocRoot(), + osVersion); + ((SymbianSDK)sdk).setEnabled(entry.isEnabled()); + synchronized (sdkList) { + sdkList.add(sdk); + } + } else { + ((SymbianSDK)sdk).setEnabled(entry.isEnabled()); } - - 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(); - } - }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(); - - // 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){ - - if (wasScanned.equalsIgnoreCase("true")){ - sdk.setPreviouslyScanned(true); - } 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)); - } - } - - 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) { - } + } } public void updateCarbideSDKCache() { if (!Platform.isRunning()) return; - - DocumentBuilder docBuilder = null; - try { - docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - } catch (ParserConfigurationException e) { - ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e)); - 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(); + + clearSDKCache(); + synchronized(sdkList) + { + for (ISymbianSDK currSDK: sdkList) { + SDKManagerCacheEntry entry = new SDKManagerCacheEntry(); + entry.setId(currSDK.getUniqueId()); + entry.setEpocRoot(currSDK.getEPOCROOT()); + entry.setOsVersion(currSDK.getOSVersion().toString()); + entry.setEnabled(currSDK.isEnabled()); + setSDKCacheEntry(entry); } - - 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 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); - } - } - } - 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){ - + flushSDKCache(); } } @@ -500,10 +353,18 @@ */ abstract protected boolean isEPOCRootFixed(); + /** + * Get whether or not the UI has enabled BSF scanning. + * @return true if BSF scanning is enabled. + */ public boolean getBSFScannerEnabled(){ return enableBSFScanner; } + /** + * Set whether or not build platforms should be added for SDKs that contain .bsf extensions. + * @param enabled - When true, add BSF platforms. + */ public void enableBSFScanner(boolean enabled){ enableBSFScanner = enabled; } @@ -516,6 +377,10 @@ return platList; } + /** + * Returns toolchain info for all detected RVCT tools. + * @return Array of toolchain information objects. + */ public synchronized IRVCTToolChainInfo[] getInstalledRVCTTools() { // the path wn't change inside one invocation so cache the results if (rvctInfoList == null) { @@ -548,9 +413,9 @@ // RVCT waits for like 4 minutes trying to find a license when the computer is // not connected to the network. in such cases, the call to br.readline doesn't // return for 4 minutes which is unacceptable here. Instead we'll poll at 1/2 second - // intervals for 40 seconds and see if we get a response. On the first response we break out + // intervals for 5 seconds and see if we get a response. On the first response we break out // of the loop and read the output. So in most normal circumstances it will take 1/2 to 1 seconds. - int maxTries = 80; + int maxTries = 10; int numTries = 0; while (numTries < maxTries) { try { @@ -590,6 +455,10 @@ return rvctToolList; } + public void addMissingSdk(ISymbianSDK sdk) { + missingSdkMap.put(sdk.getUniqueId(), sdk); + } + public ISymbianSDK addMissingSdk(String uid) { ISymbianSDK sdk = getMissingSdk(uid); if (sdk == null) { @@ -599,6 +468,10 @@ return sdk; } + public void removeMissingSdk(ISymbianSDK sdk) { + missingSdkMap.remove(sdk.getUniqueId()); + } + public void removeMissingSdk(String uid) { missingSdkMap.remove(uid); } @@ -665,7 +538,7 @@ 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 overallOutput = ""; @@ -727,6 +600,11 @@ return sbsV2Version; } + /** + * Retrieve the minimum supported version of SBSv2 for Carbide.c++ + * @return Version + * @since 2.3 + */ public Version getMinimumSupportedSBSv2Version() { return MINIMUM_RAPTOR_VERSION; } @@ -766,6 +644,54 @@ return; } - - + + protected void clearSDKCache() { + SDKCacheUtils.getCache().removeCache(SDK_MANAGER_CACHE_KEY, false); + } + + protected void flushSDKCache() { + try { + SDKCacheUtils.getCache().flushCache(SDK_MANAGER_CACHE_KEY); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @SuppressWarnings("unchecked") + protected List getSDKCacheIdList() { + Map cacheMap = SDKCacheUtils.getCache().getCachedData(SDK_MANAGER_CACHE_KEY, Map.class, 0); + List idList = new ArrayList(); + + if (cacheMap != null) { + idList.addAll(cacheMap.keySet()); + } + + return idList; + } + + @SuppressWarnings("unchecked") + protected SDKManagerCacheEntry getSDKCacheEntry(String id) { + SDKManagerCacheEntry entry = null; + Map cacheMap = SDKCacheUtils.getCache().getCachedData(SDK_MANAGER_CACHE_KEY, Map.class, 0); + + if (cacheMap != null) { + entry = cacheMap.get(id); + } + + return entry; + } + + @SuppressWarnings("unchecked") + protected void setSDKCacheEntry(SDKManagerCacheEntry entry) { + String id = entry.getId(); + Map cacheMap = SDKCacheUtils.getCache().getCachedData(SDK_MANAGER_CACHE_KEY, Map.class, 0); + + if (cacheMap == null) { + cacheMap = new HashMap(); + } + + cacheMap.put(id, entry); + SDKCacheUtils.getCache().putCachedData(SDK_MANAGER_CACHE_KEY, (Serializable)cacheMap, 0); + } + } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/BSFCatalogFactory.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/DynamicFeatureInstaller.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/DynamicFeatureInstaller.java Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/DynamicFeatureInstaller.java Wed Aug 25 11:08:33 2010 -0500 @@ -137,7 +137,6 @@ for (IConfiguredSite site : configuredSites) { installedFeatureRefs.addAll(Arrays.asList(site.getConfiguredFeatures())); if (localSite == null && site.isUpdatable()) { - // TODO: If there are multiple sites should the user be presented a list to choose from? localSite = site; } } diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,330 @@ +/* +* 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 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.ISBSv1BuildContext; +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.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; + +/** + * 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>(); + private List supportedTargetTypesList = new ArrayList(); + + private static final String TARGETTYPE_PM_FILE = "epoc32/tools/trgtype.pm"; //$NON-NLS-1$ + + public SBSv1BuildInfo(ISymbianSDK sdk) { + this.sdk = sdk; + } + + public void clearPlatformMacros() { + cachedPlatformMacros.clear(); + } + + public List getAvailablePlatforms() { + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + return ((SDKManager)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(); + } + + if (sdkFeatures.contains(ISymbianSDKFeatures.IS_WINSCW_UREL_SUPPORTED)){ + buildTargets.add(new BuildContextSBSv1(sdk, ISBSv1BuildContext.EMULATOR_PLATFORM, ISymbianBuildContext.RELEASE_TARGET)); + } + + if (sdkFeatures.contains(ISymbianSDKFeatures.IS_WINSCW_UDEB_SUPPORTED)){ + buildTargets.add(new BuildContextSBSv1(sdk, ISBSv1BuildContext.EMULATOR_PLATFORM, ISymbianBuildContext.DEBUG_TARGET)); + } + + for (String currPlat : buildPlats){ + if (currPlat.equals(ISBSv1BuildContext.EMULATOR_PLATFORM) ) { + // emulation targets already determined (some SDKs don't get WISNCW UREL + continue; + } + buildTargets.add(new BuildContextSBSv1(sdk, currPlat, ISymbianBuildContext.DEBUG_TARGET)); + + // everything gets release except for WINSCW + buildTargets.add(new BuildContextSBSv1(sdk, currPlat, ISymbianBuildContext.RELEASE_TARGET)); + } + + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + if (((SDKManager)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 = ((SDKManager)sdkMgr).getSymbianMacroStore().getPlatformMacros(sdk.getOSVersion(), "", bsfCatalog, platform); + cachedPlatformMacros.put(platform.toUpperCase(), platformMacros); + } + } + return platformMacros; + } + + + + public ISBVCatalog getSBVCatalog() { + synchronized (sdk) { + if (sbvCatalog == null) { + sbvCatalog = SBVCatalogFactory.createCatalog(sdk); + } + } + return sbvCatalog; + } + + public String getTargetTypeMacro(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. + + // if it's not one of these then it's a DLL + if (targettype.compareToIgnoreCase("EPOCEXE") == 0) { + return "__EXEDLL__"; + } else if (targettype.compareToIgnoreCase("EXEDLL") == 0) { + return "__EXEDLL__"; + } else if (targettype.compareToIgnoreCase("EXE") == 0) { + return "__EXE__"; + } else if (targettype.compareToIgnoreCase("EXEXP") == 0) { + return "__EXE__"; + } else if (targettype.compareToIgnoreCase("IMPLIB") == 0) { + return "__IMPLIB__"; + } else if (targettype.compareToIgnoreCase("KLIB") == 0) { + return "__LIB__"; + } else if (targettype.compareToIgnoreCase("LIB") == 0) { + return "__LIB__"; + } else { + return "__DLL__"; + } + + } + + public List getVendorSDKMacros() { + return new ArrayList(); // vendor macros no longer apply for Symbian^3 and up + } + + 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()){ + binaryVariantContextList.add(new BuildContextSBSv1(sdk, BuildContextSBSv1.ARMV5_PLATFORM + "." + sbvPlatform.getName(), ISymbianBuildContext.DEBUG_TARGET)); + 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()) { + bsfContextList.add(new BuildContextSBSv1(sdk, platform.getName().toUpperCase(), ISymbianBuildContext.DEBUG_TARGET)); + 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 = ((SDKManager)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; + } + + public List getBuiltinMacros(ISymbianBuildContext context) { + List macros = new ArrayList(); + + // add the macros that should always be defined + macros.add("__SYMBIAN32__"); //$NON-NLS-1$ + macros.add("_UNICODE"); //$NON-NLS-1$ + + macros.add("__SUPPORT_CPP_EXCEPTIONS__"); //$NON-NLS-1$ + + if (context.getTargetString().equals(ISymbianBuildContext.DEBUG_TARGET)) { + macros.add("_DEBUG"); //$NON-NLS-1$ + } else { + macros.add("NDEBUG"); //$NON-NLS-1$ + } + + return macros; + } + + /** + * ABLD specifc mechanism of parsing perl script to get targettypes. This is imperfect + * but is the best way to generalize targettypes. Raptor/SBSv2 API improves on this + * by retrieving configuration specific targettypes. + */ + public List getSupportedTargetTypes() { + + synchronized (supportedTargetTypesList) { + if (supportedTargetTypesList.size() > 0){ + return supportedTargetTypesList; + } + + File epocRoot = new File(sdk.getEPOCROOT()); + File targetTypePM = new File(epocRoot, TARGETTYPE_PM_FILE); + if (!targetTypePM.exists()) + return supportedTargetTypesList; + + // greedy match means the filename is in the last group + try { + char[] cbuf = new char[(int) targetTypePM.length()]; + Reader reader = new FileReader(targetTypePM); + reader.read(cbuf); + reader.close(); + String[] lines = new String(cbuf).split("\r|\r\n|\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 current line... the slitting could be done better with more efficent reg exp.... + line = line.trim(); + line = line.replaceAll(" ", ""); + if (line.endsWith("=>{")){ + String[] lineSplit = line.split("=>"); + if (lineSplit.length == 2 && Character.isLetter(lineSplit[0].charAt(0))){ + supportedTargetTypesList.add(lineSplit[0]); + } + } + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + return supportedTargetTypesList; + } + + + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,326 @@ +/* +* 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.Iterator; +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.ISBSv2BuildContext; +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.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.Logging; +import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; + +/** + * SBSv2 specific build information. Serves as a container for build data container for a Symbian SDK using SBSv2 + * @since 3.0 + * + */ +public class SBSv2BuildInfo implements ISBSv2BuildInfo { + + private ISymbianSDK sdk; + private List sbsv2FilteredContexts = new ArrayList(); + private boolean wasScanned = false; + /** from element from sbs --query=config[] */ + private Map> cachedMetadataMacros = new HashMap>(); + /** from element from sbs --query=config[] */ + private Map> cachedBuildMacros = 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; + } + + public List getAllBuildConfigurations() { + // This really only applies to SBSv1. We never return the full list of configs for SBSv2, only the filtered ones + return sbsv2FilteredContexts; + } + + public void clearDataFromBuildCache(){ + aliasToMeaningMap.clear(); + if (productList != null) productList.clear(); + sbsv2FilteredContexts.clear(); + cachedBuildMacros.clear(); + cachedMetadataMacros.clear(); + cachedVariantHRHFile = null; + } + + 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 (SBSv2Utils.enableSBSv2Support()){ + + try { + initSBSv2BuildContextList(allowedConfigs); + } catch (SBSv2MinimumVersionException e) { + // igore, would be caught above + } + } + + return sbsv2FilteredContexts; + } + + 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(); + sbsv2FilteredContexts.clear(); + for (String alias : filteredAliasList) { + SBSv2ConfigQueryData configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias); + if (configQueryData != null && configQueryData.getConfigurationErrorMessage().trim().length() == 0) { + ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData); + sbsv2FilteredContexts.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; + } + SBSv2ConfigQueryData configQueryData = new SBSv2ConfigQueryData(alias, meaning, configQueryXML); + ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData); + sbsv2FilteredContexts.add(sbsv2Context); + SBSv2QueryUtils.storeConfigQueryDataForSDK(sdk, alias, configQueryData); + } + } + + checkWINSCWSupport(); + } + + private void checkWINSCWSupport() { + List contextList = new ArrayList(); + for (Iterator itr = sbsv2FilteredContexts.iterator(); itr.hasNext();) { + ISBSv2BuildContext context = (ISBSv2BuildContext) itr.next(); + if (context.getPlatformString().equalsIgnoreCase(ISBSv2BuildContext.TOOLCHAIN_WINSCW)) { + if (context.getTargetString().equalsIgnoreCase(ISymbianBuildContext.DEBUG_TARGET)) { + if (sdk.getSupportedFeatures().contains(ISymbianSDKFeatures.IS_WINSCW_UDEB_SUPPORTED)){ + contextList.add(context); + } + } + else + if (context.getTargetString().equalsIgnoreCase(ISymbianBuildContext.RELEASE_TARGET)) { + if (sdk.getSupportedFeatures().contains(ISymbianSDKFeatures.IS_WINSCW_UREL_SUPPORTED)){ + contextList.add(context); + } + } + } else { + contextList.add(context); + } + } + sbsv2FilteredContexts = contextList; + } + + private String getMeaningForVariant(String alias) { + String meaning = null; + + // The alias is the first token when splitting on a dot. + 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 getMetadataMacros(String buildAlias) { + Map platformMacros = cachedMetadataMacros.get(buildAlias); + if (platformMacros == null) { + platformMacros = new HashMap(); + synchronized (cachedMetadataMacros) { + if (sbsv2FilteredContexts == null || sbsv2FilteredContexts.size() == 0) { + getFilteredBuildConfigurations(); + } + if (sbsv2FilteredContexts.size() > 0) { + for (ISymbianBuildContext context : sbsv2FilteredContexts) { + if (((ISBSv2BuildContext)context).getSBSv2Alias().equalsIgnoreCase(buildAlias)) { + platformMacros.putAll(((ISBSv2BuildContext)context).getConfigQueryData().getMetaDataMacros()); + } + } + cachedMetadataMacros.put(buildAlias, platformMacros); + } + } + } + return platformMacros; + } + + public Map getBuildMacros(String buildAlias) { + Map buildMacros = cachedBuildMacros.get(buildAlias); + if (buildMacros == null) { + buildMacros = new HashMap(); + synchronized (cachedBuildMacros) { + if (sbsv2FilteredContexts == null || sbsv2FilteredContexts.size() == 0) { + getFilteredBuildConfigurations(); + } + if (sbsv2FilteredContexts.size() > 0) { + for (ISymbianBuildContext context : sbsv2FilteredContexts) { + if (((ISBSv2BuildContext)context).getSBSv2Alias().equalsIgnoreCase(buildAlias)) { + buildMacros.putAll(((ISBSv2BuildContext)context).getConfigQueryData().getBuildMacros()); + } + } + cachedBuildMacros.put(buildAlias, buildMacros); + } + } + } + return buildMacros; + } + + /** + * 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 (sbsv2FilteredContexts == null || sbsv2FilteredContexts.size() == 0) { + getFilteredBuildConfigurations(); + } + if (sbsv2FilteredContexts.size() > 0) { + for (ISymbianBuildContext context : sbsv2FilteredContexts) { + String vStr = ((ISBSv2BuildContext)context).getConfigQueryData().getMetaDataVariantHRH(); + if (vStr != null) { + cachedVariantHRHFile = new Path(vStr); + break; + } + } + } + } + return cachedVariantHRHFile; + } + + public String getTargetTypeMacro(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. + + // if it's not one of these then it's a DLL + if (targettype.compareToIgnoreCase("EPOCEXE") == 0) { + return "__EXEDLL__"; + } else if (targettype.compareToIgnoreCase("EXEDLL") == 0) { + return "__EXEDLL__"; + } else if (targettype.compareToIgnoreCase("EXE") == 0) { + return "__EXE__"; + } else if (targettype.compareToIgnoreCase("EXEXP") == 0) { + return "__EXE__"; + } else if (targettype.compareToIgnoreCase("IMPLIB") == 0) { + return "__IMPLIB__"; + } else if (targettype.compareToIgnoreCase("KLIB") == 0) { + return "__LIB__"; + } else if (targettype.compareToIgnoreCase("LIB") == 0) { + return "__LIB__"; + } else { + return "__DLL__"; + } + + } + + public boolean isPreviouslyScanned() { + return wasScanned; + } + + public void setPreviouslyScanned(boolean wasScanned) { + this.wasScanned = wasScanned; + } + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalogFactory.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java Wed Aug 25 11:08:33 2010 -0500 @@ -12,11 +12,9 @@ */ package com.nokia.carbide.cpp.internal.sdk.core.model; -import java.io.BufferedReader; import java.io.File; import java.io.FileWriter; import java.io.IOException; -import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.text.MessageFormat; @@ -25,22 +23,23 @@ import java.util.List; import org.eclipse.cdt.utils.WindowsRegistry; -import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; import org.eclipse.emf.common.util.EList; import org.eclipse.jface.dialogs.MessageDialog; 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.ISDKManager; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; import com.nokia.carbide.cpp.sdk.core.SDKEnvInfoFailureException; import com.nokia.cpp.internal.api.utils.core.HostOS; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; @@ -54,7 +53,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; @@ -70,85 +74,63 @@ 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; - } + scanCarbideSDKCache(); + 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 +150,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 +174,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; } @@ -216,6 +198,13 @@ return deviceDirPath.append(DEVICES_FILE_NAME).toFile(); } + /** + * Getting installation path of CSL (GCCE) Arm Toolchain from the registry. + * The method also check that the all required tools exist. + * @return Path to tool binaries under installation path directory, + * successful. Otherwise throws an exception. + * @throws SDKEnvInfoFailureException + */ public String getCSLArmToolchainInstallPathAndCheckReqTools() throws SDKEnvInfoFailureException{ String installPath = null; @@ -225,17 +214,15 @@ installPath = wr.getLocalMachineValue(CSL_ARM_TOOLCHAIN_REG_PATH, CSL_ARM_TOOLCHAIN_REG_KEY); } catch (Exception e) { - //TODO: Localise String errMsg = "Could not read registry for local machine key: '" + CSL_ARM_TOOLCHAIN_REG_PATH - + " (" + e.getMessage() +")."; + + " (" + e.getMessage() +")."; //$NON-NLS-N$ throw new SDKEnvInfoFailureException(errMsg); } if (!new File(installPath).exists()){ - //TODO: Localise String errMsg = "CSL Arm Toolchain installation path pointed by registry key '" + CSL_ARM_TOOLCHAIN_REG_PATH - + "' does not exist."; + + "' does not exist."; //$NON-NLS-N$ throw new SDKEnvInfoFailureException(errMsg); } @@ -252,9 +239,8 @@ toolPathName = gcceToolDir + "\\" + toolName; if (!new File(toolPathName).exists()){ - //TODO: Localise String errMsg = "Required tool from CSL Arm Toolchain is missing: " - + toolPathName; + + toolPathName; //$NON-NLS-N$ throw new SDKEnvInfoFailureException(errMsg); } } @@ -305,42 +291,15 @@ return false; } - protected void checkPerlInstallation(){ - - Runtime rt=Runtime.getRuntime(); - - // check for Perl - try { - Process p = rt.exec("perl.exe -v"); - - BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); - String overallOutput = null; - String stdErrLine = null; - while ((stdErrLine = br.readLine()) != null) { - overallOutput += stdErrLine; - } - - if (overallOutput != null && !overallOutput.contains("v5.6.1")){ - ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING, SDKCorePlugin.PLUGIN_ID, IStatus.WARNING, "Perl v5.6.1 was not detected. Some SDKs do not work with other Perl versions.", null)); - } - - p.destroy(); - - } - 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)."); - } - }); - } - } + /** + * Checks to see if the devices.xml on disk contains the same current information + * as what we have in the sdk list. When not synchronized, when an SDK is add or removed + * outside of Carbide for example, this means an SDK rescan operation is needed. + * @return true if synchronized (no rescan needed), otherwise false (not up to date). Will also return true when devices.xml does not exist + * @see ISDKManager.fireDevicesXMLChanged + * @since 2.0 + */ public boolean checkDevicesXMLSynchronized(){ if (devicesXLMLastModified == 0){ return true; // no devices.xml file @@ -376,27 +335,19 @@ 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; } } @@ -416,4 +367,125 @@ 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")) { + ((SymbianSDK)sdk).setOSVersion(new Version("9.5")); + } + + 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) { + IPath epocInclude = new Path(drive.getAbsolutePath()).append("epoc32").append("include"); + if (epocInclude.toFile().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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManagerCacheEntry.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/SDKManagerCacheEntry.java Wed Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,102 @@ +package com.nokia.carbide.cpp.internal.sdk.core.model; + +import java.io.Serializable; + +public class SDKManagerCacheEntry implements Serializable { + + private static final long serialVersionUID = 3694246766733614433L; + + private String id; + private String epocRoot; + private String osVersion; + private boolean isEnabled; + + public SDKManagerCacheEntry() { + this.id = ""; + this.epocRoot = ""; + this.osVersion = ""; + this.isEnabled = false; + } + + public SDKManagerCacheEntry(String id, String epocRoot, String osVersion, boolean isEnabled) { + this.id = id; + this.epocRoot = epocRoot; + this.osVersion = osVersion; + this.isEnabled = isEnabled; + } + + public String getEpocRoot() { + return epocRoot; + } + + public String getId() { + return this.id; + } + + public String getOsVersion() { + return this.osVersion; + } + + public boolean isEnabled() { + return this.isEnabled; + } + + public void setEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + } + + public void setEpocRoot(String epocRoot) { + this.epocRoot = epocRoot; + } + + public void setId(String id) { + this.id = id; + } + + public void setOsVersion(String osVersion) { + this.osVersion = osVersion; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((epocRoot == null) ? 0 : epocRoot.hashCode()); + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + (isEnabled ? 1231 : 1237); + result = prime * result + + ((osVersion == null) ? 0 : osVersion.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; + SDKManagerCacheEntry other = (SDKManagerCacheEntry) obj; + if (epocRoot == null) { + if (other.epocRoot != null) + return false; + } else if (!epocRoot.equals(other.epocRoot)) + return false; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + if (isEnabled != other.isEnabled) + return false; + if (osVersion == null) { + if (other.osVersion != null) + return false; + } else if (!osVersion.equals(other.osVersion)) + return false; + return true; + } + +} \ No newline at end of file diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManagerRaptorOnly.java Wed Aug 25 11:08:33 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,11 +40,16 @@ * @see com.nokia.carbide.cpp.internal.sdk.core.model.AbstractSDKManager#doScanSDKs() */ @Override - protected boolean doScanSDKs() { + protected boolean doScanSDKs(IProgressMonitor monitor) { + + scanCarbideSDKCache(); String message = SBSv2Utils.scanSBSv2(); if (message != null) { - reportError(message); + // If Raptor is not installed version will be 0.0 + // and a message will be displayed saying that + // the minimum version is not met. + //reportError(message); // no good will come from checking over and over... return true; @@ -122,12 +128,6 @@ return new File(System.getProperty("user.home"), "devices.xml"); } - /* (non-Javadoc) - * @see com.nokia.carbide.cpp.sdk.core.ISDKManager#setDefaultSDK(com.nokia.carbide.cpp.sdk.core.ISymbianSDK) - */ - public void setDefaultSDK(ISymbianSDK sdk) { - // ignore - } /* (non-Javadoc) * @see com.nokia.carbide.cpp.sdk.core.ISDKManager#updateSDK(com.nokia.carbide.cpp.sdk.core.ISymbianSDK) diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianMissingSDKFactory.java Wed Aug 25 11:08:33 2010 -0500 @@ -31,16 +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("9.5")); //$NON-NLS-1$ } - - sdk.setSDKVersion(new Version("0.0")); //$NON-NLS-1$ return sdk; } - } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Wed Aug 25 11:08:33 2010 -0500 @@ -12,148 +12,91 @@ */ 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 java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.xml.XMLConstants; +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.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.*; +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.*; +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 java.io.*; -import java.net.MalformedURLException; -import java.net.URL; -import java.text.DateFormat; -import java.text.ParseException; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +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; -import javax.xml.XMLConstants; -import javax.xml.parsers.*; -import javax.xml.transform.Source; -import javax.xml.transform.TransformerException; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.*; - -public class SymbianSDK implements ISymbianSDK { +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$ - 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"; private static final String WINSCW_UREL_DIR = "epoc32/release/winscw/urel"; + private static final String WINSCW_UDEB_DIR = "epoc32/release/winscw/udeb"; + private static final String ARMV5_UDEB_DIR = "epoc32/release/armv5/udeb"; protected DeviceType deviceEntry = null; private boolean enabled = true; - private boolean wasScanned = false; private Version osVersion; - private Version sdkVersion; - private String sdkOSBranch; + private Map buildInfoMap = new HashMap(); + private Map prefixFileMap = new HashMap(); + 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(); - - 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; 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(); + + public void addSupportedFeature(Object feature) { + sdkFeatures.add(feature); + } + + public ISDKBuildInfo getBuildInfo(String builderId) { + ISDKBuildInfo buildInfo = buildInfoMap.get(builderId); + if (buildInfo == null) { + if (builderId.equals(ISymbianBuilderID.SBSV1_BUILDER)) { + buildInfo = createSBSv1BuildInfo(); + } else if (builderId.equals(ISymbianBuilderID.SBSV2_BUILDER)) { + buildInfo = createSBSv2BuildInfo(); } } - - 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()); - } - - public Date getCreationDate() { - return createDate; + return buildInfo; } public String getEPOCROOT() { @@ -183,189 +126,6 @@ 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)){ - // 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; - } else { - return parts[2]; - } - } - - 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(); if (epocRoot.length() > 0) { @@ -380,55 +140,27 @@ return null; } - public File getLicenseFile() { - return licenseFile; - } - - public String getName() { - if (deviceEntry != null) { - return deviceEntry.getName(); - } - return ""; - } - public Version getOSVersion() { if (osVersion == null){ - return new Version("0.0"); + return new Version("9.5"); } 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() { - return prefixFile; - } - - public URL getPublisherURL() { - return publisherURL; - } +// public File getPrefixFile(String builderId) { +// File prefixFile = prefixFileMap.get(builderId); +// if (prefixFile == null) { +// ISDKBuildInfo buildInfo = getBuildInfo(builderId); +// if (buildInfo != null) { +// IPath prefixFilePath = buildInfo.getPrefixFromVariantCfg(); +// if (prefixFilePath != null) { +// prefixFile = prefixFilePath.toFile(); +// setPrefixFile(prefixFilePath, builderId); +// } +// } +// } +// return prefixFile; +// } public IPath getReleaseRoot() { String epocRoot = getEPOCROOT(); @@ -444,19 +176,9 @@ return null; } - public String getSDKDescription() { - if (sdkDescription == null){ - return ""; - } - return sdkDescription; - } - - public String getSDKOSBranch() { - if (sdkOSBranch == null){ - return ""; - } - - return sdkOSBranch; + @SuppressWarnings("rawtypes") + public Set getSupportedFeatures() { + return sdkFeatures; } public IPath getToolsPath() { @@ -480,207 +202,106 @@ return ""; } - 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; } - public List getProjectVariantHRHDefines() { - // this is deprecated. should use the one in ISymbianBuildContext instead. - - long hrhTime = 0; - if (getPrefixFile() != null){ - hrhTime = getPrefixFile().lastModified(); - } + /** + * 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 (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); + // 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 - 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; - } + 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); + + sbsv1BuildInfo.clearPlatformMacros(); + + if (!setDataFromManifestXML()){ + //need to scan SDK files for OS version + scanSDKForVersionInfo(); } - 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; + setSupportFeatures(); } - - @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 void setBuildInfo(ISDKBuildInfo buildInfo, String builderId) { + buildInfoMap.put(builderId, buildInfo); } - - - public List getSupportedTargetTypes() { - - synchronized (supportedTargetTypesList) { - if (supportedTargetTypesList.size() > 0){ - return supportedTargetTypesList; - } - - File epocRoot = new File(getEPOCROOT()); - File targetTypePM = new File(epocRoot, TARGETTYPE_PM_FILE); - if (!targetTypePM.exists()) - return supportedTargetTypesList; - - // greedy match means the filename is in the last group - try { - char[] cbuf = new char[(int) targetTypePM.length()]; - Reader reader = new FileReader(targetTypePM); - reader.read(cbuf); - reader.close(); - String[] lines = new String(cbuf).split("\r|\r\n|\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 current line... the slitting could be done better with more efficent reg exp.... - line = line.trim(); - line = line.replaceAll(" ", ""); - if (line.endsWith("=>{")){ - String[] lineSplit = line.split("=>"); - if (lineSplit.length == 2 && Character.isLetter(lineSplit[0].charAt(0))){ - supportedTargetTypesList.add(lineSplit[0]); - } - } - } - } catch (IOException e) { - e.printStackTrace(); - } - } + + public void setEnabled(boolean enable) { + enabled = enable; + } - return supportedTargetTypesList; + public void setEPOCROOT(String epocRoot) { + deviceEntry.setEpocroot(epocRoot); } - - public boolean isDefaultSDK() { - if (deviceEntry == null) { - return false; - } - - if (deviceEntry.getDefault().equals(DefaultType.YES_LITERAL)){ - return true; - } else { - return false; + + 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 void setOSVersion(Version osVer) { + this.osVersion = osVer; + } + + public void setPrefixFile(IPath prefixFile, String builderId) { + if (prefixFile == null) + return; + File file = prefixFile.toFile(); + prefixFileMap.put(builderId, file); } - public List validationErrors() { - // TODO return error strings for everything that is not setup - // properly. - return null; + public void setUniqueId(String id) { + deviceEntry.setId(id); } - private boolean setDataFromManifestXML(){ - if (hasManifestXML()){ - - if (processManifest(new File(deviceEntry.getEpocroot(), MANIFEST_XML_LOCATION))){ - return true; - } else { - return false; - } - - } else { - return false; - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return getUniqueId(); } + private SBSv1BuildInfo createSBSv1BuildInfo() { + SBSv1BuildInfo buildInfo = new SBSv1BuildInfo(this); + setBuildInfo(buildInfo, ISymbianBuilderID.SBSV1_BUILDER); + return buildInfo; + } + + private SBSv2BuildInfo createSBSv2BuildInfo() { + SBSv2BuildInfo buildInfo = new SBSv2BuildInfo(this); + setBuildInfo(buildInfo, ISymbianBuilderID.SBSV2_BUILDER); + return buildInfo; + } + private boolean hasManifestXML(){ File manifestXML = new File(deviceEntry.getEpocroot(), MANIFEST_XML_LOCATION); if (manifestXML.exists()){ @@ -692,7 +313,6 @@ /** * Parses the epoc32\kit\manifest.xml file and add the relavant SDK information - * Currently this is just a bunch of hackish code to parse the simplest manifest.xml file that really does nothing useful at all * For a manifest to be properly mapped you need at minimum: epocRoot, id, and label filled out. */ @@ -703,71 +323,59 @@ // 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; - } - - try { + // 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 { 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 +390,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 +428,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 { + // ignored } - 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 @@ -1044,31 +481,18 @@ if (versionTokens[2].toUpperCase().contains("TB92SF")){ setOSVersion(new Version("9.5.0")); - 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")); break; } else if (versionTokens[2].toUpperCase().contains("TB102SF")){ setOSVersion(new Version("9.6.0")); - 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 +513,82 @@ } - /* (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; + private boolean setDataFromManifestXML(){ + if (hasManifestXML()){ + + if (processManifest(new File(deviceEntry.getEpocroot(), MANIFEST_XML_LOCATION))){ + return true; + } else { + return false; + } + + } else { + return false; } - - 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); + private void setSupportFeatures() { + scanForWINSCW_UREL(); + scanForWINSCW_UDEB(); + scanForAvkon(); + sdkFeatures.add(ISymbianSDKFeatures.IS_EKA2); } - 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; + /** + * Check if avkon is a supported feature. + */ + private void scanForAvkon() { + String armv5UDEBFullPathStr = getEPOCROOT(); + armv5UDEBFullPathStr += ARMV5_UDEB_DIR; + IPath armv5UDEBPath = new Path(armv5UDEBFullPathStr); + if (armv5UDEBPath != null && armv5UDEBPath.toFile().exists()){ + if (armv5UDEBPath.append("avkon.dll").toFile().exists()){ + sdkFeatures.add(ISymbianSDKFeatures.IS_AVKON_SUPPORTED); + return; + } + // not there, check winscw + String winscwURELFullPathStr = getEPOCROOT(); + winscwURELFullPathStr += WINSCW_UREL_DIR; + IPath winscwURELPath = new Path(winscwURELFullPathStr); + if (winscwURELPath != null && winscwURELPath.toFile().exists()){ + if (winscwURELPath.append("avkon.dll").toFile().exists()){ + sdkFeatures.add(ISymbianSDKFeatures.IS_AVKON_SUPPORTED); + return; + } + } } - 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 */ 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() + + /** + * Check to see whether or not we should support WINSCW UDEB */ - public IBSFCatalog getBSFCatalog() { - synchronized (this) { - if (bsfCatalog == null) { - bsfCatalog = BSFCatalogFactory.createCatalog(this); + private void scanForWINSCW_UDEB(){ + String winscwURELFullPathStr = getEPOCROOT(); + winscwURELFullPathStr += WINSCW_UDEB_DIR; + IPath winscwURELPath = new Path(winscwURELFullPathStr); + if (winscwURELPath != null && winscwURELPath.toFile().exists()){ + if (winscwURELPath.append("epoc.exe").toFile().exists()){ + if (winscwURELPath.append("euser.dll").toFile().exists()){ + sdkFeatures.add(ISymbianSDKFeatures.IS_WINSCW_UDEB_SUPPORTED); + } } } - 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; } - public void setPreviouslyScanned(boolean wasScanned) { - this.wasScanned = wasScanned; - } - - public boolean isPreviouslyScanned() { - return wasScanned; - } - } diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/processes/CheckS60CustKitSupport.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/processes/CheckS60CustKitSupport.java Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/processes/CheckS60CustKitSupport.java Wed Aug 25 11:08:33 2010 -0500 @@ -138,9 +138,6 @@ helpCompilerNames = new String[] { HELP_COMPILER_WIN32, HELP_COMPILER_PERL }; } else { - // TODO: the infrastructure for the techview/bldhelp.mk is a total mess - // currently, and it also appears that help is obsolete in recent devkits, - // so just drop this if (!SBSv2Utils.enableSBSv1Support() && isSBSv2Project(template)) return null; @@ -178,7 +175,7 @@ // the 3.2 CustKit // has the middleware folder but doesn't use the new build // macros for include paths - if (sdk.getSDKVersion().getMajor() >= 5 && middleWareInclude.exists()) { + if (middleWareInclude.exists()) { // add symbol as at least one build config is a CustKit S60_50_Macros_String = S60_INC_MACROS; break; @@ -187,7 +184,7 @@ middleWareInclude = new File(sdk.getEPOCROOT(), S60_MIDDWARE_INC2); File sfoPath = new File(sdk.getEPOCROOT(), S60_SF_FOLDER); // check for middleware paths and /sf path (if SFO kit) - if (sdk.getSDKVersion().getMajor() >= 5 && middleWareInclude.exists() && sfoPath.exists()) { + if (middleWareInclude.exists() && sfoPath.exists()) { // add symbol as at least one build config is a CustKit S60_50_Macros_String = S60_INC_MACROS_SF; break; @@ -195,7 +192,7 @@ // try newer middleware paths moved to app layer includes - if (sdk.getSDKVersion().getMajor() >= 5 && middleWareInclude.exists()) { + if (middleWareInclude.exists()) { // add symbol as at least one build config is a CustKit File domainPath = new File(sdk.getEPOCROOT(), S60_DOMAND_OSTEXT_PLAT_PATHS); if (domainPath.exists()){ diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/scripting/SymbianSDKs.java Wed Aug 25 11:08:33 2010 -0500 @@ -29,7 +29,6 @@ private static final String KEY_SDK_ID = "KEY_SDK_ID"; private static final String KEY_SDK_EPOCROOT = "KEY_SDK_EPOCROOT"; - private static final String KEY_SDK_NAME = "KEY_SDK_NAME"; static private ISDKManager getSDKManager(){ return SDKCorePlugin.getSDKManager(); @@ -41,12 +40,10 @@ for (ISymbianSDK sdk : sdkList){ Map mp = new HashMap(); mp.put(KEY_SDK_ID, sdk.getUniqueId()); - mp.put(KEY_SDK_NAME, sdk.getName()); mp.put(KEY_SDK_EPOCROOT, sdk.getEPOCROOT()); sdkMapArray.add(mp); } - return sdkMapArray.toArray(new HashMap[sdkMapArray.size()]); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/xml/DevicesLoader.java Wed Aug 25 11:08:33 2010 -0500 @@ -109,11 +109,11 @@ 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()); - currDevice.setName(sdk.getName()); if (currDevice.getUserdeletetable() != null){ currDevice.setUserdeletable(currDevice.getUserdeletetable()); } @@ -132,12 +132,7 @@ DeviceType newDeviceEntry = DevicesFactory.eINSTANCE.createDeviceType(); 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 +167,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 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,37 @@ +/* +* 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; + +/** + * Interface for build related information of a Symbian SDK. + * @since 3.0 + * @noimplement This interface is not intended to be implemented by clients. + */ +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(); + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKManager.java Wed Aug 25 11:08:33 2010 -0500 @@ -17,9 +17,6 @@ import org.osgi.framework.Version; -import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat; -import com.nokia.carbide.cpp.internal.api.sdk.SymbianMacroStore; - /** * Interface to Symbian OS SDK's. Use this interface to get the list of all SDKs. * @see ISymianSDK @@ -86,53 +83,12 @@ void updateSDK(ISymbianSDK sdkId); /** - * Retrieves the instance of the Symbian Macro Store - * @return - */ - SymbianMacroStore getSymbianMacroStore(); - - /** - * Refresh the configuration cache that contains additional information that the devices.xml - * data does not have, such as OS and SDK version. + * Refresh the configuration cache that contains Symbian SDK info such as 'id' and EPOCROOT * */ 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. - */ - public boolean getBSFScannerEnabled(); - - /** - * Set whether or not build platforms should be added for SDKs that contain .bsf extensions. - * @param enabled - When true, add BSF platforms. - */ - public void enableBSFScanner(boolean enabled); - - /** - * Sets the list of available build platforms - * @param platList, a list of BuildPlat objects - * @see BuildPlat - */ - public void setPlatformList(List platList); - - /** - * Get the list of all available built-in platforms - * @return A list of BuildPlat objects - * @see BuildPlat - */ - public List getPlatformList(); - - /** * Get the absolute path to the devices.xml file. * This first scans the windows registry under 'SOFTWARE\Symbian\EPOC SDKs\CommonPath'. * If CommonPath is not defined then the system drive spec is used with the folder location at: @@ -140,23 +96,8 @@ * @return File object. Clients should check File.exists() to make sure the file exists on disk. */ public File getDevicesXMLFile(); - - /** - * Getting installation path of CSL (GCCE) Arm Toolchain from the registry. - * The method also check that the all required tools exist. - * @return Path to tool binaries under installation path directory, - * successful. Otherwise throws an exception. - * @throws SDKEnvInfoFailureException - */ - public String getCSLArmToolchainInstallPathAndCheckReqTools() throws SDKEnvInfoFailureException; /** - * Returns toolchain info for all detected RVCT tools. - * @return Array of toolchain information objects. - */ - public IRVCTToolChainInfo[] getInstalledRVCTTools(); - - /** * Add an ICarbideInstalledSDKChangeListener listener * @param listener - An instance of ICarbideInstalledSDKChangeListener */ @@ -169,16 +110,6 @@ public void removeInstalledSdkChangeListener(ICarbideInstalledSDKChangeListener listener); /** - * Checks to see if the devices.xml on disk contains the same current information - * as what we have in the sdk list. When not synchronized, when an SDK is add or removed - * outside of Carbide for example, this means an SDK rescan operation is needed. - * @return true if synchronized (no rescan needed), otherwise false (not up to date). Will also return true when devices.xml does not exist - * @see ISDKManager.fireDevicesXMLChanged - * @since 2.0 - */ - public boolean checkDevicesXMLSynchronized(); - - /** * Get the version of SBSv2 installed on the PATH. * @param boolean forceScan - forceScan even if version already determined. * @return A Verion object of the installed SBSv2 version. Version will be 0.0.0 if not found. @@ -189,7 +120,8 @@ /** * Retrieve the minimum supported version of SBSv2 for Carbide.c++ * @return Version - * @since 2.3 + * @since 3.0 */ public Version getMinimumSupportedSBSv2Version(); + } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java Wed Aug 25 11:08:33 2010 -0500 @@ -15,6 +15,7 @@ import java.io.File; import java.util.List; +import org.eclipse.cdt.core.settings.model.ICStorageElement; import org.eclipse.core.runtime.IPath; import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; @@ -30,17 +31,7 @@ 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 + * DEFAULT suffix to use for components that are specified as variant, but don't build as variants. For example, plain ARMV5, when specified as * as a FEATUREVARIANT, will build as ARMV5.DEFAULT * @since 2.0 */ @@ -66,15 +57,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 +73,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 @@ -104,27 +85,33 @@ public IPath getCompilerPrefixFile(); /** - * 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. + * 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. + * @since 3.0 + */ + public IPath getPrefixFromVariantCfg(); + + /** + * Returns the list of all vendor specific C/C++ macros for this SDK. This is the result of preprocessing + * the HRH file defined under /epoc32/tools/variant/variant.cfg * @return a list of macros which may be empty. */ public List getVariantHRHDefines(); /** - * Returns the list of all header files recursively included by the SDK prefix file. Note that the list of + * Returns the list of all header files recursively included by the SDK prefix file (defined in /epoc32/tools/variant/variant.cfg). Note that the list of * files could be different for different context's since the platform can potentially change the list of include * paths. * @return a list of header files which may be empty */ - public List getPrefixFileIncludes(); + public List getVariantHRHIncludes(); /** - * Returns the list of compiler macros from the compiler prefix file (if any). + * Returns the list of compiler macros from the compiler prefix file (if any). This is the result + * of preprocessing the actual compiler pre-include file, e.g. rvct.h or gcce.h. WINSCW platform builds will return an empty list. * @return a list of macros which may be empty. */ - public List getCompilerMacros(); + public List getCompilerPreincludeDefines(); /** * For platforms that are building with Symbian Binary Variation, this suffix will be included in the configuration name @@ -135,17 +122,49 @@ public String getBuildVariationName(); /** - * Is the current build context building as a Symbian Binary Variation? Not to be confused with BSF. - * @return true if this is a binary variant build - * @since 2.0 + * Load build context specific configuration settings + * @param ICStorageElement - a child of CARBIDE_STORAGE_ID ("CarbideConfigurationDataProvider") in .cproject data + * @since 3.0 + * */ - public boolean isSymbianBinaryVariation(); + public void loadConfigurationSettings(ICStorageElement se); + + /** + * Save build context specific configuration settings + * @param ISymbianBuildContext + * @param ICStorageElement - a child of CARBIDE_STORAGE_ID ("CarbideConfigurationDataProvider") in .cproject data + * @since 3.0 + */ + public void saveConfigurationSettings(ICStorageElement se, ISymbianBuildContext ISymbianBuildContext); + + /** + * Get the 'id' attribute for this configuration (from .cproject file). This is an ISymbianBuildContext wrapper. + * @return String + * @since 3.0 + */ + String getConfigurationID(); /** - * 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. + * This is the list of macros used to preprocess CPP source files. + * @return a list of defines. + * @since + */ + List getBuildMacros(); + + /** + * This is the list of macros used to preprocess Symbian build files (bld.inf & mmp) + * @return a list of defines + * @since 3.0 */ - public String getSBSv2Alias(); + List getMetadataMacros(); + + /** + * 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 + * @since 3.0 + */ + IDefine getTargetTypeMacro(String targettype); + } diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,28 @@ +/* +* 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. + * @since 3.0 + */ +public interface ISymbianBuilderID { + + /** + * @deprecated - SBSv1 / ABLD builder will be removed in vFuture. + */ + public static final String SBSV1_BUILDER = "SBSv1Builder"; + public static final String SBSV2_BUILDER = "SBSv2Builder"; + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java Wed Aug 25 11:08:33 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,7 @@ */ 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,51 +30,80 @@ 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"; + /** + * Value given for an SDK that is created when a build configuration + * references an non-existent SDK. + */ + public static String BAD_EPOCROOT = "/BAD_SDK_ROOT"; - // 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 (ISymbianBuilderID constant) + * @return ISDKBuildInfo - may be null if the builderId is deprecated. + * @since 3.0 + * @see {@link ISymbianBuilderID} + */ + 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 true if the SDK is configured properly, and - * false otherwise + * @return the absolute path to the epoc32 directory. */ - boolean isValid(); - + String getEPOCROOT(); + + /** + * Returns an IPath for the epoc32\include directory of a SDK. + * @return an IPath for the epoc32\include directory, or null. + */ + IPath getIncludePath(); + /** - * Returns a list of human readable error strings desribing why the - * SDK is not configured properly. + * Returns the OS version string of this SDK. * - * @return a list of strings which may be empty. - * @see #isValid() + * @return the OS Version object. If the version cannot be determined it will be "9.5". + * @deprecated - use ISymbianSDK{@link #getSupportedFeatures()} to figure out the properties of an SDK + */ + 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. */ - List validationErrors(); + IPath getReleaseRoot(); /** + * Returns a set of features supported by the SDK. + * Feature IDs are defined in ISymbianSDKFeatures. + * @return set of features + * @since 3.0 + */ + @SuppressWarnings("rawtypes") + Set getSupportedFeatures(); + + /** + * 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 the id string of this SDK. + */ + String getUniqueId(); + + /** * Returns true if the SDK is enabled, false otherwise. * * @return true if the SDK is enabled, and @@ -88,300 +112,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 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,31 @@ +/* +* 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. + * @since 3.0 + * @noimplement This interface is not intended to be implemented by clients. + */ +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_WINSCW_UDEB_SUPPORTED = "isWINSCWUDEBSupported"; + public static final String IS_EKA1 = "isEKA1"; + public static final String IS_EKA2 = "isEKA2"; + public static final String IS_FROM_DEVICES_XML = "isFromDevicesXml"; + +} diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SDKCorePlugin.java Wed Aug 25 11:08:33 2010 -0500 @@ -15,6 +15,7 @@ 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; @@ -56,6 +57,11 @@ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { + try { + SDKCacheUtils.getCache().flushAll(); + } catch (Exception e) { + e.printStackTrace(); + } plugin = null; super.stop(context); } @@ -81,6 +87,7 @@ if (sdkManager == null) { // TODO: SDKManagerRaptorOnly, currently only works on Linux // ... and SDKManager depends on Windows + // Win32 can use this instead once ABLD support is dropped from Carbide if (HostOS.IS_WIN32) sdkManager = new SDKManager(); else diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SymbianSDKFactory.java Wed Aug 25 11:08:33 2010 -0500 @@ -38,35 +38,21 @@ */ public static ISymbianSDK createInstance(String id, String epocRoot, - String name, - Version osVersion, - String osBranch, - Version sdkVersion, - boolean isDefault){ + Version osVersion) { 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){ - sdk.setSDKVersion(sdkVersion); } return sdk; } + } diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.ui/META-INF/MANIFEST.MF --- a/core/com.nokia.carbide.cpp.sdk.ui/META-INF/MANIFEST.MF Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/META-INF/MANIFEST.MF Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.ui/plugin.properties --- a/core/com.nokia.carbide.cpp.sdk.ui/plugin.properties Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/plugin.properties Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv1PlatformFilterComposite.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv1PlatformFilterComposite.java Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv1PlatformFilterComposite.java Wed Aug 25 11:08:33 2010 -0500 @@ -29,6 +29,7 @@ import org.eclipse.swt.widgets.Label; import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; import com.nokia.carbide.cpp.internal.sdk.ui.Messages; import com.nokia.carbide.cpp.internal.sdk.ui.SDKUIPreferenceConstants; import com.nokia.carbide.cpp.sdk.core.ISDKManager; @@ -96,7 +97,7 @@ bldPlatList = getPlatFilterPrefsStore(); ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - enableBSFScanner.setSelection(sdkMgr.getBSFScannerEnabled()); + enableBSFScanner.setSelection(((SDKManager)sdkMgr).getBSFScannerEnabled()); for (BuildPlat currBldPlat : bldPlatList) { if (currBldPlat.getPlatName().equals("WINSCW")){ //$NON-NLS-1$ @@ -120,7 +121,7 @@ IPreferenceStore prefsStore = SDKUIPlugin.getDefault().getPreferenceStore(); ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - sdkMgr.enableBSFScanner(prefsStore.getBoolean(SDKUIPreferenceConstants.ENABLE_BSF_SCANNER)); + ((SDKManager)sdkMgr).enableBSFScanner(prefsStore.getBoolean(SDKUIPreferenceConstants.ENABLE_BSF_SCANNER)); buildPlatList.add(new BuildPlat("WINSCW", BuildPlat.EKA2_IDENTIFIER, prefsStore.getBoolean(SDKUIPreferenceConstants.PLAT_EKA2_WINSCW))); buildPlatList.add(new BuildPlat("ARMV5", BuildPlat.EKA2_IDENTIFIER, prefsStore.getBoolean(SDKUIPreferenceConstants.PLAT_EKA2_ARMV5))); @@ -129,7 +130,7 @@ buildPlatList.add(new BuildPlat("GCCE", BuildPlat.EKA2_IDENTIFIER, prefsStore.getBoolean(SDKUIPreferenceConstants.PLAT_EKA2_GCCE))); - sdkMgr.setPlatformList(buildPlatList); + ((SDKManager)sdkMgr).setPlatformList(buildPlatList); return buildPlatList; } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Wed Aug 25 11:08:33 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,92 +38,254 @@ 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.core.model.SBSv2BuildInfo; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; +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.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.HostOS; /** * @since 1.4 */ +@SuppressWarnings("restriction") public class SBSv2PlatformFilterComposite extends Composite { - private CheckboxTableViewer tableViewer; + 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); } public void widgetSelected(SelectionEvent e) { - initTable(true); + refreshButton.setEnabled(false); + refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonScanningText")); //$NON-NLS-1$ + SBSv2QueryUtils.removeAllCachedQueries(); + clearLocalSBSCacheData(); + initTable(); + + for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){ + ((SBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER)).clearDataFromBuildCache(); + } + + refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonText")); //$NON-NLS-1$ + refreshButton.setEnabled(true); + } + + private void clearLocalSBSCacheData(){ + aliasMap.clear(); + productVariantList.clear(); + } + + + }); + + 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(); + } + } + } } }); - initTable(false); + 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(); } 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) { + private void initTable() { 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; } } @@ -123,17 +293,24 @@ } 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); + initTable(); + for (TableItem item : buildAliasTableViewer.getTable().getItems()) { + String tableItemText = item.getText().toLowerCase(); + if (tableItemText.equals("armv5_udeb") || + tableItemText.equals("armv5_urel") || + tableItemText.equals("armv5_udeb_gcce") || + tableItemText.equals("armv5_urel_gcce") || + tableItemText.equals("winscw_udeb") || + tableItemText.equals("winscw_urel")) { + + if (HostOS.IS_UNIX && tableItemText.startsWith("winscw")) + ; // ignore winscw as an option for Unix + else + buildAliasTableViewer.setChecked(item.getData(), true); + + } else { - tableViewer.setChecked(item.getData(), true); + buildAliasTableViewer.setChecked(item.getData(), false); } } } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/TemplateUtils.java Wed Aug 25 11:08:33 2010 -0500 @@ -20,18 +20,21 @@ import java.util.ArrayList; import java.util.List; - -import org.osgi.framework.Version; +import java.util.Set; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.template.engine.ITemplate; public class TemplateUtils { + + private static final String SDK_FEATURE_DELIM = ";"; //$NON-NLS-1$ - private static final String FAMILY_DELIM = ":"; //$NON-NLS-1$ - private static final String RANGE_DELIM = "-"; //$NON-NLS-1$ - private static final String VERSION_DELIM = ";"; //$NON-NLS-1$ + // Template flags. These are the template flags used for filtering + // As of Carbide 3.0, we no longer use OS/SDK version or family name + // to filter templates. + private static final String FEATURE_SUPPORTS_AVKON = "supportsAvkon"; //$NON-NLS-1$ public static final String PROJECT_NAME = "projectName"; //$NON-NLS-1$ public static final String BASE_NAME = "baseName"; //$NON-NLS-1$ @@ -44,70 +47,33 @@ * @param symbianSDK * @param template * @return whether this sdk matches the template - * template filter arguments:= framework[:versionSpec] - * versionSpec is a list of version or versionRange delimited by ; - * versionRange is a minVersion and maxVersion delimited by - + * template filter arguments */ public static boolean sdkMatchesTemplate(ISymbianSDK symbianSDK, ITemplate template) { - Version sdkVersion = symbianSDK.getSDKVersion(); - String family = symbianSDK.getFamily(); // S60, symbian... 3rd segment of devices.xml 'name' attrib - return sdkMatchesTemplate(sdkVersion, family, template); - } - - - private static boolean isSameFamily(String f1, String f2) { - if (f1.equalsIgnoreCase(f2)) - return true; + String filterArgs = template.getFilterArguments(); + Set supportedFeatures = symbianSDK.getSupportedFeatures(); + if (filterArgs != null && filterArgs.length() > 0) { + String[] strings = filterArgs.split(SDK_FEATURE_DELIM); + if (strings.length > 0) { + // check for avkon support + boolean hasAvkon = false; + if (supportedFeatures.contains(ISymbianSDKFeatures.IS_AVKON_SUPPORTED)){ + + for (String templateFeature : strings){ + if (templateFeature.equals(FEATURE_SUPPORTS_AVKON)){ + hasAvkon = true; // This template requires avkon support and it's there + break; + } + } + } + if (!hasAvkon) + return false; // This template requires avkon support but is not there. Don't show + } + } - if ((f1.equalsIgnoreCase(ISymbianSDK.S60_FAMILY_ID) && - f2.equalsIgnoreCase(ISymbianSDK.SERIES60_FAMILY_ID)) || - (f2.equalsIgnoreCase(ISymbianSDK.S60_FAMILY_ID) && - f1.equalsIgnoreCase(ISymbianSDK.SERIES60_FAMILY_ID))) - return true; - - return false; + return true; } - /** - * @param symbianSDK - * @param template - * @return whether this sdk matches the template - * template filter arguments:= family[:versionSpec] - * versionSpec is a list of version or versionRange delimited by ; - * versionRange is a minVersion and maxVersion delimited by - - */ - public static boolean sdkMatchesTemplate(Version sdkVersion, String family, ITemplate template) { - String filterArgs = template.getFilterArguments(); - if (filterArgs != null) { - String[] strings = filterArgs.split(FAMILY_DELIM); - if (strings.length > 0) { - if (!isSameFamily(family, strings[0])) - return false; - - if (strings.length > 1) { - String[] versions = strings[1].split(VERSION_DELIM); - for (int i = 0; i < versions.length; i++) { - String[] versionRange = versions[i].split(RANGE_DELIM); - if (versionRange.length == 1) { - Version version = Version.parseVersion(versionRange[0]); - if (sdkVersion.equals(version)) - return true; - } - else if (versionRange.length > 1) { - Version minVersion = Version.parseVersion(versionRange[0]); - Version maxVersion = Version.parseVersion(versionRange[1]); - if (sdkVersion.compareTo(minVersion) >= 0 && - sdkVersion.compareTo(maxVersion) <= 0) - return true; - } - } - return false; - } - } - } - return true; - } - public static List getEnabledSDKs() { List enabledSDKList = new ArrayList(); diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/NewPluginChecker.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java Wed Aug 25 11:08:33 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" @@ -17,22 +17,32 @@ package com.nokia.carbide.cpp.internal.sdk.ui; import java.io.File; -import java.util.ArrayList; +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.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; +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.IStructuredContentProvider; 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.Viewer; +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.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -44,541 +54,600 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.DirectoryDialog; 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.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 ISDKManager sdkMgr; + private List sdkList; 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 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; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) + */ + public void createControl(Composite parent){ + if (sdkMgr == null) { + sdkMgr = SDKCorePlugin.getSDKManager(); + } + if (sdkMgr == null) { + return; + } + + super.createControl(parent); + + // Hide "Restore Defaults" button + getDefaultsButton().setVisible(false); + + PlatformUI.getWorkbench().getHelpSystem().setHelp(super.getControl(), SDKUIHelpIds.SDK_PREFERENCES_PAGE); + } + + /* + * (non-Javadoc) * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) */ public void init(IWorkbench workbench) { - if (sdkMgr == null) + if (sdkMgr == null) { sdkMgr = SDKCorePlugin.getSDKManager(); - if (sdkMgr != null) - sdkList = sdkMgr.getSDKList(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - - IPreferenceStore prefsStore = SDKUIPlugin.getDefault().getPreferenceStore(); - if (sdkMgr == null) - sdkMgr = SDKCorePlugin.getSDKManager(); - if (sdkMgr == null){ - return; } - - shell = parent.getShell(); - 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 != null) { + sdkList = sdkMgr.getSDKList(); + } + } - 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$ - - 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); - - 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.preference.PreferencePage#performOk() + */ public boolean performOk() { - - IPreferenceStore prefsStore = SDKUIPlugin.getDefault().getPreferenceStore(); - prefsStore.setValue(SDKUIPreferenceConstants.LISTEN_FOR_DEVICES_XML_CHANGE, listenForDevicesXMLChangeButton.getSelection()); - - for (ISymbianSDK sdk : sdkMgr.getSDKList()){ - sdk.setEnabled(false); + // Remember which SDK is enabled + for (ISymbianSDK sdk : sdkMgr.getSDKList()) { + ((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 + public 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); - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - //do nothing - } + // 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); + + // 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 + + // 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(rescanButton)) { + handleRescanButton(false); } - } }; 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); + } + + public 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); + } + } + + public 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); } + } + } + + public 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 addNewSdkButtonAction(){ - - AddSDKDialog dialog = new AddSDKDialog(getShell()); - if (dialog.open() == AddSDKDialog.OK){ - addSDKComponentTableItems(); - sdkListTableViewer.refresh(); - } - } - - private void rescanNowButtonAction(){ + public void handleRescanButton(boolean fromPortalPage) { // 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); + selectSDKEntry(0); + rescanButton.setText(Messages.getString("SDKPreferencePage.Rescan_Button_Label")); //$NON-NLS-1$ + rescanButton.setEnabled(true); + } + + public void selectSDKEntry(int index) { + ISymbianSDK sdk = (ISymbianSDK)sdkListTableViewer.getElementAt(index); if (sdk != null){ sdkListTableViewer.setSelection(new StructuredSelection(sdk), true); - setSelectedSDKInfoText(sdk); + sdkListTableViewer.getTable().setFocus(); } - - if (scanForNewPlugins){ - NewPluginChecker.checkForNewlyInstalledPlugins(SDKUIPlugin.getDefault().getWorkbench()); + updateSDKStatus(sdk); + } + + private void setCheckedElements() { + Iterator iterator = sdkList.iterator(); + while (iterator.hasNext()) { + ISymbianSDK sdk = iterator.next(); + sdkListTableViewer.setChecked(sdk, sdk.isEnabled()); } } - - /** - * 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 statusClear() { + iconLabel.setImage(null); + statusLabel.setText(""); + } - 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 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; + + public void updateForPortalLayer() { + addButton.setVisible(false); + deleteButton.setVisible(false); + propertiesButton.setVisible(false); + rescanButton.setVisible(false); + getApplyButton().setVisible(false); + GridLayout gridLayout = new GridLayout(); + sdkListTableViewer.getTable().getParent().setLayout(gridLayout); } + } \ No newline at end of file diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPropertiesDialog.java Wed Aug 25 11:08:33 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,10 @@ 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$ - } - - 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(); + itemOSVersion.setText(new String[] {Messages.getString("SDKPropertiesDialog.OS_Version"), //$NON-NLS-2$ + sdk.getOSVersion().toString()}); //$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, SDKUIHelpIds.SDK_PROPERTIES_DIALOG); @@ -202,8 +103,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 +112,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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIHelpIds.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIPreferenceConstants.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIPreferenceInitializer.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Wed Aug 25 11:08:33 2010 -0500 @@ -1,66 +1,28 @@ 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.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. +SDKPreferencePage.Manage_SDKs_Label=Manage SDKs 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 +31,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 +38,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 +53,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 +70,25 @@ 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.RefreshButtonScanningText=Please wait... Scanning. +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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKPreferencesPortalPageLayer.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKPreferencesPortalPageLayer.java Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKPreferencesPortalPageLayer.java Wed Aug 25 11:08:33 2010 -0500 @@ -16,11 +16,17 @@ */ package com.nokia.carbide.cpp.sdk.ui; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PlatformUI; +import com.nokia.carbide.cpp.internal.sdk.ui.Messages; import com.nokia.carbide.cpp.internal.sdk.ui.SDKPreferencePage; import com.nokia.carbide.internal.discovery.ui.extension.IActionBar; import com.nokia.carbide.internal.discovery.ui.extension.IActionUIUpdater; @@ -29,11 +35,32 @@ @SuppressWarnings("restriction") public class SDKPreferencesPortalPageLayer implements IPortalPageLayer { + protected class SDKActionBar implements IActionBar { + private IAction[] actions; + + public SDKActionBar(IEditorPart part) { + actions = makeActions(part); + } + + public String getTitle() { + return Messages.getString("SDKPreferencePage.Manage_SDKs_Label"); + } + + public IAction[] getActions() { + return actions; + } + + public String[] getHighlightedActionIds() { + return null; + } + } + private SDKPreferencePage preferencePage; public Control createControl(Composite parent, IEditorPart part) { preferencePage = new SDKPreferencePage(); preferencePage.createControl(parent); + preferencePage.updateForPortalLayer(); return preferencePage.getControl(); } @@ -42,11 +69,53 @@ } public IActionBar[] createCommandBars(IEditorPart part, IActionUIUpdater updater) { - return null; + return new IActionBar[] { new SDKActionBar(part) }; } public void dispose() { preferencePage.dispose(); } + protected IAction[] makeActions(final IEditorPart part) { + List actions = new ArrayList(); + IAction action; + + // Add SDK + action = new Action(Messages.getString("SDKPreferencePage.Add_Button_Label")) { + public void run() { + preferencePage.handleAddButton(); + } + }; + action.setToolTipText(Messages.getString("SDKPreferencePage.Add_Button_ToolTip")); + actions.add(action); + + // Delete SDK + action = new Action(Messages.getString("SDKPreferencePage.Delete_Button_Label")) { + public void run() { + preferencePage.handleDeleteButton(); + } + }; + action.setToolTipText(Messages.getString("SDKPreferencePage.Delete_Button_ToolTip")); + actions.add(action); + + // SDK Properties + action = new Action(Messages.getString("SDKPreferencePage.Properties_Button_Label")) { + public void run() { + preferencePage.handlePropertiesButton(); + } + }; + action.setToolTipText(Messages.getString("SDKPreferencePage.Properties_Button_ToolTip")); + actions.add(action); + + // Rescan SDKs + action = new Action(Messages.getString("SDKPreferencePage.Rescan_Button_Label")) { + public void run() { + preferencePage.handleRescanButton(true); + } + }; + action.setToolTipText(Messages.getString("SDKPreferencePage.Rescan_Button_ToolTip")); + actions.add(action); + + return (IAction[]) actions.toArray(new IAction[actions.size()]); + } } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKUIPlugin.java Wed Aug 25 11:08:33 2010 -0500 @@ -27,11 +27,13 @@ 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.core.model.SDKManager; 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.core.HostOS; +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,10 +60,11 @@ */ public void start(BundleContext context) throws Exception { super.start(context); - NewPluginChecker.checkForNewlyInstalledPlugins(getWorkbench()); ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - sdkMgr.setPlatformList(SBSv1PlatformFilterComposite.getPlatFilterPrefsStore()); + if (HostOS.IS_WIN32){ + ((SDKManager)sdkMgr).setPlatformList(SBSv1PlatformFilterComposite.getPlatFilterPrefsStore()); + } } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/AddSDKDialog.java Wed Aug 25 11:08:33 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,76 @@ //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 + Version osVersion = new Version("9.4.0"); //$NON-NLS-1$ + ISymbianSDK sdk = SymbianSDKFactory.createInstance(deviceIDtext.getText(), + epocRootText.getText(), + osVersion ); + ((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 +208,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 +219,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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java Wed Aug 25 11:08:33 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.ISBSv2BuildContext; import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; 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 = stripSDKIDFromConfigName(context.getDisplayString(), 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() + " (" + f.getAbsolutePath() + ") " + 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,10 @@ } return realInput; } + + private static String stripSDKIDFromConfigName(String configName, String sdkID){ + return configName.replace("[" + sdkID + "]", ""); + } + + } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetsPage.java Wed Aug 25 11:08:33 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.SDKPreferencePage", 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 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp/icons/gold_header.png diff -r 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.cpp/splash.bmp diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.templatewizard.symbian.tests/src/com/nokia/carbide/templatewizard/symbian/tests/TestSymbianSDK.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 core/com.nokia.carbide.templatewizard/src/com/nokia/carbide/internal/api/templatewizard/ui/TemplateWizardPage.java --- a/core/com.nokia.carbide.templatewizard/src/com/nokia/carbide/internal/api/templatewizard/ui/TemplateWizardPage.java Tue Aug 24 16:42:58 2010 -0500 +++ b/core/com.nokia.carbide.templatewizard/src/com/nokia/carbide/internal/api/templatewizard/ui/TemplateWizardPage.java Wed Aug 25 11:08:33 2010 -0500 @@ -118,7 +118,7 @@ if (type instanceof UidFieldType) { values.put(type.getId(), value.toLowerCase()); - // least hacky way to support this without creating a language out of templates + // simplest way to support this without creating a language out of templates values.put(type.getId() + UIDComposite.WITHOUT_0X_PREFIX, UIDComposite.getWithout0x(value).toLowerCase()); } diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 2010 -0500 @@ -0,0 +1,195 @@ +/******************************************************************************* + * 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, boolean removeFromDisk) { + CacheEntry cache = caches.get(identifier); + if (cache != null) { + caches.remove(identifier); + if (removeFromDisk){ + cache.delete(); + } + } + } + + 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) + { + caches.put(cacheIdentifier, cache); + 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 void flushCache(String identifier) throws Exception { + CacheEntry entry = caches.get(identifier); + if (entry != null) { + entry.flush(); + } + } + + public IPath getDefaultLocation() { + return defaultLocation; + } + + public void setDefaultLocation(IPath defaultLocation) { + this.defaultLocation = defaultLocation; + } + +} diff -r 6507baa94ab8 -r c71aea166ff8 debuggercdi/com.nokia.carbide.cpp.debug.capabilities/plugin.xml diff -r 6507baa94ab8 -r c71aea166ff8 debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/Activator.java --- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/Activator.java Tue Aug 24 16:42:58 2010 -0500 +++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/Activator.java Wed Aug 25 11:08:33 2010 -0500 @@ -84,12 +84,4 @@ public static void log(Throwable t) { Logging.log(plugin, Logging.newSimpleStatus(0, t)); } - - public static void checkoutTraceLicense() { - FeatureUseTrackerPlugin.getFeatureUseProxy().startUsingFeature(FeatureUseTrackerConsts.CARBIDE_OST_TRACE); - } - - public static void checkinTraceLicense() { - FeatureUseTrackerPlugin.getFeatureUseProxy().stopUsingFeature(FeatureUseTrackerConsts.CARBIDE_OST_TRACE); - } } diff -r 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/SettingsData.java Wed Aug 25 11:08:33 2010 -0500 @@ -57,8 +57,9 @@ 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.ISBSv1BuildContext; 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; @@ -254,13 +255,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)); } @@ -359,7 +358,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 { @@ -394,7 +393,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$ @@ -465,7 +464,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$ } @@ -772,11 +771,8 @@ 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. + if ("exe".equalsIgnoreCase(mainExeHostPath.getFileExtension())) { //$NON-NLS-1$ Version version = currSDK.getOSVersion(); if (!(version.getMajor() == 9 && version.getMinor() == 1)) { diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java Wed Aug 25 11:08:33 2010 -0500 @@ -50,7 +50,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.internal.api.sdk.ISBSv1BuildContext; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.IService; import com.nokia.cdt.debug.cw.symbian.SettingsData; @@ -202,7 +202,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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianProjectPropertyTester.java Wed Aug 25 11:08:33 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.internal.api.sdk.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 != null && buildConfig.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { + if (buildConfig.getPlatformString().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { return true; } } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/InstallationTab.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/TestsPlugin.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/BaseMMPViewTest.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestMMPView3.java Wed Aug 25 11:08:33 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 * @@ -54,8 +56,7 @@ // we need to have a fixed idea of the SDK for these tests (even when workspace isn't running) 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); + sdk = SymbianSDKFactory.createInstance("S60_3rd", "c:\\symbian\\9.1\\S60_3rd", new Version(9,0,0)); // add to memory for standalone test, hopefully only affecting my system SDKCorePlugin.getSDKManager().addSDK(sdk); } else { @@ -68,9 +69,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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestModelProvider.java Wed Aug 25 11:08:33 2010 -0500 @@ -121,7 +121,7 @@ return true; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { return "BWINS"; } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestStandaloneModelProvider.java Wed Aug 25 11:08:33 2010 -0500 @@ -123,7 +123,7 @@ return true; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { return "BWINS"; } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/parser/TestSystemMMPs.java Wed Aug 25 11:08:33 2010 -0500 @@ -123,7 +123,7 @@ return parserConfig; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { return "BWINS"; } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/workspace/BaseProjectTests.java Wed Aug 25 11:08:33 2010 -0500 @@ -134,7 +134,7 @@ return true; } - public String getDefaultDefFileBase(boolean isASSP) { + public String getDefaultDefFileBase() { return defFileBase; } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/mmp/IMMPViewConfiguration.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/ViewDataCache.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/bldinf/BldInfView.java --- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/bldinf/BldInfView.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/bldinf/BldInfView.java Wed Aug 25 11:08:33 2010 -0500 @@ -437,7 +437,6 @@ */ @Override protected boolean internalMerge(IASTTranslationUnit oldTu) { - // TODO Auto-generated method stub return false; } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/mmp/MMPView.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/MissingSdkTest.java Wed Aug 25 11:08:33 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: Using SBSv1 static method. Currently display name keeps the SDKID the same for both + // SBSv1 and SBSv2 configs. Will need to update in the event that SBSv1 support is removed. TCK. + if (SDKManagerInternalAPI.getMissingSdk(BuildContextSBSv1.getSDKIDFromConfigName(config.getDisplayString())) != null) { badCount++; } } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/TestBldInfImportDataLoader.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.core.tests/src/com/nokia/carbide/cpp/project/core/tests/TestsPlugin.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.core/src/com/nokia/carbide/cpp/internal/api/project/core/ProjectCorePluginUtility.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.core/src/com/nokia/carbide/cpp/internal/api/project/core/ResourceChangeListener.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/ProjectUIPlugin.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/ProjectUIPlugin.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/ProjectUIPlugin.java Wed Aug 25 11:08:33 2010 -0500 @@ -276,6 +276,16 @@ store.setValue(PreferenceConstants.PREF_KEEP_PROJECTS_IN_SYNC, keepInSync); } + public static boolean supportLinkedResources() { + IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); + return store.getBoolean(PreferenceConstants.PREF_SUPPORT_LINKED_RESOURCES); + } + + public static void setSupportLinkedResources(boolean supported) { + IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); + store.setValue(PreferenceConstants.PREF_SUPPORT_LINKED_RESOURCES, supported); + } + public static int getAddFilesToProjectOption() { IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); return store.getInt(PreferenceConstants.PREF_ADDED_FILES_OPTION); diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/AIFOutputFileParametersComposite.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/MultiImageEditorContext.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/images/MultiImageEditorContextBase.java Wed Aug 25 11:08:33 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,13 +436,11 @@ * @return */ public boolean isS60() { - ISymbianBuildContext buildContext = getBuildContext(); - ISymbianSDK sdk = buildContext != null ? buildContext.getSDK() : null; - if (sdk != null) { - return sdk.isS60(); + ISymbianBuildContext buildContext = getCarbideBuildConfiguration().getBuildContext(); + if (buildContext.getSDK().getSupportedFeatures().contains(ISymbianSDKFeatures.IS_AVKON_SUPPORTED)){ + return true; } return false; - } /** diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/editors/inf/BldInfEditor.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/images/CarbideImageModelFactory.java Wed Aug 25 11:08:33 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; } /** @@ -313,21 +301,8 @@ */ public static IImageConverterFactory getImageConverterFactory( ICarbideProjectInfo projectInfo) { - IImageConverterFactory imageConverterFactory = null; - if (projectInfo != null) { - List buildConfigurations = projectInfo.getBuildConfigurations(); - for (ICarbideBuildConfiguration buildConfiguration : buildConfigurations) { - ISymbianSDK sdk = buildConfiguration.getSDK(); - if (sdk.getFamily().equals(ISymbianSDK.UIQ_FAMILY_ID)) { - imageConverterFactory = new UIQImageConverterFactory(); - break; - } - } - } - if (imageConverterFactory == null) { - imageConverterFactory = new SymbianImageConverterFactory(); - } - return imageConverterFactory; + + return new SymbianImageConverterFactory(); } /** diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/images/providers/ImageTableLabelProvider.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfImportWizard.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfImportWizard.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/BldInfImportWizard.java Wed Aug 25 11:08:33 2010 -0500 @@ -20,12 +20,14 @@ import java.util.List; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.WorkspaceJob; 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.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.IDialogSettings; @@ -35,12 +37,17 @@ import org.eclipse.ui.IWorkbench; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal; import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; 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.SDKCorePlugin; import com.nokia.carbide.cpp.ui.CarbideUIPlugin; import com.nokia.carbide.cpp.ui.ICarbideSharedImages; +import com.nokia.cpp.internal.api.utils.core.HostOS; public class BldInfImportWizard extends Wizard implements IImportWizard { @@ -61,10 +68,12 @@ setDefaultPageImageDescriptor(CarbideUIPlugin.getSharedImages().getImageDescriptor(ICarbideSharedImages.IMG_IMPORT_BLDINF_WIZARD_BANNER)); ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - if (!sdkMgr.checkDevicesXMLSynchronized()){ - if (sdkMgr instanceof ISDKManagerInternal){ - ISDKManagerInternal sdkMgrInternal = (ISDKManagerInternal)sdkMgr; - sdkMgrInternal.fireDevicesXMLChanged(); + if (HostOS.IS_WIN32){ + if (!((SDKManager)sdkMgr).checkDevicesXMLSynchronized()){ + if (sdkMgr instanceof ISDKManagerInternal){ + ISDKManagerInternal sdkMgrInternal = (ISDKManagerInternal)sdkMgr; + sdkMgrInternal.fireDevicesXMLChanged(); + } } } } @@ -78,16 +87,20 @@ final String projectName = projectPropertiesPage.getProjectName(); final IPath rootDirectory = projectPropertiesPage.getRootDirectory(); + final boolean isLinkedProject = projectPropertiesPage.linkedResourcesEnabled(); // calculate the project relative path to the bld.inf file. IPath absoluteBldInfPath = new Path(getBldInfFile()); assert(rootDirectory.isPrefixOf(absoluteBldInfPath)); final String projectRelativePath = absoluteBldInfPath.removeFirstSegments(rootDirectory.segmentCount()).setDevice(null).toOSString(); + final String absoluteInfPath = absoluteBldInfPath.toOSString(); // if all mmps are checked then don't pass any to createProject. that // way the project setting will be set to build bld.inf. final List components = mmpSelectionPage.areAllMakMakeReferencesChecked() ? new ArrayList(0) : mmpSelectionPage.getSelectedMakMakeReferences(); + final List refs = getSelectedMakMakeReferences(); + final List selectedConfigs = getSelectedConfigs(); // run this in a workspace job @@ -96,13 +109,41 @@ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { monitor.beginTask(Messages.BldInfImportWizard_CreatingProjectJobName, IProgressMonitor.UNKNOWN); - IProject newProject = ProjectCorePlugin.createProject(projectName, rootDirectory.toOSString()); + // write the debug target mmp setting - use the last mmp in + // the list of selected mak make files. + // We also need to check for project test mmpfiles and add that only if the project is only comprised of test mmp files + String debugMMP = ""; //$NON-NLS-1$ + boolean hasOneNormalMMP = false; // Don't add test mmp if there's a regular MMP + for (String ref : refs) { + if (ref.toLowerCase().endsWith(".mmp")){ + hasOneNormalMMP = true; + debugMMP = ref; + } + + if (hasOneNormalMMP == false){ + if (ref.toLowerCase().endsWith(".mmp " + ICarbideProjectInfo.TEST_COMPONENT_LABEL)) { //$NON-NLS-1$ + debugMMP = ref; + debugMMP = debugMMP.substring(0, debugMMP.indexOf( " " + ICarbideProjectInfo.TEST_COMPONENT_LABEL)); + } + } + } // for + + IProject newProject = null; + if (isLinkedProject){ + newProject = ProjectCorePlugin.createProject(projectName, null); + newProject.getFolder(rootDirectory.lastSegment()).createLink(rootDirectory.toFile().toURI(), IResource.BACKGROUND_REFRESH, new NullProgressMonitor()); + } else { + newProject = ProjectCorePlugin.createProject(projectName, rootDirectory.toOSString()); + } monitor.worked(1); - + newProject.setSessionProperty(CarbideBuilderPlugin.SBSV2_PROJECT, Boolean.valueOf(useSBSv2Builder())); - // TODO pass PKG file path to postProjectCreatedActions, currently passing null - ProjectCorePlugin.postProjectCreatedActions(newProject, projectRelativePath, selectedConfigs, components, null, null, monitor); + if (isLinkedProject){ + ProjectCorePlugin.postProjectCreatedActions(newProject, absoluteInfPath, selectedConfigs, components, debugMMP, null, monitor); + } else { + ProjectCorePlugin.postProjectCreatedActions(newProject, projectRelativePath, selectedConfigs, components, debugMMP, null, monitor); + } if (monitor.isCanceled()) { // the user canceled the import so delete the project diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ImporterBuildTargetsPage.java Wed Aug 25 11:08:33 2010 -0500 @@ -24,8 +24,19 @@ 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.ISBSv1BuildContext; +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.SBSv2Utils; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; +import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; +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; +import com.nokia.cpp.internal.api.utils.core.HostOS; public class ImporterBuildTargetsPage extends BuildTargetsPage { @@ -67,7 +78,18 @@ for (int i=0; i 0){ + IBSFCatalog bsfCatalog = null; + ISBSv1BuildInfo sbsv1BuildInfo = null; + if (SBSv2Utils.enableSBSv1Support()){ + sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + } + + ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); + if (sbsv1BuildInfo != null) { + // SBSv1 only + bsfCatalog = sbsv1BuildInfo.getBSFCatalog(); + } + if (HostOS.IS_WIN32 && (((SDKManager)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,11 +143,18 @@ ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); for (ISymbianBuildContext currContext : selectedConfigs){ ISymbianSDK sdk = currContext.getSDK(); - if (sdk.getBSFCatalog().getVirtualVariantPlatforms().length > 0 || sdkMgr.getBSFScannerEnabled()){ - // this setting needs to be persisted. - settingsNeedUpdate = true; - selectedConfigsToSave.add(currContext); - } + IBSFCatalog bsfCatalog = null; + if (currContext instanceof ISBSv1BuildContext) { + // SBSv1 only + ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); + bsfCatalog = sbsv1BuildInfo.getBSFCatalog(); + + if (((SDKManager)sdkMgr).getBSFScannerEnabled() || (bsfCatalog != null && bsfCatalog.getVirtualVariantPlatforms().length > 0)){ + // this setting needs to be persisted. + settingsNeedUpdate = true; + selectedConfigsToSave.add(currContext); + } + } } if (settingsNeedUpdate) { // Iterate through all the persisted configs and don't add those that have the same diff -r 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/Messages.java Wed Aug 25 11:08:33 2010 -0500 @@ -112,6 +112,10 @@ public static String ProjectPropertiesPage_directoryTooLong; public static String ProjectPropertiesPage_directoryIsRoot; + + public static String ProjectPropertiesPage_linkedProject; + + public static String ProjectPropertiesPage_linkedProjectTooltip; static { // initialize resource bundle diff -r 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java Wed Aug 25 11:08:33 2010 -0500 @@ -16,7 +16,6 @@ */ package com.nokia.carbide.cpp.internal.project.ui.importWizards; -import java.io.File; import java.lang.reflect.InvocationTargetException; import java.util.List; @@ -45,6 +44,7 @@ import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cpp.internal.project.ui.ProjectUIHelpIds; +import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; @@ -53,6 +53,7 @@ private Text projectName; private Text rootDirectory; private Button browseButton; + private Button linkedResourcesCheck; String projectNameText = ""; //$NON-NLS-1$ IPath rootDirectoryPath = null; @@ -143,6 +144,14 @@ gd.horizontalSpan = 3; helpText.setLayoutData(gd); + if (ProjectUIPlugin.supportLinkedResources()){ + linkedResourcesCheck = new Button(parent, SWT.CHECK); + linkedResourcesCheck.setFont(font); + linkedResourcesCheck.setText(Messages.ProjectPropertiesPage_linkedProject); + linkedResourcesCheck.setToolTipText(Messages.ProjectPropertiesPage_linkedProjectTooltip); + linkedResourcesCheck.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); + } + setButtonLayoutData(browseButton); } @@ -280,6 +289,14 @@ return rootDirectoryPath; } + public boolean linkedResourcesEnabled(){ + if (linkedResourcesCheck == null){ + return false; + } + + return linkedResourcesCheck.getSelection(); + } + @Override public void setVisible(boolean visible) { // this gets called just before the page goes in or out of view. if it's diff -r 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/messages.properties Wed Aug 25 11:08:33 2010 -0500 @@ -18,6 +18,8 @@ ProjectPropertiesPage_directoryDoesNotContainSourceFiles=The root directory specified does not contain all the source and resource files referenced in the project. This may make navigation and editing more difficult. ProjectPropertiesPage_directoryTooLong=The root directory specified is too long. It cannot exceed 215 characters so that project settings files do not exceed the 256 character path limit. ProjectPropertiesPage_directoryIsRoot=A project path near the root SDK directory can lead to slow import times. Please select another project path or import a subset of included bld.inf files (if possible). +ProjectPropertiesPage_linkedProject=Create project with linked resources +ProjectPropertiesPage_linkedProjectToolTip=When enabled, the eclipse project files are created in the workspace and all project content is formed with linked resources. MMPSelectionPage_title=MMP Selection MMPSelectionPage_description=Select the mmp and extension make files to work with. You will be able to edit this after the project has been created. MMPSelectionPage_selectAllAButtonLabel=Select All diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/LibrarySectionPart.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/MMPEditor.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/OverviewPage.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/OverviewPage.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/OverviewPage.java Wed Aug 25 11:08:33 2010 -0500 @@ -21,7 +21,10 @@ import org.eclipse.jface.dialogs.IPageChangedListener; import org.eclipse.jface.dialogs.PageChangedEvent; -import org.eclipse.jface.viewers.*; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; @@ -29,7 +32,11 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.widgets.*; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; import org.eclipse.ui.forms.IManagedForm; import org.eclipse.ui.forms.events.HyperlinkAdapter; import org.eclipse.ui.forms.events.HyperlinkEvent; @@ -44,13 +51,18 @@ import org.osgi.framework.Version; import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext; import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; -import com.nokia.carbide.cpp.internal.project.ui.editors.common.*; +import com.nokia.carbide.cpp.internal.project.ui.editors.common.ControlHandler; +import com.nokia.carbide.cpp.internal.project.ui.editors.common.FormUtilities; import com.nokia.carbide.cpp.internal.project.ui.mmpEditor.commands.EMMPListSelector; import com.nokia.carbide.cpp.internal.project.ui.mmpEditor.commands.EMMPStringValueSelector; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.cpp.internal.api.utils.core.*; -import com.nokia.cpp.internal.api.utils.ui.*; +import com.nokia.cpp.internal.api.utils.core.TextUtils; +import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; import com.nokia.cpp.internal.api.utils.ui.editor.FormEditorEditingContext; import com.swtdesigner.ResourceManager; import com.swtdesigner.SWTResourceManager; @@ -340,9 +352,18 @@ void refresh() { if (getPartControl() != null) { + ISymbianSDK sdk = editorContext.activeBuildConfig.getSDK(); List supportedTargetTypes = new ArrayList(); - List sdkTypes = sdk.getSupportedTargetTypes(); + List sdkTypes = new ArrayList(); + if (editorContext.activeBuildConfig.getBuildContext() instanceof ISBSv1BuildContext){ + ISBSv1BuildInfo sbsv1BuildInfo = ((ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER)); + sdkTypes = sbsv1BuildInfo.getSupportedTargetTypes(); + } else if (editorContext.activeBuildConfig.getBuildContext() instanceof ISBSv2BuildContext){ + ISBSv2BuildContext sbsv2BuildContext = ((ISBSv2BuildContext)editorContext.activeBuildConfig.getBuildContext()); + sdkTypes = sbsv2BuildContext.getSupportedTargettypes(); + } + // this could come back empty if a devkit is not completely installed if (sdkTypes != null) { supportedTargetTypes.addAll(sdkTypes); diff -r 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceConstants.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceConstants.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceConstants.java Wed Aug 25 11:08:33 2010 -0500 @@ -28,4 +28,6 @@ public final static String PREF_CHANGED_FILES_OPTION = "changedFilesOption"; //$NON-NLS-1$ public static final String PREF_INDEX_ALL = "indexAll"; //$NON-NLS-1$ + + public static final String PREF_SUPPORT_LINKED_RESOURCES = "supportsLinkedRsrcs"; //$NON-NLS-1$ } diff -r 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceInitializer.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceInitializer.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceInitializer.java Wed Aug 25 11:08:33 2010 -0500 @@ -16,6 +16,7 @@ */ package com.nokia.carbide.cpp.internal.project.ui.preferences; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.jface.preference.IPreferenceStore; @@ -35,6 +36,21 @@ IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.PREF_KEEP_PROJECTS_IN_SYNC, true); store.setDefault(PreferenceConstants.PREF_INDEX_ALL, false); + + if (cmdLineArgsSupportsLinkedResources()){ + store.setDefault(PreferenceConstants.PREF_SUPPORT_LINKED_RESOURCES, true); + } else { + store.setDefault(PreferenceConstants.PREF_SUPPORT_LINKED_RESOURCES, false); + } + } + + private boolean cmdLineArgsSupportsLinkedResources(){ + String[] args = Platform.getCommandLineArgs(); + for (String arg : args){ + if (arg.equals("supportsLinkedRsrcs=true")) + return true; + } + return false; } } diff -r 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java Wed Aug 25 11:08:33 2010 -0500 @@ -29,6 +29,8 @@ import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils; import com.nokia.carbide.cpp.internal.project.ui.Messages; import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; +import com.nokia.carbide.cpp.sdk.core.ISDKManager; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.cpp.sdk.ui.shared.BuildTargetsPage; @@ -89,16 +91,16 @@ useSBSv2Builder = false; } else if (selection.equals(Messages.getString("NewProjectPage.sbsv2"))) { //$NON-NLS-1$ - + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); // if SBSv2 is selected, make sure SBS bin directory exists if (SBSv2Utils.getSBSBinDirectory() == null){ status = new Status(Status.ERROR, ProjectUIPlugin.PLUGIN_ID, "The Symbian Build System (sbs) cannot be found on the PATH. Carbide needs a valid SBS installation on the PATH to use the SBSv2 builder."); } // check the raptor version - else if (SDKCorePlugin.getSDKManager().getSBSv2Version(false).getMajor() == 0){ + else if (sdkMgr.getSBSv2Version(false).getMajor() == 0){ // Try to scan again.... - if (SDKCorePlugin.getSDKManager().getSBSv2Version(true).getMajor() == 0){ + if (sdkMgr.getSBSv2Version(true).getMajor() == 0){ status = new Status(Status.WARNING, ProjectUIPlugin.PLUGIN_ID, "SBS version cannot be determined, some SBS functionality may not work. Please check your SBS installation."); } } diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/views/SPNViewContentProvider.java Wed Aug 25 11:08:33 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.IWorkspace; +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 org.eclipse.ui.model.WorkbenchAdapter; -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.project.ui.ProjectUIPlugin; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +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 com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; /** * 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) { @@ -2260,7 +2329,20 @@ if (info != null) { IPath infPath = info.getProjectRelativeBldInfPath(); if (infPath != null) { - IFile file = getIFileFromBldInfViewPath(project, infPath); + IFile file = null; + if (infPath.isAbsolute()){ + // Make sure to get the project relative location if the inf path is absolute. + // This means the project has linked resources + // TODO: Just using for prototyping with using linked resources.... + // XXX: This is still not working, as the path is relative to the workspace and + // hence it's wrong. Seems we need to change the container for the SPN to take + // a bld.inf as an absolute path??? + IFile infFile = ResourcesPlugin.getWorkspace().getRoot().getFile(infPath); + children.add(infFile); + return children.toArray(); + } else { + file = getIFileFromBldInfViewPath(project, infPath); + } if (file != null) { children.add(containerFactory.getBldInfContainer(file, true)); @@ -2447,6 +2529,11 @@ } protected IFile getIFileFromBldInfViewPath(IProject project, IPath pathFromBldInfView) { + + if (pathFromBldInfView.isAbsolute()){ + IWorkspace workspace= ResourcesPlugin.getWorkspace(); + return workspace.getRoot().getFile(pathFromBldInfView); + } EpocEnginePathHelper helper = new EpocEnginePathHelper(project); IPath resolvedProjectRelativePath = helper.convertToProject(pathFromBldInfView); if (resolvedProjectRelativePath != null) diff -r 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/wizards/NewSymbianOSCppProjectWizard.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/wizards/NewSymbianOSCppProjectWizard.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/wizards/NewSymbianOSCppProjectWizard.java Wed Aug 25 11:08:33 2010 -0500 @@ -26,6 +26,7 @@ import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal; import com.nokia.carbide.cpp.internal.api.sdk.ui.TemplateSDKsFilter; import com.nokia.carbide.cpp.internal.project.ui.Messages; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; import com.nokia.carbide.cpp.project.ui.sharedui.NewProjectPage; import com.nokia.carbide.cpp.sdk.core.ISDKManager; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; @@ -34,6 +35,7 @@ import com.nokia.carbide.cpp.ui.ICarbideSharedImages; import com.nokia.carbide.internal.api.templatewizard.ui.IWizardDataPage; import com.nokia.carbide.internal.api.templatewizard.ui.TemplateWizard; +import com.nokia.cpp.internal.api.utils.core.HostOS; /** * Wizard for creating Symbian OS C++ project @@ -51,13 +53,15 @@ setTemplateFilter(new TemplateSDKsFilter()); setWindowTitle(Messages.getString("NewSymbianOSCppProjectWizard.WindowTitle")); //$NON-NLS-1$ - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - if (!sdkMgr.checkDevicesXMLSynchronized()){ - if (sdkMgr instanceof ISDKManagerInternal){ - ISDKManagerInternal sdkMgrInternal = (ISDKManagerInternal)sdkMgr; - sdkMgrInternal.fireDevicesXMLChanged(); + if (HostOS.IS_WIN32){ + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + if (!((SDKManager)sdkMgr).checkDevicesXMLSynchronized()){ + if (sdkMgr instanceof ISDKManagerInternal){ + ISDKManagerInternal sdkMgrInternal = (ISDKManagerInternal)sdkMgr; + sdkMgrInternal.fireDevicesXMLChanged(); + } + } - } } diff -r 6507baa94ab8 -r c71aea166ff8 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/utils/BldInfImportWrapper.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/utils/BldInfImportWrapper.java Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/utils/BldInfImportWrapper.java Wed Aug 25 11:08:33 2010 -0500 @@ -113,8 +113,7 @@ project.setSessionProperty(CarbideBuilderPlugin.SBSV2_PROJECT, isSBSv2); // TODO pass PKG file path to postProjectCreatedActions, currently passing null - - + ProjectCorePlugin.postProjectCreatedActions(project, projectRelativePath, selectedConfigs, components, debugMMP, null, monitor); if (monitor.isCanceled()) { diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/ImporterScritpingUtils.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/scripting/SymbianProject.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtFilter.java Wed Aug 25 11:08:33 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.internal.api.sdk.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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtSDKUtils.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF --- a/qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF Tue Aug 24 16:42:58 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.ui/META-INF/MANIFEST.MF Wed Aug 25 11:08:33 2010 -0500 @@ -23,6 +23,7 @@ org.eclipse.cdt.core, org.eclipse.ui.ide, com.trolltech.qtcppproject;bundle-version="1.6.0";resolution:=optional, - com.nokia.cpp.utils.ui + com.nokia.cpp.utils.ui, + com.nokia.cpp.utils.core;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy diff -r 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QMakeEnvironmentModifier.java Wed Aug 25 11:08:33 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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QtUIPlugin.java Wed Aug 25 11:08:33 2010 -0500 @@ -42,11 +42,11 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; 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.ISBSv1BuildContext; import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerLoadedHook; 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.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 6507baa94ab8 -r c71aea166ff8 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 Tue Aug 24 16:42:58 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtImporterBuildTargetsPage.java Wed Aug 25 11:08:33 2010 -0500 @@ -21,8 +21,13 @@ import org.eclipse.jface.dialogs.IDialogSettings; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; +import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; +import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; 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 || ((SDKManager)sdkMgr).getBSFScannerEnabled()){ // this setting needs to be persisted. settingsNeedUpdate = true; selectedConfigsToSave.add(currContext); diff -r 6507baa94ab8 -r c71aea166ff8 qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileImportWizard.java --- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileImportWizard.java Tue Aug 24 16:42:58 2010 -0500 +++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileImportWizard.java Wed Aug 25 11:08:33 2010 -0500 @@ -42,8 +42,13 @@ 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.QtUIPlugin; +import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager; 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.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.cpp.internal.api.utils.core.HostOS; import com.trolltech.qtcppproject.QtProject; import com.trolltech.qtcppproject.qmake.QMakeRunner; @@ -62,11 +67,13 @@ setDialogSettings(section); setNeedsProgressMonitor(true); - ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); - if (!sdkMgr.checkDevicesXMLSynchronized()){ - if (sdkMgr instanceof ISDKManagerInternal){ - ISDKManagerInternal sdkMgrInternal = (ISDKManagerInternal)sdkMgr; - sdkMgrInternal.fireDevicesXMLChanged(); + if (HostOS.IS_WIN32){ + ISDKManager sdkMgr = SDKCorePlugin.getSDKManager(); + if (!((SDKManager)sdkMgr).checkDevicesXMLSynchronized()){ + if (sdkMgr instanceof ISDKManagerInternal){ + ISDKManagerInternal sdkMgrInternal = (ISDKManagerInternal)sdkMgr; + sdkMgrInternal.fireDevicesXMLChanged(); + } } } } diff -r 6507baa94ab8 -r c71aea166ff8 templates/com.nokia.carbide.cpp.qt.templates/plugin.xml --- a/templates/com.nokia.carbide.cpp.qt.templates/plugin.xml Tue Aug 24 16:42:58 2010 -0500 +++ b/templates/com.nokia.carbide.cpp.qt.templates/plugin.xml Wed Aug 25 11:08:33 2010 -0500 @@ -14,7 +14,7 @@