Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Bug 69114 - [Managed Build] fails when starting build with old plugin

The patch contains a fix for Bug 69114.  The particular problem was that the manifest file contained an invalid id in an optionCategory “owner” attribute.  The patch contains a change to all appropriate resolveReferences methods to check for unresolved references and write out an error message.  For the optionCategory “owner” attribute, the “owner” is set to the Tool by default.

 

Leo Treggiari

 

Index: src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java,v
retrieving revision 1.32
diff -u -r1.32 ManagedBuildManager.java
--- src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java	15 Nov 2004 19:33:07 -0000	1.32
+++ src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java	22 Nov 2004 02:47:29 -0000
@@ -97,15 +97,18 @@
 
 	private static final QualifiedName buildInfoProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "managedBuildInfo");	//$NON-NLS-1$
 	private static final String ROOT_NODE_NAME = "ManagedProjectBuildInfo";	//$NON-NLS-1$
-	public static final String SETTINGS_FILE_NAME = ".cdtbuild";	//$NON-NLS-1$
+	public  static final String SETTINGS_FILE_NAME = ".cdtbuild";	//$NON-NLS-1$
 	private static final ITarget[] emptyTargets = new ITarget[0];
-	public static final String INTERFACE_IDENTITY = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".ManagedBuildManager";	//$NON-NLS-1$
-	public static final String EXTENSION_POINT_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".buildDefinitions";		//$NON-NLS-1$
-	public static final String EXTENSION_POINT_ID_V2 = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".ManagedBuildInfo";	//$NON-NLS-1$
+	public  static final String INTERFACE_IDENTITY = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".ManagedBuildManager";	//$NON-NLS-1$
+	public  static final String EXTENSION_POINT_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".buildDefinitions";		//$NON-NLS-1$
+	public  static final String EXTENSION_POINT_ID_V2 = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".ManagedBuildInfo";	//$NON-NLS-1$
 	private static final String REVISION_ELEMENT_NAME = "managedBuildRevision";	//$NON-NLS-1$
 	private static final String VERSION_ELEMENT_NAME = "fileVersion";	//$NON-NLS-1$
 	private static final String MANIFEST_VERSION_ERROR ="ManagedBuildManager.error.manifest.version.error";	//$NON-NLS-1$
 	private static final String PROJECT_VERSION_ERROR ="ManagedBuildManager.error.project.version.error";	//$NON-NLS-1$
+	private static final String MANIFEST_ERROR_HEADER = "ManagedBuildManager.error.manifest.header";	//$NON-NLS-1$
+	public  static final String MANIFEST_ERROR_RESOLVING = "ManagedBuildManager.error.manifest.resolving";	//$NON-NLS-1$
+	private static final String NEWLINE = System.getProperty("line.separator");	//$NON-NLS-1$
 	
 	// This is the version of the manifest and project files that
 	private static final PluginVersionIdentifier buildInfoVersion = new PluginVersionIdentifier(2, 1, 0);
@@ -1862,5 +1865,19 @@
 	 */
 	public static IManagedConfigElement getConfigElement(IBuildObject buildObj) {
 		return (IManagedConfigElement)getConfigElementMap().get(buildObj);
+	}
+	
+	public static void OutputResolveError(String attribute, String lookupId, String type, String id) {
+		String[] msgs = new String[4];
+		msgs[0] = attribute;
+		msgs[1] = lookupId;
+		msgs[2] = type;
+		msgs[3] = id;
+		ManagedBuildManager.OutputManifestError(
+			ManagedMakeMessages.getFormattedString(ManagedBuildManager.MANIFEST_ERROR_RESOLVING, msgs));
+	}
+	
+	public static void OutputManifestError(String message) {
+		System.err.println(ManagedMakeMessages.getResourceString(MANIFEST_ERROR_HEADER) + message + NEWLINE);
 	}
 }
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java,v
retrieving revision 1.2
diff -u -r1.2 Builder.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java	4 Nov 2004 16:56:27 -0000	1.2
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java	22 Nov 2004 02:47:29 -0000
@@ -523,7 +523,12 @@
 			if (superClassId != null && superClassId.length() > 0) {
 				superClass = ManagedBuildManager.getExtensionBuilder(superClassId);
 				if (superClass == null) {
-					// TODO:  Report error
+					// Report error
+					ManagedBuildManager.OutputResolveError(
+							"superClass",	//$NON-NLS-1$
+							superClassId,
+							"builder",	//$NON-NLS-1$
+							getId());
 				}
 			}
 		}
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java,v
retrieving revision 1.14
diff -u -r1.14 Option.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Option.java	4 Nov 2004 16:56:27 -0000	1.14
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Option.java	22 Nov 2004 02:47:31 -0000
@@ -1314,11 +1314,24 @@
 			if (superClassId != null && superClassId.length() > 0) {
 				superClass = ManagedBuildManager.getExtensionOption(superClassId);
 				if (superClass == null) {
-					// TODO:  Report error
+					// Report error
+					ManagedBuildManager.OutputResolveError(
+							"superClass",	//$NON-NLS-1$
+							superClassId,
+							"option",	//$NON-NLS-1$
+							getId());
 				}
 			}
 			if (categoryId != null) {
 				category = ((Tool)tool).getOptionCategory(categoryId);
+				if (category == null) {
+					// Report error
+					ManagedBuildManager.OutputResolveError(
+							"category",	//$NON-NLS-1$
+							categoryId,
+							"option",	//$NON-NLS-1$
+							getId());
+					}
 			}
 			// Process the value and default value attributes.  This is delayed until now
 			// because we may not know the valueType until after we have resolved the superClass above
