1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22:11 +02:00

The patch from Tim Kelly and Ken Ryall for the IManagedBuildDefinitionsStartup functionality see bug# 123275

This commit is contained in:
Mikhail Sennikovsky 2006-04-06 14:11:37 +00:00
parent 8f100afd6c
commit 3bba0c47ad
4 changed files with 147 additions and 5 deletions

View file

@ -21,6 +21,7 @@
<element ref="builder" minOccurs="0" maxOccurs="unbounded"/>
<element ref="dynamicElementProvider" minOccurs="0" maxOccurs="unbounded"/>
<element ref="managedBuildRevision" minOccurs="0" maxOccurs="1"/>
<element ref="buildDefinitionStartup"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
@ -1600,6 +1601,33 @@ If this attribute is not specified, MBS will assume that there are no reserved m
</complexType>
</element>
<element name="buildDefinitionStartup">
<annotation>
<documentation>
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.
</documentation>
</annotation>
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
The class that implements the &lt;code&gt;IManagedBuildDefinitionsStartup&lt;/code&gt; interface. This class may not actually do anything, but additional initialization can be done here is desired.
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IManagedBuildDefinitionsStartup"/>
</appInfo>
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
A meaningful name for the type of element being provided.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="managedBuildRevision">
<annotation>
<documentation>
@ -1940,7 +1968,7 @@ The way the value is specified and treated depends on the value of the isRegex a
<meta.section type="copyright"/>
</appInfo>
<documentation>
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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt; Eclipse&lt;/a&gt; website.
</documentation>
</annotation>

View file

@ -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();
}

View file

@ -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

View file

@ -188,7 +188,9 @@ managed build system and how to extend it.</font></td>
<div class="indent"><a href="#_TocSectionDynamic_11">7.11 Defining an Option Value Handler</a></div>
<div class="indent"><a href="#_TocSectionDynamic_12">7.12 Defining an Option Applicability Calculator</a></div>
<div class="indent"><a href="#_TocSectionDynamic_13">7.13 Defining a Dynamic Element Provider</a></div>
<div class="indent"><a href="#_TocSectionDynamic_14">7.14 Adding Custom Pages to the New Project Wizard</a></div>
<div class="indent"><a href="#_TocSectionDynamic_14">7.14 Adding Custom Pages to the New Project Wizard</a><br>
<a href="#_TocSectionStartup_15">7.15 Defining Startup Behavior for Build Configuration Loading </a><br>
</div>
</div>
<div class="indent"><a href="#_TocSectionAdvanced">8 Advanced Features</a>
<div class="indent"><a href="#_TocSectionAdvanced_1">8.1 Converting CDT 2.0 Manifest Files</a></div>
@ -6519,9 +6521,32 @@ definitions must define a dynamicElementProvider element as described in
<p>This section will be provided in a future version of the document.&nbsp; For
now, refer to the Custom Project Wizard Pages design document in bugzilla
#90334.</p>
<p class="section"><a name="_TocSectionAdvanced"> Advanced Features</a></p>
<p class="subsection"><a name="_TocSectionAdvanced_1">8.1 Converting CDT 2.0 Manifest Files</p>
</a>
<p class="subsection"><a name="_TocSectionStartup_15"></a><a name="_TocSectionTutorial_18"> 7.15 Defining Startup Behavior for Configuration Loading</a></p>
<p>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 <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=123275">bug 123275</a>. </p>
<blockquote>
<p class="style1"> public interface IManagedBuildDefinitionsStartup {</p>
<blockquote>
<p class="style1">String BUILD_DEFINITION_STARTUP = &quot;buildDefinitionStartup&quot;; //$NON-NLS-1$<br>
String CLASS_ATTRIBUTE = &quot;class&quot;; //$NON-NLS-1$<br>
<br>
/**<br>
* Any work you want to do on build definitions after they have been loaded but before they have been resolved.<br>
*/<br>
void buildDefsLoaded();<br>
<br>
/**<br>
* Any work you want to do on build definitions after they have been resolved.<br>
*/<br>
void buildDefsResolved();</p>
</blockquote>
<p class="style1">} </p>
</blockquote>
<a name="_TocSectionTutorial_18">
<p>&nbsp;</p>
<p class="section"><a name="_TocSectionAdvanced"> Advanced Features</a></p>
<p class="subsection"><a name="_TocSectionAdvanced_1">8.1 Converting CDT 2.0 Manifest Files</p>
</a>
<p class="MsoNormal">The CDT 2.1 Managed Build System (MBS) defined a new object
model for tool integrators to use when integrating their tool definitions.&nbsp;
The CDT 3.0 model is upward compatible with the CDT 2.1 model with the exception