Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-10-01 10:25:35 -0400
committerDoug Schaefer2003-10-01 10:25:35 -0400
commit02de2c978820252ba06bc0e2631b80349f2633a3 (patch)
tree3b9ed26d79f92d624aea6c3d1ec90ee5deae2c8c
parentbd8a994627bd8703c242346ebd92378982e7b63e (diff)
downloadorg.eclipse.cdt-02de2c978820252ba06bc0e2631b80349f2633a3.tar.gz
org.eclipse.cdt-02de2c978820252ba06bc0e2631b80349f2633a3.tar.xz
org.eclipse.cdt-02de2c978820252ba06bc0e2631b80349f2633a3.zip
Patch for Sean Evoy:
the logic for managing the makefiles in the face of a header file modification. There seems to be a problem (maybe with the dependency calculation) for dependants in other projects when a header file is moved, but other than that the builder seems to respond properly.
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/ChangeLog28
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd9
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java21
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java43
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java34
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java143
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java16
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java43
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java7
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/ChangeLog7
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/plugin.xml69
-rw-r--r--core/org.eclipse.cdt.core.tests/ChangeLog8
-rw-r--r--core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java9
-rw-r--r--core/org.eclipse.cdt.core.tests/plugin.xml2
14 files changed, 353 insertions, 86 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/ChangeLog b/build/org.eclipse.cdt.managedbuilder.core/ChangeLog
index 7085a3aadc4..4e639a304c2 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/ChangeLog
+++ b/build/org.eclipse.cdt.managedbuilder.core/ChangeLog
@@ -1,3 +1,31 @@
+2003-09-30 Sean Evoy
+ Fix for bug 41826.
+
+ Finished the use case for changing header files and triggering a build. I had
+ to add a new attribute to the build model schema to allow a build information
+ client to determine that a file is considered a header file.
+ * schema/ManagedBuildTools.exsd
+
+ The ITool, and its implementors now have a method to test if an extension is
+ considered to belong to a header file. The Tool also pays attention to the new
+ attribute when it reads itself in from the plugin file.
+ * src/org/eclipse/cdt/managedbuilder/core/ITool.java
+ * src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
+ * src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
+
+ There is a method for clients of this information on the BuildInfo interface and
+ its implementor.
+ * src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
+ * src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
+
+ The builder had to be tweaked in order to behave correctly on a build of an
+ empty project or non-managed projects.
+ * src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
+
+ The makefile generator had to be tweaked to properly add folders that are effected
+ by header file changes.
+ * src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
+
2003-09-26 Sean Evoy
A partial implementation for bug 41826. This patch contains the logic to properly
respond in the face of the following project changes:
diff --git a/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd b/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd
index 270e4c42cde..3f6c1a321f6 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd
+++ b/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd
@@ -104,13 +104,20 @@
<attribute name="dependencyCalculator" type="string">
<annotation>
<documentation>
- This is an optional field that specifies the class that provides the dependency calculation for a given tool.
+ This is an optional field that specifies the class that provides the dependency calculation for a given tool. This field is unused in CDT 1.2.
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.cdt.internal.core.sourcedependency.ISourceDependency"/>
</appInfo>
</annotation>
</attribute>
+ <attribute name="headerExtensions" type="string">
+ <annotation>
+ <documentation>
+ A comma-separated list of file extensions that are used for header files. Since many other files depend on the interfaces defined in header files, the build system needs to be able to determine that a header file has changed to properly rebuild its dependents.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
index b4212fd8a2b..fe4b3621b36 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
@@ -168,8 +168,8 @@ public interface IManagedBuildInfo {
* Returns a <code>String</code> containing the command-line invocation
* for the tool associated with the source extension.
*
- * @param extension
- * @return
+ * @param extension the file extension of the file to be built
+ * @return String
*/
public String getToolForSource(String extension);
@@ -183,7 +183,10 @@ public interface IManagedBuildInfo {
public String getToolForTarget(String extension);
/**
- * @param extension
+ * Answers a <code>String</code> array containing the contents of the
+ * user objects option, if one is defined for the target.
+ *
+ * @param extension the file ecxtension of the build target
* @return
*/
public String[] getUserObjectsForTarget(String extension);
@@ -191,11 +194,20 @@ public interface IManagedBuildInfo {
/**
* Answers true if the build model has been changed by the user.
*
- * @return
+ * @return boolean
*/
public boolean isDirty();
/**
+ * Answers <code>true</code> if the extension matches one of the special
+ * file extensions the tools for the target consider to be a header file.
+ *
+ * @param ext the file extension of the resource
+ * @return boolean
+ */
+ public boolean isHeaderFile(String ext);
+
+ /**
* Set the dirty flag for the build model to the value of the argument.
*
* @param isDirty
@@ -216,5 +228,4 @@ public interface IManagedBuildInfo {
* @param target
*/
public void setDefaultTarget(ITarget target);
-
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java
index f6bc93031cc..e25ce3f0e7e 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java
@@ -24,27 +24,30 @@ public interface ITool extends IBuildObject {
public static final String OUTPUT_PREFIX = "outputPrefix"; //$NON-NLS-1$
public static final String OUTPUTS = "outputs"; //$NON-NLS-1$
public static final String SOURCES = "sources"; //$NON-NLS-1$
+ public static final String INTERFACE_EXTS = "headerExtensions"; //$NON-NLS-1$
public static final String WHITE_SPACE = " "; //$NON-NLS-1$
/**
* Return <code>true</code> if the receiver builds files with the
* specified extension, else <code>false</code>.
*
- * @param extension
- * @return
+ * @param extension file extension of the source
+ * @return boolean
*/
public boolean buildsFileType(String extension);
/**
* Get a particular option.
*
- * @param id
- * @return
+ * @param id unique identifier of the option to search for
+ * @return IOption
*/
public IOption getOption(String id);
/**
- * Returns the options that may be customized for this tool.
+ * Answers the options that may be customized for this tool.
+ *
+ * @return IOption[]
*/
public IOption[] getOptions();
@@ -53,7 +56,7 @@ public interface ITool extends IBuildObject {
* or <code>null</code> if the tool does not understand that extension.
*
* @param inputExtension The extension of the source file.
- * @return
+ * @return String
*/
public String getOutputExtension(String inputExtension);
@@ -62,27 +65,27 @@ public interface ITool extends IBuildObject {
* control the name of the output artifact. For example, the GCC compile and
* linker use '-o', while the archiver does not.
*
- * @return
+ * @return String
*/
public String getOutputFlag();
/**
* Answers the prefix that the tool should prepend to the name of the build artifact.
* For example, a librarian usually prepends 'lib' to the target.a
- * @return
+ * @return String
*/
public String getOutputPrefix();
/**
* Return the target that defines this tool, if applicable
- * @return
- */
+ * @return ITarget
+ */
public ITarget getTarget();
/**
* Answers the command-line invocation defined for the receiver.
*
- * @return
+ * @return String
*/
public String getToolCommand();
@@ -90,7 +93,7 @@ public interface ITool extends IBuildObject {
* Answers the additional command line arguments the user has specified for
* the tool.
*
- * @return
+ * @return String
*/
public String getToolFlags() throws BuildException ;
@@ -99,18 +102,26 @@ public interface ITool extends IBuildObject {
* These categories are organized into a tree. This is the root
* of that tree.
*
- * @return
+ * @return IOptionCategory
*/
public IOptionCategory getTopOptionCategory();
/**
+ * Answers <code>true</code> if the tool considers the file extension to be
+ * one associated with a header file.
+ *
+ * @param ext file extension of the source
+ * @return boolean
+ */
+ public boolean isHeaderFile(String ext);
+
+ /**
* Answers <code>true</code> if the receiver builds a file with the extension specified
* in the argument, else <code>false</code>.
*
- * @param outputExtension
- * @return
+ * @param outputExtension extension of the file being produced by a tool
+ * @return boolean
*/
public boolean producesFileType(String outputExtension);
-
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
index 5b8ed071467..c60ede4c2fd 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
@@ -36,6 +36,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -127,7 +128,10 @@ public class GeneratedMakefileBuilder extends ACBuilder {
for (int i = 0; i < deps.length; i++) {
IProject project = deps[i];
IManagedBuildInfo depInfo = ManagedBuildManager.getBuildInfo(project);
- depInfo.setDirty(false);
+ // May not be a managed project
+ if (depInfo != null) {
+ depInfo.setDirty(false);
+ }
}
// Ask build mechanism to compute deltas for project dependencies next time
@@ -183,11 +187,14 @@ public class GeneratedMakefileBuilder extends ACBuilder {
// Throw the exception back to the builder
throw e;
}
- IPath topBuildDir = generator.getTopBuildDir();
// Now call make
- invokeMake(true, topBuildDir.removeFirstSegments(1), info, monitor);
- monitor.worked(1);
+ IPath topBuildDir = generator.getTopBuildDir();
+ if (topBuildDir != null) {
+ invokeMake(true, topBuildDir.removeFirstSegments(1), info, monitor);
+ } else {
+ monitor.done();
+ }
}
/* (non-javadoc)
@@ -280,8 +287,6 @@ public class GeneratedMakefileBuilder extends ACBuilder {
// Run the build
IPath buildDir = new Path(info.getConfigurationName());
invokeMake(false, buildDir, info, monitor);
-
- monitor.worked(1);
}
protected void invokeMake(boolean fullBuild, IPath buildDir, IManagedBuildInfo info, IProgressMonitor monitor) {
@@ -292,6 +297,21 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
try {
+ // Figure out the working directory for the build and make sure there is a makefile there
+ IPath workingDirectory = getWorkingDirectory().append(buildDir);
+ IWorkspace workspace = currentProject.getWorkspace();
+ if (workspace == null) {
+ return;
+ }
+ IWorkspaceRoot root = workspace.getRoot();
+ if (root == null) {
+ return;
+ }
+ IPath makefile = workingDirectory.addTrailingSeparator().append(MakefileGenerator.MAKEFILE_NAME);
+ if (root.getFileForLocation(makefile) == null) {
+ return;
+ }
+
// Flag to the user that make is about to be called
IPath makeCommand = new Path(info.getMakeCommand());
if (makeCommand != null) {
@@ -313,8 +333,6 @@ public class GeneratedMakefileBuilder extends ACBuilder {
removeAllMarkers(project);
}
- IPath workingDirectory = getWorkingDirectory().append(buildDir);
-
// Get the arguments to be passed to make from build model
ArrayList makeArgs = new ArrayList();
String args = info.getMakeArguments();
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
index 14659171fab..b9d456ec587 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
@@ -44,6 +44,7 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
@@ -61,10 +62,10 @@ public class MakefileGenerator {
// String constants for makefile contents
protected static final String COLON = ":";
- protected static final String DEPFILE_NAME = "module.dep"; //$NON-NLS-1$
+ protected static final String DEPFILE_NAME = "subdir.dep"; //$NON-NLS-1$
protected static final String DOT = ".";
protected static final String MAKEFILE_NAME = "makefile"; //$NON-NLS-1$
- protected static final String MODFILE_NAME = "module.mk"; //$NON-NLS-1$
+ protected static final String MODFILE_NAME = "subdir.mk"; //$NON-NLS-1$
protected static final String LINEBREAK = "\\";
protected static final String NEWLINE = System.getProperty("line.separator");
protected static final String SEMI_COLON = ";";
@@ -81,10 +82,9 @@ public class MakefileGenerator {
protected IProject project;
protected List ruleList;
protected IPath topBuildDir;
-
private String target;
-
private String extension;
+
/**
* This class is used to recursively walk the project and determine which
* modules contribute buildable source files.
@@ -142,6 +142,61 @@ public class MakefileGenerator {
this.info = info;
}
+ /* (non-javadoc)
+ * Answers a list of resource names in the workspace that depend on the resource
+ * specified in the argument.
+ *
+ * @param resource the root of the dependency tree
+ * @return IResource[]
+ */
+ private IResource[] findDependencies(IResource resource) {
+ PathCollector pathCollector = new PathCollector();
+ ICSearchScope scope = SearchEngine.createWorkspaceScope();
+ CSearchPattern pattern = CSearchPattern.createPattern(resource.getLocation().toOSString(), ICSearchConstants.INCLUDE, ICSearchConstants.REFERENCES, ICSearchConstants.EXACT_MATCH, true);
+ IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
+ indexManager.performConcurrentJob(
+ new PatternSearchJob(
+ (CSearchPattern) pattern,
+ scope,
+ pathCollector,
+ indexManager),
+ ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
+ null);
+
+ // We will get back an array of resource names relative to the workspace
+ String[] deps = pathCollector.getPaths();
+
+ // Convert them to something useful
+ List depList = new ArrayList();
+ IResource res = null;
+ IWorkspaceRoot root = null;
+ if (generator.project != null) {
+ root = generator.project.getWorkspace().getRoot();
+ }
+ for (int index = 0; index < deps.length; ++index) {
+ res = root.findMember(deps[index]);
+ if (res != null) {
+ depList.add(res);
+ }
+ }
+
+ return (IResource[]) depList.toArray(new IResource[depList.size()]);
+ }
+
+ private void handleHeaderDependency(IResource resource, boolean moved) {
+ // If this is a move and the resource is external to the project, touch that resource
+ if (resource.getProject().equals(generator.project)) {
+ generator.appendModifiedSubdirectory(resource);
+ } else {
+ if (moved) {
+ try {
+ resource.touch(new NullProgressMonitor());
+ } catch (CoreException e) {
+ }
+ }
+ }
+ }
+
/* (non-Javadoc)
* @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
*/
@@ -153,40 +208,53 @@ public class MakefileGenerator {
// 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:
- case IResourceDelta.REMOVED:
- // Add the container of the resource and any resources that depend on it
+ moved = delta.getFlags() == IResourceDelta.MOVED_TO;
+ if (!generator.isGeneratedResource(resource)) {
+ // This is a source file so just add its container
if (info.buildsFileType(ext)) {
- if (!generator.isGeneratedResource(resource)) {
- // Here's the container
+ generator.appendModifiedSubdirectory(resource);
+ } else if (info.isHeaderFile(ext)) {
+ // Add the container of the resource and any resources that depend on it
+ generator.appendModifiedSubdirectory(resource);
+ IResource[] deps = findDependencies(resource);
+ for (int i = 0; i < deps.length; ++i){
+ handleHeaderDependency(deps[i], moved);
+ }
+ }
+ }
+ break;
+ case IResourceDelta.REMOVED:
+ moved = delta.getFlags() == IResourceDelta.MOVED_FROM;
+ if (!generator.isGeneratedResource(resource)) {
+ // This is a source file so just add its container
+ if (info.buildsFileType(ext)) {
+ generator.appendModifiedSubdirectory(resource);
+ } else if (info.isHeaderFile(ext)) {
+ // Add the container of the resource and any resources that depend on it
generator.appendModifiedSubdirectory(resource);
- // and all the dependents
- PathCollector pathCollector = new PathCollector();
- ICSearchScope scope = SearchEngine.createWorkspaceScope();
- CSearchPattern pattern = CSearchPattern.createPattern(resource.getLocation().toOSString(),ICSearchConstants.INCLUDE, ICSearchConstants.REFERENCES,ICSearchConstants.EXACT_MATCH,true);
- IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
- indexManager.performConcurrentJob(
- new PatternSearchJob(
- (CSearchPattern) pattern,
- scope,
- pathCollector,
- indexManager
- ),
- ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
- null );
- String[] deps = pathCollector.getPaths();
- if (deps.length > 0 ) {
- for (int i=0; i<deps.length; i++){
- generator.appendModifiedSubdirectory(resource);
- }
+ IResource[] deps = findDependencies(resource);
+ for (int i = 0; i < deps.length; ++i){
+ handleHeaderDependency(deps[i], moved);
}
}
}
break;
case IResourceDelta.CHANGED:
- if (info.buildsFileType(ext)) {
- keepLooking = true;
+ if (!generator.isGeneratedResource(resource)) {
+ if (info.buildsFileType(ext)) {
+ keepLooking = true;
+ } else if (info.isHeaderFile(ext)) {
+ // Add the container of the resource and any resources that depend on it
+ generator.appendModifiedSubdirectory(resource);
+ IResource[] deps= findDependencies(resource);
+ for (int i = 0; i < deps.length; ++i){
+ handleHeaderDependency(deps[i], moved);
+ }
+ // That does it for this directory, so don't bother to keep looking
+ }
}
break;
default:
@@ -360,7 +428,7 @@ public class MakefileGenerator {
// Now add the makefile instruction to include all the subdirectory makefile fragments
buffer.append(NEWLINE);
buffer.append(ManagedBuilderCorePlugin.getResourceString(MOD_INCL) + NEWLINE);
- buffer.append("-include ${patsubst %, %/module.mk, $(SUBDIRS)}" + NEWLINE);
+ buffer.append("-include ${patsubst %, %/subdir.mk, $(SUBDIRS)}" + NEWLINE);
buffer.append(NEWLINE + NEWLINE);
return buffer;
@@ -521,7 +589,7 @@ public class MakefileGenerator {
buffer.append(".PHONY: all clean deps" + NEWLINE + NEWLINE);
buffer.append(ManagedBuilderCorePlugin.getResourceString(DEP_INCL) + NEWLINE);
- buffer.append("-include ${patsubst %, %/module.dep, $(SUBDIRS)}" + NEWLINE);
+ buffer.append("-include ${patsubst %, %/subdir.dep, $(SUBDIRS)}" + NEWLINE);
return buffer;
}
@@ -581,7 +649,7 @@ public class MakefileGenerator {
* Adds the container of the argument to the list of folders in the project that
* contribute source files to the build. The resource visitor has already established
* that the build model knows how to build the files. It has also checked that
- * the resouce is not generated as part of the build.
+ * the resource is not generated as part of the build.
*
* @param resource
*/
@@ -590,6 +658,7 @@ public class MakefileGenerator {
if (!getSubdirList().contains(container)) {
getSubdirList().add(container);
}
+
}
/**
@@ -788,7 +857,7 @@ public class MakefileGenerator {
public IPath getTopBuildDir() {
return topBuildDir;
}
-
+
/**
* Answers <code>true</code> if the argument is found in a generated container
* @param resource
@@ -870,10 +939,15 @@ public class MakefileGenerator {
// Visit the resources in the project
ResourceProxyVisitor visitor = new ResourceProxyVisitor(this, info);
project.accept(visitor, IResource.NONE);
-
+
// See if the user has cancelled the build
checkCancel();
+ // Populate the makefile if any source files have been found in the project
+ if (getSubdirList().isEmpty()) {
+ return;
+ }
+
// Create the top-level directory for the build output
topBuildDir = createDirectory(info.getConfigurationName());
@@ -881,7 +955,6 @@ public class MakefileGenerator {
IPath makefilePath = topBuildDir.addTrailingSeparator().append(MAKEFILE_NAME);
IFile makefileHandle = createFile(makefilePath);
- // Populate the makefile
populateTopMakefile(makefileHandle, true);
checkCancel();
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
index b00929d4466..5a79470ad98 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
@@ -539,6 +539,22 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
return isDirty;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isHeaderFile(java.lang.String)
+ */
+ public boolean isHeaderFile(String ext) {
+ // Check to see if there is a rule to build a file with this extension
+ IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ ITool[] tools = config.getTools();
+ for (int index = 0; index < tools.length; index++) {
+ ITool tool = tools[index];
+ if (tool.isHeaderFile(ext)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Write the contents of the build model to the persistent store specified in the
* argument.
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
index 126a6f2afa8..483aefdc56d 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
@@ -36,16 +36,17 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
private static final IOptionCategory[] EMPTY_CATEGORIES = new IOptionCategory[0];
private static final IOption[] EMPTY_OPTIONS = new IOption[0];
- private ITarget target;
- private List options;
- private Map optionMap;
- private List childOptionCategories;
private Map categoryMap;
+ private List childOptionCategories;
private String command;
private List inputExtensions;
+ private List interfaceExtensions;
+ private Map optionMap;
+ private List options;
private String outputExtension;
private String outputFlag;
private String outputPrefix;
+ private ITarget target;
public Tool(Target target) {
this.target = target;
@@ -78,7 +79,17 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
while (tokenizer.hasMoreElements()) {
getInputExtensions().add(tokenizer.nextElement());
}
-
+
+ // Get the interface (header file) extensions
+ String headers = element.getAttribute(INTERFACE_EXTS);
+ if (headers == null) {
+ headers = new String();
+ }
+ tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
+ while (tokenizer.hasMoreElements()) {
+ getInterfaceExtensions().add(tokenizer.nextElement());
+ }
+
// Get the output extension
outputExtension = element.getAttribute(ITool.OUTPUTS) == null ?
new String() :
@@ -170,7 +181,10 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
}
/* (non-Javadoc)
- * @return
+ * Safe accessor method to retrieve the list of valid source extensions
+ * the receiver know how to build.
+ *
+ * @return List
*/
private List getInputExtensions() {
if (inputExtensions == null) {
@@ -178,6 +192,13 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
}
return inputExtensions;
}
+
+ private List getInterfaceExtensions() {
+ if (interfaceExtensions == null) {
+ interfaceExtensions = new ArrayList();
+ }
+ return interfaceExtensions;
+ }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#createChildCategory()
@@ -351,6 +372,16 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#isHeaderFile(java.lang.String)
+ */
+ public boolean isHeaderFile(String ext) {
+ if (ext == null) {
+ return false;
+ }
+ return getInterfaceExtensions().contains(ext);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
*/
public boolean producesFileType(String outputExtension) {
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
index e671a2a3dcc..3c095188014 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
@@ -257,6 +257,13 @@ public class ToolReference implements ITool {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#isHeaderFile(java.lang.String)
+ */
+ public boolean isHeaderFile(String ext) {
+ return parent.isHeaderFile(ext);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
*/
public boolean producesFileType(String outputExtension) {
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/ChangeLog b/build/org.eclipse.cdt.managedbuilder.ui/ChangeLog
index 3ba04427453..115f40a891d 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/ChangeLog
+++ b/build/org.eclipse.cdt.managedbuilder.ui/ChangeLog
@@ -1,3 +1,10 @@
+2003-09-30 Sean Evoy
+ Fix for bug 41826.
+
+ Updated the tool specifications for Win32, Linux, and Solaris so that header
+ file extension info is available.
+ * plugin.xml
+
2003-09-25 Sean Evoy
For bug (really an enhancement request)43756, I added the word default to a
widget label to try and make it clear that a new configuration will be based
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
index 4c5fa3e7fbc..ac2f58e0bfe 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
+++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
@@ -79,6 +79,7 @@
<tool
sources="c,cc,cpp,cxx,C"
name="%ToolName.compiler"
+ headerExtensions="h,H,hpp"
outputFlag="-o"
outputs="o"
command="g++"
@@ -219,13 +220,29 @@
id="cygwin.preprocessor.undef.symbol">
</option>
<optionCategory
- owner="org.eclipse.cdt.build.tool.cygwin.compiler"
- name="%OptionCategory.General"
- id="cygwin.compiler.category.general">
+ name="%OptionCategory.Dirs"
+ id="cygwin.gnu.compiler.category.dirs"
+ owner="org.eclipse.cdt.build.tool.cygwin.compiler">
+ </optionCategory>
+ <option
+ name="Include Paths"
+ category="cygwin.gnu.compiler.category.dirs"
+ command="-I"
+ valueType="includePath"
+ id="cygwin.compiler.general.include.paths">
+ <listOptionValue
+ value="C:\cygwin\usr\include\w32api"
+ builtIn="true">
+ </listOptionValue>
+ </option>
+ <optionCategory
+ name="%OptionCategory.Optimize"
+ id="cygwin.gnu.compiler.category.optimization"
+ owner="org.eclipse.cdt.build.tool.cygwin.compiler">
</optionCategory>
<option
name="Optimization Level"
- category="cygwin.compiler.category.general"
+ category="cygwin.gnu.compiler.category.optimization"
valueType="enumerated"
id="cygwin.compiler.general.optimization.level">
<enumeratedOptionValue
@@ -252,8 +269,19 @@
</enumeratedOptionValue>
</option>
<option
+ category="cygwin.gnu.compiler.category.optimization"
+ name="Other optimization flags"
+ id="cygwin.compiler.optimization.flags"
+ valueType="string">
+ </option>
+ <optionCategory
+ name="%OptionCategory.Debug"
+ id="cygwin.gnu.compiler.category.debug"
+ owner="org.eclipse.cdt.build.tool.cygwin.compiler">
+ </optionCategory>
+ <option
name="Debug Level"
- category="cygwin.compiler.category.general"
+ category="cygwin.gnu.compiler.category.debug"
valueType="enumerated"
id="cygwin.compiler.debugging.level">
<enumeratedOptionValue
@@ -280,15 +308,26 @@
</enumeratedOptionValue>
</option>
<option
- name="Include Paths"
- category="cygwin.compiler.category.general"
- command="-I"
- valueType="includePath"
- id="cygwin.compiler.general.include.paths">
- <listOptionValue
- value="C:\cygwin\usr\include\w32api"
- builtIn="true">
- </listOptionValue>
+ category="cygwin.gnu.compiler.category.debug"
+ name="Other debugging flags"
+ id="cygwin.gnu.compiler.debugging.other"
+ valueType="string">
+ </option>
+ <option
+ category="cygwin.gnu.compiler.category.debug"
+ id="cygwin.gnu.compiler.debugging.prof"
+ command="-p"
+ name="Generate prof information (-p)"
+ defaultValue="false"
+ valueType="boolean">
+ </option>
+ <option
+ category="cygwin.gnu.compiler.category.debug"
+ id="cygwin.gnu.compiler.debugging.gprof"
+ command="-pg"
+ name="Generate gprof information (-pg)"
+ defaultValue="false"
+ valueType="boolean">
</option>
<optionCategory
owner="org.eclipse.cdt.build.tool.cygwin.compiler"
@@ -783,6 +822,7 @@
<tool
sources="c,C,cc,cxx,cpp"
name="%ToolName.compiler"
+ headerExtensions="h,H,hpp"
outputFlag="-o"
outputs="o"
command="g++"
@@ -1403,6 +1443,7 @@
<tool
sources="c,C,cc,cxx,cpp"
name="%ToolName.compiler"
+ headerExtensions="h,H,hpp"
outputFlag="-o"
outputs="o"
command="g++"
diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog
index 46fa59ce03d..8161dd7b56b 100644
--- a/core/org.eclipse.cdt.core.tests/ChangeLog
+++ b/core/org.eclipse.cdt.core.tests/ChangeLog
@@ -1,3 +1,11 @@
+2003-09-30 Sean Evoy
+ Fix for bug 41826.
+ Updated the plugin file so that tool specifications have the new attribute
+ for header files. The test for the managed builder now insure that those
+ values are properly read.
+ * plugin.xml
+ * build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
+
2003-09-30 John Camelon
Updated CompleteParseASTTest::testBug42872()
Moved FailedCompleteParseASTTest::testBug43503() to CompleteParseASTTest::testBug43503A().
diff --git a/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java b/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
index 2c5d35b97c8..4a933236193 100644
--- a/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
+++ b/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
@@ -677,7 +677,8 @@ public class ManagedBuildTests extends TestCase {
// Root Config
IConfiguration rootConfig = configs[0];
assertEquals("Root Config", rootConfig.getName());
- // Tools
+
+ // Tool elements
tools = rootConfig.getTools();
assertEquals(1, tools.length);
assertEquals("Root Tool", tools[0].getName());
@@ -687,6 +688,9 @@ public class ManagedBuildTests extends TestCase {
assertTrue(tools[0].producesFileType("toor"));
assertEquals("doIt", tools[0].getToolCommand());
assertEquals("", tools[0].getOutputPrefix());
+ // The root tool defines one valid header file extension
+ assertTrue(rootTool.isHeaderFile("baz"));
+ assertTrue(tools[0].isHeaderFile("baz"));
// Partially Overriden Configuration
assertEquals("Root Override Config", configs[1].getName());
@@ -722,6 +726,7 @@ public class ManagedBuildTests extends TestCase {
assertTrue(tools[0].buildsFileType("foo"));
assertTrue(tools[0].buildsFileType("bar"));
assertTrue(tools[0].producesFileType("toor"));
+ assertTrue(tools[0].isHeaderFile("baz"));
assertEquals("doIt", tools[0].getToolCommand());
// Completely Overridden configuration
@@ -813,6 +818,8 @@ public class ManagedBuildTests extends TestCase {
assertTrue(subTool.producesFileType("bus"));
assertEquals("", subTool.getToolCommand());
assertEquals("lib", subTool.getOutputPrefix());
+ assertTrue(subTool.isHeaderFile("arf"));
+ assertTrue(subTool.isHeaderFile("barf"));
// Do a sanity check on the options
assertEquals("Include Paths", subOpts[0].getName());
diff --git a/core/org.eclipse.cdt.core.tests/plugin.xml b/core/org.eclipse.cdt.core.tests/plugin.xml
index 5cc402e8e8e..c1343638115 100644
--- a/core/org.eclipse.cdt.core.tests/plugin.xml
+++ b/core/org.eclipse.cdt.core.tests/plugin.xml
@@ -42,6 +42,7 @@
<tool
sources="foo,bar"
name="Root Tool"
+ headerExtensions="baz"
outputFlag="-r"
outputs="toor"
command="doIt"
@@ -160,6 +161,7 @@
<tool
sources="yarf"
name="Sub Tool"
+ headerExtensions="arf,barf"
outputs="bus"
outputPrefix="lib"
id="tool.sub">

Back to the top