diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestLinkerNameProvider.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestLinkerNameProvider.java
index 80e211aab9b..584e1ff80f7 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestLinkerNameProvider.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestLinkerNameProvider.java
@@ -51,7 +51,7 @@ public class TestLinkerNameProvider implements IManagedOutputNameProvider {
fileName = fileName.substring(2,fileName.length()-1);
}
}
- String[] exts = tool.getPrimaryOutputType().getOutputExtensions();
+ String[] exts = tool.getPrimaryOutputType().getOutputExtensions(tool);
if (exts != null && exts[0].length() > 0) {
fileName += IManagedBuilderMakefileGenerator.DOT + exts[0];
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IInputType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IInputType.java
index 827feeead55..3d740babba2 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IInputType.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IInputType.java
@@ -183,18 +183,20 @@ public interface IInputType extends IBuildObject {
* is specified and registered with Eclipse. Otherwise the
* sourceExtensions attribute will be used.
*
+ * @param tool the tool that contains the input-type
* @return String[]
*/
- public String[] getSourceExtensions();
+ public String[] getSourceExtensions(ITool tool);
/**
* Answers true
if the input type considers the file extension to be
* one associated with a source file.
*
- * @param ext file extension of the source
+ * @param tool the tool that contains the input-type
+ * @param ext file extension of the source
* @return boolean
*/
- public boolean isSourceExtension(String ext);
+ public boolean isSourceExtension(ITool tool, String ext);
/**
* Returns the Eclipse IContentType
that describes the
@@ -242,18 +244,20 @@ public interface IInputType extends IBuildObject {
* is specified and registered with Eclipse. Otherwise the
* dependencyExtensions attribute will be used.
*
+ * @param tool the tool that contains the input-type
* @return String[]
*/
- public String[] getDependencyExtensions();
+ public String[] getDependencyExtensions(ITool tool);
/**
* Answers true
if the input type considers the file extension to be
* one associated with a dependency file.
*
- * @param ext file extension of the source
+ * @param tool the tool that contains the input-type
+ * @param ext file extension of the source
* @return boolean
*/
- public boolean isDependencyExtension(String ext);
+ public boolean isDependencyExtension(ITool tool, String ext);
/**
* Returns the id of the option that is associated with this
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOutputType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOutputType.java
index b58fd770c32..073866ffdc2 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOutputType.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOutputType.java
@@ -93,18 +93,20 @@ public interface IOutputType extends IBuildObject {
* is specified and registered with Eclipse. Otherwise the
* outputs attribute will be used.
*
+ * @param tool the tool that contains the output-type
* @return String[]
*/
- public String[] getOutputExtensions();
+ public String[] getOutputExtensions(ITool tool);
/**
* Answers true
if the output type considers the file extension to be
* one associated with an output file.
*
- * @param ext file extension
+ * @param tool the tool that contains the output-type
+ * @param ext file extension
* @return boolean
*/
- public boolean isOutputExtension(String ext);
+ public boolean isOutputExtension(ITool tool, String ext);
/**
* Returns the id of the option that is associated with this
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java
index 767adc48639..55715b71d3b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java
@@ -16,10 +16,15 @@ import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.content.*;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IInputOrder;
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
@@ -677,6 +682,22 @@ public class InputType extends BuildObject implements IInputType {
}
return (IPath[])ins.toArray(new IPath[ins.size()]);
}
+
+ /* (non-Javadoc)
+ * Returns the project that uses this IInputType
+ */
+ public IProject getProject(ITool tool) {
+ IProject project = null;
+ IBuildObject toolParent = tool.getParent();
+ if (toolParent != null) {
+ if (toolParent instanceof IToolChain) {
+ return (IProject)((IToolChain)toolParent).getParent().getOwner();
+ } else if (toolParent instanceof IResourceConfiguration) {
+ return (IProject)((IResourceConfiguration)toolParent).getOwner();
+ }
+ }
+ return project;
+ }
/* (non-Javadoc)
* Memory-safe way to access the list of input orders
@@ -806,10 +827,26 @@ public class InputType extends BuildObject implements IInputType {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IInputType#getDependencyExtensions()
*/
- public String[] getDependencyExtensions() {
+ public String[] getDependencyExtensions(ITool tool) {
// Use content type if specified and registered with Eclipse
IContentType type = getDependencyContentType();
if (type != null) {
+ IContentTypeSettings settings = null;
+ IProject project = getProject(tool);
+ if (project != null) {
+ IScopeContext projectScope = new ProjectScope(project);
+ try {
+ settings = type.getSettings(projectScope);
+ } catch (Exception e) {}
+ if (settings != null) {
+ String[] specs = settings.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ // TODO: There doesn't seem to be any way to distinguish between these 2 cases:
+ // 1. No project specific entries have been set so getFileSpecs returns an empty list
+ // 2. There are project specific entries and all of the "default" entries have been removed
+ // For now, we have to assume the first case.
+ if (specs.length > 0) return specs;
+ }
+ }
return type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
}
return getDependencyExtensionsAttribute();
@@ -818,8 +855,8 @@ public class InputType extends BuildObject implements IInputType {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IInputType#isDependencyExtension()
*/
- public boolean isDependencyExtension(String ext) {
- String[] exts = getDependencyExtensions();
+ public boolean isDependencyExtension(ITool tool, String ext) {
+ String[] exts = getDependencyExtensions(tool);
for (int i=0; i 0) return specs;
+ }
+ }
return type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
}
return getSourceExtensionsAttribute();
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IInputType#isDependencyExtension()
+ * @see org.eclipse.cdt.core.build.managed.IInputType#isSourceExtension()
*/
- public boolean isSourceExtension(String ext) {
- String[] exts = getSourceExtensions();
+ public boolean isSourceExtension(ITool tool, String ext) {
+ String[] exts = getSourceExtensions(tool);
for (int i=0; i 0) return specs;
+ }
+ }
return type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
}
return getOutputExtensionsAttribute();
@@ -649,8 +686,8 @@ public class OutputType extends BuildObject implements IOutputType {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOutputType#isOutputExtension()
*/
- public boolean isOutputExtension(String ext) {
- String[] exts = getOutputExtensions();
+ public boolean isOutputExtension(ITool tool, String ext) {
+ String[] exts = getOutputExtensions(tool);
if (exts != null) {
for (int i=0; i 0) return exts[0];
}
@@ -1358,7 +1358,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
public String[] getPrimaryInputExtensions() {
IInputType type = getPrimaryInputType();
if (type != null) {
- String[] exts = type.getSourceExtensions();
+ String[] exts = type.getSourceExtensions(this);
// Use the first entry in the list
if (exts.length > 0) return exts;
}
@@ -1379,7 +1379,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
if (types != null && types.length > 0) {
List allExts = new ArrayList();
for (int i=0; i 0) {
for (int i=0; i 0) {
List allExts = new ArrayList();
for (int i=0; i 0) {
List allExts = new ArrayList();
for (int i=0; i 0) {
return exts[0];
}
@@ -1893,7 +1893,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
if (getInputType(inputExtension) != null) {
// Return the first extension of the primary output type
IOutputType outType = getPrimaryOutputType();
- String[] exts = outType.getOutputExtensions();
+ String[] exts = outType.getOutputExtensions(this);
if (exts != null && exts.length > 0) {
return exts[0];
}
@@ -1924,7 +1924,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
IOutputType[] types = getOutputTypes();
if (types != null && types.length > 0) {
for (int i=0; i 0) {
fileName += IManagedBuilderMakefileGenerator.DOT + exts[0];
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
index fec92a9e8fb..a80e4fcacfd 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
@@ -119,7 +119,6 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// What kind of resource change has occurred
if (resource.getType() == IResource.FILE) {
String ext = resource.getFileExtension();
- boolean moved = false;
switch (delta.getKind()) {
case IResourceDelta.ADDED:
if (!generator.isGeneratedResource(resource)) {
@@ -232,11 +231,11 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// String constants for makefile contents and messages
private static final String COMMENT = "MakefileGenerator.comment"; //$NON-NLS-1$
- private static final String AUTO_DEP = COMMENT + ".autodeps"; //$NON-NLS-1$
- private static final String MESSAGE = "ManagedMakeBuilder.message"; //$NON-NLS-1$
- private static final String BUILD_ERROR = MESSAGE + ".error"; //$NON-NLS-1$
+ //private static final String AUTO_DEP = COMMENT + ".autodeps"; //$NON-NLS-1$
+ //private static final String MESSAGE = "ManagedMakeBuilder.message"; //$NON-NLS-1$
+ //private static final String BUILD_ERROR = MESSAGE + ".error"; //$NON-NLS-1$
- private static final String DEP_INCL = COMMENT + ".module.dep.includes"; //$NON-NLS-1$
+ //private static final String DEP_INCL = COMMENT + ".module.dep.includes"; //$NON-NLS-1$
private static final String HEADER = COMMENT + ".header"; //$NON-NLS-1$
protected static final String MESSAGE_FINISH_BUILD = ManagedMakeMessages.getResourceString("MakefileGenerator.message.finish.build"); //$NON-NLS-1$
@@ -244,7 +243,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
protected static final String MESSAGE_START_BUILD = ManagedMakeMessages.getResourceString("MakefileGenerator.message.start.build"); //$NON-NLS-1$
protected static final String MESSAGE_START_FILE = ManagedMakeMessages.getResourceString("MakefileGenerator.message.start.file"); //$NON-NLS-1$
protected static final String MESSAGE_NO_TARGET_TOOL = ManagedMakeMessages.getResourceString("MakefileGenerator.message.no.target"); //$NON-NLS-1$
- private static final String MOD_INCL = COMMENT + ".module.make.includes"; //$NON-NLS-1$
+ //private static final String MOD_INCL = COMMENT + ".module.make.includes"; //$NON-NLS-1$
private static final String MOD_LIST = COMMENT + ".module.list"; //$NON-NLS-1$
private static final String MOD_VARS = COMMENT + ".module.variables"; //$NON-NLS-1$
private static final String MOD_RULES = COMMENT + ".build.rule"; //$NON-NLS-1$
@@ -1601,7 +1600,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// Generate a build rule for any tool that consumes the output of this tool
IOutputType[] outTypes = generatingTool.getOutputTypes();
for (int i=0; i 0) {
namePattern += DOT + outExt;
}
@@ -597,7 +597,7 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
switch (calcType) {
case IManagedDependencyGenerator.TYPE_COMMAND:
// iterate over all extensions that the tool knows how to handle
- String[] extensionsList = type.getSourceExtensions();
+ String[] extensionsList = type.getSourceExtensions(tool);
for (int j=0; j