Index: src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java,v
retrieving revision 1.7
diff -u -r1.7 OptionCategory.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java	28 Oct 2004 17:16:53 -0000	1.7
+++ src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java	22 Nov 2004 02:47:31 -0000
@@ -294,10 +294,20 @@
 	public void resolveReferences() {
 		if (!resolved) {
 			resolved = true;
-			if (ownerId != null)
+			if (ownerId != null) {
 				owner = tool.getOptionCategory(ownerId);
-			else
+				if (owner == null) {
+					// Report error
+					ManagedBuildManager.OutputResolveError(
+							"owner",	//$NON-NLS-1$
+							ownerId,
+							"optionCategory",	//$NON-NLS-1$
+							getId());
+				}
+			}
+			if (owner == null) {
 				owner = tool;
+			}
 			
 			// Hook me in
 			if (owner instanceof Tool)
Index: src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties,v
retrieving revision 1.20
diff -u -r1.20 PluginResources.properties
--- src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties	15 Nov 2004 19:33:07 -0000	1.20
+++ src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties	22 Nov 2004 02:47:31 -0000
@@ -39,6 +39,8 @@
 ManagedBuildManager.error.owner_not_project=addTarget: owner not project
 ManagedBuildManager.error.manifest_load_failed_title=Managed Build System Version Error
 ManagedBuildManager.error.manifest.version.error=The version number defined in the plugin manifest file\n{0}\nis greater than the version of the Managed Build System.\nThe definitions in the manifest file will not be loaded.
+ManagedBuildManager.error.manifest.header=Manifest file error: 
+ManagedBuildManager.error.manifest.resolving=Unable to resolve the {0} identifier {1} in the {2} {3}.
 ManagedBuildManager.error.open_failed_title=Managed Make Project File Error
 ManagedBuildManager.error.open_failed=The Managed Make project file could not be read because of the following error.\n\n{0}\n\nManaged Make functionality will not be available for this project.
 ManagedBuildManager.error.project.version.error=The version number of the project {0} is greater than the Managed Build System version number.
Index: src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java,v
retrieving revision 1.1
diff -u -r1.1 ProjectType.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java	28 Oct 2004 17:16:53 -0000	1.1
+++ src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java	22 Nov 2004 02:47:32 -0000
@@ -298,7 +298,12 @@
 			if (superClassId != null && superClassId.length() > 0) {
 				superClass = ManagedBuildManager.getExtensionProjectType(superClassId);
 				if (superClass == null) {
-					// TODO:  Report error
+					// Report error
+					ManagedBuildManager.OutputResolveError(
+							"superClass",	//$NON-NLS-1$
+							superClassId,
+							"projectType",	//$NON-NLS-1$
+							getId());
 				}
 			}
 			
Index: src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java,v
retrieving revision 1.1
diff -u -r1.1 TargetPlatform.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java	28 Oct 2004 17:16:53 -0000	1.1
+++ src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java	22 Nov 2004 02:47:32 -0000
@@ -522,7 +522,12 @@
 			if (superClassId != null && superClassId.length() > 0) {
 				superClass = ManagedBuildManager.getExtensionTargetPlatform(superClassId);
 				if (superClass == null) {
-					// TODO:  Report error
+					// Report error
+					ManagedBuildManager.OutputResolveError(
+							"superClass",	//$NON-NLS-1$
+							superClassId,
+							"targetPlatform",	//$NON-NLS-1$
+							getId());
 				}
 			}
 		}
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java,v
retrieving revision 1.20
diff -u -r1.20 Tool.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java	4 Nov 2004 16:56:27 -0000	1.20
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java	22 Nov 2004 02:47:34 -0000
@@ -1496,7 +1496,12 @@
 			if (superClassId != null && superClassId.length() > 0) {
 				superClass = ManagedBuildManager.getExtensionTool(superClassId);
 				if (superClass == null) {
-					// TODO:  Report error
+					// Report error
+					ManagedBuildManager.OutputResolveError(
+							"superClass",	//$NON-NLS-1$
+							superClassId,
+							"tool",	//$NON-NLS-1$
+							getId());
 				}
 			}
 			//  Call resolveReferences on our children
Index: src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java,v
retrieving revision 1.2
diff -u -r1.2 ToolChain.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java	4 Nov 2004 16:56:27 -0000	1.2
+++ src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java	22 Nov 2004 02:47:35 -0000
@@ -916,7 +916,12 @@
 			if (superClassId != null && superClassId.length() > 0) {
 				superClass = ManagedBuildManager.getExtensionToolChain(superClassId);
 				if (superClass == null) {
-					// TODO:  Report error
+					// Report error
+					ManagedBuildManager.OutputResolveError(
+							"superClass",	//$NON-NLS-1$
+							superClassId,
+							"toolChain",	//$NON-NLS-1$
+							getId());
 				}
 			}
 			//  Call resolveReferences on our children

Back to the top