mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
Add new dependency calculator interfaces
Apply patch from bugzilla 127077 (Echo loses quotes) Apply patch from bugzilla 128333 (Limitations for project converter support) Fix problem in ResourceChangeHandler.sendClose when MBS project cannot be loaded
This commit is contained in:
parent
373ff106c3
commit
c7f73a4051
31 changed files with 22682 additions and 20994 deletions
|
@ -1,391 +1,391 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005 Intel Corporation and others.
|
* Copyright (c) 2005, 2006 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
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.IManagedDependencyGeneratorType;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.content.IContentType;
|
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.
|
||||||
* It describes one category of input files to a Tool. A tool can have
|
* It describes one category of input files to a Tool. A tool can have
|
||||||
* multiple inputType children.
|
* multiple inputType children.
|
||||||
*
|
*
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public interface IInputType extends IBuildObject {
|
public interface IInputType extends IBuildObject {
|
||||||
public static final String INPUT_TYPE_ELEMENT_NAME = "inputType"; //$NON-NLS-1$
|
public static final String INPUT_TYPE_ELEMENT_NAME = "inputType"; //$NON-NLS-1$
|
||||||
public static final String SOURCE_CONTENT_TYPE = "sourceContentType"; //$NON-NLS-1$
|
public static final String SOURCE_CONTENT_TYPE = "sourceContentType"; //$NON-NLS-1$
|
||||||
public static final String SOURCES = "sources"; //$NON-NLS-1$
|
public static final String SOURCES = "sources"; //$NON-NLS-1$
|
||||||
public static final String DEPENDENCY_CONTENT_TYPE = "dependencyContentType"; //$NON-NLS-1$
|
public static final String DEPENDENCY_CONTENT_TYPE = "dependencyContentType"; //$NON-NLS-1$
|
||||||
public static final String DEPENDENCY_EXTENSIONS = "dependencyExtensions"; //$NON-NLS-1$
|
public static final String DEPENDENCY_EXTENSIONS = "dependencyExtensions"; //$NON-NLS-1$
|
||||||
public static final String OPTION = "option"; //$NON-NLS-1$
|
public static final String OPTION = "option"; //$NON-NLS-1$
|
||||||
public static final String ASSIGN_TO_OPTION = "assignToOption"; //$NON-NLS-1$
|
public static final String ASSIGN_TO_OPTION = "assignToOption"; //$NON-NLS-1$
|
||||||
public static final String MULTIPLE_OF_TYPE = "multipleOfType"; //$NON-NLS-1$
|
public static final String MULTIPLE_OF_TYPE = "multipleOfType"; //$NON-NLS-1$
|
||||||
public static final String PRIMARY_INPUT = "primaryInput"; //$NON-NLS-1$
|
public static final String PRIMARY_INPUT = "primaryInput"; //$NON-NLS-1$
|
||||||
public static final String BUILD_VARIABLE = "buildVariable"; //$NON-NLS-1$
|
public static final String BUILD_VARIABLE = "buildVariable"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an inputOrder child for this InputType.
|
* Creates an inputOrder child for this InputType.
|
||||||
*
|
*
|
||||||
* @param path The path associated with the InputOrder element
|
* @param path The path associated with the InputOrder element
|
||||||
* @return IInputOrder of the new element
|
* @return IInputOrder of the new element
|
||||||
*/
|
*/
|
||||||
public IInputOrder createInputOrder(String path);
|
public IInputOrder createInputOrder(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the InputOrder element with the path specified in the argument.
|
* Removes the InputOrder element with the path specified in the argument.
|
||||||
*
|
*
|
||||||
* @param path The path associated with the InputOrder element
|
* @param path The path associated with the InputOrder element
|
||||||
*/
|
*/
|
||||||
public void removeInputOrder(String path);
|
public void removeInputOrder(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the InputOrder element specified in the argument.
|
* Removes the InputOrder element specified in the argument.
|
||||||
*
|
*
|
||||||
* @param path The InputOrder element
|
* @param path The InputOrder element
|
||||||
*/
|
*/
|
||||||
public void removeInputOrder(IInputOrder element);
|
public void removeInputOrder(IInputOrder element);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all of the InputOrder children of this InputType
|
* Returns all of the InputOrder children of this InputType
|
||||||
*
|
*
|
||||||
* @return IInputOrder[]
|
* @return IInputOrder[]
|
||||||
*/
|
*/
|
||||||
public IInputOrder[] getInputOrders();
|
public IInputOrder[] getInputOrders();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the InputOrder element with the path specified in the argument.
|
* Returns the InputOrder element with the path specified in the argument.
|
||||||
*
|
*
|
||||||
* @param path The path associated with the InputOrder element
|
* @param path The path associated with the InputOrder element
|
||||||
* @return IInputOrder
|
* @return IInputOrder
|
||||||
*/
|
*/
|
||||||
public IInputOrder getInputOrder(String path);
|
public IInputOrder getInputOrder(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an additionalInput child for this InputType.
|
* Creates an additionalInput child for this InputType.
|
||||||
*
|
*
|
||||||
* @param path The path associated with the AdditionalInput element
|
* @param path The path associated with the AdditionalInput element
|
||||||
* @return IAdditionalInput of the new element
|
* @return IAdditionalInput of the new element
|
||||||
*/
|
*/
|
||||||
public IAdditionalInput createAdditionalInput(String path);
|
public IAdditionalInput createAdditionalInput(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the AdditionalInput element with the path specified in the argument.
|
* Removes the AdditionalInput element with the path specified in the argument.
|
||||||
*
|
*
|
||||||
* @param path The path associated with the AdditionalInput element
|
* @param path The path associated with the AdditionalInput element
|
||||||
*/
|
*/
|
||||||
public void removeAdditionalInput(String path);
|
public void removeAdditionalInput(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the AdditionalInput element specified in the argument.
|
* Removes the AdditionalInput element specified in the argument.
|
||||||
*
|
*
|
||||||
* @param element The AdditionalInput element
|
* @param element The AdditionalInput element
|
||||||
*/
|
*/
|
||||||
public void removeAdditionalInput(IAdditionalInput element);
|
public void removeAdditionalInput(IAdditionalInput element);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all of the AdditionalInput children of this InputType
|
* Returns all of the AdditionalInput children of this InputType
|
||||||
*
|
*
|
||||||
* @return IAdditionalInput[]
|
* @return IAdditionalInput[]
|
||||||
*/
|
*/
|
||||||
public IAdditionalInput[] getAdditionalInputs();
|
public IAdditionalInput[] getAdditionalInputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the AdditionalInput element with the path specified in the argument.
|
* Returns the AdditionalInput element with the path specified in the argument.
|
||||||
*
|
*
|
||||||
* @param path The path associated with the AdditionalInput element
|
* @param path The path associated with the AdditionalInput element
|
||||||
* @return IAdditionalInput
|
* @return IAdditionalInput
|
||||||
*/
|
*/
|
||||||
public IAdditionalInput getAdditionalInput(String path);
|
public IAdditionalInput getAdditionalInput(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all of the additional input resources of this InputType.
|
* Returns all of the additional input resources of this InputType.
|
||||||
* Note: This does not include additional dependencies.
|
* Note: This does not include additional dependencies.
|
||||||
*
|
*
|
||||||
* @return IPath[]
|
* @return IPath[]
|
||||||
*/
|
*/
|
||||||
public IPath[] getAdditionalResources();
|
public IPath[] getAdditionalResources();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all of the additional dependency resources of this InputType.
|
* Returns all of the additional dependency resources of this InputType.
|
||||||
* Note: This does not include additional inputs.
|
* Note: This does not include additional inputs.
|
||||||
*
|
*
|
||||||
* @return IPath[]
|
* @return IPath[]
|
||||||
*/
|
*/
|
||||||
public IPath[] getAdditionalDependencies();
|
public IPath[] getAdditionalDependencies();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tool parent of this InputType.
|
* Returns the tool parent of this InputType.
|
||||||
*
|
*
|
||||||
* @return ITool
|
* @return ITool
|
||||||
*/
|
*/
|
||||||
public ITool getParent();
|
public ITool getParent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <code>IInputType</code> that is the superclass of this
|
* Returns the <code>IInputType</code> that is the superclass of this
|
||||||
* InputType, or <code>null</code> if the attribute was not specified.
|
* InputType, or <code>null</code> if the attribute was not specified.
|
||||||
*
|
*
|
||||||
* @return IInputType
|
* @return IInputType
|
||||||
*/
|
*/
|
||||||
public IInputType getSuperClass();
|
public IInputType getSuperClass();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Eclipse <code>IContentType</code> that describes this
|
* Returns the Eclipse <code>IContentType</code> that describes this
|
||||||
* input type. If both the sources attribute and the sourceContentType
|
* input type. If both the sources attribute and the sourceContentType
|
||||||
* attribute are specified, the sourceContentType will be used if it
|
* attribute are specified, the sourceContentType will be used if it
|
||||||
* is registered in Eclipse.
|
* is registered in Eclipse.
|
||||||
*
|
*
|
||||||
* @return IContentType
|
* @return IContentType
|
||||||
*/
|
*/
|
||||||
public IContentType getSourceContentType();
|
public IContentType getSourceContentType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Eclipse <code>IContentType</code> that describes this
|
* Sets the Eclipse <code>IContentType</code> that describes this
|
||||||
* input type.
|
* input type.
|
||||||
*
|
*
|
||||||
* @param contentType The Eclipse content type
|
* @param contentType The Eclipse content type
|
||||||
*/
|
*/
|
||||||
public void setSourceContentType(IContentType contentType);
|
public void setSourceContentType(IContentType contentType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of valid source extensions from the
|
* Returns the list of valid source extensions from the
|
||||||
* sourceExtensions attribute. Note that this value is not used
|
* sourceExtensions attribute. Note that this value is not used
|
||||||
* if source content type is specified and registered with Eclipse.
|
* if source content type is specified and registered with Eclipse.
|
||||||
* Also, the user will not be able to modify the set of file
|
* Also, the user will not be able to modify the set of file
|
||||||
* extensions as they can when sourceContentType is specified.
|
* extensions as they can when sourceContentType is specified.
|
||||||
*
|
*
|
||||||
* @return String[]
|
* @return String[]
|
||||||
*/
|
*/
|
||||||
public String[] getSourceExtensionsAttribute();
|
public String[] getSourceExtensionsAttribute();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the list of valid source extensions for this input type.
|
* Sets the list of valid source extensions for this input type.
|
||||||
* NOTE: The value of this attribute will NOT be used if a
|
* NOTE: The value of this attribute will NOT be used if a
|
||||||
* source content type is specified and is registered with
|
* source content type is specified and is registered with
|
||||||
* Eclipse.
|
* Eclipse.
|
||||||
*
|
*
|
||||||
* @param extensions The comma-separated list of valid file extensions
|
* @param extensions The comma-separated list of valid file extensions
|
||||||
* - not including the separator period.
|
* - not including the separator period.
|
||||||
*/
|
*/
|
||||||
public void setSourceExtensionsAttribute(String extensions);
|
public void setSourceExtensionsAttribute(String extensions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of valid source extensions for this input type.
|
* Returns the list of valid source extensions for this input type.
|
||||||
* Note that the list will come from the sourceContentType if it
|
* Note that the list will come from the sourceContentType if it
|
||||||
* is specified and registered with Eclipse. Otherwise the
|
* is specified and registered with Eclipse. Otherwise the
|
||||||
* sourceExtensions attribute will be used.
|
* sourceExtensions attribute will be used.
|
||||||
*
|
*
|
||||||
* @param tool the tool that contains the input-type
|
* @param tool the tool that contains the input-type
|
||||||
* @return String[]
|
* @return String[]
|
||||||
*/
|
*/
|
||||||
public String[] getSourceExtensions(ITool tool);
|
public String[] getSourceExtensions(ITool tool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answers <code>true</code> if the input type considers the file extension to be
|
* Answers <code>true</code> if the input type considers the file extension to be
|
||||||
* one associated with a source file.
|
* one associated with a source file.
|
||||||
*
|
*
|
||||||
* @param tool the tool that contains the input-type
|
* @param tool the tool that contains the input-type
|
||||||
* @param ext file extension of the source
|
* @param ext file extension of the source
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isSourceExtension(ITool tool, String ext);
|
public boolean isSourceExtension(ITool tool, String ext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Eclipse <code>IContentType</code> that describes the
|
* Returns the Eclipse <code>IContentType</code> that describes the
|
||||||
* dependency files of this input type. If both the dependencyExtensions
|
* dependency files of this input type. If both the dependencyExtensions
|
||||||
* attribute and the dependencyContentType attribute are specified,
|
* attribute and the dependencyContentType attribute are specified,
|
||||||
* the dependencyContentType will be used if it is defined in Eclipse.
|
* the dependencyContentType will be used if it is defined in Eclipse.
|
||||||
*
|
*
|
||||||
* @return IContentType
|
* @return IContentType
|
||||||
*/
|
*/
|
||||||
public IContentType getDependencyContentType();
|
public IContentType getDependencyContentType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Eclipse <code>IContentType</code> that describes the
|
* Sets the Eclipse <code>IContentType</code> that describes the
|
||||||
* dependency files of this input type.
|
* dependency files of this input type.
|
||||||
*
|
*
|
||||||
* @return type
|
* @return type
|
||||||
*/
|
*/
|
||||||
public void setDependencyContentType(IContentType type);
|
public void setDependencyContentType(IContentType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of valid dependency extensions from the
|
* Returns the list of valid dependency extensions from the
|
||||||
* dependencyExtensions attribute. Note that this value is not used
|
* dependencyExtensions attribute. Note that this value is not used
|
||||||
* if dependency content type is specified and registered with Eclipse.
|
* if dependency content type is specified and registered with Eclipse.
|
||||||
* Also, the user will not be able to modify the set of file
|
* Also, the user will not be able to modify the set of file
|
||||||
* extensions as they can when dependencyContentType is specified.
|
* extensions as they can when dependencyContentType is specified.
|
||||||
*
|
*
|
||||||
* @return String[]
|
* @return String[]
|
||||||
*/
|
*/
|
||||||
public String[] getDependencyExtensionsAttribute();
|
public String[] getDependencyExtensionsAttribute();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the list of valid dependency extensions for this input type.
|
* Sets the list of valid dependency extensions for this input type.
|
||||||
* NOTE: The value of this attribute will NOT be used if a
|
* NOTE: The value of this attribute will NOT be used if a
|
||||||
* dependency content type is specified and is registered with
|
* dependency content type is specified and is registered with
|
||||||
* Eclipse.
|
* Eclipse.
|
||||||
*
|
*
|
||||||
* @param extensions The comma-separated list of valid dependency extensions
|
* @param extensions The comma-separated list of valid dependency extensions
|
||||||
* - not including the separator period.
|
* - not including the separator period.
|
||||||
*/
|
*/
|
||||||
public void setDependencyExtensionsAttribute(String extensions);
|
public void setDependencyExtensionsAttribute(String extensions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of valid dependency extensions for this input type.
|
* Returns the list of valid dependency extensions for this input type.
|
||||||
* Note that the list will come from the dependencyContentType if it
|
* Note that the list will come from the dependencyContentType if it
|
||||||
* is specified and registered with Eclipse. Otherwise the
|
* is specified and registered with Eclipse. Otherwise the
|
||||||
* dependencyExtensions attribute will be used.
|
* dependencyExtensions attribute will be used.
|
||||||
*
|
*
|
||||||
* @param tool the tool that contains the input-type
|
* @param tool the tool that contains the input-type
|
||||||
* @return String[]
|
* @return String[]
|
||||||
*/
|
*/
|
||||||
public String[] getDependencyExtensions(ITool tool);
|
public String[] getDependencyExtensions(ITool tool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answers <code>true</code> if the input type considers the file extension to be
|
* Answers <code>true</code> if the input type considers the file extension to be
|
||||||
* one associated with a dependency file.
|
* one associated with a dependency file.
|
||||||
*
|
*
|
||||||
* @param tool the tool that contains the input-type
|
* @param tool the tool that contains the input-type
|
||||||
* @param ext file extension of the source
|
* @param ext file extension of the source
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isDependencyExtension(ITool tool, String ext);
|
public boolean isDependencyExtension(ITool tool, String ext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the id of the option that is associated with this input
|
* Returns the id of the option that is associated with this input
|
||||||
* type on the command line. If specified, the name(s) of the input
|
* type on the command line. If specified, the name(s) of the input
|
||||||
* files for this input type are taken from the value specified
|
* files for this input type are taken from the value specified
|
||||||
* for the option.
|
* for the option.
|
||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getOptionId();
|
public String getOptionId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the id of the option that is associated with this input type on
|
* Sets the id of the option that is associated with this input type on
|
||||||
* the command line. If specified, the name(s) of the input files for
|
* the command line. If specified, the name(s) of the input files for
|
||||||
* this input type are taken from the value specified for the option.
|
* this input type are taken from the value specified for the option.
|
||||||
*
|
*
|
||||||
* @param optionId
|
* @param optionId
|
||||||
*/
|
*/
|
||||||
public void setOptionId(String optionId);
|
public void setOptionId(String optionId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the id of the option whose value is to be assigned to the
|
* Returns the id of the option whose value is to be assigned to the
|
||||||
* file(s) calculated for this input type. The default is not to
|
* file(s) calculated for this input type. The default is not to
|
||||||
* assign the input file(s) to a command line option but to assign the
|
* assign the input file(s) to a command line option but to assign the
|
||||||
* files to the ${Inputs} part of the command line. Note that the
|
* files to the ${Inputs} part of the command line. Note that the
|
||||||
* option value is only updated during build file generation and therefore
|
* option value is only updated during build file generation and therefore
|
||||||
* could be out of sync with the project until build file generation
|
* could be out of sync with the project until build file generation
|
||||||
* occurs.
|
* occurs.
|
||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getAssignToOptionId();
|
public String getAssignToOptionId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the id of the option whose value is to be assigned to the
|
* Sets the id of the option whose value is to be assigned to the
|
||||||
* file(s) calculated for this input type. The default is not to
|
* file(s) calculated for this input type. The default is not to
|
||||||
* assign the input file(s) to a command line option but to assign the
|
* assign the input file(s) to a command line option but to assign the
|
||||||
* files to the ${Inputs} part of the command line. Note that the
|
* files to the ${Inputs} part of the command line. Note that the
|
||||||
* option value is only updated during build file generation and therefore
|
* option value is only updated during build file generation and therefore
|
||||||
* could be out of sync with the project until build file generation
|
* could be out of sync with the project until build file generation
|
||||||
* occurs.
|
* occurs.
|
||||||
*
|
*
|
||||||
* @param optionId
|
* @param optionId
|
||||||
*/
|
*/
|
||||||
public void setAssignToOptionId(String optionId);
|
public void setAssignToOptionId(String optionId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if this inputType can contain multiple input
|
* Returns <code>true</code> if this inputType can contain multiple input
|
||||||
* resources, else <code>false</code>. The inputs can be project resources,
|
* resources, else <code>false</code>. The inputs can be project resources,
|
||||||
* or the outputs of other tools in the tool-chain.
|
* or the outputs of other tools in the tool-chain.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean getMultipleOfType();
|
public boolean getMultipleOfType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether this inputType can contain multiple input resources
|
* Sets whether this inputType can contain multiple input resources
|
||||||
*
|
*
|
||||||
* @param multiple
|
* @param multiple
|
||||||
*/
|
*/
|
||||||
public void setMultipleOfType(boolean multiple);
|
public void setMultipleOfType(boolean multiple);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if this inputType is considered the primary input
|
* Returns <code>true</code> if this inputType is considered the primary input
|
||||||
* of the tool, else <code>false</code>.
|
* of the tool, else <code>false</code>.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean getPrimaryInput();
|
public boolean getPrimaryInput();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether this inputType is considered the primary input of the tool
|
* Sets whether this inputType is considered the primary input of the tool
|
||||||
*
|
*
|
||||||
* @param primary
|
* @param primary
|
||||||
*/
|
*/
|
||||||
public void setPrimaryInput(boolean primary);
|
public void setPrimaryInput(boolean primary);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
* This method may return <code>null</code> in which case, the receiver
|
* This method may return <code>null</code> in which case, the receiver
|
||||||
* should assume that the input type does not require dependency information
|
* should assume that the input type does not require dependency information
|
||||||
* when the project is built.
|
* when the project is built.
|
||||||
*
|
*
|
||||||
* @return IManagedDependencyGenerator
|
* @return IManagedDependencyGeneratorType
|
||||||
*/
|
*/
|
||||||
public IManagedDependencyGenerator getDependencyGenerator();
|
public IManagedDependencyGeneratorType getDependencyGenerator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the build variable associated this this input type's resources
|
* Returns the name of the build variable associated this this input type's resources
|
||||||
* The build variable used in the build file to represent the list of input files when
|
* The build variable used in the build file to represent the list of input files when
|
||||||
* multipleOfType is True. The same variable name can be used by an outputType to
|
* multipleOfType is True. The same variable name can be used by an outputType to
|
||||||
* identify a set of output files that contribute to this tool’s input
|
* identify a set of output files that contribute to this tool’s input
|
||||||
* (i.e., those using the same buildVariable name). The default name is chosen by MBS.
|
* (i.e., those using the same buildVariable name). The default name is chosen by MBS.
|
||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getBuildVariable();
|
public String getBuildVariable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of the build variable associated this this input type's resources
|
* Sets the name of the build variable associated this this input type's resources
|
||||||
*
|
*
|
||||||
* @return variableName
|
* @return variableName
|
||||||
*/
|
*/
|
||||||
public void setBuildVariable(String variableName);
|
public void setBuildVariable(String variableName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if this element has changes that need to
|
* Returns <code>true</code> if this element has changes that need to
|
||||||
* be saved in the project file, else <code>false</code>.
|
* be saved in the project file, else <code>false</code>.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isDirty();
|
public boolean isDirty();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if this InputType was loaded from a manifest file,
|
* Returns <code>true</code> if this InputType was loaded from a manifest file,
|
||||||
* and <code>false</code> if it was loaded from a project (.cdtbuild) file.
|
* and <code>false</code> if it was loaded from a project (.cdtbuild) file.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isExtensionElement();
|
public boolean isExtensionElement();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the element's "dirty" (have I been modified?) flag.
|
* Sets the element's "dirty" (have I been modified?) flag.
|
||||||
*
|
*
|
||||||
* @param isDirty
|
* @param isDirty
|
||||||
*/
|
*/
|
||||||
public void setDirty(boolean isDirty);
|
public void setDirty(boolean isDirty);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,110 +1,111 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2002, 2005 Rational Software Corporation and others.
|
# Copyright (c) 2002, 2006 Rational Software Corporation and others.
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
# http://www.eclipse.org/legal/epl-v10.html
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
#
|
#
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# IBM Rational Software - Initial API and implementation
|
# IBM Rational Software - Initial API and implementation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# Generated makefile builder messages
|
# Generated makefile builder messages
|
||||||
ManagedMakeBuilder.message.starting = Starting the build for project {0}
|
ManagedMakeBuilder.message.starting = Starting the build for project {0}
|
||||||
ManagedMakeBuilder.message.rebuild.makefiles = Regenerating makefiles for project {0}
|
ManagedMakeBuilder.message.rebuild.makefiles = Regenerating makefiles for project {0}
|
||||||
ManagedMakeBuilder.message.update.makefiles = Updating makefiles for project {0}
|
ManagedMakeBuilder.message.update.makefiles = Updating makefiles for project {0}
|
||||||
ManagedMakeBuilder.message.incremental = Updating makefiles for project {0}
|
ManagedMakeBuilder.message.incremental = Updating makefiles for project {0}
|
||||||
ManagedMakeBuilder.message.updating = Updating project files...
|
ManagedMakeBuilder.message.updating = Updating project files...
|
||||||
ManagedMakeBuilder.message.make = Calling {0} for project {1}
|
ManagedMakeBuilder.message.make = Calling {0} for project {1}
|
||||||
ManagedMakeBuilder.message.regen.deps = Regenerating dependency files for {0}
|
ManagedMakeBuilder.message.regen.deps = Regenerating dependency files for {0}
|
||||||
ManagedMakeBuilder.message.updating.deps = Updating dependency files for {0}
|
ManagedMakeBuilder.message.updating.deps = Updating dependency files for {0}
|
||||||
ManagedMakeBuilder.message.creating.markers = Generating markers...
|
ManagedMakeBuilder.message.creating.markers = Generating markers...
|
||||||
ManagedMakeBuilder.message.console.header = **** {0} of configuration {1} for project {2} ****
|
ManagedMakeBuilder.message.console.header = **** {0} of configuration {1} for project {2} ****
|
||||||
ManagedMakeBuilder.message.no.build = Nothing to build for {0}
|
ManagedMakeBuilder.message.no.build = Nothing to build for {0}
|
||||||
ManagedMakeBuilder.message.error = Build error
|
ManagedMakeBuilder.message.error = Build error
|
||||||
ManagedMakeBuilder.message.error.refresh = Error refreshing project
|
ManagedMakeBuilder.message.error.refresh = Error refreshing project
|
||||||
ManagedMakeBuilder.message.finished = Build complete for project {0}
|
ManagedMakeBuilder.message.finished = Build complete for project {0}
|
||||||
ManagedMakeBuilder.message.clean.deleting.output=Removing build artifacts from {0}
|
ManagedMakeBuilder.message.clean.deleting.output=Removing build artifacts from {0}
|
||||||
ManagedMakeBuilder.message.clean.build.clean=Trying a make clean in {0}
|
ManagedMakeBuilder.message.clean.build.clean=Trying a make clean in {0}
|
||||||
ManagedMakeBuilder.type.clean = Clean-only build
|
ManagedMakeBuilder.type.clean = Clean-only build
|
||||||
ManagedMakeBuider.type.incremental = Build
|
ManagedMakeBuider.type.incremental = Build
|
||||||
ManagedMakeBuilder.warning.unsupported.configuration=**** WARNING: The "{0}" Configuration may not build ****\n**** because it uses the "{1}" ****\n**** tool-chain that is unsupported on this system. ****\n\n**** Attempting to build... ****
|
ManagedMakeBuilder.warning.unsupported.configuration=**** WARNING: The "{0}" Configuration may not build ****\n**** because it uses the "{1}" ****\n**** tool-chain that is unsupported on this system. ****\n\n**** Attempting to build... ****
|
||||||
|
|
||||||
# Option exception messages
|
# Option exception messages
|
||||||
Option.error.bad_value_type=Bad value for type
|
Option.error.bad_value_type=Bad value for type
|
||||||
|
|
||||||
# Managed build manager exception messages
|
# Managed build manager exception messages
|
||||||
ManagedBuildManager.error.owner_not_null=addTarget: owner not null
|
ManagedBuildManager.error.owner_not_null=addTarget: owner not null
|
||||||
ManagedBuildManager.error.null_owner=addTarget: null owner
|
ManagedBuildManager.error.null_owner=addTarget: null owner
|
||||||
ManagedBuildManager.error.owner_not_project=addTarget: owner not project
|
ManagedBuildManager.error.owner_not_project=addTarget: owner not project
|
||||||
ManagedBuildManager.error.manifest_load_failed_title=Managed Build System Version Error
|
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.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=Managed Build system manifest file error:
|
ManagedBuildManager.error.manifest.header=Managed Build system manifest file error:
|
||||||
ManagedBuildManager.error.manifest.resolving=Unable to resolve the {0} identifier {1} in the {2} {3}.
|
ManagedBuildManager.error.manifest.resolving=Unable to resolve the {0} identifier {1} in the {2} {3}.
|
||||||
ManagedBuildManager.error.manifest.duplicate=Duplicate identifier {1} for element type {0}.
|
ManagedBuildManager.error.manifest.duplicate=Duplicate identifier {1} for element type {0}.
|
||||||
ManagedBuildManager.error.manifest.icon=Could not load icon "{0}".
|
ManagedBuildManager.error.manifest.icon=Could not load icon "{0}".
|
||||||
ManagedBuildManager.error.manifest.option.category=Option {0} uses a null category that is invalid in its context. The option was ignored.
|
ManagedBuildManager.error.manifest.option.category=Option {0} uses a null category that is invalid in its context. The option was ignored.
|
||||||
ManagedBuildManager.error.manifest.option.filter=Option {0} uses an unsupported resourceFilter attribute value. The option was ignored.
|
ManagedBuildManager.error.manifest.option.filter=Option {0} uses an unsupported resourceFilter attribute value. The option was ignored.
|
||||||
ManagedBuildManager.error.manifest.option.valuehandler=Could not load value handler {0} in option {1}.
|
ManagedBuildManager.error.manifest.option.valuehandler=Could not load value handler {0} in option {1}.
|
||||||
ManagedBuildManager.error.open_failed_title=Managed Make Project File Error
|
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.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.write_failed_title=Managed Make Project File Write Error
|
ManagedBuildManager.error.write_failed_title=Managed Make Project File Write Error
|
||||||
ManagedBuildManager.error.write_failed=The Managed Make project file could not be written because of the following error:\n\n{0}\n
|
ManagedBuildManager.error.write_failed=The Managed Make project file could not be written because of the following error:\n\n{0}\n
|
||||||
ManagedBuildManager.error.read_only=File {0} is read-only.
|
ManagedBuildManager.error.read_only=File {0} is read-only.
|
||||||
ManagedBuildManager.error.project.version.error=The version number of the project {0} is greater than the Managed Build System version number.
|
ManagedBuildManager.error.project.version.error=The version number of the project {0} is greater than the Managed Build System version number.
|
||||||
ManagedBuildManager.error.id.nomatch=Error loading Managed Make project information for project {0}. The tool definitions used to create the project are not available.
|
ManagedBuildManager.error.id.nomatch=Error loading Managed Make project information for project {0}. The tool definitions used to create the project are not available.
|
||||||
ManagedBuildManager.error.project.file.missing=The Managed Make project file for project {0} is missing.
|
ManagedBuildManager.error.project.file.missing=The Managed Make project file for project {0} is missing.
|
||||||
# Makefile Generator Messages
|
# Makefile Generator Messages
|
||||||
MakefileGenerator.message.start.file=Building file:
|
MakefileGenerator.message.start.file=Building file:
|
||||||
MakefileGenerator.message.finish.file=Finished building:
|
MakefileGenerator.message.finish.file=Finished building:
|
||||||
MakefileGenerator.message.start.build=Building target:
|
MakefileGenerator.message.start.build=Building target:
|
||||||
MakefileGenerator.message.finish.build=Finished building target:
|
MakefileGenerator.message.finish.build=Finished building target:
|
||||||
MakefileGenerator.message.no.target=No tool found that can build the extension specified with the build arrtifact name
|
MakefileGenerator.message.start.dependency=Regenerating dependency file:
|
||||||
MakefileGenerator.message.adding.source.folder=Adding folder {0} to sources
|
MakefileGenerator.message.no.target=No tool found that can build the extension specified with the build arrtifact name
|
||||||
MakefileGenerator.message.gen.source.makefile=Generating makefile for source folder {0}
|
MakefileGenerator.message.adding.source.folder=Adding folder {0} to sources
|
||||||
MakefileGenerator.message.calc.delta=Calculating the delta for project {0}
|
MakefileGenerator.message.gen.source.makefile=Generating makefile for source folder {0}
|
||||||
MakefileGenerator.message.finding.sources=Finding source files in project {0}
|
MakefileGenerator.message.calc.delta=Calculating the delta for project {0}
|
||||||
MakefileGenerator.comment.module.list = Every subdirectory with source files must be described here
|
MakefileGenerator.message.finding.sources=Finding source files in project {0}
|
||||||
MakefileGenerator.comment.module.variables = Add inputs and outputs from these tool invocations to the build variables
|
MakefileGenerator.comment.module.list = Every subdirectory with source files must be described here
|
||||||
MakefileGenerator.comment.source.list = All of the sources participating in the build are defined here
|
MakefileGenerator.comment.module.variables = Add inputs and outputs from these tool invocations to the build variables
|
||||||
MakefileGenerator.comment.build.rule = Each subdirectory must supply rules for building sources it contributes
|
MakefileGenerator.comment.source.list = All of the sources participating in the build are defined here
|
||||||
MakefileGenerator.comment.build.toprules = Tool invocations
|
MakefileGenerator.comment.build.rule = Each subdirectory must supply rules for building sources it contributes
|
||||||
MakefileGenerator.comment.build.alltarget = All Target
|
MakefileGenerator.comment.build.toprules = Tool invocations
|
||||||
MakefileGenerator.comment.build.mainbuildtarget = Main-build Target
|
MakefileGenerator.comment.build.alltarget = All Target
|
||||||
MakefileGenerator.comment.build.toptargets = Other Targets
|
MakefileGenerator.comment.build.mainbuildtarget = Main-build Target
|
||||||
MakefileGenerator.comment.module.make.includes = Include the makefiles for each source subdirectory
|
MakefileGenerator.comment.build.toptargets = Other Targets
|
||||||
MakefileGenerator.comment.module.dep.includes = Include automatically-generated dependency list:
|
MakefileGenerator.comment.module.make.includes = Include the makefiles for each source subdirectory
|
||||||
MakefileGenerator.comment.autodeps=Automatically-generated dependency list:
|
MakefileGenerator.comment.module.dep.includes = Include automatically-generated dependency list:
|
||||||
MakefileGenerator.comment.header=Automatically-generated file. Do not edit!
|
MakefileGenerator.comment.autodeps=Automatically-generated dependency list:
|
||||||
MakefileGenerator.error.spaces=Cannot generate makefile for folder with spaces in name
|
MakefileGenerator.comment.header=Automatically-generated file. Do not edit!
|
||||||
MakefileGenerator.warning.no.source=Nothing to build for project {0}
|
MakefileGenerator.error.spaces=Cannot generate makefile for folder with spaces in name
|
||||||
MakefileGenerator.error.no.nameprovider=A nameProvider or outputNames must be specified with multipleType == true
|
MakefileGenerator.warning.no.source=Nothing to build for project {0}
|
||||||
|
MakefileGenerator.error.no.nameprovider=A nameProvider or outputNames must be specified with multipleType == true
|
||||||
ManagedBuildInfo.message.job.init = Initializing path container for {0}
|
|
||||||
ManagedBuildInfo.message.init.ok = Initializing path container succeeded for {0}
|
ManagedBuildInfo.message.job.init = Initializing path container for {0}
|
||||||
|
ManagedBuildInfo.message.init.ok = Initializing path container succeeded for {0}
|
||||||
# Default GNU Makefile Generator messages
|
|
||||||
GnuMakefileGenerator.message.postproc.dep.file=Verifying contents of dependency file {0}
|
# Default GNU Makefile Generator messages
|
||||||
|
GnuMakefileGenerator.message.postproc.dep.file=Verifying contents of dependency file {0}
|
||||||
# Tool strings
|
|
||||||
Tool.default.announcement=Invoking:
|
# Tool strings
|
||||||
#Environment loader messages
|
Tool.default.announcement=Invoking:
|
||||||
StorableEnvironmentLoader.storeOutputStream.wrong.arguments=Wrong arguments
|
#Environment loader messages
|
||||||
|
StorableEnvironmentLoader.storeOutputStream.wrong.arguments=Wrong arguments
|
||||||
#User Defined Macro Supplier
|
|
||||||
UserDefinedMacroSupplier.storeOutputStream.wrong.arguments=Failed to persist macros: Wrong arguments
|
#User Defined Macro Supplier
|
||||||
|
UserDefinedMacroSupplier.storeOutputStream.wrong.arguments=Failed to persist macros: Wrong arguments
|
||||||
# BuildMacroStatus messages
|
|
||||||
BuildMacroStatus.status.macro.undefined=Macro {0} is undefined
|
# BuildMacroStatus messages
|
||||||
BuildMacroStatus.status.reference.eachother=Macros {0} and {1} reference each other
|
BuildMacroStatus.status.macro.undefined=Macro {0} is undefined
|
||||||
BuildMacroStatus.status.reference.incorrect=Macro {0} reference is incorrect
|
BuildMacroStatus.status.reference.eachother=Macros {0} and {1} reference each other
|
||||||
BuildMacroStatus.status.macro.not.string=Macro {0} is not of String type
|
BuildMacroStatus.status.reference.incorrect=Macro {0} reference is incorrect
|
||||||
BuildMacroStatus.status.macro.not.stringlist=Macro {0} is not of String-list type
|
BuildMacroStatus.status.macro.not.string=Macro {0} is not of String type
|
||||||
BuildMacroStatus.status.error=Error occured
|
BuildMacroStatus.status.macro.not.stringlist=Macro {0} is not of String-list type
|
||||||
BuildMacroStatus.value.undefined=
|
BuildMacroStatus.status.error=Error occured
|
||||||
|
BuildMacroStatus.value.undefined=
|
||||||
#ResourceChangeHandler messages
|
|
||||||
ResourceChangeHandler.buildInfoSerializationJob=Build Info Serialization
|
#ResourceChangeHandler messages
|
||||||
|
ResourceChangeHandler.buildInfoSerializationJob=Build Info Serialization
|
||||||
#ManagedBuilderCorePlugin messages
|
|
||||||
|
#ManagedBuilderCorePlugin messages
|
||||||
ManagedBuilderCorePlugin.resourceChangeHandlingInitializationJob=Initializing Resource Change Handling
|
ManagedBuilderCorePlugin.resourceChangeHandlingInitializationJob=Initializing Resource Change Handling
|
|
@ -1,455 +1,458 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005 Intel Corporation and others.
|
* Copyright (c) 2005 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.managedbuilder.internal.core;
|
package org.eclipse.cdt.managedbuilder.internal.core;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
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.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
|
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
|
||||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||||
import org.eclipse.core.resources.IResourceChangeListener;
|
import org.eclipse.core.resources.IResourceChangeListener;
|
||||||
import org.eclipse.core.resources.IResourceDelta;
|
import org.eclipse.core.resources.IResourceDelta;
|
||||||
import org.eclipse.core.resources.IResourceDeltaVisitor;
|
import org.eclipse.core.resources.IResourceDeltaVisitor;
|
||||||
import org.eclipse.core.resources.IResourceRuleFactory;
|
import org.eclipse.core.resources.IResourceRuleFactory;
|
||||||
import org.eclipse.core.resources.ISaveContext;
|
import org.eclipse.core.resources.ISaveContext;
|
||||||
import org.eclipse.core.resources.ISaveParticipant;
|
import org.eclipse.core.resources.ISaveParticipant;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.core.runtime.jobs.MultiRule;
|
import org.eclipse.core.runtime.jobs.MultiRule;
|
||||||
|
|
||||||
public class ResourceChangeHandler implements IResourceChangeListener, ISaveParticipant {
|
public class ResourceChangeHandler implements IResourceChangeListener, ISaveParticipant {
|
||||||
|
|
||||||
private class ResourceConfigurationChecker implements IResourceDeltaVisitor{
|
private class ResourceConfigurationChecker implements IResourceDeltaVisitor{
|
||||||
private IResourceDelta fRootDelta;
|
private IResourceDelta fRootDelta;
|
||||||
private HashMap fBuildFileGeneratorMap = new HashMap();
|
private HashMap fBuildFileGeneratorMap = new HashMap();
|
||||||
private HashSet fValidatedFilesSet = new HashSet();
|
private HashSet fValidatedFilesSet = new HashSet();
|
||||||
private HashSet fModifiedProjects = new HashSet();
|
private HashSet fModifiedProjects = new HashSet();
|
||||||
|
|
||||||
public ResourceConfigurationChecker(IResourceDelta rootDelta){
|
public ResourceConfigurationChecker(IResourceDelta rootDelta){
|
||||||
fRootDelta = rootDelta;
|
fRootDelta = rootDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProject[] getModifiedProjects(){
|
public IProject[] getModifiedProjects(){
|
||||||
return (IProject[])fModifiedProjects.toArray(new IProject[fModifiedProjects.size()]);
|
return (IProject[])fModifiedProjects.toArray(new IProject[fModifiedProjects.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean visit(IResourceDelta delta) throws CoreException {
|
public boolean visit(IResourceDelta delta) throws CoreException {
|
||||||
IResource dResource = delta.getResource();
|
IResource dResource = delta.getResource();
|
||||||
int rcType = dResource.getType();
|
int rcType = dResource.getType();
|
||||||
|
|
||||||
if(rcType == IResource.PROJECT || rcType == IResource.FOLDER){
|
if(rcType == IResource.PROJECT || rcType == IResource.FOLDER){
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
IProject project = null;
|
IProject project = null;
|
||||||
IResource rcToCheck = null;
|
IResource rcToCheck = null;
|
||||||
switch (delta.getKind()) {
|
switch (delta.getKind()) {
|
||||||
case IResourceDelta.REMOVED :
|
case IResourceDelta.REMOVED :
|
||||||
if ((delta.getFlags() & IResourceDelta.MOVED_TO) == 0 && rcType == IResource.PROJECT) {
|
if ((delta.getFlags() & IResourceDelta.MOVED_TO) == 0 && rcType == IResource.PROJECT) {
|
||||||
sendClose((IProject)dResource);
|
sendClose((IProject)dResource);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IResourceDelta.CHANGED :
|
case IResourceDelta.CHANGED :
|
||||||
if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
|
if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
|
||||||
IPath path = delta.getMovedToPath();
|
IPath path = delta.getMovedToPath();
|
||||||
if(path != null){
|
if(path != null){
|
||||||
project = root.findMember(path.segment(0)).getProject();
|
project = root.findMember(path.segment(0)).getProject();
|
||||||
if(project != null && rcType == IResource.FOLDER)
|
if(project != null && rcType == IResource.FOLDER)
|
||||||
rcToCheck = root.getFolder(substituteProject(dResource.getFullPath(),project.getName()));
|
rcToCheck = root.getFolder(substituteProject(dResource.getFullPath(),project.getName()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
project = dResource.getProject();
|
project = dResource.getProject();
|
||||||
if(rcType == IResource.FOLDER)
|
if(rcType == IResource.FOLDER)
|
||||||
rcToCheck = dResource;
|
rcToCheck = dResource;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(project != null) {
|
if(project != null) {
|
||||||
IManagedBuilderMakefileGenerator makeGen = getInitializedGenerator(project);
|
IManagedBuilderMakefileGenerator makeGen = getInitializedGenerator(project);
|
||||||
if(makeGen != null){
|
if(makeGen != null){
|
||||||
if(rcToCheck == null || !makeGen.isGeneratedResource(rcToCheck))
|
if(rcToCheck == null || !makeGen.isGeneratedResource(rcToCheck))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (rcType == IResource.FILE && !dResource.isDerived()) {
|
} else if (rcType == IResource.FILE && !dResource.isDerived()) {
|
||||||
int flags = delta.getFlags();
|
int flags = delta.getFlags();
|
||||||
switch (delta.getKind()) {
|
switch (delta.getKind()) {
|
||||||
case IResourceDelta.REMOVED :
|
case IResourceDelta.REMOVED :
|
||||||
if ((flags & IResourceDelta.MOVED_TO) == 0) {
|
if ((flags & IResourceDelta.MOVED_TO) == 0) {
|
||||||
handleDeleteFile(dResource.getFullPath());
|
handleDeleteFile(dResource.getFullPath());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IResourceDelta.ADDED :
|
case IResourceDelta.ADDED :
|
||||||
case IResourceDelta.CHANGED :
|
case IResourceDelta.CHANGED :
|
||||||
if ((flags & IResourceDelta.MOVED_TO) != 0) {
|
if ((flags & IResourceDelta.MOVED_TO) != 0) {
|
||||||
IPath path = delta.getMovedToPath();
|
IPath path = delta.getMovedToPath();
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
handleRenamedFile(
|
handleRenamedFile(
|
||||||
dResource.getFullPath(),
|
dResource.getFullPath(),
|
||||||
path);
|
path);
|
||||||
}
|
}
|
||||||
} else if ((flags & IResourceDelta.MOVED_FROM) != 0) {
|
} else if ((flags & IResourceDelta.MOVED_FROM) != 0) {
|
||||||
IPath path = delta.getMovedFromPath();
|
IPath path = delta.getMovedFromPath();
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
handleRenamedFile(
|
handleRenamedFile(
|
||||||
path,
|
path,
|
||||||
dResource.getFullPath());
|
dResource.getFullPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true; // visit the children
|
return true; // visit the children
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPath substituteProject(IPath path, String projectName){
|
private IPath substituteProject(IPath path, String projectName){
|
||||||
return new Path(projectName).makeAbsolute().append(path.removeFirstSegments(1));
|
return new Path(projectName).makeAbsolute().append(path.removeFirstSegments(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRenamedFile(IPath fromPath, IPath toPath){
|
private void handleRenamedFile(IPath fromPath, IPath toPath){
|
||||||
if(!fValidatedFilesSet.add(fromPath))
|
if(!fValidatedFilesSet.add(fromPath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IProject fromProject = findModifiedProject(fromPath.segment(0));
|
IProject fromProject = findModifiedProject(fromPath.segment(0));
|
||||||
if(fromProject == null)
|
if(fromProject == null)
|
||||||
return;
|
return;
|
||||||
IManagedBuilderMakefileGenerator fromMakeGen = getInitializedGenerator(fromProject);
|
IManagedBuilderMakefileGenerator fromMakeGen = getInitializedGenerator(fromProject);
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
if(fromMakeGen == null || fromMakeGen.isGeneratedResource(root.getFile(substituteProject(fromPath,fromProject.getName()))))
|
if(fromMakeGen == null || fromMakeGen.isGeneratedResource(root.getFile(substituteProject(fromPath,fromProject.getName()))))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IManagedBuildInfo fromInfo = fromProject != null ?
|
IManagedBuildInfo fromInfo = fromProject != null ?
|
||||||
ManagedBuildManager.getBuildInfo(fromProject) :
|
ManagedBuildManager.getBuildInfo(fromProject) :
|
||||||
null;
|
null;
|
||||||
|
|
||||||
IProject toProject = root.findMember(toPath.uptoSegment(1)).getProject();
|
IProject toProject = root.findMember(toPath.uptoSegment(1)).getProject();
|
||||||
IManagedBuildInfo toInfo = toProject != null ?
|
IManagedBuildInfo toInfo = toProject != null ?
|
||||||
ManagedBuildManager.getBuildInfo(toProject) :
|
ManagedBuildManager.getBuildInfo(toProject) :
|
||||||
null;
|
null;
|
||||||
IManagedBuilderMakefileGenerator toMakeGen = toProject != null ?
|
IManagedBuilderMakefileGenerator toMakeGen = toProject != null ?
|
||||||
getInitializedGenerator(toProject) :
|
getInitializedGenerator(toProject) :
|
||||||
null;
|
null;
|
||||||
if(toMakeGen != null && toMakeGen.isGeneratedResource(root.getFile(toPath)))
|
if(toMakeGen != null && toMakeGen.isGeneratedResource(root.getFile(toPath)))
|
||||||
toInfo = null;
|
toInfo = null;
|
||||||
|
|
||||||
if(fromInfo == toInfo){
|
if(fromInfo == toInfo){
|
||||||
//the resource was moved whithing the project scope
|
//the resource was moved whithing the project scope
|
||||||
if(updateResourceConfigurations(fromInfo,fromPath,toPath) && toProject != null)
|
if(updateResourceConfigurations(fromInfo,fromPath,toPath) && toProject != null)
|
||||||
fModifiedProjects.add(toProject);
|
fModifiedProjects.add(toProject);
|
||||||
} else {
|
} else {
|
||||||
if(fromInfo != null && toInfo != null){
|
if(fromInfo != null && toInfo != null){
|
||||||
//TODO: this is the case when the resource
|
//TODO: this is the case when the resource
|
||||||
//is moved from one managed project to another
|
//is moved from one managed project to another
|
||||||
//should we handle this?
|
//should we handle this?
|
||||||
//e.g. add resource configurations to the destination project?
|
//e.g. add resource configurations to the destination project?
|
||||||
}
|
}
|
||||||
if(fromInfo != null && removeResourceConfigurations(fromInfo,fromPath) && fromProject != null)
|
if(fromInfo != null && removeResourceConfigurations(fromInfo,fromPath) && fromProject != null)
|
||||||
fModifiedProjects.add(fromProject);
|
fModifiedProjects.add(fromProject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleDeleteFile(IPath path){
|
private void handleDeleteFile(IPath path){
|
||||||
IProject project = findModifiedProject(path.segment(0));
|
IProject project = findModifiedProject(path.segment(0));
|
||||||
if(project != null){
|
if(project != null){
|
||||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
||||||
if(info != null
|
if(info != null
|
||||||
&& removeResourceConfigurations(info,path))
|
&& removeResourceConfigurations(info,path))
|
||||||
fModifiedProjects.add(project);
|
fModifiedProjects.add(project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//finds the project geven the initial project name
|
//finds the project geven the initial project name
|
||||||
//That is:
|
//That is:
|
||||||
// if the project of a given name was renamed returns the renamed project
|
// if the project of a given name was renamed returns the renamed project
|
||||||
// if the project of a given name was removed returns null
|
// if the project of a given name was removed returns null
|
||||||
// if the project of a given name was neither renamed or removed
|
// if the project of a given name was neither renamed or removed
|
||||||
// returns the project of that name or null if the project does not exist
|
// returns the project of that name or null if the project does not exist
|
||||||
//
|
//
|
||||||
private IProject findModifiedProject(final String oldProjectName){
|
private IProject findModifiedProject(final String oldProjectName){
|
||||||
IResourceDelta projectDelta = fRootDelta.findMember(new Path(oldProjectName));
|
IResourceDelta projectDelta = fRootDelta.findMember(new Path(oldProjectName));
|
||||||
boolean replaced = false;
|
boolean replaced = false;
|
||||||
if(projectDelta != null) {
|
if(projectDelta != null) {
|
||||||
switch(projectDelta.getKind()){
|
switch(projectDelta.getKind()){
|
||||||
case IResourceDelta.REMOVED :
|
case IResourceDelta.REMOVED :
|
||||||
if ((projectDelta.getFlags() & IResourceDelta.MOVED_TO) == 0) {
|
if ((projectDelta.getFlags() & IResourceDelta.MOVED_TO) == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case IResourceDelta.CHANGED :
|
case IResourceDelta.CHANGED :
|
||||||
if ((projectDelta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
|
if ((projectDelta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
|
||||||
IPath path = projectDelta.getMovedToPath();
|
IPath path = projectDelta.getMovedToPath();
|
||||||
if(path != null)
|
if(path != null)
|
||||||
return ResourcesPlugin.getWorkspace().getRoot().findMember(path).getProject();
|
return ResourcesPlugin.getWorkspace().getRoot().findMember(path).getProject();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final IProject project[] = new IProject[1];
|
final IProject project[] = new IProject[1];
|
||||||
try {
|
try {
|
||||||
fRootDelta.accept(new IResourceDeltaVisitor() {
|
fRootDelta.accept(new IResourceDeltaVisitor() {
|
||||||
public boolean visit(IResourceDelta delta) throws CoreException {
|
public boolean visit(IResourceDelta delta) throws CoreException {
|
||||||
IResource dResource = delta.getResource();
|
IResource dResource = delta.getResource();
|
||||||
int rcType = dResource.getType();
|
int rcType = dResource.getType();
|
||||||
if(rcType == IResource.ROOT) {
|
if(rcType == IResource.ROOT) {
|
||||||
return true;
|
return true;
|
||||||
} else if(rcType == IResource.PROJECT){
|
} else if(rcType == IResource.PROJECT){
|
||||||
switch(delta.getKind()){
|
switch(delta.getKind()){
|
||||||
case IResourceDelta.ADDED :
|
case IResourceDelta.ADDED :
|
||||||
case IResourceDelta.CHANGED :
|
case IResourceDelta.CHANGED :
|
||||||
if ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0) {
|
if ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0) {
|
||||||
IPath path = delta.getMovedFromPath();
|
IPath path = delta.getMovedFromPath();
|
||||||
if (path != null && path.segment(0).equals(oldProjectName)) {
|
if (path != null && path.segment(0).equals(oldProjectName)) {
|
||||||
project[0] = dResource.getProject();
|
project[0] = dResource.getProject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(project[0] == null && !replaced)
|
if(project[0] == null && !replaced)
|
||||||
project[0] = ResourcesPlugin.getWorkspace().getRoot().findMember(oldProjectName).getProject();
|
project[0] = ResourcesPlugin.getWorkspace().getRoot().findMember(oldProjectName).getProject();
|
||||||
return project[0];
|
return project[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
private IManagedBuilderMakefileGenerator getInitializedGenerator(IProject project){
|
private IManagedBuilderMakefileGenerator getInitializedGenerator(IProject project){
|
||||||
IManagedBuilderMakefileGenerator makeGen = (IManagedBuilderMakefileGenerator)fBuildFileGeneratorMap.get(project);
|
IManagedBuilderMakefileGenerator makeGen = (IManagedBuilderMakefileGenerator)fBuildFileGeneratorMap.get(project);
|
||||||
if (makeGen == null) {
|
if (makeGen == null) {
|
||||||
try {
|
try {
|
||||||
if (project.hasNature(ManagedCProjectNature.MNG_NATURE_ID)) {
|
if (project.hasNature(ManagedCProjectNature.MNG_NATURE_ID)) {
|
||||||
// Determine if we can access the build info before actually trying
|
// Determine if we can access the build info before actually trying
|
||||||
// If not, don't try, to avoid putting up a dialog box warning the user
|
// If not, don't try, to avoid putting up a dialog box warning the user
|
||||||
if (!ManagedBuildManager.canGetBuildInfo(project)) return null;
|
if (!ManagedBuildManager.canGetBuildInfo(project)) return null;
|
||||||
|
|
||||||
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
|
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
|
||||||
if (buildInfo != null){
|
if (buildInfo != null){
|
||||||
IConfiguration defaultCfg = buildInfo.getDefaultConfiguration();
|
IConfiguration defaultCfg = buildInfo.getDefaultConfiguration();
|
||||||
if (defaultCfg != null) {
|
if (defaultCfg != null) {
|
||||||
makeGen = ManagedBuildManager.getBuildfileGenerator(defaultCfg);
|
makeGen = ManagedBuildManager.getBuildfileGenerator(defaultCfg);
|
||||||
makeGen.initialize(project,buildInfo,new NullProgressMonitor());
|
makeGen.initialize(project,buildInfo,new NullProgressMonitor());
|
||||||
fBuildFileGeneratorMap.put(project,makeGen);
|
fBuildFileGeneratorMap.put(project,makeGen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e){
|
} catch (CoreException e){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return makeGen;
|
return makeGen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendClose(IProject project){
|
public void sendClose(IProject project){
|
||||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project,false);
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project,false);
|
||||||
if(info != null){
|
if(info != null){
|
||||||
IConfiguration cfgs[] = info.getManagedProject().getConfigurations();
|
IManagedProject managedProj = info.getManagedProject();
|
||||||
|
if (managedProj != null) {
|
||||||
for(int i = 0; i < cfgs.length; i++)
|
IConfiguration cfgs[] = managedProj.getConfigurations();
|
||||||
ManagedBuildManager.performValueHandlerEvent(cfgs[i], IManagedOptionValueHandler.EVENT_CLOSE, true);
|
|
||||||
}
|
for(int i = 0; i < cfgs.length; i++)
|
||||||
}
|
ManagedBuildManager.performValueHandlerEvent(cfgs[i], IManagedOptionValueHandler.EVENT_CLOSE, true);
|
||||||
|
}
|
||||||
/*
|
}
|
||||||
* I R e s o u r c e C h a n g e L i s t e n e r
|
}
|
||||||
*/
|
|
||||||
|
/*
|
||||||
/* (non-Javadoc)
|
* I R e s o u r c e C h a n g e L i s t e n e r
|
||||||
*
|
*/
|
||||||
* Handle the renaming and deletion of project resources
|
|
||||||
* This is necessary in order to update ResourceConfigurations and AdditionalInputs
|
/* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
|
* Handle the renaming and deletion of project resources
|
||||||
*/
|
* This is necessary in order to update ResourceConfigurations and AdditionalInputs
|
||||||
public void resourceChanged(IResourceChangeEvent event) {
|
*
|
||||||
if (event.getSource() instanceof IWorkspace) {
|
* @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
|
||||||
|
*/
|
||||||
switch (event.getType()) {
|
public void resourceChanged(IResourceChangeEvent event) {
|
||||||
case IResourceChangeEvent.PRE_CLOSE:
|
if (event.getSource() instanceof IWorkspace) {
|
||||||
IResource proj = event.getResource();
|
|
||||||
if(proj instanceof IProject)
|
switch (event.getType()) {
|
||||||
sendClose((IProject)proj);
|
case IResourceChangeEvent.PRE_CLOSE:
|
||||||
break;
|
IResource proj = event.getResource();
|
||||||
case IResourceChangeEvent.POST_CHANGE :
|
if(proj instanceof IProject)
|
||||||
case IResourceChangeEvent.POST_BUILD :
|
sendClose((IProject)proj);
|
||||||
case IResourceChangeEvent.PRE_DELETE :
|
break;
|
||||||
IResourceDelta resDelta = event.getDelta();
|
case IResourceChangeEvent.POST_CHANGE :
|
||||||
if (resDelta == null) {
|
case IResourceChangeEvent.POST_BUILD :
|
||||||
break;
|
case IResourceChangeEvent.PRE_DELETE :
|
||||||
}
|
IResourceDelta resDelta = event.getDelta();
|
||||||
try {
|
if (resDelta == null) {
|
||||||
ResourceConfigurationChecker rcChecker = new ResourceConfigurationChecker(resDelta);
|
break;
|
||||||
resDelta.accept(rcChecker);
|
}
|
||||||
|
try {
|
||||||
//saving info for the modified projects
|
ResourceConfigurationChecker rcChecker = new ResourceConfigurationChecker(resDelta);
|
||||||
initInfoSerialization(rcChecker.getModifiedProjects());
|
resDelta.accept(rcChecker);
|
||||||
|
|
||||||
} catch (CoreException e) {
|
//saving info for the modified projects
|
||||||
CCorePlugin.log(e);
|
initInfoSerialization(rcChecker.getModifiedProjects());
|
||||||
}
|
|
||||||
break;
|
} catch (CoreException e) {
|
||||||
default :
|
CCorePlugin.log(e);
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
}
|
default :
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
private void initInfoSerialization(final IProject projects[]){
|
}
|
||||||
if(projects.length == 0)
|
}
|
||||||
return;
|
|
||||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
private void initInfoSerialization(final IProject projects[]){
|
||||||
IResourceRuleFactory ruleFactory = workspace.getRuleFactory();
|
if(projects.length == 0)
|
||||||
ISchedulingRule buildInfoSaveRule;
|
return;
|
||||||
if(projects.length == 1){
|
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||||
buildInfoSaveRule = ruleFactory.modifyRule(projects[0]);
|
IResourceRuleFactory ruleFactory = workspace.getRuleFactory();
|
||||||
} else {
|
ISchedulingRule buildInfoSaveRule;
|
||||||
ISchedulingRule rules[] = new ISchedulingRule[projects.length];
|
if(projects.length == 1){
|
||||||
for(int i = 0; i < rules.length; i++)
|
buildInfoSaveRule = ruleFactory.modifyRule(projects[0]);
|
||||||
rules[i] = ruleFactory.modifyRule(projects[i]);
|
} else {
|
||||||
buildInfoSaveRule = MultiRule.combine(rules);
|
ISchedulingRule rules[] = new ISchedulingRule[projects.length];
|
||||||
}
|
for(int i = 0; i < rules.length; i++)
|
||||||
|
rules[i] = ruleFactory.modifyRule(projects[i]);
|
||||||
Job savingJob = new Job(ManagedMakeMessages.getResourceString("ResourceChangeHandler.buildInfoSerializationJob")){ //$NON-NLS-1$
|
buildInfoSaveRule = MultiRule.combine(rules);
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
}
|
||||||
for(int i = 0; i < projects.length; i++){
|
|
||||||
ManagedBuildManager.saveBuildInfo(projects[i],true);
|
Job savingJob = new Job(ManagedMakeMessages.getResourceString("ResourceChangeHandler.buildInfoSerializationJob")){ //$NON-NLS-1$
|
||||||
}
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
return new Status(
|
for(int i = 0; i < projects.length; i++){
|
||||||
IStatus.OK,
|
ManagedBuildManager.saveBuildInfo(projects[i],true);
|
||||||
ManagedBuilderCorePlugin.getUniqueIdentifier(),
|
}
|
||||||
IStatus.OK,
|
return new Status(
|
||||||
new String(),
|
IStatus.OK,
|
||||||
null);
|
ManagedBuilderCorePlugin.getUniqueIdentifier(),
|
||||||
}
|
IStatus.OK,
|
||||||
};
|
new String(),
|
||||||
savingJob.setRule(buildInfoSaveRule);
|
null);
|
||||||
|
}
|
||||||
savingJob.schedule();
|
};
|
||||||
}
|
savingJob.setRule(buildInfoSaveRule);
|
||||||
|
|
||||||
private boolean updateResourceConfigurations(IManagedBuildInfo info, IPath oldPath, IPath newPath){
|
savingJob.schedule();
|
||||||
boolean changed = false;
|
}
|
||||||
if(!oldPath.equals(newPath)){
|
|
||||||
IManagedProject mngProj = info.getManagedProject();
|
private boolean updateResourceConfigurations(IManagedBuildInfo info, IPath oldPath, IPath newPath){
|
||||||
if(mngProj != null){
|
boolean changed = false;
|
||||||
IConfiguration configs[] = mngProj.getConfigurations();
|
if(!oldPath.equals(newPath)){
|
||||||
if(configs != null && configs.length > 0){
|
IManagedProject mngProj = info.getManagedProject();
|
||||||
for(int i = 0; i < configs.length; i++){
|
if(mngProj != null){
|
||||||
if(updateResourceConfiguration(configs[i],oldPath,newPath))
|
IConfiguration configs[] = mngProj.getConfigurations();
|
||||||
changed = true;
|
if(configs != null && configs.length > 0){
|
||||||
}
|
for(int i = 0; i < configs.length; i++){
|
||||||
}
|
if(updateResourceConfiguration(configs[i],oldPath,newPath))
|
||||||
}
|
changed = true;
|
||||||
}
|
}
|
||||||
return changed;
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private boolean removeResourceConfigurations(IManagedBuildInfo info, IPath path){
|
return changed;
|
||||||
boolean changed = false;
|
}
|
||||||
IManagedProject mngProj = info.getManagedProject();
|
|
||||||
if(mngProj != null){
|
private boolean removeResourceConfigurations(IManagedBuildInfo info, IPath path){
|
||||||
IConfiguration configs[] = mngProj.getConfigurations();
|
boolean changed = false;
|
||||||
if(configs != null && configs.length > 0){
|
IManagedProject mngProj = info.getManagedProject();
|
||||||
for(int i = 0; i < configs.length; i++){
|
if(mngProj != null){
|
||||||
if(removeResourceConfiguration(configs[i],path))
|
IConfiguration configs[] = mngProj.getConfigurations();
|
||||||
changed = true;
|
if(configs != null && configs.length > 0){
|
||||||
}
|
for(int i = 0; i < configs.length; i++){
|
||||||
}
|
if(removeResourceConfiguration(configs[i],path))
|
||||||
}
|
changed = true;
|
||||||
return changed;
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private boolean updateResourceConfiguration(IConfiguration config, IPath oldPath, IPath newPath){
|
return changed;
|
||||||
IResourceConfiguration rcCfg = config.getResourceConfiguration(oldPath.toString());
|
}
|
||||||
if(rcCfg != null && !oldPath.equals(newPath)){
|
|
||||||
config.removeResourceConfiguration(rcCfg);
|
private boolean updateResourceConfiguration(IConfiguration config, IPath oldPath, IPath newPath){
|
||||||
rcCfg.setResourcePath(newPath.toString());
|
IResourceConfiguration rcCfg = config.getResourceConfiguration(oldPath.toString());
|
||||||
((Configuration)config).addResourceConfiguration((ResourceConfiguration)rcCfg);
|
if(rcCfg != null && !oldPath.equals(newPath)){
|
||||||
config.setRebuildState(true);
|
config.removeResourceConfiguration(rcCfg);
|
||||||
return true;
|
rcCfg.setResourcePath(newPath.toString());
|
||||||
}
|
((Configuration)config).addResourceConfiguration((ResourceConfiguration)rcCfg);
|
||||||
return false;
|
config.setRebuildState(true);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
private boolean removeResourceConfiguration(IConfiguration config, IPath path){
|
return false;
|
||||||
IResourceConfiguration rcCfg = config.getResourceConfiguration(path.toString());
|
}
|
||||||
if(rcCfg != null){
|
|
||||||
config.removeResourceConfiguration(rcCfg);
|
private boolean removeResourceConfiguration(IConfiguration config, IPath path){
|
||||||
config.setRebuildState(true);
|
IResourceConfiguration rcCfg = config.getResourceConfiguration(path.toString());
|
||||||
return true;
|
if(rcCfg != null){
|
||||||
}
|
config.removeResourceConfiguration(rcCfg);
|
||||||
return false;
|
config.setRebuildState(true);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
/*
|
return false;
|
||||||
* I S a v e P a r t i c i p a n t
|
}
|
||||||
*/
|
|
||||||
|
/*
|
||||||
/* (non-Javadoc)
|
* I S a v e P a r t i c i p a n t
|
||||||
* @see org.eclipse.core.resources.ISaveParticipant#saving(org.eclipse.core.resources.ISaveContext)
|
*/
|
||||||
*/
|
|
||||||
public void saving(ISaveContext context) throws CoreException {
|
/* (non-Javadoc)
|
||||||
// No state to be saved by the plug-in, but request a
|
* @see org.eclipse.core.resources.ISaveParticipant#saving(org.eclipse.core.resources.ISaveContext)
|
||||||
// resource delta to be used on next activation.
|
*/
|
||||||
context.needDelta();
|
public void saving(ISaveContext context) throws CoreException {
|
||||||
}
|
// No state to be saved by the plug-in, but request a
|
||||||
|
// resource delta to be used on next activation.
|
||||||
/* (non-Javadoc)
|
context.needDelta();
|
||||||
* @see org.eclipse.core.resources.ISaveParticipant#doneSaving(org.eclipse.core.resources.ISaveContext)
|
}
|
||||||
*/
|
|
||||||
public void doneSaving(ISaveContext context) {
|
/* (non-Javadoc)
|
||||||
}
|
* @see org.eclipse.core.resources.ISaveParticipant#doneSaving(org.eclipse.core.resources.ISaveContext)
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
public void doneSaving(ISaveContext context) {
|
||||||
* @see org.eclipse.core.resources.ISaveParticipant#prepareToSave(org.eclipse.core.resources.ISaveContext)
|
}
|
||||||
*/
|
|
||||||
public void prepareToSave(ISaveContext context) throws CoreException {
|
/* (non-Javadoc)
|
||||||
}
|
* @see org.eclipse.core.resources.ISaveParticipant#prepareToSave(org.eclipse.core.resources.ISaveContext)
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
public void prepareToSave(ISaveContext context) throws CoreException {
|
||||||
* @see org.eclipse.core.resources.ISaveParticipant#rollback(org.eclipse.core.resources.ISaveContext)
|
}
|
||||||
*/
|
|
||||||
public void rollback(ISaveContext context) {
|
/* (non-Javadoc)
|
||||||
}
|
* @see org.eclipse.core.resources.ISaveParticipant#rollback(org.eclipse.core.resources.ISaveContext)
|
||||||
|
*/
|
||||||
}
|
public void rollback(ISaveContext context) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,79 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 3.1
|
||||||
|
*
|
||||||
|
* A Tool dependency calculator may implement this interface or
|
||||||
|
* IManagedDependencyCommands or IManagedDependencyPreBuild.
|
||||||
|
* An object implementing the interface is returned from a call to
|
||||||
|
* IManagedDependencyGenerator2.getDependencySourceInfo.
|
||||||
|
*
|
||||||
|
* Discussion of Dependency Calculation:
|
||||||
|
*
|
||||||
|
* There are two major, and multiple minor, modes of dependency calculation
|
||||||
|
* supported by the MBS. The major modes are:
|
||||||
|
*
|
||||||
|
* 1. The build file generator invokes tool integrator provided methods
|
||||||
|
* that calculate all dependencies using whatever method the tool
|
||||||
|
* integrator wants. The build file generator then adds the dependencies
|
||||||
|
* to the build file using the appropriate build file syntax.
|
||||||
|
* This type of dependency calculator implements the
|
||||||
|
* IManagedDependencyCalculator interface defined in this module.
|
||||||
|
*
|
||||||
|
* One minor mode of this mode is to use a dependency calculator provided
|
||||||
|
* by a language integration (e.g. C, C++ or Fortran) that uses the
|
||||||
|
* language's parsing support to return information regarding source file
|
||||||
|
* dependencies. An example of this is using the C/C++ Indexer to
|
||||||
|
* compute dependencies.
|
||||||
|
*
|
||||||
|
* 2. The build file generator and the tool-chain cooperate in creating and
|
||||||
|
* using separate "dependency" files. In this case, dependency calculation
|
||||||
|
* is done at "build time", rather than at "build file generation time" as
|
||||||
|
* in mode #1. This currently supports the GNU concept of using .d files
|
||||||
|
* in GNU make. See the IManagedDependencyCommands and
|
||||||
|
* IManagedDependencyPreBuild interfaces for more information.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IManagedDependencyCalculator extends IManagedDependencyInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of source file specific dependencies.
|
||||||
|
*
|
||||||
|
* The paths can be either relative to the project directory, or absolute
|
||||||
|
* in the file system.
|
||||||
|
*
|
||||||
|
* @return IPath[]
|
||||||
|
*/
|
||||||
|
public IPath[] getDependencies();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of source file specific additional targets that the
|
||||||
|
* source file creates. Most source files will return null. An example
|
||||||
|
* of where additional targets should be returned is for a Fortran 90
|
||||||
|
* source file that creates one or more Fortran Modules.
|
||||||
|
*
|
||||||
|
* Note that these output files that are dependencies to other invocations
|
||||||
|
* of the same tool can be specified here, or as another output type
|
||||||
|
* of the tool. If the output file can be used as the input of a different
|
||||||
|
* tool, then use the output type mechanism.
|
||||||
|
*
|
||||||
|
* The paths can be either relative to the top build directory, or absolute
|
||||||
|
* in the file system.
|
||||||
|
*
|
||||||
|
* @return IPath[]
|
||||||
|
*/
|
||||||
|
public IPath[] getAdditionalTargets();
|
||||||
|
}
|
|
@ -0,0 +1,168 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 3.1
|
||||||
|
*
|
||||||
|
* A Tool dependency calculator may implement this interface or
|
||||||
|
* IManagedDependencyCalculator or IManagedDependencyPreBuild.
|
||||||
|
* An object implementing the interface is returned from a call to
|
||||||
|
* IManagedDependencyGenerator2.getDependencySourceInfo.
|
||||||
|
*
|
||||||
|
* Discussion of Dependency Calculation:
|
||||||
|
*
|
||||||
|
* There are two major, and multiple minor, modes of dependency calculation
|
||||||
|
* supported by the MBS. The major modes are:
|
||||||
|
*
|
||||||
|
* 1. The build file generator invokes tool integrator provided methods
|
||||||
|
* that calculate all dependencies using whatever method the tool
|
||||||
|
* integrator wants. The build file generator then adds the dependencies
|
||||||
|
* to the build file using the appropriate build file syntax.
|
||||||
|
* See the IManagedDependencyCalculator interface for more information.
|
||||||
|
*
|
||||||
|
* 2. The build file generator and the tool-chain cooperate in creating and
|
||||||
|
* using separate "dependency" files. The build file generator calls
|
||||||
|
* the dependency calculator to get the dependency file names and to get
|
||||||
|
* commands that need to be added to the build file. In this case,
|
||||||
|
* dependency calculation is done at "build time", rather than at
|
||||||
|
* "build file generation time" as in mode #1. This currently
|
||||||
|
* supports the GNU concept of using .d files in GNU make.
|
||||||
|
*
|
||||||
|
* There are multiple ways that these separate dependency files can
|
||||||
|
* be created by the tool-chain and used by the builder.
|
||||||
|
*
|
||||||
|
* a. In some cases (e.g., Fortran 90 using modules) the dependency files
|
||||||
|
* must be created/updated prior to invoking the build of the project
|
||||||
|
* artifact (e.g., an application). In this case, the dependency
|
||||||
|
* generation step must occur separately before the main build.
|
||||||
|
* See the IManagedDependencyPreBuild interface for more information.
|
||||||
|
*
|
||||||
|
* b. In other cases (e.g., C/C++) the dependency files can be created as
|
||||||
|
* a side effect of the main build. This implies that the up to date
|
||||||
|
* dependency files are not required for the current build, but for
|
||||||
|
* the next build. C/C++ builds can be treated in this manner as is
|
||||||
|
* described in the following link:
|
||||||
|
* http://sourceware.org/automake/automake.html#Dependency-Tracking-Evolution
|
||||||
|
*
|
||||||
|
* Use the IManagedDependencyCommands interface defined in this file
|
||||||
|
* for this mode.
|
||||||
|
*
|
||||||
|
* Two sub-scenarios of this mode are to:
|
||||||
|
*
|
||||||
|
* Create dependency files in the same invocation of the tool that
|
||||||
|
* creates the tool's build artifact - by adding additional options
|
||||||
|
* to the tool invocation command line.
|
||||||
|
*
|
||||||
|
* Create dependency files in a separate invocation of the tool, or
|
||||||
|
* by the invocation of another tool.
|
||||||
|
*
|
||||||
|
* MBS can also help in the generation of the dependency files. Prior to
|
||||||
|
* CDT 3.1, MBS and gcc cooperated in generating dependency files using the
|
||||||
|
* following steps:
|
||||||
|
*
|
||||||
|
* 1. Gcc is invoked to perform the compilation that generates the object
|
||||||
|
* file.
|
||||||
|
*
|
||||||
|
* 2. An "echo" command creates the .d file, adding the name of the .d
|
||||||
|
* file to the beginning of the newly created .d file. Note that this
|
||||||
|
* causes problems with some implementations of "echo" that don't
|
||||||
|
* work exactly the way that we want (e.g., it doesn't support the -n
|
||||||
|
* switch).
|
||||||
|
|
||||||
|
* 3. Gcc is invoked again with the appropriate additional command line
|
||||||
|
* options to append its dependency file information to the .d file
|
||||||
|
* that was created by "echo".
|
||||||
|
*
|
||||||
|
* 4. Steps 1 - 3 are invoked in the make file. Step 4 occurs after the
|
||||||
|
* make invocation has finished. In step 4, MBS code post-processes
|
||||||
|
* the .d files to add a dummy dependency for each header file, for
|
||||||
|
* the reason explained in the link above.
|
||||||
|
*
|
||||||
|
* This mode is no longer used by the default gcc implementation, but can
|
||||||
|
* still be used by selecting the DefaultGCCDependencyCalculator.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Note for GNU make: these separate dependency files are "include"d by
|
||||||
|
* a main makefile. Therefore, if the dependency files are required to
|
||||||
|
* be up to date before the main build begins, they must be updated by
|
||||||
|
* a separate invocation of make. Also, the configuration "clean" step
|
||||||
|
* must be invoked by a separate invocation of make. This is so that
|
||||||
|
* we can exclude the dependency files for a "make clean" invocation
|
||||||
|
* using syntax like:
|
||||||
|
*
|
||||||
|
* ifneq ($(MAKECMDGOALS), clean)
|
||||||
|
* -include $(DEPS)
|
||||||
|
* endif
|
||||||
|
*
|
||||||
|
* Otherwise, because GNU make attempts to re-make make files, we
|
||||||
|
* can end up with out of date or missing dependency files being
|
||||||
|
* re-generated and then immediately "clean"ed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IManagedDependencyCommands extends IManagedDependencyInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of generated dependency files.
|
||||||
|
*
|
||||||
|
* The paths can be either relative to the top build directory, or absolute
|
||||||
|
* in the file system.
|
||||||
|
*
|
||||||
|
* @return IPath[]
|
||||||
|
*/
|
||||||
|
public IPath[] getDependencyFiles();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the command lines to be invoked before the normal tool invocation
|
||||||
|
* to calculate dependencies.
|
||||||
|
*
|
||||||
|
* @return String[] This can be null or an empty array if no dependency
|
||||||
|
* generation command needs to be invoked before the normal
|
||||||
|
* tool invocation.
|
||||||
|
*/
|
||||||
|
public String[] getPreToolDependencyCommands();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the command line options to be used to calculate dependencies.
|
||||||
|
* The options are added to the normal tool invocation.
|
||||||
|
*
|
||||||
|
* @return 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[]?
|
||||||
|
*/
|
||||||
|
public String[] getDependencyCommandOptions();
|
||||||
|
// IMPLEMENTATION NOTE: This should be called from addRuleFromSource for both resconfig & non-resconfig
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the command lines to be invoked after the normal tool invocation
|
||||||
|
* to calculate dependencies.
|
||||||
|
*
|
||||||
|
* @return String[] This can be null or an empty array if no dependency
|
||||||
|
* generation commands needs to be invoked after the normal
|
||||||
|
* tool invocation
|
||||||
|
*/
|
||||||
|
public String[] getPostToolDependencyCommands();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean areCommandsGeneric();
|
||||||
|
}
|
|
@ -1,35 +1,27 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.makegen;
|
package org.eclipse.cdt.managedbuilder.makegen;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*
|
* @deprecated 3.1
|
||||||
* TODO: These methods should take IPath's rather than IResource's,
|
*
|
||||||
* because an output file from one tool can be used as an
|
* Use IManagedDependencyGenerator2 instead.
|
||||||
* input file to another, and it can be generated outside of the
|
*/
|
||||||
* project directory.
|
public interface IManagedDependencyGenerator extends IManagedDependencyGeneratorType {
|
||||||
* This will require a new interface.
|
|
||||||
*/
|
public IResource[] findDependencies(IResource resource, IProject project);
|
||||||
public interface IManagedDependencyGenerator {
|
public String getDependencyCommand(IResource resource, IManagedBuildInfo info);
|
||||||
public int TYPE_NODEPS = 0;
|
}
|
||||||
public int TYPE_COMMAND = 1;
|
|
||||||
public int TYPE_INDEXER = 2;
|
|
||||||
public int TYPE_EXTERNAL = 3;
|
|
||||||
|
|
||||||
public IResource[] findDependencies(IResource resource, IProject project);
|
|
||||||
public int getCalculatorType();
|
|
||||||
public String getDependencyCommand(IResource resource, IManagedBuildInfo info);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,89 +1,114 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005 IBM Corporation and others.
|
* Copyright (c) 2005, 2006 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation of IManagedDependencyGenerator
|
* IBM - Initial API and implementation of IManagedDependencyGenerator
|
||||||
* Intel - Initial API and implementation of IManagedDependencyGenerator2
|
* Intel - Initial API and implementation of IManagedDependencyGenerator2
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.makegen;
|
package org.eclipse.cdt.managedbuilder.makegen;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
/**
|
|
||||||
* @since NOT YET
|
/**
|
||||||
* This interface is PROPOSED and not yet used.
|
* @since 3.1
|
||||||
*
|
*
|
||||||
* A Tool dependency calculator must implement this interface. This interface
|
* A Tool dependency calculator must implement this interface. This interface
|
||||||
* replaces IManagedDependencyGenerator which is deprecated.
|
* replaces IManagedDependencyGenerator which is deprecated.
|
||||||
*
|
*
|
||||||
* Note: The IPath arguments to the methods below can be either relative to
|
* Discussion of Dependency Calculation:
|
||||||
* the project directory, or absolute in the file system.
|
*
|
||||||
*/
|
* There are two major, and multiple minor, modes of dependency calculation
|
||||||
public interface IManagedDependencyGenerator2 {
|
* supported by the MBS. The major modes are:
|
||||||
/**
|
*
|
||||||
* Constants returned by getCalculatorType
|
* 1. The build file generator invokes tool integrator provided methods
|
||||||
*/
|
* that calculate all dependencies using whatever method the tool
|
||||||
public int TYPE_NODEPS = 0;
|
* integrator wants. The build file generator then adds the dependencies
|
||||||
public int TYPE_COMMAND = 1;
|
* to the build file using the appropriate build file syntax.
|
||||||
public int TYPE_INDEXER = 2;
|
* This is a TYPE_CUSTOM dependency calculator as defined below.
|
||||||
public int TYPE_EXTERNAL = 3;
|
* See the IManagedDependencyCalculator interface for more information.
|
||||||
|
*
|
||||||
/**
|
* 2. The build file generator and the tool-chain cooperate in creating and
|
||||||
* Returns the type of dependency generator that is implemented.
|
* using separate "dependency" files. In this case, dependency calculation
|
||||||
*
|
* is done at "build time", rather than at "build file generation time" as
|
||||||
* TYPE_NODEPS indicates a NULL dependency generator
|
* in mode #1. This currently supports the GNU concept of using .d files
|
||||||
* TYPE_COMMAND indicates that a command line will be returned to be
|
* in GNU make.
|
||||||
* used to calculate dependencies. This currently supports compilers
|
* This is either a TYPE_BUILD_COMMANDS dependency calculator or a
|
||||||
* that generate .d files.
|
* TYPE_PREBUILD_COMMANDS dependency calculator as defined below.
|
||||||
* TYPE_INDEXER indicates that the CDT indexer should be used to
|
* See the IManagedDependencyCommands and IManagedDependencyPreBuild
|
||||||
* calculate the dependencies.
|
* interfaces for more information.
|
||||||
* TYPE_EXTERNAL indicates that a custom dependency calculator is
|
*
|
||||||
* implemented.
|
*/
|
||||||
*
|
|
||||||
* @return int
|
public interface IManagedDependencyGenerator2 extends IManagedDependencyGeneratorType {
|
||||||
*/
|
|
||||||
public int getCalculatorType();
|
/**
|
||||||
|
* Returns an instance of IManagedDependencyInfo for this source file.
|
||||||
/**
|
* IManagedDependencyCalculator, IManagedDependencyCommands
|
||||||
* Returns the list of dependencies for this source file.
|
* and IManagedDependencyPreBuild are all derived from
|
||||||
* The paths can be either relative to the project directory, or absolute
|
* IManagedDependencyInfo, and any one of the three can be returned.
|
||||||
* in the file system.
|
* This is called when getCalculatorType returns TYPE_BUILD_COMMANDS,
|
||||||
*
|
* TYPE_CUSTOM or TYPE_PREBUILD_COMMANDS.
|
||||||
* @param source The source file for which dependencies should be calculated
|
*
|
||||||
* @param info The IManagedBuildInfo of the project
|
* @param source The source file for which dependencies should be calculated
|
||||||
* @param tool The tool associated with the source file
|
* The IPath can be either relative to the project directory, or absolute in the file system.
|
||||||
* @param topBuildDirectory The top build directory of the project. This is
|
* @param buildContext The IConfiguration or IResourceConfiguration that
|
||||||
* the working directory for the tool.
|
* contains the context in which the source file will be built
|
||||||
* @return IPath[]
|
* @param tool The tool associated with the source file
|
||||||
*/
|
* @param topBuildDirectory The top build directory of the configuration. This is
|
||||||
public IPath[] findDependencies(
|
* the working directory for the tool. This IPath is relative to the project directory.
|
||||||
IPath source,
|
* @return IManagedDependencyInfo
|
||||||
IManagedBuildInfo info,
|
*/
|
||||||
ITool tool,
|
public IManagedDependencyInfo getDependencySourceInfo(
|
||||||
IPath topBuildDirectory);
|
IPath source,
|
||||||
|
IBuildObject buildContext,
|
||||||
/**
|
ITool tool,
|
||||||
*
|
IPath topBuildDirectory);
|
||||||
* Returns the command line to be used to calculate dependencies.
|
|
||||||
* This currently supports compilers that generate .d files
|
/**
|
||||||
*
|
* Returns the file extension used by dependency files created
|
||||||
* @param source The source file for which dependencies should be calculated
|
* by this dependency generator.
|
||||||
* @param info The IManagedBuildInfo of the project
|
* This is called when getCalculatorType returns TYPE_BUILD_COMMANDS or
|
||||||
* @param tool The tool associated with the source file
|
* TYPE_PREBUILD_COMMANDS.
|
||||||
* @param topBuildDirectory The top build directory of the project. This is
|
*
|
||||||
* the working directory for the tool.
|
* @param buildContext The IConfiguration that contains the context of the build
|
||||||
*
|
* @param tool The tool associated with the dependency generator.
|
||||||
* @return String
|
*
|
||||||
*/
|
* @return String
|
||||||
public String getDependencyCommand(
|
*/
|
||||||
IPath source,
|
public String getDependencyFileExtension(
|
||||||
IManagedBuildInfo info,
|
IConfiguration buildContext,
|
||||||
ITool tool,
|
ITool tool);
|
||||||
IPath topBuildDirectory);
|
|
||||||
}
|
/**
|
||||||
|
* Called to allow the dependency calculator to post-process dependency files.
|
||||||
|
* This method is called after the build has completed for at least every
|
||||||
|
* dependency file that has changed, and possibly for those that have not
|
||||||
|
* changed as well. It may also be called with dependency files created by
|
||||||
|
* another tool. This method should be able to recognize dependency files
|
||||||
|
* that don't belong to it, or that it has already post-processed.
|
||||||
|
* This is called when getCalculatorType returns TYPE_BUILD_COMMANDS or
|
||||||
|
* TYPE_PREBUILD_COMMANDS.
|
||||||
|
*
|
||||||
|
* @param dependencyFile The dependency file
|
||||||
|
* The IPath can be either relative to the top build directory, or absolute in the file system.
|
||||||
|
* @param buildContext The IConfiguration that contains the context of the build
|
||||||
|
* @param tool The tool associated with the dependency generator. Note that this is
|
||||||
|
* not necessarily the tool that created the dependency file
|
||||||
|
* @param topBuildDirectory The top build directory of the project. This is
|
||||||
|
* the working directory for the tool.
|
||||||
|
*
|
||||||
|
* @return boolean True if the method modified the dependency (e.g., .d) file
|
||||||
|
*/
|
||||||
|
public boolean postProcessDependencyFile(
|
||||||
|
IPath dependencyFile,
|
||||||
|
IConfiguration buildContext,
|
||||||
|
ITool tool,
|
||||||
|
IPath topBuildDirectory);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 3.1
|
||||||
|
*
|
||||||
|
* IManagedDependencyGenerator (deprecated) and IManagedDependencyGenerator2
|
||||||
|
* extend this interface.
|
||||||
|
*
|
||||||
|
* Discussion of Dependency Calculation:
|
||||||
|
*
|
||||||
|
* There are two major, and multiple minor, modes of dependency calculation
|
||||||
|
* supported by the MBS. The major modes are:
|
||||||
|
*
|
||||||
|
* 1. The build file generator invokes tool integrator provided methods
|
||||||
|
* that calculate all dependencies using whatever method the tool
|
||||||
|
* integrator wants. The build file generator then adds the dependencies
|
||||||
|
* to the build file using the appropriate build file syntax.
|
||||||
|
* This is a TYPE_CUSTOM dependency calculator as defined below.
|
||||||
|
* See the IManagedDependencyCalculator interface for more information.
|
||||||
|
*
|
||||||
|
* 2. The build file generator and the tool-chain cooperate in creating and
|
||||||
|
* using separate "dependency" files. In this case, dependency calculation
|
||||||
|
* is done at "build time", rather than at "build file generation time" as
|
||||||
|
* in mode #1. This currently supports the GNU concept of using .d files
|
||||||
|
* in GNU make.
|
||||||
|
* This is either a TYPE_BUILD_COMMANDS dependency calculator or a
|
||||||
|
* TYPE_PREBUILD_COMMANDS dependency calculator as defined below.
|
||||||
|
* See the IManagedDependencyCommands and IManagedDependencyPreBuild
|
||||||
|
* interfaces for more information.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IManagedDependencyGeneratorType {
|
||||||
|
/**
|
||||||
|
* Constants returned by getCalculatorType
|
||||||
|
*/
|
||||||
|
public int TYPE_NODEPS = 0; // Deprecated - use TYPE_NODEPENDENCIES
|
||||||
|
public int TYPE_COMMAND = 1; // Deprecated - use TYPE_BUILD_COMMANDS
|
||||||
|
public int TYPE_INDEXER = 2; // Deprecated - use TYPE_CUSTOM
|
||||||
|
public int TYPE_EXTERNAL = 3; // Deprecated - use TYPE_CUSTOM
|
||||||
|
public int TYPE_OLD_TYPE_LIMIT = 3;
|
||||||
|
|
||||||
|
// Use these types
|
||||||
|
public int TYPE_NODEPENDENCIES = 4;
|
||||||
|
public int TYPE_BUILD_COMMANDS = 5;
|
||||||
|
public int TYPE_PREBUILD_COMMANDS = 6;
|
||||||
|
public int TYPE_CUSTOM = 7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the type of dependency generator that is implemented.
|
||||||
|
*
|
||||||
|
* TYPE_NODEPENDENCIES indicates that no dependency generator is
|
||||||
|
* supplied or needed.
|
||||||
|
* TYPE_CUSTOM indicates that a custom, "build file generation time"
|
||||||
|
* dependency calculator is implemented. Note that the dependency
|
||||||
|
* calculator will be called when the makefile is generated, and
|
||||||
|
* for every source file that is built by this tool in the build
|
||||||
|
* file, not just for those that have changed since the last build
|
||||||
|
* file generation.
|
||||||
|
* TYPE_BUILD_COMMANDS indicates that command lines or options will
|
||||||
|
* be returned to be used to calculate dependencies. These
|
||||||
|
* commands/options are added to the build file to perform dependency
|
||||||
|
* calculation at "build time". This currently supports
|
||||||
|
* compilers/tools that generate .d files either as a
|
||||||
|
* side-effect of tool invocation, or as a separate step that is
|
||||||
|
* invoked immediately before or after the tool invocation.
|
||||||
|
* TYPE_PREBUILD_COMMANDS indicates that a separate build step is
|
||||||
|
* invoked, prior to the the normal build steps, to update the
|
||||||
|
* dependency information. These commands are added to the build
|
||||||
|
* file to perform dependency calculation at "build time". Note
|
||||||
|
* that this step will be invoked every time a build is done in
|
||||||
|
* order to determine if dependency files need to be re-generated.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int getCalculatorType();
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 3.1
|
||||||
|
*
|
||||||
|
* This interface is the base interface for IManagedDependencyCalculator,
|
||||||
|
* IManagedDependencyCommands and IManagedDependencyPreBuild. See these
|
||||||
|
* interfaces and IManagedDependencyGenerator2 for more information on
|
||||||
|
* writing a dependency calculator.
|
||||||
|
*
|
||||||
|
* The methods below simply return the arguments passed to the
|
||||||
|
* IManagedDependencyGenerator2.getDependency*Info call that created the
|
||||||
|
* IManagedDependencyInfo instance.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IManagedDependencyInfo {
|
||||||
|
public IPath getSource();
|
||||||
|
public IBuildObject getBuildContext();
|
||||||
|
public ITool getTool();
|
||||||
|
public IPath getTopBuildDirectory();
|
||||||
|
}
|
|
@ -0,0 +1,136 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 3.1
|
||||||
|
*
|
||||||
|
* A Tool dependency calculator may implement this interface or
|
||||||
|
* IManagedDependencyCalculator or IManagedDependencyCommands.
|
||||||
|
* An object implementing the interface is returned from a call to
|
||||||
|
* IManagedDependencyGenerator2.getDependencySourceInfo.
|
||||||
|
*
|
||||||
|
* Discussion of Dependency Calculation:
|
||||||
|
*
|
||||||
|
* There are two major, and multiple minor, modes of dependency calculation
|
||||||
|
* supported by the MBS. The major modes are:
|
||||||
|
*
|
||||||
|
* 1. The build file generator invokes tool integrator provided methods
|
||||||
|
* that calculate all dependencies using whatever method the tool
|
||||||
|
* integrator wants. The build file generator then adds the dependencies
|
||||||
|
* to the build file using the appropriate build file syntax.
|
||||||
|
* See the IManagedDependencyCalculator interface for more information.
|
||||||
|
*
|
||||||
|
* 2. The build file generator and the tool-chain cooperate in creating and
|
||||||
|
* using separate "dependency" files. The build file generator calls
|
||||||
|
* the dependency calculator to get the dependency file names and to get
|
||||||
|
* commands that need to be added to the build file. In this case,
|
||||||
|
* dependency calculation is done at "build time", rather than at
|
||||||
|
* "build file generation time" as in mode #1. This currently
|
||||||
|
* supports the GNU concept of using .d files in GNU make.
|
||||||
|
*
|
||||||
|
* There are multiple ways that these separate dependency files can
|
||||||
|
* be created by the tool-chain and used by the builder.
|
||||||
|
*
|
||||||
|
* a. In some cases (e.g., Fortran 90 using modules) the dependency files
|
||||||
|
* must be created/updated prior to invoking the build of the project
|
||||||
|
* artifact (e.g., an application). In this case, the dependency
|
||||||
|
* generation step must occur separately before the main build.
|
||||||
|
* Use the IManagedDependencyPreBuild interface defined in this file
|
||||||
|
* for this mode.
|
||||||
|
*
|
||||||
|
* b. In other cases (e.g., C/C++) the dependency files can be created as
|
||||||
|
* a side effect of the main build. This implies that the up to date
|
||||||
|
* dependency files are not required for the current build, but for
|
||||||
|
* the next build. C/C++ builds can be treated in this manner as is
|
||||||
|
* described in the following link:
|
||||||
|
* http://sourceware.org/automake/automake.html#Dependency-Tracking-Evolution
|
||||||
|
*
|
||||||
|
* See the IManagedDependencyCommands interface for more information.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Note for GNU make: these separate dependency files are "include"d by
|
||||||
|
* a main makefile. Make performs special processing on make files:
|
||||||
|
*
|
||||||
|
* "To this end, after reading in all makefiles, make will consider
|
||||||
|
* each as a goal target and attempt to update it. If a makefile has a
|
||||||
|
* rule which says how to update it (found either in that very
|
||||||
|
* makefile or in another one)..., it will be updated if necessary.
|
||||||
|
* After all makefiles have been checked, if any have actually been
|
||||||
|
* changed, make starts with a clean slate and reads all the makefiles
|
||||||
|
* over again."
|
||||||
|
*
|
||||||
|
* We can use this to ensure that the dependency files are up to date
|
||||||
|
* by adding rules to the make file for generating the dependency files.
|
||||||
|
* These rules are returned by the call to getDependencyCommands.
|
||||||
|
* However, this has a significant problem when we don’t want to build
|
||||||
|
* the build target, but only want to “clean” the configuration,
|
||||||
|
* for example. If we invoke make just to clean the configuration,
|
||||||
|
* make will still update the dependency files if necessary, thereby
|
||||||
|
* re-generating the dependency files only to immediately delete them.
|
||||||
|
* The workaround suggested by the make documentation is to check for
|
||||||
|
* an invocation using the “clean” target, and to not include the
|
||||||
|
* dependency files it that case. For example,
|
||||||
|
*
|
||||||
|
* ifneq ($(MAKECMDGOALS),clean)
|
||||||
|
* include $(DEPS)
|
||||||
|
* endif
|
||||||
|
*
|
||||||
|
* The restriction with this is that it only works if “clean” is the only
|
||||||
|
* target specified on the make command line. Therefore, the build
|
||||||
|
* "clean" step must be invoked separately.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IManagedDependencyPreBuild extends IManagedDependencyInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of generated dependency files.
|
||||||
|
*
|
||||||
|
* The paths can be either relative to the top build directory, or absolute
|
||||||
|
* in the file system.
|
||||||
|
*
|
||||||
|
* @return IPath[]
|
||||||
|
*/
|
||||||
|
public IPath[] getDependencyFiles();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name to be used in the build file to identify the separate
|
||||||
|
* build step. Note that this name should be unique to the tool since
|
||||||
|
* multiple tools in a tool-chain may be using this method of
|
||||||
|
* dependency calculation.
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public String getBuildStepName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the command line(s) to be invoked in the separate
|
||||||
|
* dependencies pre-build step.
|
||||||
|
*
|
||||||
|
* @return String[]
|
||||||
|
*/
|
||||||
|
public String[] getDependencyCommands();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the command lines 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
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean areCommandsGeneric();
|
||||||
|
}
|
|
@ -1,300 +1,300 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.makegen.gnu;
|
package org.eclipse.cdt.managedbuilder.makegen.gnu;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
|
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.macros.FileContextData;
|
import org.eclipse.cdt.managedbuilder.internal.macros.FileContextData;
|
||||||
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
|
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
|
||||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
||||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerator {
|
public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerator {
|
||||||
|
|
||||||
private static final String EMPTY_STRING = new String();
|
private static final String EMPTY_STRING = new String();
|
||||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||||
public final String WHITESPACE = " "; //$NON-NLS-1$
|
public final String WHITESPACE = " "; //$NON-NLS-1$
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#findDependencies(org.eclipse.core.resources.IResource)
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#findDependencies(org.eclipse.core.resources.IResource)
|
||||||
*/
|
*/
|
||||||
public IResource[] findDependencies(IResource resource, IProject project) {
|
public IResource[] findDependencies(IResource resource, IProject project) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#getCalculatorType()
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#getCalculatorType()
|
||||||
*/
|
*/
|
||||||
public int getCalculatorType() {
|
public int getCalculatorType() {
|
||||||
return TYPE_COMMAND;
|
return TYPE_COMMAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#getDependencyCommand()
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#getDependencyCommand()
|
||||||
*/
|
*/
|
||||||
public String getDependencyCommand(IResource resource, IManagedBuildInfo info) {
|
public String getDependencyCommand(IResource resource, IManagedBuildInfo info) {
|
||||||
/*
|
/*
|
||||||
* For a given input, <path>/<resource_name>.<ext>, return a string containing
|
* For a given input, <path>/<resource_name>.<ext>, return a string containing
|
||||||
* echo -n $(@:%.<out_ext>=%.d) '<path>/' >> $(@:%.<out_ext>=%.d) && \
|
* echo -n $(@:%.<out_ext>=%.d) '<path>/' >> $(@:%.<out_ext>=%.d) && \
|
||||||
* <tool_command> -P -MM -MG <tool_flags> $< >> $(@:%.<out_ext>=%.d)
|
* <tool_command> -P -MM -MG <tool_flags> $< >> $(@:%.<out_ext>=%.d)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
|
||||||
// Get what we need to create the dependency generation command
|
// Get what we need to create the dependency generation command
|
||||||
IConfiguration config = info.getDefaultConfiguration();
|
IConfiguration config = info.getDefaultConfiguration();
|
||||||
|
|
||||||
// We need to check whether we have any resource specific build information.
|
// We need to check whether we have any resource specific build information.
|
||||||
IResourceConfiguration resConfig = null;
|
IResourceConfiguration resConfig = null;
|
||||||
if( config != null ) resConfig = config.getResourceConfiguration(resource.getFullPath().toString());
|
if( config != null ) resConfig = config.getResourceConfiguration(resource.getFullPath().toString());
|
||||||
|
|
||||||
String inputExtension = resource.getFileExtension();
|
String inputExtension = resource.getFileExtension();
|
||||||
String outputExtension = info.getOutputExtension(inputExtension);
|
String outputExtension = info.getOutputExtension(inputExtension);
|
||||||
|
|
||||||
// Work out the build-relative path for the output files
|
// Work out the build-relative path for the output files
|
||||||
IContainer resourceLocation = resource.getParent();
|
IContainer resourceLocation = resource.getParent();
|
||||||
String relativePath = new String();
|
String relativePath = new String();
|
||||||
if (resourceLocation != null) {
|
if (resourceLocation != null) {
|
||||||
relativePath += resourceLocation.getProjectRelativePath().toString();
|
relativePath += resourceLocation.getProjectRelativePath().toString();
|
||||||
}
|
}
|
||||||
if (relativePath.length() > 0) {
|
if (relativePath.length() > 0) {
|
||||||
relativePath += IManagedBuilderMakefileGenerator.SEPARATOR;
|
relativePath += IManagedBuilderMakefileGenerator.SEPARATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the dependency rule
|
// Calculate the dependency rule
|
||||||
// <path>/$(@:%.<out_ext>=%.d)
|
// <path>/$(@:%.<out_ext>=%.d)
|
||||||
String depRule = "'$(@:%." + //$NON-NLS-1$
|
String depRule = "'$(@:%." + //$NON-NLS-1$
|
||||||
outputExtension +
|
outputExtension +
|
||||||
"=%." + //$NON-NLS-1$
|
"=%." + //$NON-NLS-1$
|
||||||
IManagedBuilderMakefileGenerator.DEP_EXT +
|
IManagedBuilderMakefileGenerator.DEP_EXT +
|
||||||
")'"; //$NON-NLS-1$
|
")'"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Add the rule that will actually create the right format for the dep
|
// Add the rule that will actually create the right format for the dep
|
||||||
buffer.append(IManagedBuilderMakefileGenerator.TAB +
|
buffer.append(IManagedBuilderMakefileGenerator.TAB +
|
||||||
IManagedBuilderMakefileGenerator.ECHO +
|
IManagedBuilderMakefileGenerator.ECHO +
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
"-n" + //$NON-NLS-1$
|
"-n" + //$NON-NLS-1$
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
depRule +
|
depRule +
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
"$(dir $@)" + //$NON-NLS-1$
|
"$(dir $@)" + //$NON-NLS-1$
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
">" + //$NON-NLS-1$
|
">" + //$NON-NLS-1$
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
depRule +
|
depRule +
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
IManagedBuilderMakefileGenerator.LOGICAL_AND +
|
IManagedBuilderMakefileGenerator.LOGICAL_AND +
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
IManagedBuilderMakefileGenerator.LINEBREAK);
|
IManagedBuilderMakefileGenerator.LINEBREAK);
|
||||||
|
|
||||||
// Add the line that will do the work to calculate dependencies
|
// Add the line that will do the work to calculate dependencies
|
||||||
IManagedCommandLineInfo cmdLInfo = null;
|
IManagedCommandLineInfo cmdLInfo = null;
|
||||||
String buildCmd = null;
|
String buildCmd = null;
|
||||||
String[] inputs= new String[1]; inputs[0] = IManagedBuilderMakefileGenerator.IN_MACRO;
|
String[] inputs= new String[1]; inputs[0] = IManagedBuilderMakefileGenerator.IN_MACRO;
|
||||||
String outflag = ""; //$NON-NLS-1$
|
String outflag = ""; //$NON-NLS-1$
|
||||||
String outputPrefix = ""; //$NON-NLS-1$
|
String outputPrefix = ""; //$NON-NLS-1$
|
||||||
String outputFile = ""; //$NON-NLS-1$
|
String outputFile = ""; //$NON-NLS-1$
|
||||||
ITool[] tools;
|
ITool[] tools;
|
||||||
if( resConfig != null && (tools = resConfig.getToolsToInvoke()) != null && tools.length > 0) {
|
if( resConfig != null && (tools = resConfig.getToolsToInvoke()) != null && tools.length > 0) {
|
||||||
ITool tool = tools[0];
|
ITool tool = tools[0];
|
||||||
String cmd = tool.getToolCommand();
|
String cmd = tool.getToolCommand();
|
||||||
//try to resolve the build macros in the tool command
|
//try to resolve the build macros in the tool command
|
||||||
try {
|
try {
|
||||||
String resolvedCommand = null;
|
String resolvedCommand = null;
|
||||||
|
|
||||||
// does the resource have spaces in its name?
|
// does the resource have spaces in its name?
|
||||||
if (resource.getProjectRelativePath().toString().indexOf(" ") != -1) {
|
if (resource.getProjectRelativePath().toString().indexOf(" ") != -1) {
|
||||||
// use fully qualified strings
|
// use fully qualified strings
|
||||||
resolvedCommand = ManagedBuildManager
|
resolvedCommand = ManagedBuildManager
|
||||||
.getBuildMacroProvider()
|
.getBuildMacroProvider()
|
||||||
.resolveValueToMakefileFormat(
|
.resolveValueToMakefileFormat(
|
||||||
cmd,
|
cmd,
|
||||||
"", //$NON-NLS-1$
|
"", //$NON-NLS-1$
|
||||||
" ", //$NON-NLS-1$
|
" ", //$NON-NLS-1$
|
||||||
IBuildMacroProvider.CONTEXT_FILE,
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
new FileContextData(resource.getLocation(),
|
new FileContextData(resource.getLocation(),
|
||||||
null, null, tool));
|
null, null, tool));
|
||||||
} else {
|
} else {
|
||||||
// use builder variables
|
// use builder variables
|
||||||
resolvedCommand = ManagedBuildManager
|
resolvedCommand = ManagedBuildManager
|
||||||
.getBuildMacroProvider()
|
.getBuildMacroProvider()
|
||||||
.resolveValueToMakefileFormat(
|
.resolveValueToMakefileFormat(
|
||||||
cmd,
|
cmd,
|
||||||
"", //$NON-NLS-1$
|
"", //$NON-NLS-1$
|
||||||
" ", //$NON-NLS-1$
|
" ", //$NON-NLS-1$
|
||||||
IBuildMacroProvider.CONTEXT_FILE,
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
new FileContextData(resource.getLocation(),
|
new FileContextData(resource.getLocation(),
|
||||||
null, null, tool));
|
null, null, tool));
|
||||||
}
|
}
|
||||||
|
|
||||||
if((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
if((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
||||||
cmd = resolvedCommand;
|
cmd = resolvedCommand;
|
||||||
|
|
||||||
} catch (BuildMacroException e){
|
} catch (BuildMacroException e){
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] toolFlags = null;
|
String[] toolFlags = null;
|
||||||
try {
|
try {
|
||||||
toolFlags = tool.getToolCommandFlags(resource.getLocation(),null);
|
toolFlags = tool.getToolCommandFlags(resource.getLocation(),null);
|
||||||
} catch( BuildException ex ) {
|
} catch( BuildException ex ) {
|
||||||
// TODO add some routines to catch this
|
// TODO add some routines to catch this
|
||||||
toolFlags = EMPTY_STRING_ARRAY;
|
toolFlags = EMPTY_STRING_ARRAY;
|
||||||
}
|
}
|
||||||
String[] flags = new String[toolFlags.length + 4];
|
String[] flags = new String[toolFlags.length + 4];
|
||||||
flags[0] = "-MM"; //$NON-NLS-1$
|
flags[0] = "-MM"; //$NON-NLS-1$
|
||||||
flags[1] = "-MG"; //$NON-NLS-1$
|
flags[1] = "-MG"; //$NON-NLS-1$
|
||||||
flags[2] = "-P"; //$NON-NLS-1$
|
flags[2] = "-P"; //$NON-NLS-1$
|
||||||
flags[3] = "-w"; //$NON-NLS-1$
|
flags[3] = "-w"; //$NON-NLS-1$
|
||||||
for (int i=0; i<toolFlags.length; i++) {
|
for (int i=0; i<toolFlags.length; i++) {
|
||||||
flags[4+i] = toolFlags[i];
|
flags[4+i] = toolFlags[i];
|
||||||
}
|
}
|
||||||
IManagedCommandLineGenerator cmdLGen = tool.getCommandLineGenerator();
|
IManagedCommandLineGenerator cmdLGen = tool.getCommandLineGenerator();
|
||||||
cmdLInfo = cmdLGen.generateCommandLineInfo( tool, cmd, flags, outflag, outputPrefix,
|
cmdLInfo = cmdLGen.generateCommandLineInfo( tool, cmd, flags, outflag, outputPrefix,
|
||||||
outputFile, inputs, tool.getCommandLinePattern() );
|
outputFile, inputs, tool.getCommandLinePattern() );
|
||||||
buildCmd = cmdLInfo.getCommandLine();
|
buildCmd = cmdLInfo.getCommandLine();
|
||||||
|
|
||||||
// resolve any remaining macros in the command after it has been generated
|
// resolve any remaining macros in the command after it has been generated
|
||||||
try {
|
try {
|
||||||
String resolvedCommand = null;
|
String resolvedCommand = null;
|
||||||
|
|
||||||
// does the resource have spaces in its name?
|
// does the resource have spaces in its name?
|
||||||
if (resource.getProjectRelativePath().toString().indexOf(" ") != -1) {
|
if (resource.getProjectRelativePath().toString().indexOf(" ") != -1) {
|
||||||
// use fully qualified strings
|
// use fully qualified strings
|
||||||
resolvedCommand = ManagedBuildManager
|
resolvedCommand = ManagedBuildManager
|
||||||
.getBuildMacroProvider()
|
.getBuildMacroProvider()
|
||||||
.resolveValueToMakefileFormat(
|
.resolveValueToMakefileFormat(
|
||||||
buildCmd,
|
buildCmd,
|
||||||
"", //$NON-NLS-1$
|
"", //$NON-NLS-1$
|
||||||
" ", //$NON-NLS-1$
|
" ", //$NON-NLS-1$
|
||||||
IBuildMacroProvider.CONTEXT_FILE,
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
new FileContextData(resource.getLocation(),
|
new FileContextData(resource.getLocation(),
|
||||||
null, null, tool));
|
null, null, tool));
|
||||||
} else {
|
} else {
|
||||||
// use builder variables
|
// use builder variables
|
||||||
resolvedCommand = ManagedBuildManager
|
resolvedCommand = ManagedBuildManager
|
||||||
.getBuildMacroProvider()
|
.getBuildMacroProvider()
|
||||||
.resolveValueToMakefileFormat(
|
.resolveValueToMakefileFormat(
|
||||||
buildCmd,
|
buildCmd,
|
||||||
"", //$NON-NLS-1$
|
"", //$NON-NLS-1$
|
||||||
" ", //$NON-NLS-1$
|
" ", //$NON-NLS-1$
|
||||||
IBuildMacroProvider.CONTEXT_FILE,
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
new FileContextData(resource.getLocation(),
|
new FileContextData(resource.getLocation(),
|
||||||
null, null, tool));
|
null, null, tool));
|
||||||
}
|
}
|
||||||
if((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
if((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
||||||
buildCmd = resolvedCommand;
|
buildCmd = resolvedCommand;
|
||||||
|
|
||||||
} catch (BuildMacroException e){
|
} catch (BuildMacroException e){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ITool tool = null;
|
ITool tool = null;
|
||||||
tools = config.getFilteredTools();
|
tools = config.getFilteredTools();
|
||||||
for (int index = 0; index < tools.length; index++) {
|
for (int index = 0; index < tools.length; index++) {
|
||||||
ITool tmp = tools[index];
|
ITool tmp = tools[index];
|
||||||
if (tmp.buildsFileType(inputExtension)) {
|
if (tmp.buildsFileType(inputExtension)) {
|
||||||
tool = tmp;
|
tool = tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String cmd = tool != null ? tool.getToolCommand() : null;
|
String cmd = tool != null ? tool.getToolCommand() : null;
|
||||||
|
|
||||||
//try to resolve the build macros in the tool command
|
//try to resolve the build macros in the tool command
|
||||||
try{
|
try{
|
||||||
String resolvedCommand = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(cmd,
|
String resolvedCommand = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(cmd,
|
||||||
"", //$NON-NLS-1$
|
"", //$NON-NLS-1$
|
||||||
" ", //$NON-NLS-1$
|
" ", //$NON-NLS-1$
|
||||||
IBuildMacroProvider.CONTEXT_FILE,
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
new FileContextData(resource.getLocation(),null,null,tool));
|
new FileContextData(resource.getLocation(),null,null,tool));
|
||||||
if((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
if((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
||||||
cmd = resolvedCommand;
|
cmd = resolvedCommand;
|
||||||
|
|
||||||
} catch (BuildMacroException e){
|
} catch (BuildMacroException e){
|
||||||
}
|
}
|
||||||
|
|
||||||
String buildFlags = "-MM -MG -P -w " + info.getToolFlagsForSource(inputExtension, resource.getLocation(), null); //$NON-NLS-1$
|
String buildFlags = "-MM -MG -P -w " + info.getToolFlagsForSource(inputExtension, resource.getLocation(), null); //$NON-NLS-1$
|
||||||
String[] flags = buildFlags.split( "\\s" ); //$NON-NLS-1$
|
String[] flags = buildFlags.split( "\\s" ); //$NON-NLS-1$
|
||||||
cmdLInfo = info.generateToolCommandLineInfo( inputExtension, flags, outflag, outputPrefix,
|
cmdLInfo = info.generateToolCommandLineInfo( inputExtension, flags, outflag, outputPrefix,
|
||||||
outputFile, inputs, resource.getLocation(), null);
|
outputFile, inputs, resource.getLocation(), null);
|
||||||
// The command to build
|
// The command to build
|
||||||
if( cmdLInfo == null ) buildCmd =
|
if( cmdLInfo == null ) buildCmd =
|
||||||
cmd +
|
cmd +
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
"-MM -MG -P -w " + //$NON-NLS-1$
|
"-MM -MG -P -w " + //$NON-NLS-1$
|
||||||
buildFlags +
|
buildFlags +
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
IManagedBuilderMakefileGenerator.IN_MACRO;
|
IManagedBuilderMakefileGenerator.IN_MACRO;
|
||||||
else {
|
else {
|
||||||
buildCmd = cmdLInfo.getCommandLine();
|
buildCmd = cmdLInfo.getCommandLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolve any remaining macros in the command after it has been
|
// resolve any remaining macros in the command after it has been
|
||||||
// generated
|
// generated
|
||||||
try {
|
try {
|
||||||
String resolvedCommand = null;
|
String resolvedCommand = null;
|
||||||
|
|
||||||
// does the resource have spaces in its name?
|
// does the resource have spaces in its name?
|
||||||
if (resource.getProjectRelativePath().toString().indexOf(" ") != -1) {
|
if (resource.getProjectRelativePath().toString().indexOf(" ") != -1) {
|
||||||
// use fully qualified strings
|
// use fully qualified strings
|
||||||
resolvedCommand = ManagedBuildManager
|
resolvedCommand = ManagedBuildManager
|
||||||
.getBuildMacroProvider()
|
.getBuildMacroProvider()
|
||||||
.resolveValueToMakefileFormat(
|
.resolveValueToMakefileFormat(
|
||||||
buildCmd,
|
buildCmd,
|
||||||
"", //$NON-NLS-1$
|
"", //$NON-NLS-1$
|
||||||
" ", //$NON-NLS-1$
|
" ", //$NON-NLS-1$
|
||||||
IBuildMacroProvider.CONTEXT_FILE,
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
new FileContextData(resource.getLocation(),
|
new FileContextData(resource.getLocation(),
|
||||||
null, null, tool));
|
null, null, tool));
|
||||||
} else {
|
} else {
|
||||||
// use builder variables
|
// use builder variables
|
||||||
resolvedCommand = ManagedBuildManager
|
resolvedCommand = ManagedBuildManager
|
||||||
.getBuildMacroProvider()
|
.getBuildMacroProvider()
|
||||||
.resolveValueToMakefileFormat(
|
.resolveValueToMakefileFormat(
|
||||||
buildCmd,
|
buildCmd,
|
||||||
"", //$NON-NLS-1$
|
"", //$NON-NLS-1$
|
||||||
" ", //$NON-NLS-1$
|
" ", //$NON-NLS-1$
|
||||||
IBuildMacroProvider.CONTEXT_FILE,
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
new FileContextData(resource.getLocation(),
|
new FileContextData(resource.getLocation(),
|
||||||
null, null, tool));
|
null, null, tool));
|
||||||
}
|
}
|
||||||
if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
||||||
buildCmd = resolvedCommand;
|
buildCmd = resolvedCommand;
|
||||||
|
|
||||||
} catch (BuildMacroException e) {
|
} catch (BuildMacroException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.append(IManagedBuilderMakefileGenerator.TAB +
|
buffer.append(IManagedBuilderMakefileGenerator.TAB +
|
||||||
buildCmd +
|
buildCmd +
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
">>" + //$NON-NLS-1$
|
">>" + //$NON-NLS-1$
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE + depRule );
|
IManagedBuilderMakefileGenerator.WHITESPACE + depRule );
|
||||||
|
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.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.cdt.managedbuilder.makegen.IManagedDependencyPreBuild;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This dependency calculator uses the GCC -MMD -MF -MP -MQ 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 dependency calculator uses the class DefaultGCCDependencyCalculator2Commands
|
||||||
|
* which implements the per-source command information
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DefaultGCCDependencyCalculator2 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 DefaultGCCDependencyCalculator2Commands(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) {
|
||||||
|
// Nothing
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,203 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.IBuildObject;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.macros.FileContextData;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.macros.MacroResolver;
|
||||||
|
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 GCC -MMD -MF -MP -MQ 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DefaultGCCDependencyCalculator2Commands implements
|
||||||
|
IManagedDependencyCommands {
|
||||||
|
|
||||||
|
// Member variables set by the constructor
|
||||||
|
IPath source;
|
||||||
|
IBuildObject buildContext;
|
||||||
|
ITool tool;
|
||||||
|
IPath topBuildDirectory;
|
||||||
|
|
||||||
|
// Other Member variables
|
||||||
|
IProject project;
|
||||||
|
IPath sourceLocation;
|
||||||
|
IPath outputLocation;
|
||||||
|
boolean needExplicitRuleForFile;
|
||||||
|
Boolean genericCommands = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 DefaultGCCDependencyCalculator2Commands(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) {
|
||||||
|
IConfiguration config = (IConfiguration)buildContext;
|
||||||
|
project = (IProject)config.getOwner();
|
||||||
|
} else if (buildContext instanceof IResourceConfiguration) {
|
||||||
|
IResourceConfiguration resConfig = (IResourceConfiguration)buildContext;
|
||||||
|
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 (needExplicitRuleForFile) genericCommands = new Boolean(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#areCommandsGeneric()
|
||||||
|
*/
|
||||||
|
public boolean areCommandsGeneric() {
|
||||||
|
if (genericCommands == null) genericCommands = new Boolean(true);
|
||||||
|
return genericCommands.booleanValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#getDependencyCommandOptions()
|
||||||
|
*/
|
||||||
|
public String[] getDependencyCommandOptions() {
|
||||||
|
|
||||||
|
String[] options = new String[4];
|
||||||
|
// -MMD
|
||||||
|
options[0] = "-MMD"; //$NON-NLS-1$
|
||||||
|
// -MP
|
||||||
|
options[1] = "-MP"; //$NON-NLS-1$
|
||||||
|
// -MF$(@:%.o=%.d)
|
||||||
|
options[2] = "-MF\"$(@:%.o=%.d)\""; //$NON-NLS-1$
|
||||||
|
//options[2] = "-MF\"${OutputDirRelPath}${OutputFileBaseName}.d\""; //$NON-NLS-1$
|
||||||
|
if( buildContext instanceof IResourceConfiguration || needExplicitRuleForFile ) {
|
||||||
|
IPath outPath = getDependencyFiles()[0];
|
||||||
|
// -MT"dependecy-file-name"
|
||||||
|
String optTxt = "-MT\""; //$NON-NLS-1$
|
||||||
|
optTxt += GnuMakefileGenerator.escapeWhitespaces(outPath.toString()) + "\""; //$NON-NLS-1$
|
||||||
|
options[3] = optTxt;
|
||||||
|
} else {
|
||||||
|
// -MT"$(@:%.o=%.d) %.o"
|
||||||
|
options[3] = "-MT\"$(@:%.o=%.d)\""; //$NON-NLS-1$
|
||||||
|
//options[3] = "-MT\"${OutputDirRelPath}${OutputFileBaseName}.d\""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (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() {
|
||||||
|
// Nothing
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#getPreToolDependencyCommands()
|
||||||
|
*/
|
||||||
|
public String[] getPreToolDependencyCommands() {
|
||||||
|
// Nothing
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo#getBuildContext()
|
||||||
|
*/
|
||||||
|
public IBuildObject getBuildContext() {
|
||||||
|
return buildContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo#getSource()
|
||||||
|
*/
|
||||||
|
public IPath getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo#getTool()
|
||||||
|
*/
|
||||||
|
public ITool getTool() {
|
||||||
|
return tool;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo#getTopBuildDirectory()
|
||||||
|
*/
|
||||||
|
public IPath getTopBuildDirectory() {
|
||||||
|
return topBuildDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.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.cdt.managedbuilder.makegen.IManagedDependencyPreBuild;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This dependency calculator uses the GCC -MM -MF -MP -MQ options in order to
|
||||||
|
* generate .d files as separate step prior to the source compilations.
|
||||||
|
*
|
||||||
|
* This dependency calculator uses the class DefaultGCCDependencyCalculatorPreBuildCommands
|
||||||
|
* which implements the per-source command information
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DefaultGCCDependencyCalculatorPreBuild implements
|
||||||
|
IManagedDependencyGenerator2 {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType#getCalculatorType()
|
||||||
|
*/
|
||||||
|
public int getCalculatorType() {
|
||||||
|
return TYPE_PREBUILD_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 DefaultGCCDependencyCalculatorPreBuildCommands(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) {
|
||||||
|
// Nothing
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,308 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.IManagedDependencyPreBuild;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This dependency calculator uses the GCC -MM -MF -MP -MT options in order to
|
||||||
|
* generate .d files as separate step prior to the source compilations.
|
||||||
|
*
|
||||||
|
* This dependency calculator uses the class DefaultGCCDependencyCalculatorPreBuildCommands
|
||||||
|
* which implements the per-source command information
|
||||||
|
*
|
||||||
|
* This class is used with DefaultGCCDependencyCalculatorPreBuild.
|
||||||
|
*
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DefaultGCCDependencyCalculatorPreBuildCommands implements IManagedDependencyPreBuild {
|
||||||
|
|
||||||
|
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;
|
||||||
|
IPath sourceLocation;
|
||||||
|
IPath outputLocation;
|
||||||
|
boolean needExplicitRuleForFile;
|
||||||
|
Boolean genericCommands = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 DefaultGCCDependencyCalculatorPreBuildCommands(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) {
|
||||||
|
IConfiguration config = (IConfiguration)buildContext;
|
||||||
|
project = (IProject)config.getOwner();
|
||||||
|
} else if (buildContext instanceof IResourceConfiguration) {
|
||||||
|
IResourceConfiguration resConfig = (IResourceConfiguration)buildContext;
|
||||||
|
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 (needExplicitRuleForFile) genericCommands = new Boolean(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areCommandsGeneric() {
|
||||||
|
if (genericCommands != null) return genericCommands.booleanValue();
|
||||||
|
// If the context is a Configuration, yes
|
||||||
|
if (buildContext instanceof IConfiguration) {
|
||||||
|
genericCommands = new Boolean(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// If the context is a Resource Configuration, determine if it overrides any
|
||||||
|
// of its parent configuration's options that would affect dependency file
|
||||||
|
// generation.
|
||||||
|
// TODO
|
||||||
|
genericCommands = new Boolean(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBuildStepName() {
|
||||||
|
return new String("GCC_DEPENDS"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getDependencyCommands() {
|
||||||
|
|
||||||
|
String[] commands = new String[1];
|
||||||
|
String depCmd = EMPTY_STRING;
|
||||||
|
|
||||||
|
// Get and resolve the command
|
||||||
|
String cmd = tool.getToolCommand();
|
||||||
|
try {
|
||||||
|
String resolvedCommand = null;
|
||||||
|
if (!needExplicitRuleForFile) {
|
||||||
|
resolvedCommand = ManagedBuildManager.getBuildMacroProvider()
|
||||||
|
.resolveValueToMakefileFormat(
|
||||||
|
cmd,
|
||||||
|
EMPTY_STRING,
|
||||||
|
IManagedBuilderMakefileGenerator.WHITESPACE,
|
||||||
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
|
new FileContextData(sourceLocation,
|
||||||
|
outputLocation, null, tool));
|
||||||
|
} else {
|
||||||
|
// if we need an explicit rule then don't use any builder
|
||||||
|
// variables, resolve everything
|
||||||
|
// to explicit strings
|
||||||
|
resolvedCommand = ManagedBuildManager.getBuildMacroProvider()
|
||||||
|
.resolveValue(
|
||||||
|
cmd,
|
||||||
|
EMPTY_STRING,
|
||||||
|
IManagedBuilderMakefileGenerator.WHITESPACE,
|
||||||
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
|
new FileContextData(sourceLocation,
|
||||||
|
outputLocation, null, tool));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
||||||
|
cmd = resolvedCommand;
|
||||||
|
|
||||||
|
} catch (BuildMacroException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
IManagedCommandLineInfo cmdLInfo = null;
|
||||||
|
|
||||||
|
// Set up the command line options that will generate the dependency file
|
||||||
|
Vector options = new Vector();
|
||||||
|
// -w
|
||||||
|
options.add("-w"); //$NON-NLS-1$
|
||||||
|
// -MM
|
||||||
|
options.add("-MM"); //$NON-NLS-1$
|
||||||
|
// -MP
|
||||||
|
options.add("-MP"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
String optTxt;
|
||||||
|
|
||||||
|
if( buildContext instanceof IResourceConfiguration || needExplicitRuleForFile ) {
|
||||||
|
IPath outPath = getDependencyFiles()[0];
|
||||||
|
// -MT"dependecy-file-name"
|
||||||
|
optTxt = "-MT\""; //$NON-NLS-1$
|
||||||
|
optTxt += GnuMakefileGenerator.escapeWhitespaces(outPath.toString()) + "\""; //$NON-NLS-1$
|
||||||
|
options.add(optTxt);
|
||||||
|
// -MT"object-file-filename"
|
||||||
|
optTxt = "-MT\""; //$NON-NLS-1$
|
||||||
|
GnuMakefileGenerator.escapeWhitespaces((outPath.removeFileExtension()).toString());
|
||||||
|
String outExt = tool.getOutputExtension(source.getFileExtension());
|
||||||
|
if (outExt != null) optTxt += "." + outExt; //$NON-NLS-1$
|
||||||
|
optTxt += "\""; //$NON-NLS-1$
|
||||||
|
options.add(optTxt);
|
||||||
|
} else {
|
||||||
|
// -MT"$@"
|
||||||
|
options.add("-MT\"$@\""); //$NON-NLS-1$
|
||||||
|
// -MT'$(@:%.d=%.o)'
|
||||||
|
optTxt = "-MT\"$(@:%.d=%.o)\""; //$NON-NLS-1$
|
||||||
|
//optTxt = "-MT\"${OutputDirRelPath}${OutputFileBaseName}";
|
||||||
|
//if (outExt != null) optTxt += "." + outExt;
|
||||||
|
//optTxt += "\""; //$NON-NLS-1$
|
||||||
|
options.add(optTxt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the -I, -D, -U options and discard the rest
|
||||||
|
try {
|
||||||
|
String[] allFlags = tool.getToolCommandFlags(sourceLocation, outputLocation);
|
||||||
|
for (int i=0; i<allFlags.length; i++) {
|
||||||
|
if (allFlags[i].startsWith("-I") || //$NON-NLS-1$
|
||||||
|
allFlags[i].startsWith("-D") || //$NON-NLS-1$
|
||||||
|
allFlags[i].startsWith("-U")) { //$NON-NLS-1$
|
||||||
|
options.add(allFlags[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch( BuildException ex ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the command line generator
|
||||||
|
IManagedCommandLineGenerator cmdLGen = tool.getCommandLineGenerator();
|
||||||
|
String[] flags = (String[])options.toArray(new String[options.size()]);
|
||||||
|
String[] inputs = new String[1];
|
||||||
|
inputs[0] = IManagedBuilderMakefileGenerator.IN_MACRO;
|
||||||
|
cmdLInfo = cmdLGen.generateCommandLineInfo(
|
||||||
|
tool, cmd, flags, "-MF", EMPTY_STRING, //$NON-NLS-1$
|
||||||
|
IManagedBuilderMakefileGenerator.OUT_MACRO,
|
||||||
|
inputs,
|
||||||
|
tool.getCommandLinePattern() );
|
||||||
|
|
||||||
|
// The command to build
|
||||||
|
if (cmdLInfo != null) {
|
||||||
|
depCmd = cmdLInfo.getCommandLine();
|
||||||
|
|
||||||
|
// resolve any remaining macros in the command after it has been
|
||||||
|
// generated
|
||||||
|
try {
|
||||||
|
String resolvedCommand;
|
||||||
|
IBuildMacroProvider provider = ManagedBuildManager.getBuildMacroProvider();
|
||||||
|
if (!needExplicitRuleForFile) {
|
||||||
|
resolvedCommand = provider.resolveValueToMakefileFormat(
|
||||||
|
depCmd,
|
||||||
|
EMPTY_STRING,
|
||||||
|
IManagedBuilderMakefileGenerator.WHITESPACE,
|
||||||
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
|
new FileContextData(sourceLocation,
|
||||||
|
outputLocation, null, tool));
|
||||||
|
} else {
|
||||||
|
// if we need an explicit rule then don't use any builder
|
||||||
|
// variables, resolve everything to explicit strings
|
||||||
|
resolvedCommand = provider.resolveValue(
|
||||||
|
depCmd,
|
||||||
|
EMPTY_STRING,
|
||||||
|
IManagedBuilderMakefileGenerator.WHITESPACE,
|
||||||
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
|
new FileContextData(sourceLocation,
|
||||||
|
outputLocation, null, tool));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
||||||
|
depCmd = resolvedCommand;
|
||||||
|
|
||||||
|
} catch (BuildMacroException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
commands[0] = depCmd;
|
||||||
|
return commands;
|
||||||
|
}
|
||||||
|
|
||||||
|
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.IManagedDependencyInfo#getBuildContext()
|
||||||
|
*/
|
||||||
|
public IBuildObject getBuildContext() {
|
||||||
|
return buildContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo#getSource()
|
||||||
|
*/
|
||||||
|
public IPath getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo#getTool()
|
||||||
|
*/
|
||||||
|
public ITool getTool() {
|
||||||
|
return tool;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo#getTopBuildDirectory()
|
||||||
|
*/
|
||||||
|
public IPath getTopBuildDirectory() {
|
||||||
|
return topBuildDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This class contains the desciption of a group of generated dependency files,
|
||||||
|
* e.g., .d files created by compilations
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GnuDependencyGroupInfo {
|
||||||
|
|
||||||
|
// Member Variables
|
||||||
|
String groupBuildVar;
|
||||||
|
boolean conditionallyInclude;
|
||||||
|
ArrayList groupFiles;
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
public GnuDependencyGroupInfo(String groupName, boolean bConditionallyInclude) {
|
||||||
|
groupBuildVar = groupName;
|
||||||
|
conditionallyInclude = bConditionallyInclude;
|
||||||
|
// Note: not yet needed
|
||||||
|
groupFiles = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,112 +1,122 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005 Intel Corporation and others.
|
* Copyright (c) 2005, 2006 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.makegen.gnu;
|
package org.eclipse.cdt.managedbuilder.makegen.gnu;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface returns information about a Tool's inputs
|
* This interface returns information about a Tool's inputs
|
||||||
* and outputs while a Gnu makefile is being generated.
|
* and outputs while a Gnu makefile is being generated.
|
||||||
*/
|
*/
|
||||||
public interface IManagedBuildGnuToolInfo {
|
public interface IManagedBuildGnuToolInfo {
|
||||||
public final String DOT = "."; //$NON-NLS-1$
|
public final String DOT = "."; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if the tool's inputs have been calculated,
|
* Returns <code>true</code> if the tool's inputs have been calculated,
|
||||||
* else <code>false</code>.
|
* else <code>false</code>.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean areInputsCalculated();
|
public boolean areInputsCalculated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tool's inputs in command line format. This will use
|
* Returns the tool's inputs in command line format. This will use
|
||||||
* variables rather than actual file names as appropriate.
|
* variables rather than actual file names as appropriate.
|
||||||
*
|
*
|
||||||
* @return Vector
|
* @return Vector
|
||||||
*/
|
*/
|
||||||
public Vector getCommandInputs();
|
public Vector getCommandInputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the raw list of tool's input file names.
|
* Returns the raw list of tool's input file names.
|
||||||
*
|
*
|
||||||
* @return Vector
|
* @return Vector
|
||||||
*/
|
*/
|
||||||
public Vector getEnumeratedInputs();
|
public Vector getEnumeratedInputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if the tool's outputs have been calculated,
|
* Returns <code>true</code> if the tool's outputs have been calculated,
|
||||||
* else <code>false</code>.
|
* else <code>false</code>.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean areOutputsCalculated();
|
public boolean areOutputsCalculated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tool's outputs in command line format. This will use
|
* Returns the tool's outputs in command line format. This will use
|
||||||
* variables rather than actual file names as appropriate.
|
* variables rather than actual file names as appropriate.
|
||||||
*
|
*
|
||||||
* @return Vector
|
* @return Vector
|
||||||
*/
|
*/
|
||||||
public Vector getCommandOutputs();
|
public Vector getCommandOutputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the raw list of tool's primary output file names.
|
* Returns the raw list of tool's primary output file names.
|
||||||
*
|
*
|
||||||
* @return Vector
|
* @return Vector
|
||||||
*/
|
*/
|
||||||
public Vector getEnumeratedPrimaryOutputs();
|
public Vector getEnumeratedPrimaryOutputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the raw list of tool's secondary output file names.
|
* Returns the raw list of tool's secondary output file names.
|
||||||
*
|
*
|
||||||
* @return Vector
|
* @return Vector
|
||||||
*/
|
*/
|
||||||
public Vector getEnumeratedSecondaryOutputs();
|
public Vector getEnumeratedSecondaryOutputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the raw list of tool's output variable names.
|
* Returns the raw list of tool's output variable names.
|
||||||
*
|
*
|
||||||
* @return Vector
|
* @return Vector
|
||||||
*/
|
*/
|
||||||
public Vector getOutputVariables();
|
public Vector getOutputVariables();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if the tool's dependencies have been calculated,
|
* Returns <code>true</code> if the tool's dependencies have been calculated,
|
||||||
* else <code>false</code>.
|
* else <code>false</code>.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean areDependenciesCalculated();
|
public boolean areDependenciesCalculated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tool's dependencies in command line format. This will use
|
* Returns the tool's dependencies in command line format. This will use
|
||||||
* variables rather than actual file names as appropriate.
|
* variables rather than actual file names as appropriate.
|
||||||
*
|
* Dependencies are top build directory relative.
|
||||||
* @return Vector
|
*
|
||||||
*/
|
* @return Vector
|
||||||
public Vector getCommandDependencies();
|
*/
|
||||||
|
public Vector getCommandDependencies();
|
||||||
/**
|
|
||||||
* Returns the raw list of tool's input dependencies.
|
/**
|
||||||
*
|
* Returns the tool's additional targets as determined by the
|
||||||
* @return Vector
|
* dependency calculator.
|
||||||
*/
|
* Additional targets are top build directory relative
|
||||||
//public Vector getEnumeratedDependencies();
|
*
|
||||||
|
* @return Vector
|
||||||
/**
|
*/
|
||||||
* Returns <code>true</code> if this is the target tool
|
public Vector getAdditionalTargets();
|
||||||
* else <code>false</code>.
|
|
||||||
*
|
/**
|
||||||
* @return boolean
|
* Returns the raw list of tool's input dependencies.
|
||||||
*/
|
*
|
||||||
public boolean isTargetTool();
|
* @return Vector
|
||||||
}
|
*/
|
||||||
|
//public Vector getEnumeratedDependencies();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns <code>true</code> if this is the target tool
|
||||||
|
* else <code>false</code>.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isTargetTool();
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,87 +1,87 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004 IBM Corporation and others.
|
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.makegen.internal;
|
package org.eclipse.cdt.managedbuilder.makegen.internal;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
import org.eclipse.cdt.core.search.SearchEngine;
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
import org.eclipse.cdt.internal.core.search.PathCollector;
|
import org.eclipse.cdt.internal.core.search.PathCollector;
|
||||||
import org.eclipse.cdt.internal.core.search.PatternSearchJob;
|
import org.eclipse.cdt.internal.core.search.PatternSearchJob;
|
||||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
|
import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public class DefaultIndexerDependencyCalculator implements IManagedDependencyGenerator {
|
public class DefaultIndexerDependencyCalculator implements IManagedDependencyGenerator {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#findDependencies(org.eclipse.core.resources.IResource)
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#findDependencies(org.eclipse.core.resources.IResource)
|
||||||
*/
|
*/
|
||||||
public IResource[] findDependencies(IResource resource, IProject project) {
|
public IResource[] findDependencies(IResource resource, IProject project) {
|
||||||
PathCollector pathCollector = new PathCollector();
|
PathCollector pathCollector = new PathCollector();
|
||||||
ICSearchScope scope = SearchEngine.createWorkspaceScope();
|
ICSearchScope scope = SearchEngine.createWorkspaceScope();
|
||||||
CSearchPattern pattern = CSearchPattern.createPattern(resource.getLocation().toOSString(), ICSearchConstants.INCLUDE, ICSearchConstants.REFERENCES, ICSearchConstants.EXACT_MATCH, true);
|
CSearchPattern pattern = CSearchPattern.createPattern(resource.getLocation().toOSString(), ICSearchConstants.INCLUDE, ICSearchConstants.REFERENCES, ICSearchConstants.EXACT_MATCH, true);
|
||||||
IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
||||||
indexManager.performConcurrentJob(
|
indexManager.performConcurrentJob(
|
||||||
new PatternSearchJob(
|
new PatternSearchJob(
|
||||||
(CSearchPattern) pattern,
|
(CSearchPattern) pattern,
|
||||||
scope,
|
scope,
|
||||||
pathCollector,
|
pathCollector,
|
||||||
indexManager),
|
indexManager),
|
||||||
ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
|
ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
|
||||||
null, null);
|
null, null);
|
||||||
|
|
||||||
// We will get back an array of resource names relative to the workspace
|
// We will get back an array of resource names relative to the workspace
|
||||||
String[] deps = pathCollector.getPaths();
|
String[] deps = pathCollector.getPaths();
|
||||||
|
|
||||||
// Convert them to something useful
|
// Convert them to something useful
|
||||||
List depList = new ArrayList();
|
List depList = new ArrayList();
|
||||||
IResource res = null;
|
IResource res = null;
|
||||||
IWorkspaceRoot root = null;
|
IWorkspaceRoot root = null;
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
root = project.getWorkspace().getRoot();
|
root = project.getWorkspace().getRoot();
|
||||||
}
|
}
|
||||||
for (int index = 0; index < deps.length; ++index) {
|
for (int index = 0; index < deps.length; ++index) {
|
||||||
res = root.findMember(deps[index]);
|
res = root.findMember(deps[index]);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
depList.add(res);
|
depList.add(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IResource[]) depList.toArray(new IResource[depList.size()]);
|
return (IResource[]) depList.toArray(new IResource[depList.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#getCalculatorType()
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#getCalculatorType()
|
||||||
*/
|
*/
|
||||||
public int getCalculatorType() {
|
public int getCalculatorType() {
|
||||||
// Tell the
|
// Tell the
|
||||||
return TYPE_INDEXER;
|
return TYPE_EXTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#getDependencyCommand()
|
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderDependencyCalculator#getDependencyCommand()
|
||||||
*/
|
*/
|
||||||
public String getDependencyCommand(IResource resource, IManagedBuildInfo info) {
|
public String getDependencyCommand(IResource resource, IManagedBuildInfo info) {
|
||||||
// There is no command
|
// There is no command
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue