diff --git a/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd b/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd index 84f1fe6b168..5ff57f486be 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd +++ b/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd @@ -21,6 +21,7 @@ + @@ -1600,6 +1601,33 @@ If this attribute is not specified, MBS will assume that there are no reserved m + + + + An optional element that allows a tool implementor to supply a class that insures a plugin that modifies any build configruation attributes (e.g. the build config id) will get loaded before initial project information is created. + + + + + + + The class that implements the <code>IManagedBuildDefinitionsStartup</code> interface. This class may not actually do anything, but additional initialization can be done here is desired. + + + + + + + + + + A meaningful name for the type of element being provided. + + + + + + @@ -1940,7 +1968,7 @@ The way the value is specified and treated depends on the value of the isRegex a - Copyright (c) 2003, 2005 IBM Corporation and others. + Copyright (c) 2003, 2006 IBM Corporation 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 on the <a href="http://www.eclipse.org/legal/epl-v10.html"> Eclipse</a> website. diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildDefinitionsStartup.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildDefinitionsStartup.java new file mode 100644 index 00000000000..2219a4282ae --- /dev/null +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildDefinitionsStartup.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2006 Nokia Corporation 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 Corporation - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.managedbuilder.core; + +/** + * Clients that need to augment configuration attributes may need to insure + * that those modification are picked up when configruation elements are loaded. + * Implementing this interface will insure that a client's plugin is loaded + * before all available configurations are available to the first project that + * is loaded in the workbench. + * + * An example of this use is when a client creates unique build configuration IDs, + * derived from default configruations, and all existing projects need to know about + * all possible build configurations at eclipse startup. + */ +public interface IManagedBuildDefinitionsStartup { + + String BUILD_DEFINITION_STARTUP = "buildDefinitionStartup"; //$NON-NLS-1$ + String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ + + /** + * Any work you want to do on build definitions after they have been loaded but before they have been resolved. + */ + void buildDefsLoaded(); + + /** + * Any work you want to do on build definitions after they have been resolved. + */ + void buildDefsResolved(); +} + diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java index c64bc336e53..887ffff952b 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. + * Copyright (c) 2003, 2006 IBM Corporation 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 @@ -142,6 +142,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI // Project types defined in the manifest files public static SortedMap projectTypeMap; private static List projectTypes; + // Early configuration initialization extension elements + private static List startUpConfigElements; // Configurations defined in the manifest files private static Map extensionConfigurationMap; // Resource configurations defined in the manifest files @@ -1770,6 +1772,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI return; projectTypesLoading = true; + //The list of the IManagedBuildDefinitionsStartup callbacks + List buildDefStartupList = null; // Get the extensions that use the current CDT managed build model IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID); if( extensionPoint != null) { @@ -1824,6 +1828,27 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI loadConfigElements(DefaultManagedConfigElement.convertArray(elements, extension), revision); } } + + // Call the start up config extensions. These may rely on the standard elements + // having already been loaded so we wait to call them from here. + if (startUpConfigElements != null) { + buildDefStartupList = new ArrayList(startUpConfigElements.size()); + + for (Iterator iter = startUpConfigElements.iterator(); iter.hasNext();) { + IManagedBuildDefinitionsStartup customConfigLoader; + try { + customConfigLoader = createStartUpConfigLoader((DefaultManagedConfigElement)iter.next()); + + //need to save the startup for the future notifications + buildDefStartupList.add(customConfigLoader); + + // Now we can perform any actions on the build configurations + // in an extended plugin before the build configurations have been resolved + customConfigLoader.buildDefsLoaded(); + } catch (CoreException e) {} + } + } + // Then call resolve. // // Here are notes on "references" within the managed build system. @@ -2035,6 +2060,17 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI } } + // configs resolved... + // Call the start up config extensions again now that configs have been resolved. + if (buildDefStartupList != null) { + for (Iterator iter = buildDefStartupList.iterator(); iter.hasNext();) { + IManagedBuildDefinitionsStartup customConfigLoader = (IManagedBuildDefinitionsStartup)iter.next(); + + // Now we can perform any actions on the build configurations + // in an extended plugin now that all build configruations have been resolved + customConfigLoader.buildDefsResolved(); + } + } performAdjustments(); projectTypesLoading = false; projectTypesLoaded = true; @@ -2118,6 +2154,14 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI providedConfigs = provider.getConfigElements(); loadConfigElements(providedConfigs, revision); // This must use the current build model } + } else if (element.getName().equals(IManagedBuildDefinitionsStartup.BUILD_DEFINITION_STARTUP)) { + if (element instanceof DefaultManagedConfigElement) { + // Cache up early configuration extension elements so was can call them after + // other configuration elements have loaded. + if (startUpConfigElements == null) + startUpConfigElements = new ArrayList(); + startUpConfigElements.add(element); + } } else { // TODO: Report an error (log?) } @@ -2192,6 +2236,12 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI } + private static IManagedBuildDefinitionsStartup createStartUpConfigLoader( + DefaultManagedConfigElement element) throws CoreException { + + return (IManagedBuildDefinitionsStartup)element.getConfigurationElement().createExecutableExtension(IManagedBuildDefinitionsStartup.CLASS_ATTRIBUTE); + } + /** * @param project * @return diff --git a/doc/org.eclipse.cdt.doc.isv/guide/mbs/extensibilityGuide/Managed_Build_Extensibility.html b/doc/org.eclipse.cdt.doc.isv/guide/mbs/extensibilityGuide/Managed_Build_Extensibility.html index d5d21108b6d..ec1a8f1ae27 100644 --- a/doc/org.eclipse.cdt.doc.isv/guide/mbs/extensibilityGuide/Managed_Build_Extensibility.html +++ b/doc/org.eclipse.cdt.doc.isv/guide/mbs/extensibilityGuide/Managed_Build_Extensibility.html @@ -188,7 +188,9 @@ managed build system and how to extend it. - +
8 Advanced Features @@ -6519,9 +6521,32 @@ definitions must define a dynamicElementProvider element as described in

This section will be provided in a future version of the document.  For now, refer to the Custom Project Wizard Pages design document in bugzilla #90334.

-

Advanced Features

-

8.1 Converting CDT 2.0 Manifest Files

+

7.15 Defining Startup Behavior for Configuration Loading

+

Tool integrators may require that a plugin contain all the build configurations before projects are loaded. Use of this interface insures that a plugin will have access to build configurations before project inforamation is loaded in the workbench. Two methods can be used to access configuration information just after build definitions have been loaded and then again after the build definitions have been resolved. Added as enhancement to bug 123275.

+
+

public interface IManagedBuildDefinitionsStartup {

+
+

String BUILD_DEFINITION_STARTUP = "buildDefinitionStartup"; //$NON-NLS-1$
+ String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+
+ /**
+ * Any work you want to do on build definitions after they have been loaded but before they have been resolved.
+ */
+ void buildDefsLoaded();
+
+ /**
+ * Any work you want to do on build definitions after they have been resolved.
+ */
+ void buildDefsResolved();

+
+

}

+
+ +

 

+

Advanced Features

+

8.1 Converting CDT 2.0 Manifest Files

+

The CDT 2.1 Managed Build System (MBS) defined a new object model for tool integrators to use when integrating their tool definitions.  The CDT 3.0 model is upward compatible with the CDT 2.1 model with the exception