diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java index 170d3ba1274..db97e1548a0 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java @@ -1,494 +1,503 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.core; - -import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier; -import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; - -/** - * A tool-integrator defines default configurations as children of the project type. - * These provide a template for the configurations added to the user's project, - * which are stored in the project's .cdtbuild file. - *
- * The configuration contains one child of type tool-chain. This describes how the
- * project's resources are transformed into the build artifact. The configuration can
- * contain one or more children of type resourceConfiguration. These describe build
- * settings of individual resources that are different from the configuration as a whole.
- *
- * @since 2.1
- */
-public interface IConfiguration extends IBuildObject {
- public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$
- public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$
- public static final String PREBUILD_STEP = "prebuildStep"; //$NON-NLS-1$
- public static final String POSTBUILD_STEP = "postbuildStep"; //$NON-NLS-1$
- public static final String PREANNOUNCEBUILD_STEP = "preannouncebuildStep"; //$NON-NLS-1$
- public static final String POSTANNOUNCEBUILD_STEP = "postannouncebuildStep"; //$NON-NLS-1$
- // Schema element names
- public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
- public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
- public static final String EXTENSION = "artifactExtension"; //$NON-NLS-1$
- public static final String PARENT = "parent"; //$NON-NLS-1$
-
- public static final String DESCRIPTION = "description"; //$NON-NLS-1$
-
-
-
- /**
- * Returns the description of the configuration.
- *
- * @return String
- */
- public String getDescription();
-
- /**
- * Sets the description of the receiver to the value specified in the argument
- *
- * @param description
- */
- public void setDescription(String description);
-
- /**
- * Creates a child resource configuration corresponding to the passed in file.
- *
- * @param file
- * @return IResourceConfiguration
- */
- public IResourceConfiguration createResourceConfiguration(IFile file);
-
- /**
- * Creates the IToolChain
child of this configuration.
- *
- * @param ToolChain The superClass, if any
- * @param String The id for the new tool chain
- * @param String The name for the new tool chain
- *
- * @return IToolChain
- */
- public IToolChain createToolChain(IToolChain superClass, String Id, String name, boolean isExtensionElement);
-
- /**
- * Returns the extension that should be applied to build artifacts created by
- * this configuration.
- *
- * @return String
- */
- public String getArtifactExtension();
-
- /**
- * Returns the name of the final build artifact.
- *
- * @return String
- */
- public String getArtifactName();
-
- /**
- * Returns the build arguments from this configuration's builder
- *
- * @return String
- */
- public String getBuildArguments();
-
- /**
- * Returns the build command from this configuration's builder
- *
- * @return String
- */
- public String getBuildCommand();
-
- /**
- * Returns the prebuild step command
- *
- * @return String
- */
- public String getPrebuildStep();
-
- /**
- * Returns the postbuild step command
- *
- * @return String
- */
- public String getPostbuildStep();
-
- /**
- * Returns the display string associated with the prebuild step
- *
- * @return String
- */
- public String getPreannouncebuildStep();
-
- /**
- * Returns the display string associated with the postbuild step
- *
- * @return String
- */
- public String getPostannouncebuildStep();
-
- /**
- * Answers the OS-specific command to remove files created by the build
- * of this configuration.
- *
- * @return String
- */
- public String getCleanCommand();
-
- /**
- * Answers the semicolon separated list of unique IDs of the error parsers associated
- * with this configuration.
- *
- * @return String
- */
- public String getErrorParserIds();
-
- /**
- * Answers the ordered list of unique IDs of the error parsers associated
- * with this configuration.
- *
- * @return String[]
- */
- public String[] getErrorParserList();
-
- /**
- * Projects have C or CC natures. Tools can specify a filter so they are not
- * misapplied to a project. This method allows the caller to retrieve a list
- * of tools from a project that are correct for a project's nature.
- *
- * @return an array of ITools
that have compatible filters
- * for this configuration.
- */
- ITool[] getFilteredTools();
-
- /**
- * Returns the managed-project parent of this configuration, if this is a
- * project configuration. Otherwise, returns null
.
- *
- * @return IManagedProject
- */
- public IManagedProject getManagedProject();
-
- /**
- * Returns the Eclipse project that owns the configuration.
- *
- * @return IResource
- */
- public IResource getOwner();
-
- /**
- * Returns the configuration that this configuration is based on.
- *
- * @return IConfiguration
- */
- public IConfiguration getParent();
-
- /**
- * Returns the project-type parent of this configuration, if this is an
- * extension configuration. Otherwise, returns null
.
- *
- * @return IProjectType
- */
- public IProjectType getProjectType();
-
- /**
- * Returns the resource configuration child of this configuration
- * that is associated with the project resource, or null
if none.
- *
- * @return IResourceConfiguration
- */
- public IResourceConfiguration getResourceConfiguration(String path);
-
- /**
- * Returns the resource configuration children of this configuration.
- *
- * @return IResourceConfigurations[]
- */
- public IResourceConfiguration[] getResourceConfigurations();
-
- /**
- * Returns the ITool
in this configuration's tool-chain with
- * the same id as the argument, or null
.
- *
- * @param id unique identifier to search for
- * @return ITool
- */
- public ITool getTool(String id);
-
- /**
- * Returns the ITool
in this configuration's tool-chain with
- * the specified ID, or the tool(s) with a superclass with this id.
- *
- *
If the tool-chain does not have a tool with that ID, the method
- * returns an empty array. It is the responsibility of the caller to
- * verify the return value.
- *
- * @param id unique identifier of the tool to search for
- * @return ITool[]
- * @since 3.0.2
- */
- public ITool[] getToolsBySuperClassId(String id);
-
- /**
- * Returns the IToolChain
child of this configuration.
- *
- * @return IToolChain
- */
- public IToolChain getToolChain();
-
- /**
- * Returns the command-line invocation command for the specified tool.
- *
- * @param tool The tool that will have its command retrieved.
- * @return String The command
- */
- public String getToolCommand(ITool tool);
-
- /**
- * Returns the tools that are used in this configuration's tool-chain.
- *
- * @return ITool[]
- */
- public ITool[] getTools();
-
- /**
- * Returns the tool in this configuration that creates the build artifact.
- *
- * @return ITool
- */
- public ITool getTargetTool();
-
- /**
- * Returns true
if this configuration has overridden the default build
- * build command in this configuration, otherwise false
.
- *
- * @return boolean
- */
- public boolean hasOverriddenBuildCommand();
-
- /**
- * Returns true
if this configuration has changes that need to
- * be saved in the project file, else false
.
- * Should not be called for an extension configuration.
- *
- * @return boolean
- */
- public boolean isDirty();
-
- /**
- * Returns true
if this configuration was loaded from a manifest file,
- * and false
if it was loaded from a project (.cdtbuild) file.
- *
- * @return boolean
- */
- public boolean isExtensionElement();
-
- /**
- * Returns whether this configuration has been changed and requires the
- * project to be rebuilt.
- *
- * @return true
if the configuration contains a change
- * that needs the project to be rebuilt.
- * Should not be called for an extension configuration.
- */
- public boolean needsRebuild();
-
- /**
- * Removes a resource configuration from the configuration's list.
- *
- * @param option
- */
- public void removeResourceConfiguration(IResourceConfiguration resConfig);
-
- /**
- * Set (override) the extension that should be appended to the build artifact
- * for the receiver.
- *
- * @param extension
- */
- public void setArtifactExtension(String extension);
-
- /**
- * Set the name of the artifact that will be produced when the receiver
- * is built.
- *
- * @param name
- */
- public void setArtifactName(String name);
-
- /**
- * Sets the arguments to be passed to the build utility used by the
- * receiver to produce a build goal.
- *
- * @param makeArgs
- */
- public void setBuildArguments(String makeArgs);
-
- /**
- * Sets the build command for the receiver to the value in the argument.
- *
- * @param command
- */
- public void setBuildCommand(String command);
-
- /**
- * Sets the prebuild step for the receiver to the value in the argument.
- *
- * @param step
- */
- public void setPrebuildStep(String step);
-
- /**
- * Sets the postbuild step for the receiver to the value in the argument.
- *
- * @param step
- */
- public void setPostbuildStep(String step);
-
- /**
- * Sets the prebuild step display string for the receiver to the value in the argument.
- *
- * @param announceStep
- */
- public void setPreannouncebuildStep(String announceStep);
-
- /**
- * Sets the postbuild step display string for the receiver to the value in the argument.
- *
- * @param announceStep
- */
- public void setPostannouncebuildStep(String announceStep);
-
- /**
- * Sets the command used to clean the outputs of this configuration.
- *
- * @param name
- */
- public void setCleanCommand(String command);
-
- /**
- * Sets the element's "dirty" (have I been modified?) flag.
- *
- * @param isDirty
- */
- public void setDirty(boolean isDirty);
-
- /**
- * Sets the semicolon separated list of error parser ids
- *
- * @param ids
- */
- public void setErrorParserIds(String ids);
-
- /**
- * Sets the name of the receiver to the value specified in the argument
- *
- * @param name
- */
- public void setName(String name);
-
- /**
- * Sets the value of a boolean option for this configuration.
- *
- * @param parent The holder/parent of the option.
- * @param option The option to change.
- * @param value The value to apply to the option.
- *
- * @return IOption The modified option. This can be the same option or a newly created option.
- *
- * @throws BuildException
- *
- * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
- * Code assuming ITool as type, will continue to work unchanged.
- */
- public IOption setOption(IHoldsOptions parent, IOption option, boolean value)
- throws BuildException;
-
- /**
- * Sets the value of a string option for this configuration.
- *
- * @param parent The holder/parent of the option.
- * @param option The option that will be effected by change.
- * @param value The value to apply to the option.
- *
- * @return IOption The modified option. This can be the same option or a newly created option.
- *
- * @throws BuildException
- *
- * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
- * Code assuming ITool as type, will continue to work unchanged.
- */
- public IOption setOption(IHoldsOptions parent, IOption option, String value)
- throws BuildException;
-
- /**
- * Sets the value of a list option for this configuration.
- *
- * @param parent The holder/parent of the option.
- * @param option The option to change.
- * @param value The values to apply to the option.
- *
- * @return IOption The modified option. This can be the same option or a newly created option.
- *
- * @throws BuildException
- *
- * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
- * Code assuming ITool as type, will continue to work unchanged.
- */
- public IOption setOption(IHoldsOptions parent, IOption option, String[] value)
- throws BuildException;
-
- /**
- * Sets the rebuild state in this configuration.
- *
- * @param rebuild true
will force a rebuild the next time the project builds
- * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setRebuildState(boolean)
- */
- void setRebuildState(boolean rebuild);
-
- /**
- * Overrides the tool command for a tool defined in this configuration's tool-chain.
- *
- * @param tool The tool that will have its command modified.
- * @param command The command
- */
- public void setToolCommand(ITool tool, String command);
-
- /**
- * Returns true
if the configuration's tool-chain is supported on the system
- * otherwise returns false
- *
- * @return boolean
- */
- public boolean isSupported();
-
- /**
- * Returns the implementation of the IConfigurationEnvironmentVariableSupplier provided
- * by the tool-integrator or null
if none.
- *
- * @return IConfigurationEnvironmentVariableSupplier
- */
- public IConfigurationEnvironmentVariableSupplier getEnvironmentVariableSupplier();
-
- /**
- * Returns the tool-integrator provided implementation of the configuration build macro supplier
- * or null
if none.
- *
- * @return IConfigurationBuildMacroSupplier
- */
- public IConfigurationBuildMacroSupplier getBuildMacroSupplier();
-
- /**
- * answers true if the configuration is temporary, otherwise - false
- * @return boolean
- */
- public boolean isTemporary();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2003, 2005 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+
+/**
+ * A tool-integrator defines default configurations as children of the project type.
+ * These provide a template for the configurations added to the user's project,
+ * which are stored in the project's .cdtbuild file.
+ *
+ * The configuration contains one child of type tool-chain. This describes how the
+ * project's resources are transformed into the build artifact. The configuration can
+ * contain one or more children of type resourceConfiguration. These describe build
+ * settings of individual resources that are different from the configuration as a whole.
+ *
+ * @since 2.1
+ */
+public interface IConfiguration extends IBuildObject {
+ public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$
+ public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$
+ public static final String PREBUILD_STEP = "prebuildStep"; //$NON-NLS-1$
+ public static final String POSTBUILD_STEP = "postbuildStep"; //$NON-NLS-1$
+ public static final String PREANNOUNCEBUILD_STEP = "preannouncebuildStep"; //$NON-NLS-1$
+ public static final String POSTANNOUNCEBUILD_STEP = "postannouncebuildStep"; //$NON-NLS-1$
+ // Schema element names
+ public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
+ public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
+ public static final String EXTENSION = "artifactExtension"; //$NON-NLS-1$
+ public static final String PARENT = "parent"; //$NON-NLS-1$
+
+ public static final String DESCRIPTION = "description"; //$NON-NLS-1$
+
+
+
+ /**
+ * Returns the description of the configuration.
+ *
+ * @return String
+ */
+ public String getDescription();
+
+ /**
+ * Sets the description of the receiver to the value specified in the argument
+ *
+ * @param description
+ */
+ public void setDescription(String description);
+
+ /**
+ * Creates a child resource configuration corresponding to the passed in file.
+ *
+ * @param file
+ * @return IResourceConfiguration
+ */
+ public IResourceConfiguration createResourceConfiguration(IFile file);
+
+ /**
+ * Creates the IToolChain
child of this configuration.
+ *
+ * @param ToolChain The superClass, if any
+ * @param String The id for the new tool chain
+ * @param String The name for the new tool chain
+ *
+ * @return IToolChain
+ */
+ public IToolChain createToolChain(IToolChain superClass, String Id, String name, boolean isExtensionElement);
+
+ /**
+ * Returns the extension that should be applied to build artifacts created by
+ * this configuration.
+ *
+ * @return String
+ */
+ public String getArtifactExtension();
+
+ /**
+ * Returns the name of the final build artifact.
+ *
+ * @return String
+ */
+ public String getArtifactName();
+
+ /**
+ * Returns the build arguments from this configuration's builder
+ *
+ * @return String
+ */
+ public String getBuildArguments();
+
+ /**
+ * Returns the build command from this configuration's builder
+ *
+ * @return String
+ */
+ public String getBuildCommand();
+
+ /**
+ * Returns the prebuild step command
+ *
+ * @return String
+ */
+ public String getPrebuildStep();
+
+ /**
+ * Returns the postbuild step command
+ *
+ * @return String
+ */
+ public String getPostbuildStep();
+
+ /**
+ * Returns the display string associated with the prebuild step
+ *
+ * @return String
+ */
+ public String getPreannouncebuildStep();
+
+ /**
+ * Returns the display string associated with the postbuild step
+ *
+ * @return String
+ */
+ public String getPostannouncebuildStep();
+
+ /**
+ * Answers the OS-specific command to remove files created by the build
+ * of this configuration.
+ *
+ * @return String
+ */
+ public String getCleanCommand();
+
+ /**
+ * Answers the semicolon separated list of unique IDs of the error parsers associated
+ * with this configuration.
+ *
+ * @return String
+ */
+ public String getErrorParserIds();
+
+ /**
+ * Answers the ordered list of unique IDs of the error parsers associated
+ * with this configuration.
+ *
+ * @return String[]
+ */
+ public String[] getErrorParserList();
+
+ /**
+ * Projects have C or CC natures. Tools can specify a filter so they are not
+ * misapplied to a project. This method allows the caller to retrieve a list
+ * of tools from a project that are correct for a project's nature.
+ *
+ * @return an array of ITools
that have compatible filters
+ * for this configuration.
+ */
+ ITool[] getFilteredTools();
+
+ /**
+ * Returns the managed-project parent of this configuration, if this is a
+ * project configuration. Otherwise, returns null
.
+ *
+ * @return IManagedProject
+ */
+ public IManagedProject getManagedProject();
+
+ /**
+ * Returns the Eclipse project that owns the configuration.
+ *
+ * @return IResource
+ */
+ public IResource getOwner();
+
+ /**
+ * Returns the configuration that this configuration is based on.
+ *
+ * @return IConfiguration
+ */
+ public IConfiguration getParent();
+
+ /**
+ * Returns the project-type parent of this configuration, if this is an
+ * extension configuration. Otherwise, returns null
.
+ *
+ * @return IProjectType
+ */
+ public IProjectType getProjectType();
+
+ /**
+ * Returns the resource configuration child of this configuration
+ * that is associated with the project resource, or null
if none.
+ *
+ * @return IResourceConfiguration
+ */
+ public IResourceConfiguration getResourceConfiguration(String path);
+
+ /**
+ * Returns the resource configuration children of this configuration.
+ *
+ * @return IResourceConfigurations[]
+ */
+ public IResourceConfiguration[] getResourceConfigurations();
+
+ /**
+ * Returns the ITool
in this configuration's tool-chain with
+ * the same id as the argument, or null
.
+ *
+ * @param id unique identifier to search for
+ * @return ITool
+ */
+ public ITool getTool(String id);
+
+ /**
+ * Returns the ITool
in this configuration's tool-chain with
+ * the specified ID, or the tool(s) with a superclass with this id.
+ *
+ *
If the tool-chain does not have a tool with that ID, the method
+ * returns an empty array. It is the responsibility of the caller to
+ * verify the return value.
+ *
+ * @param id unique identifier of the tool to search for
+ * @return ITool[]
+ * @since 3.0.2
+ */
+ public ITool[] getToolsBySuperClassId(String id);
+
+ /**
+ * Returns the IToolChain
child of this configuration.
+ *
+ * @return IToolChain
+ */
+ public IToolChain getToolChain();
+
+ /**
+ * Returns the command-line invocation command for the specified tool.
+ *
+ * @param tool The tool that will have its command retrieved.
+ * @return String The command
+ */
+ public String getToolCommand(ITool tool);
+
+ /**
+ * Returns the tools that are used in this configuration's tool-chain.
+ *
+ * @return ITool[]
+ */
+ public ITool[] getTools();
+
+ /**
+ * Returns the tool in this configuration that creates the build artifact.
+ *
+ * @return ITool
+ */
+ public ITool getTargetTool();
+
+ /**
+ * Returns true
if this configuration has overridden the default build
+ * build command in this configuration, otherwise false
.
+ *
+ * @return boolean
+ */
+ public boolean hasOverriddenBuildCommand();
+
+ /**
+ * Returns true
if the extension matches one of the special
+ * file extensions the tools for the configuration consider to be a header file.
+ *
+ * @param ext the file extension of the resource
+ * @return boolean
+ */
+ public boolean isHeaderFile(String ext);
+
+ /**
+ * Returns true
if this configuration has changes that need to
+ * be saved in the project file, else false
.
+ * Should not be called for an extension configuration.
+ *
+ * @return boolean
+ */
+ public boolean isDirty();
+
+ /**
+ * Returns true
if this configuration was loaded from a manifest file,
+ * and false
if it was loaded from a project (.cdtbuild) file.
+ *
+ * @return boolean
+ */
+ public boolean isExtensionElement();
+
+ /**
+ * Returns whether this configuration has been changed and requires the
+ * project to be rebuilt.
+ *
+ * @return true
if the configuration contains a change
+ * that needs the project to be rebuilt.
+ * Should not be called for an extension configuration.
+ */
+ public boolean needsRebuild();
+
+ /**
+ * Removes a resource configuration from the configuration's list.
+ *
+ * @param option
+ */
+ public void removeResourceConfiguration(IResourceConfiguration resConfig);
+
+ /**
+ * Set (override) the extension that should be appended to the build artifact
+ * for the receiver.
+ *
+ * @param extension
+ */
+ public void setArtifactExtension(String extension);
+
+ /**
+ * Set the name of the artifact that will be produced when the receiver
+ * is built.
+ *
+ * @param name
+ */
+ public void setArtifactName(String name);
+
+ /**
+ * Sets the arguments to be passed to the build utility used by the
+ * receiver to produce a build goal.
+ *
+ * @param makeArgs
+ */
+ public void setBuildArguments(String makeArgs);
+
+ /**
+ * Sets the build command for the receiver to the value in the argument.
+ *
+ * @param command
+ */
+ public void setBuildCommand(String command);
+
+ /**
+ * Sets the prebuild step for the receiver to the value in the argument.
+ *
+ * @param step
+ */
+ public void setPrebuildStep(String step);
+
+ /**
+ * Sets the postbuild step for the receiver to the value in the argument.
+ *
+ * @param step
+ */
+ public void setPostbuildStep(String step);
+
+ /**
+ * Sets the prebuild step display string for the receiver to the value in the argument.
+ *
+ * @param announceStep
+ */
+ public void setPreannouncebuildStep(String announceStep);
+
+ /**
+ * Sets the postbuild step display string for the receiver to the value in the argument.
+ *
+ * @param announceStep
+ */
+ public void setPostannouncebuildStep(String announceStep);
+
+ /**
+ * Sets the command used to clean the outputs of this configuration.
+ *
+ * @param name
+ */
+ public void setCleanCommand(String command);
+
+ /**
+ * Sets the element's "dirty" (have I been modified?) flag.
+ *
+ * @param isDirty
+ */
+ public void setDirty(boolean isDirty);
+
+ /**
+ * Sets the semicolon separated list of error parser ids
+ *
+ * @param ids
+ */
+ public void setErrorParserIds(String ids);
+
+ /**
+ * Sets the name of the receiver to the value specified in the argument
+ *
+ * @param name
+ */
+ public void setName(String name);
+
+ /**
+ * Sets the value of a boolean option for this configuration.
+ *
+ * @param parent The holder/parent of the option.
+ * @param option The option to change.
+ * @param value The value to apply to the option.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ *
+ * @throws BuildException
+ *
+ * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
+ * Code assuming ITool as type, will continue to work unchanged.
+ */
+ public IOption setOption(IHoldsOptions parent, IOption option, boolean value)
+ throws BuildException;
+
+ /**
+ * Sets the value of a string option for this configuration.
+ *
+ * @param parent The holder/parent of the option.
+ * @param option The option that will be effected by change.
+ * @param value The value to apply to the option.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ *
+ * @throws BuildException
+ *
+ * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
+ * Code assuming ITool as type, will continue to work unchanged.
+ */
+ public IOption setOption(IHoldsOptions parent, IOption option, String value)
+ throws BuildException;
+
+ /**
+ * Sets the value of a list option for this configuration.
+ *
+ * @param parent The holder/parent of the option.
+ * @param option The option to change.
+ * @param value The values to apply to the option.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ *
+ * @throws BuildException
+ *
+ * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
+ * Code assuming ITool as type, will continue to work unchanged.
+ */
+ public IOption setOption(IHoldsOptions parent, IOption option, String[] value)
+ throws BuildException;
+
+ /**
+ * Sets the rebuild state in this configuration.
+ *
+ * @param rebuild true
will force a rebuild the next time the project builds
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setRebuildState(boolean)
+ */
+ void setRebuildState(boolean rebuild);
+
+ /**
+ * Overrides the tool command for a tool defined in this configuration's tool-chain.
+ *
+ * @param tool The tool that will have its command modified.
+ * @param command The command
+ */
+ public void setToolCommand(ITool tool, String command);
+
+ /**
+ * Returns true
if the configuration's tool-chain is supported on the system
+ * otherwise returns false
+ *
+ * @return boolean
+ */
+ public boolean isSupported();
+
+ /**
+ * Returns the implementation of the IConfigurationEnvironmentVariableSupplier provided
+ * by the tool-integrator or null
if none.
+ *
+ * @return IConfigurationEnvironmentVariableSupplier
+ */
+ public IConfigurationEnvironmentVariableSupplier getEnvironmentVariableSupplier();
+
+ /**
+ * Returns the tool-integrator provided implementation of the configuration build macro supplier
+ * or null
if none.
+ *
+ * @return IConfigurationBuildMacroSupplier
+ */
+ public IConfigurationBuildMacroSupplier getBuildMacroSupplier();
+
+ /**
+ * answers true if the configuration is temporary, otherwise - false
+ * @return boolean
+ */
+ public boolean isTemporary();
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
index 164b5639fe3..e91f41fd4ba 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
@@ -1213,6 +1213,46 @@ public class Configuration extends BuildObject implements IConfiguration {
return toolChain.isSupported();
return false;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isHeaderFile(java.lang.String)
+ */
+ public boolean isHeaderFile(String ext) {
+ // Check to see if there is a rule to build a file with this extension
+ IManagedProject manProj = getManagedProject();
+ IProject project = null;
+ if (manProj != null) {
+ project = (IProject)manProj.getOwner();
+ }
+ ITool[] tools = getFilteredTools();
+ for (int index = 0; index < tools.length; index++) {
+ ITool tool = tools[index];
+ try {
+ if (project != null) {
+ // Make sure the tool is right for the project
+ switch (tool.getNatureFilter()) {
+ case ITool.FILTER_C:
+ if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ return tool.isHeaderFile(ext);
+ }
+ break;
+ case ITool.FILTER_CC:
+ if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ return tool.isHeaderFile(ext);
+ }
+ break;
+ case ITool.FILTER_BOTH:
+ return tool.isHeaderFile(ext);
+ }
+ } else {
+ return tool.isHeaderFile(ext);
+ }
+ } catch (CoreException e) {
+ continue;
+ }
+ }
+ return false;
+ }
/*
* O B J E C T S T A T E M A I N T E N A N C E
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
index d454572a0c5..0917f79dcdc 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
@@ -861,34 +861,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isHeaderFile(java.lang.String)
*/
public boolean isHeaderFile(String ext) {
- IProject project = (IProject)owner;
-
// Check to see if there is a rule to build a file with this extension
IConfiguration config = getDefaultConfiguration();
- ITool[] tools = config.getFilteredTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- try {
- // Make sure the tool is right for the project
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.isHeaderFile(ext);
- }
- break;
- case ITool.FILTER_CC:
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return tool.isHeaderFile(ext);
- }
- break;
- case ITool.FILTER_BOTH:
- return tool.isHeaderFile(ext);
- }
- } catch (CoreException e) {
- continue;
- }
- }
- return false;
+ return config.isHeaderFile(ext);
}
/**
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java
index 2c259de6052..f6a7494bf31 100755
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java
@@ -16,11 +16,10 @@ import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyPreBuild;
import org.eclipse.core.runtime.IPath;
/**
- * This dependency calculator uses the GCC -MMD -MF -MP -MQ options in order to
+ * This dependency calculator uses the GCC -MMD -MF -MP -MT options in order to
* generate .d files as a side effect of compilation.
* See bugzilla 108715 for the discussion of dependency management that led to
* the creation of this dependency calculator. Note also that this technique
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2Commands.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2Commands.java
index 9e86b5885a7..9bfdb088f23 100755
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2Commands.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2Commands.java
@@ -23,7 +23,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.resources.IProject;;
/**
- * This dependency calculator uses the GCC -MMD -MF -MP -MQ options in order to
+ * This dependency calculator uses the GCC -MMD -MF -MP -MT options in order to
* generate .d files as a side effect of compilation.
* See bugzilla 108715 for the discussion of dependency management that led to
* the creation of this dependency calculator. Note also that this technique
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java
new file mode 100755
index 00000000000..4346fb4fbeb
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Intel 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:
+ * Intel Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.makegen.gnu;
+
+import java.io.IOException;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
+import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
+import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * This dependency calculator uses the same dependency management technique as the
+ * DefaultGCCDependencyCalculator. That is:
+ *
+ * 1. An echo command creates the dependency file (.d).
+ * 2. A second invocation of the compiler is made in order to append to the dependency file.
+ * The additional options -MM -MG -P -w are added to the command line.
+ * 3. The dependency files are post-processed to add the empty header rules.
+ *
+ * This dependency calculator uses the class DefaultGCCDependencyCalculator3Commands
+ * which implements the per-source command information
+ *
+ * This is an example dependency calculator that is not used by the CDT GCC tool-chain.
+ *
+ * @since 3.1
+ */
+
+public class DefaultGCCDependencyCalculator3 implements
+ IManagedDependencyGenerator2 {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType#getCalculatorType()
+ */
+ public int getCalculatorType() {
+ return TYPE_BUILD_COMMANDS;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencyFileExtension(org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.core.ITool)
+ */
+ public String getDependencyFileExtension(IConfiguration buildContext, ITool tool) {
+ return IManagedBuilderMakefileGenerator.DEP_EXT;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
+ */
+ public IManagedDependencyInfo getDependencySourceInfo(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
+ return new DefaultGCCDependencyCalculator3Commands(source, buildContext, tool, topBuildDirectory);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#postProcessDependencyFile(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
+ */
+ public boolean postProcessDependencyFile(IPath dependencyFile, IConfiguration buildContext, ITool tool, IPath topBuildDirectory) {
+ try {
+ IWorkspaceRoot root = CCorePlugin.getWorkspace().getRoot();
+ IFile makefile;
+ IPath makefilePath;
+ if (dependencyFile.isAbsolute()) {
+ makefilePath = dependencyFile;
+ } else {
+ makefilePath = topBuildDirectory.append(dependencyFile);
+ }
+ IPath rootPath = root.getLocation();
+ if (rootPath.isPrefixOf(makefilePath)) {
+ makefilePath = makefilePath.removeFirstSegments(rootPath.segmentCount());
+ }
+ makefile = root.getFile(makefilePath);
+ return GnuMakefileGenerator.populateDummyTargets(buildContext, makefile, false);
+ } catch (CoreException e) {
+ } catch (IOException e) {
+ }
+ return false;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3Commands.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3Commands.java
new file mode 100755
index 00000000000..967d99dac1e
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3Commands.java
@@ -0,0 +1,330 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Intel 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:
+ * Intel Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.makegen.gnu;
+
+import org.eclipse.cdt.managedbuilder.core.BuildException;
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.internal.macros.FileContextData;
+import org.eclipse.cdt.managedbuilder.internal.macros.MacroResolver;
+import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
+import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
+import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
+import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.resources.IProject;;
+
+/**
+ * This dependency calculator uses the same dependency management technique as the
+ * DefaultGCCDependencyCalculator. That is:
+ *
+ * 1. An echo command creates the dependency file (.d).
+ * 2. A second invocation of the compiler is made in order to append to the dependency file.
+ * The additional options -MM -MG -P -w are added to the command line.
+ * 3. The dependency files are post-processed to add the empty header rules.
+ *
+ * This class is used with DefaultGCCDependencyCalculator3.
+ *
+ * This is an example dependency calculator that is not used by the CDT GCC tool-chain.
+ *
+ * @since 3.1
+ */
+
+public class DefaultGCCDependencyCalculator3Commands implements
+ IManagedDependencyCommands {
+
+ private static final String EMPTY_STRING = new String();
+
+ // Member variables set by the constructor
+ IPath source;
+ IBuildObject buildContext;
+ ITool tool;
+ IPath topBuildDirectory;
+
+ // Other Member variables
+ IProject project;
+ IConfiguration config;
+ IResourceConfiguration resConfig;
+ IPath sourceLocation;
+ IPath outputLocation;
+ boolean needExplicitRuleForFile;
+ boolean genericCommands = true;
+
+ /**
+ * Constructor
+ *
+ * @param source The source file for which dependencies should be calculated
+ * The IPath can be either relative to the project directory, or absolute in the file system.
+ * @param buildContext The IConfiguration or IResourceConfiguration that
+ * contains the context in which the source file will be built
+ * @param tool The tool associated with the source file
+ * @param topBuildDirectory The top build directory of the configuration. This is
+ * the working directory for the tool. This IPath is relative to the project directory.
+ */
+ public DefaultGCCDependencyCalculator3Commands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
+ this.source = source;
+ this.buildContext = buildContext;
+ this.tool = tool;
+ this.topBuildDirectory = topBuildDirectory;
+
+ // Compute the project
+ if (buildContext instanceof IConfiguration) {
+ resConfig = null;
+ config = (IConfiguration)buildContext;
+ project = (IProject)config.getOwner();
+ } else if (buildContext instanceof IResourceConfiguration) {
+ resConfig = (IResourceConfiguration)buildContext;
+ config = resConfig.getParent();
+ project = (IProject)resConfig.getOwner();
+ }
+
+ sourceLocation = (source.isAbsolute() ? source : project.getLocation().append(source));
+ outputLocation = project.getLocation().append(topBuildDirectory).append(getDependencyFiles()[0]);
+
+ // A separate rule is needed for the resource in the case where explicit file-specific macros
+ // are referenced, or if the resource contains special characters in its path (e.g., whitespace)
+ needExplicitRuleForFile = GnuMakefileGenerator.containsSpecialCharacters(sourceLocation.toString()) ||
+ MacroResolver.getReferencedExplitFileMacros(tool).length > 0
+ || MacroResolver.getReferencedExplitFileMacros(
+ tool.getToolCommand(),
+ IBuildMacroProvider.CONTEXT_FILE,
+ new FileContextData(sourceLocation, outputLocation,
+ null, tool)).length > 0;
+
+ if (buildContext instanceof IResourceConfiguration || needExplicitRuleForFile)
+ genericCommands = false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#areCommandsGeneric()
+ */
+ public boolean areCommandsGeneric() {
+ return genericCommands;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#getDependencyCommandOptions()
+ */
+ public String[] getDependencyCommandOptions() {
+ // Nothing
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#getDependencyFiles()
+ */
+ public IPath[] getDependencyFiles() {
+ // The source file is project relative and the dependency file is top build directory relative
+ // Remove the source extension and add the dependency extension
+ IPath depFilePath = source.removeFileExtension().addFileExtension(IManagedBuilderMakefileGenerator.DEP_EXT);
+ // Remember that the source folder hierarchy and the build output folder hierarchy are the same
+ // but if this is a generated resource, then it may already be under the top build directory
+ if (!depFilePath.isAbsolute()) {
+ if (topBuildDirectory.isPrefixOf(depFilePath)) {
+ depFilePath = depFilePath.removeFirstSegments(1);
+ }
+ }
+ IPath[] paths = new IPath[1];
+ paths[0] = depFilePath;
+ return paths;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#getPostToolDependencyCommands()
+ */
+ public String[] getPostToolDependencyCommands() {
+ /*
+ * For a given input, true
if the dependency file is modified
+ */
+ static public boolean populateDummyTargets(IConfiguration cfg, IFile makefile, boolean force) throws CoreException, IOException {
+ if (makefile == null || !makefile.exists()) return false;
+
+ // Get the contents of the dependency file
+ InputStream contentStream = makefile.getContents(false);
+ Reader in = new InputStreamReader(contentStream);
+ StringBuffer inBuffer = null;
+ int chunkSize = contentStream.available();
+ inBuffer = new StringBuffer(chunkSize);
+ char[] readBuffer = new char[chunkSize];
+ int n = in.read(readBuffer);
+ while (n > 0) {
+ inBuffer.append(readBuffer);
+ n = in.read(readBuffer);
+ }
+ contentStream.close();
+
+ // The rest of this operation is equally expensive, so
+ // if we are doing an incremental build, only update the
+ // files that do not have a comment
+ if (inBuffer == null) return false;
+ String inBufferString = inBuffer.toString();
+ if (!force && inBufferString.startsWith(COMMENT_SYMBOL)) {
+ return false;
+ }
+
+ // Try to determine if this file already has dummy targets defined.
+ // If so, we will only add the comment.
+ String[] bufferLines = inBufferString.split("[\\r\\n]"); //$NON-NLS-1$
+ for (int i=0; i