Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorMikhail Sennikovsky2006-04-06 14:11:37 +0000
committerMikhail Sennikovsky2006-04-06 14:11:37 +0000
commit3bba0c47ad73fc88a30f85634dc42bb39f5d305f (patch)
tree4893cea37d077bf94dd8ad9a8c7617bfecdebc79 /build
parent8f100afd6ce737232888384980887c4369742169 (diff)
downloadorg.eclipse.cdt-3bba0c47ad73fc88a30f85634dc42bb39f5d305f.tar.gz
org.eclipse.cdt-3bba0c47ad73fc88a30f85634dc42bb39f5d305f.tar.xz
org.eclipse.cdt-3bba0c47ad73fc88a30f85634dc42bb39f5d305f.zip
The patch from Tim Kelly and Ken Ryall for the IManagedBuildDefinitionsStartup functionality see bug# 123275
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd30
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildDefinitionsStartup.java39
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java52
3 files changed, 119 insertions, 2 deletions
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 @@
<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>
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

Back to the top