add extension point for access 'abld build' arguments. Used to keep analyze tool extension happy while we start to deprecate abld support. C3_BUILDER_WORK
authortimkelly
Fri, 13 Aug 2010 17:35:50 -0500
branchC3_BUILDER_WORK
changeset 1830 5f8982384793
parent 1825 8f3d04a21ae9
child 1833 04886bcd3519
add extension point for access 'abld build' arguments. Used to keep analyze tool extension happy while we start to deprecate abld support.
builder/com.nokia.carbide.cdt.builder.test/plugin.xml
builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestCarbideProjectSettingsModifier.java
builder/com.nokia.carbide.cdt.builder/plugin.xml
builder/com.nokia.carbide.cdt.builder/schema/carbideProjectPrefModifier.exsd
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/extension/ICarbidePrefsModifier.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/CarbidePrefsModifier.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildContext.java
--- a/builder/com.nokia.carbide.cdt.builder.test/plugin.xml	Fri Aug 13 12:00:38 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder.test/plugin.xml	Fri Aug 13 17:35:50 2010 -0500
@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.2"?>
 <plugin>
+  
  <extension
        point="com.nokia.carbide.cdt.builder.environmentModifier">
       <modifier class="com.nokia.carbide.cdt.builder.test.TestEnvironmentModifier"/>
  </extension>
-
+ 
 </plugin>
