1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

1. IConfigurationElement get*Element() and set*Element(IConfigurationElement ) methods are deprecated for the IBuilder and ITool, and removed for the IInputType and the IOutputType

2. IBuilder.getBuildFileGenerator() method added
This commit is contained in:
Mikhail Sennikovsky 2005-05-27 11:54:55 +00:00
parent bc4f611eb1
commit 349c1e2627
11 changed files with 71 additions and 86 deletions

View file

@ -10,25 +10,25 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.managedbuilder.core.tests; package org.eclipse.cdt.managedbuilder.core.tests;
import org.eclipse.cdt.managedbuilder.core.IProjectType; import java.util.ArrayList;
import org.eclipse.cdt.managedbuilder.core.BuildException; import java.util.Arrays;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import java.util.List;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import java.util.ArrayList; import org.eclipse.cdt.managedbuilder.core.BuildException;
import java.util.Arrays; import org.eclipse.cdt.managedbuilder.core.IBuilder;
import java.util.List; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.Builder;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
@ -160,7 +160,7 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals(builder.getCommand(), expectedCommand); assertEquals(builder.getCommand(), expectedCommand);
assertEquals(builder.getArguments(), expectedArguments); assertEquals(builder.getArguments(), expectedArguments);
assertEquals(builder.getName(), expectedBuilderName[iconfig]); assertEquals(builder.getName(), expectedBuilderName[iconfig]);
IConfigurationElement element = builder.getBuildFileGeneratorElement(); IConfigurationElement element = ((Builder)builder).getBuildFileGeneratorElement();
if (element != null) { if (element != null) {
assertEquals(element.getAttribute(IBuilder.BUILDFILEGEN_ID), expectedBuilderInfo); assertEquals(element.getAttribute(IBuilder.BUILDFILEGEN_ID), expectedBuilderInfo);
} }

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.cdt.managedbuilder.macros.IFileContextBuildMacroValues; import org.eclipse.cdt.managedbuilder.macros.IFileContextBuildMacroValues;
import org.eclipse.cdt.managedbuilder.macros.IReservedMacroNameSupplier; import org.eclipse.cdt.managedbuilder.macros.IReservedMacroNameSupplier;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
/** /**
@ -53,9 +54,17 @@ public interface IBuilder extends IBuildObject {
* Returns the plugin.xml element of the buildFileGenerator extension or <code>null</code> if none. * Returns the plugin.xml element of the buildFileGenerator extension or <code>null</code> if none.
* *
* @return IConfigurationElement * @return IConfigurationElement
* @deprecated - use getBuildFileGenerator() instead
*/ */
public IConfigurationElement getBuildFileGeneratorElement(); public IConfigurationElement getBuildFileGeneratorElement();
/**
* Returns the BuildfileGenerator used to generate buildfiles for this builder
*
* @return IManagedBuilderMakefileGenerator
*/
IManagedBuilderMakefileGenerator getBuildFileGenerator();
/** /**
* Returns the name of the build/make utility for the configuration. * Returns the name of the build/make utility for the configuration.
* *
@ -138,6 +147,8 @@ public interface IBuilder extends IBuildObject {
* Sets the BuildFileGenerator plugin.xml element * Sets the BuildFileGenerator plugin.xml element
* *
* @param element * @param element
*
* @deprecated
*/ */
public void setBuildFileGeneratorElement(IConfigurationElement element); public void setBuildFileGeneratorElement(IConfigurationElement element);

View file

@ -11,9 +11,8 @@
package org.eclipse.cdt.managedbuilder.core; package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator; import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.content.IContentType;
/** /**
* This interface represents an inputType instance in the managed build system. * This interface represents an inputType instance in the managed build system.
@ -304,20 +303,6 @@ public interface IInputType extends IBuildObject {
*/ */
public void setPrimaryInput(boolean primary); public void setPrimaryInput(boolean primary);
/**
* Returns the plugin.xml element of the dependencyGenerator extension or <code>null</code> if none.
*
* @return IConfigurationElement
*/
public IConfigurationElement getDependencyGeneratorElement();
/**
* Sets the DependencyGenerator plugin.xml element
*
* @param element
*/
public void setDependencyGeneratorElement(IConfigurationElement element);
/** /**
* Returns a class instance that implements an interface to generate * Returns a class instance that implements an interface to generate
* source-level dependencies for this input type. * source-level dependencies for this input type.

View file

@ -10,7 +10,6 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.managedbuilder.core; package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.content.IContentType; import org.eclipse.core.runtime.content.IContentType;
/** /**
@ -219,24 +218,6 @@ public interface IOutputType extends IBuildObject {
*/ */
public void setNamePattern(String pattern); public void setNamePattern(String pattern);
/**
* Returns the plugin.xml element of the nameProvider extension or <code>null</code> if none.
* nameProvider specified the name of a class that implements the IManagedOutputNameProvider
* interface. When specified, the namePattern and outputNames are ignored.
* When multipleOfType is true, this attribute, or the outputNames attribute,
* is required in order for MBS to know the names of the output files.
*
* @return IConfigurationElement
*/
public IConfigurationElement getNameProviderElement();
/**
* Sets the nameProvider plugin.xml element
*
* @param element
*/
public void setNameProviderElement(IConfigurationElement element);
/** /**
* Returns the IManagedOutputNameProvider interface as specified by the nameProvider attribute. * Returns the IManagedOutputNameProvider interface as specified by the nameProvider attribute.
* *

View file

@ -563,6 +563,8 @@ public interface ITool extends IBuildObject {
* Returns the plugin.xml element of the commandLineGenerator extension or <code>null</code> if none. * Returns the plugin.xml element of the commandLineGenerator extension or <code>null</code> if none.
* *
* @return IConfigurationElement * @return IConfigurationElement
*
* @deprecated - use getCommandLineGenerator
*/ */
public IConfigurationElement getCommandLineGeneratorElement(); public IConfigurationElement getCommandLineGeneratorElement();
@ -570,6 +572,7 @@ public interface ITool extends IBuildObject {
* Sets the CommandLineGenerator plugin.xml element * Sets the CommandLineGenerator plugin.xml element
* *
* @param element * @param element
* @deprecated
*/ */
public void setCommandLineGeneratorElement(IConfigurationElement element); public void setCommandLineGeneratorElement(IConfigurationElement element);
@ -583,23 +586,15 @@ public interface ITool extends IBuildObject {
* Returns the plugin.xml element of the dependencyGenerator extension or <code>null</code> if none. * Returns the plugin.xml element of the dependencyGenerator extension or <code>null</code> if none.
* *
* @return IConfigurationElement * @return IConfigurationElement
* @deprecated - use getDependencyGeneratorElementForExtension or IInputType method * @deprecated - use getDependencyGeneratorForExtension or IInputType#getDependencyGenerator method
*/ */
public IConfigurationElement getDependencyGeneratorElement(); public IConfigurationElement getDependencyGeneratorElement();
/**
* Returns the plugin.xml element of the dependencyGenerator extension or <code>null</code> if none.
*
* @param sourceExt source file extension
* @return IConfigurationElement
*/
public IConfigurationElement getDependencyGeneratorElementForExtension(String sourceExt);
/** /**
* Sets the DependencyGenerator plugin.xml element * Sets the DependencyGenerator plugin.xml element
* *
* @param element * @param element
* @deprecated - use IInputType method * @deprecated
*/ */
public void setDependencyGeneratorElement(IConfigurationElement element); public void setDependencyGeneratorElement(IConfigurationElement element);

View file

@ -590,26 +590,11 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
* @return * @return
*/ */
public static IManagedBuilderMakefileGenerator getBuildfileGenerator(IConfiguration config) { public static IManagedBuilderMakefileGenerator getBuildfileGenerator(IConfiguration config) {
try {
IToolChain toolChain = config.getToolChain(); IToolChain toolChain = config.getToolChain();
if(toolChain != null){ if(toolChain != null){
IBuilder builder = toolChain.getBuilder(); IBuilder builder = toolChain.getBuilder();
IConfigurationElement element = builder.getBuildFileGeneratorElement(); if(builder != null)
if (element != null) { return builder.getBuildFileGenerator();
if (element.getName().equalsIgnoreCase("target")) { //$NON-NLS-1$
if (element.getAttribute(ManagedBuilderCorePlugin.MAKEGEN_ID) != null) {
return (IManagedBuilderMakefileGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.MAKEGEN_ID);
}
} else {
if (element.getAttribute(IBuilder.BUILDFILEGEN_ID) != null) {
return (IManagedBuilderMakefileGenerator) element.createExecutableExtension(IBuilder.BUILDFILEGEN_ID);
}
}
}
}
}
catch (CoreException e) {
// Probably not defined
} }
// If no generator is defined, return the default GNU generator // If no generator is defined, return the default GNU generator
return new GnuMakefileGenerator(); return new GnuMakefileGenerator();

View file

@ -20,9 +20,12 @@ import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IProjectType; import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.IToolChain; import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.internal.macros.FileContextBuildMacroValues; import org.eclipse.cdt.managedbuilder.internal.macros.FileContextBuildMacroValues;
import org.eclipse.cdt.managedbuilder.macros.IFileContextBuildMacroValues; import org.eclipse.cdt.managedbuilder.macros.IFileContextBuildMacroValues;
import org.eclipse.cdt.managedbuilder.macros.IReservedMacroNameSupplier; import org.eclipse.cdt.managedbuilder.macros.IReservedMacroNameSupplier;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@ -578,12 +581,37 @@ public class Builder extends BuildObject implements IBuilder {
public IConfigurationElement getBuildFileGeneratorElement() { public IConfigurationElement getBuildFileGeneratorElement() {
if (buildFileGeneratorElement == null) { if (buildFileGeneratorElement == null) {
if (superClass != null) { if (superClass != null) {
return superClass.getBuildFileGeneratorElement(); return ((Builder)superClass).getBuildFileGeneratorElement();
} }
} }
return buildFileGeneratorElement; return buildFileGeneratorElement;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IBuilder#getBuildFileGenerator()
*/
public IManagedBuilderMakefileGenerator getBuildFileGenerator(){
IConfigurationElement element = getBuildFileGeneratorElement();
if (element != null) {
try {
if (element.getName().equalsIgnoreCase("target")) { //$NON-NLS-1$
if (element.getAttribute(ManagedBuilderCorePlugin.MAKEGEN_ID) != null) {
return (IManagedBuilderMakefileGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.MAKEGEN_ID);
}
} else {
if (element.getAttribute(IBuilder.BUILDFILEGEN_ID) != null) {
return (IManagedBuilderMakefileGenerator) element.createExecutableExtension(IBuilder.BUILDFILEGEN_ID);
}
}
} catch (CoreException e) {
} catch (ClassCastException e) {
}
}
return new GnuMakefileGenerator();
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IBuilder#setBuildFileGeneratorElement(String) * @see org.eclipse.cdt.managedbuilder.core.IBuilder#setBuildFileGeneratorElement(String)
*/ */

View file

@ -854,7 +854,7 @@ public class InputType extends BuildObject implements IInputType {
public IConfigurationElement getDependencyGeneratorElement() { public IConfigurationElement getDependencyGeneratorElement() {
if (dependencyGeneratorElement == null) { if (dependencyGeneratorElement == null) {
if (superClass != null) { if (superClass != null) {
return superClass.getDependencyGeneratorElement(); return ((InputType)superClass).getDependencyGeneratorElement();
} }
} }
return dependencyGeneratorElement; return dependencyGeneratorElement;

View file

@ -522,7 +522,7 @@ public class OutputType extends BuildObject implements IOutputType {
public IConfigurationElement getNameProviderElement() { public IConfigurationElement getNameProviderElement() {
if (nameProviderElement == null) { if (nameProviderElement == null) {
if (superClass != null) { if (superClass != null) {
return superClass.getNameProviderElement(); return ((OutputType)superClass).getNameProviderElement();
} }
} }
return nameProviderElement; return nameProviderElement;

View file

@ -1032,7 +1032,7 @@ public class Target extends BuildObject implements ITarget {
builder.setArguments(getMakeArguments()); builder.setArguments(getMakeArguments());
IManagedConfigElement element = ManagedBuildManager.getConfigElement(this); IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
if (element instanceof DefaultManagedConfigElement) { if (element instanceof DefaultManagedConfigElement) {
builder.setBuildFileGeneratorElement(((DefaultManagedConfigElement)element).getConfigurationElement()); ((Builder)builder).setBuildFileGeneratorElement(((DefaultManagedConfigElement)element).getConfigurationElement());
} }
// Create the TargetPlatform // Create the TargetPlatform
subId = id + ".targetplatform"; //$NON-NLS-1$ subId = id + ".targetplatform"; //$NON-NLS-1$

View file

@ -1848,7 +1848,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
public IConfigurationElement getCommandLineGeneratorElement() { public IConfigurationElement getCommandLineGeneratorElement() {
if (commandLineGeneratorElement == null) { if (commandLineGeneratorElement == null) {
if (superClass != null) { if (superClass != null) {
return superClass.getCommandLineGeneratorElement(); return ((Tool)superClass).getCommandLineGeneratorElement();
} }
} }
return commandLineGeneratorElement; return commandLineGeneratorElement;
@ -1889,7 +1889,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
// First try the primary InputType // First try the primary InputType
IInputType type = getPrimaryInputType(); IInputType type = getPrimaryInputType();
if (type != null) { if (type != null) {
IConfigurationElement primary = type.getDependencyGeneratorElement(); IConfigurationElement primary = ((InputType)type).getDependencyGeneratorElement();
if (primary != null) return primary; if (primary != null) return primary;
} }
@ -1906,7 +1906,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
if (types != null) { if (types != null) {
for (int i=0; i<types.length; i++) { for (int i=0; i<types.length; i++) {
if (types[i].isSourceExtension(sourceExt)) { if (types[i].isSourceExtension(sourceExt)) {
return types[i].getDependencyGeneratorElement(); return ((InputType)types[i]).getDependencyGeneratorElement();
} }
} }
} }