org.eclipse.cdt.managedbuilder.makegen.gnu
Class DefaultGCCDependencyCalculator2Commands

java.lang.Object
  extended by org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands
All Implemented Interfaces:
IManagedDependencyCommands, IManagedDependencyInfo

public class DefaultGCCDependencyCalculator2Commands
extends java.lang.Object
implements IManagedDependencyCommands

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 exhibits the failure modes discussed in comment #5. This class is used with DefaultGCCDependencyCalculator2.

Since:
3.1

Constructor Summary
DefaultGCCDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source, IBuildObject buildContext, ITool tool, org.eclipse.core.runtime.IPath topBuildDirectory)
          Constructor.
DefaultGCCDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source, org.eclipse.core.resources.IResource resource, IBuildObject buildContext, ITool tool, org.eclipse.core.runtime.IPath topBuildDirectory)
          Constructor
 
Method Summary
 boolean areCommandsGeneric()
          Returns true if the command lines and/or options returned by this interface are not specific to the particular source file, but are only specific to, at most, the configuration and tool.
 IBuildObject getBuildContext()
           
 java.lang.String[] getDependencyCommandOptions()
          Returns the command line options to be used to calculate dependencies.
 org.eclipse.core.runtime.IPath[] getDependencyFiles()
          Returns the list of generated dependency files.
 java.lang.String[] getPostToolDependencyCommands()
          Returns the command lines to be invoked after the normal tool invocation to calculate dependencies.
 java.lang.String[] getPreToolDependencyCommands()
          Returns the command lines to be invoked before the normal tool invocation to calculate dependencies.
 org.eclipse.core.runtime.IPath getSource()
           
 ITool getTool()
           
 org.eclipse.core.runtime.IPath getTopBuildDirectory()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGCCDependencyCalculator2Commands

public DefaultGCCDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source,
                                               org.eclipse.core.resources.IResource resource,
                                               IBuildObject buildContext,
                                               ITool tool,
                                               org.eclipse.core.runtime.IPath topBuildDirectory)
Constructor

Parameters:
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.
resource - The IResource corresponding to the source file.
buildContext - The IConfiguration or IResourceConfiguration that contains the context in which the source file will be built
tool - The tool associated with the source file
topBuildDirectory - The top build directory of the configuration. This is the working directory for the tool. This IPath is relative to the project directory.

DefaultGCCDependencyCalculator2Commands

public DefaultGCCDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source,
                                               IBuildObject buildContext,
                                               ITool tool,
                                               org.eclipse.core.runtime.IPath topBuildDirectory)
Constructor. This constructor calls DefaultGCCDependencyCalculator2Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) with a null resource. The net result of this is that dependency rules will always be explicit and will never use pattern rules, as it is impossible for the calculator to know whether the resource is linked or not.

Parameters:
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.
buildContext - The IConfiguration or IResourceConfiguration that contains the context in which the source file will be built
tool - The tool associated with the source file
topBuildDirectory - The top build directory of the configuration. This is the working directory for the tool. This IPath is relative to the project directory.
See Also:
DefaultGCCDependencyCalculator2Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
Method Detail

areCommandsGeneric

public boolean areCommandsGeneric()
Description copied from interface: IManagedDependencyCommands
Returns true if the command lines and/or options returned by this interface are not specific to the particular source file, but are only specific to, at most, the configuration and tool. If the build context is a resource configuration, this method should return false if any of the command lines and/or options are different than if the build context were the parent configuration. This can be used by the build file generator in helping to determine if a "pattern" (generic) rule can be used.

Specified by:
areCommandsGeneric in interface IManagedDependencyCommands
Returns:
boolean

getDependencyCommandOptions

public java.lang.String[] getDependencyCommandOptions()
Description copied from interface: IManagedDependencyCommands
Returns the command line options to be used to calculate dependencies. The options are added to the normal tool invocation.

Specified by:
getDependencyCommandOptions in interface IManagedDependencyCommands
Returns:
String[] This can be null or an empty array if no additional arguments need to be added to the tool invocation. SHOULD THIS RETURN AN IOption[]?

getDependencyFiles

public org.eclipse.core.runtime.IPath[] getDependencyFiles()
Description copied from interface: IManagedDependencyCommands
Returns the list of generated dependency files. The paths can be either relative to the top build directory, or absolute in the file system.

Specified by:
getDependencyFiles in interface IManagedDependencyCommands
Returns:
IPath[]

getPostToolDependencyCommands

public java.lang.String[] getPostToolDependencyCommands()
Description copied from interface: IManagedDependencyCommands
Returns the command lines to be invoked after the normal tool invocation to calculate dependencies.

Specified by:
getPostToolDependencyCommands in interface IManagedDependencyCommands
Returns:
String[] This can be null or an empty array if no dependency generation commands needs to be invoked after the normal tool invocation

getPreToolDependencyCommands

public java.lang.String[] getPreToolDependencyCommands()
Description copied from interface: IManagedDependencyCommands
Returns the command lines to be invoked before the normal tool invocation to calculate dependencies.

Specified by:
getPreToolDependencyCommands in interface IManagedDependencyCommands
Returns:
String[] This can be null or an empty array if no dependency generation command needs to be invoked before the normal tool invocation.

getBuildContext

public IBuildObject getBuildContext()
Specified by:
getBuildContext in interface IManagedDependencyInfo

getSource

public org.eclipse.core.runtime.IPath getSource()
Specified by:
getSource in interface IManagedDependencyInfo

getTool

public ITool getTool()
Specified by:
getTool in interface IManagedDependencyInfo

getTopBuildDirectory

public org.eclipse.core.runtime.IPath getTopBuildDirectory()
Specified by:
getTopBuildDirectory in interface IManagedDependencyInfo