--- /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	Fri Aug 13 17:35:50 2010 -0500
@@ -0,0 +1,144 @@
+/*
+* 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 java.util.List;
+
+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.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+
+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;
+import com.nokia.cpp.internal.api.utils.core.Check;
+import com.nokia.cpp.internal.api.utils.core.Logging;
+
+
+public class TestCarbideProjectSettingsModifier extends TestCase {
+	static IProject project;
+	static ISymbianSDK symbianSDKS60_30;
+	
+	protected static final String PROJECT_NAME = "test-prj-modifier-project";
+	
+
+	
+	// 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<String>(), "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 registry
+        
+		ICarbidePrefsModifier extProvider = checkForFeatureExtension();
+        
+        assertNotNull(extProvider); // will be null when SBSv1 support is removed
+        
+		String original = extProvider.getAbdlBuildArg(cpi
+				.getDefaultConfiguration().getBuildContext());
+		assertTrue(original.equals(""));
+
+		extProvider.setAbldBuildArg(cpi.getDefaultConfiguration()
+				.getBuildContext(), "FOO");
+
+		cpi.getDefaultConfiguration().saveConfiguration(false);
+
+		String test = extProvider.getAbdlBuildArg(cpi.getDefaultConfiguration()
+				.getBuildContext());
+		assertTrue(test.equals("FOO"));
+
+		extProvider.setAbldBuildArg(cpi.getDefaultConfiguration()
+				.getBuildContext(), original);
+
+		cpi.getDefaultConfiguration().saveConfiguration(false);
+		test = extProvider.getAbdlBuildArg(cpi.getDefaultConfiguration()
+				.getBuildContext());
+		assertTrue(original.equals(test));
+	}
+	
+	@SuppressWarnings("deprecation")
+	public static ICarbidePrefsModifier checkForFeatureExtension() {
+		
+			ICarbidePrefsModifier testExt = null;
+
+			IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+			IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint("com.nokia.carbide.cdt.builder.carbideProjectPrefModifier"); //$NON-NLS-1$
+			IExtension[] extensions = extensionPoint.getExtensions();
+			
+			for (int i = 0; i < extensions.length; i++) {
+				IExtension extension = extensions[i];
+				IConfigurationElement[] elements = extension.getConfigurationElements();
+				Check.checkContract(elements.length == 1);
+				IConfigurationElement element = elements[0];
+				
+				boolean failed = false;
+				try {
+					Object extObject = element.createExecutableExtension("class"); //$NON-NLS-1$
+					if (extObject instanceof ICarbidePrefsModifier) {
+						testExt = (ICarbidePrefsModifier)extObject;
+						break;
+					} else {
+						failed = true;
+					}
+				} 
+				catch (CoreException e) {
+					failed = true;
+				}
+				
+				if (failed) {
+					CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(), 
+							IStatus.ERROR,
+							"Unable to load com.nokia.carbide.cdt.builder.carbideProjectPrefModifier extension from " + extension.getContributor().getName()));
+				}
+			}
+		
+		return testExt;
+	}
+}
--- a/builder/com.nokia.carbide.cdt.builder/plugin.xml	Fri Aug 13 12:00:38 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/plugin.xml	Fri Aug 13 17:35:50 2010 -0500
@@ -322,5 +322,6 @@
    </extension>
    
    <extension-point id="environmentModifier" name="Environment Modifier" schema="schema/environmentModifier.exsd"/>
+   <extension-point id="carbideProjectPrefModifier" name="Carbide Preferences Modifier" schema="schema/carbideProjectPrefModifier.exsd"/>
 
 </plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/builder/com.nokia.carbide.cdt.builder/schema/carbideProjectPrefModifier.exsd	Fri Aug 13 17:35:50 2010 -0500
@@ -0,0 +1,84 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="com.nokia.carbide.cdt.builder" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appInfo>
+         <meta.schema plugin="com.nokia.carbide.cdt.builder" id="carbideProjectPrefModifier" name="Carbide Preferences Modifier"/>
+      </appInfo>
+      <documentation>
+         Allow read/write access to some Carbide project preferences.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appInfo>
+            <meta.element />
+         </appInfo>
+      </annotation>
+      <complexType>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute translatable="true"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="since"/>
+      </appInfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="examples"/>
+      </appInfo>
+      <documentation>
+         [Enter extension point usage example here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="apiinfo"/>
+      </appInfo>
+      <documentation>
+         [Enter API information here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="implementation"/>
+      </appInfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+
+</schema>
--- /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	Fri Aug 13 17:35:50 2010 -0500
@@ -0,0 +1,49 @@
+/*
+* 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.cpp.sdk.core.ISymbianBuildContext;
+
+/**
+ * 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.
+ * @deprecated - abld support is deprecated
+ *
+ */
+public interface ICarbidePrefsModifier {
+	
+	/**
+	 * Get the abld build setting from the Carbide build config arguments preference.
+	 * This only works with the SBSv1 buider and has no effect on other builders.
+	 * @param newParam
+	 * @return The String value. Or null if the the pref is not supported under the current context.
+	 * @deprecated- abld support is deprecated
+	 */
+	String getAbdlBuildArg(ISymbianBuildContext newParam);
+	
+	/**
+	 * Set the abld build setting from the Carbide build config arguments preference.
+	 * This only works with the SBSv1 buider and has no effect on other builders.
+	 * @param context
+	 * @param arg
+	 * @deprecated - abld support is deprecated
+	 */
+	void setAbldBuildArg(ISymbianBuildContext context, String arg);
+}
--- /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	Fri Aug 13 17:35:50 2010 -0500
@@ -0,0 +1,50 @@
+/*
+* 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.cpp.internal.api.sdk.BuildArgumentsInfo;
+import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
+
+public class CarbidePrefsModifier implements ICarbidePrefsModifier {
+
+	/**
+	 * @deprecated
+	 */
+	public String getAbdlBuildArg(ISymbianBuildContext context) {
+		
+		if (context instanceof ISBSv1BuildContext){
+			BuildArgumentsInfo info = ((ISBSv1BuildContext)context).getBuildArgumentsInfoCopy();
+			return info.getAbldBuildArgs();
+		}
+		
+		return null;
+	}
+
+	/**
+	 * @deprecated
+	 */
+	public void setAbldBuildArg(ISymbianBuildContext context, String arg) {
+		if (context instanceof ISBSv1BuildContext){
+			BuildArgumentsInfo info = ((ISBSv1BuildContext)context).getBuildArgumentsInfoCopy();
+			info.abldBuildArgs = arg;
+			((ISBSv1BuildContext)context).setBuildArgumentsInfo(info);
+		}
+	}
+
+}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildContext.java	Fri Aug 13 12:00:38 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildContext.java	Fri Aug 13 17:35:50 2010 -0500
@@ -52,7 +52,7 @@
 	
 	/**
 	 * Set the build arguments info for SBSv2 build arguments. This only sets values in memory, does
-	 * not write settings to disk. See 
+	 * not write settings to disk. 
 	 * @return IBuildArgumentsInfo instance, never null
 	 * @deprecated
 	 */