Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java6
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java23
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java205
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java6
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties11
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java3
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java8
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java81
8 files changed, 221 insertions, 122 deletions
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 6fe1989eb77..3ae0c4885bb 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
@@ -37,9 +37,9 @@ public interface IManagedBuildInfo {
/**
- * Answers the file extension for the receivers build goal.
+ * Answers the file extension for the receivers build goal without a separator.
*
- * @return
+ * @return the extension or an empty string if none is defined
*/
public String getBuildArtifactExtension();
@@ -163,7 +163,7 @@ public interface IManagedBuildInfo {
* the extension '.a', so the final goal would be 'libfoo.a'
*
* @param extension
- * @return
+ * @return the prefix or an empty string
*/
public String getOutputPrefix(String outputExtension);
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
index 7b1b812de95..23c8cdcc1e0 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
@@ -11,17 +11,11 @@ package org.eclipse.cdt.managedbuilder.core;
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
-import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.cdt.managedbuilder.internal.core.GeneratedMakefileBuilder;
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildCPathEntryContainer;
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildPathEntryContainerInitializer;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
@@ -63,21 +57,6 @@ public class ManagedBuilderCorePlugin extends Plugin {
return plugin;
}
- public static void log(Throwable e) {
- if (e instanceof InvocationTargetException)
- e = ((InvocationTargetException) e).getTargetException();
- IStatus status = null;
- if (e instanceof CoreException)
- status = ((CoreException) e).getStatus();
- else
- status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, e.getMessage(), e);
- log(status);
- }
-
- public static void log(IStatus status) {
- ResourcesPlugin.getPlugin().getLog().log(status);
- }
-
/* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
*/
@@ -90,7 +69,7 @@ public class ManagedBuilderCorePlugin extends Plugin {
private static final String PATH_ENTRY = ManagedBuilderCorePlugin.getUniqueIdentifier() + "/debug/pathEntry"; //$NON-NLS-1$
private static final String PATH_ENTRY_INIT = ManagedBuilderCorePlugin.getUniqueIdentifier() + "/debug/pathEntryInit"; //$NON-NLS-1$
private static final String BUILDER = ManagedBuilderCorePlugin.getUniqueIdentifier() + "/debug/builder"; //$NON-NLS-1$
-
+
/**
*
*/
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 897d94c13dc..bf56a060005 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,7 +36,9 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -70,6 +72,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
* @since 1.2
*/
public class ResourceDeltaVisitor implements IResourceDeltaVisitor {
+ private String buildGoalName;
private IManagedBuildInfo buildInfo;
private boolean buildNeeded = true;
private List reservedNames;
@@ -79,6 +82,12 @@ public class GeneratedMakefileBuilder extends ACBuilder {
*/
public ResourceDeltaVisitor(IManagedBuildInfo info) {
buildInfo = info;
+ String ext = buildInfo.getBuildArtifactExtension();
+ if (ext.length() > 0) {
+ buildGoalName = buildInfo.getOutputPrefix(ext) + buildInfo.getBuildArtifactName() + "." + ext; //$NON-NLS-1$
+ } else {
+ buildGoalName = buildInfo.getBuildArtifactName();
+ }
reservedNames = Arrays.asList(new String[]{".cdtbuild", ".cdtproject", ".project"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -118,20 +127,28 @@ public class GeneratedMakefileBuilder extends ACBuilder {
IResourceDelta[] kids = delta.getAffectedChildren();
for (int index = kids.length - 1; index >= 0; --index) {
IResource changedResource = kids[index].getResource();
- String ext = changedResource.getFileExtension();
- // There are some things we don't care about
- if (resource.isDerived()) {
- buildNeeded = false;
- } else if (isGeneratedResource(changedResource)) {
- buildNeeded = false;
- } else if (buildInfo.buildsFileType(ext) || buildInfo.isHeaderFile(ext)) {
- // We do care and there is no point checking anythings else
- buildNeeded = true;
- break;
- } else if (isProjectFile(changedResource)) {
- buildNeeded = false;
+ if (changedResource instanceof IFolder) {
+ return true;
} else {
- buildNeeded = true;
+ String name = changedResource.getName();
+ String ext = changedResource.getFileExtension();
+ // There are some things we don't care about and some we do
+ if (name.equals(buildGoalName)) {
+ buildNeeded = true;
+ break;
+ } else if (resource.isDerived()) {
+ buildNeeded |= false;
+ } else if (isGeneratedResource(changedResource)) {
+ buildNeeded |= false;
+ } else if (buildInfo.buildsFileType(ext) || buildInfo.isHeaderFile(ext)) {
+ // We do care and there is no point checking anythings else
+ buildNeeded = true;
+ break;
+ } else if (isProjectFile(changedResource)) {
+ buildNeeded |= false;
+ } else {
+ buildNeeded = true;
+ }
}
}
return false;
@@ -142,16 +159,15 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
// String constants
- 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 BUILD_FINISHED = MESSAGE + ".finished"; //$NON-NLS-1$
- private static final String CONSOLE_HEADER = MESSAGE + ".console.header"; //$NON-NLS-1$
+ private static final String BUILD_ERROR = "ManagedMakeBuilder.message.error"; //$NON-NLS-1$
+ private static final String BUILD_FINISHED = "ManagedMakeBuilder.message.finished"; //$NON-NLS-1$
+ private static final String CONSOLE_HEADER = "ManagedMakeBuilder.message.console.header"; //$NON-NLS-1$
private static final String ERROR_HEADER = "GeneratedmakefileBuilder error ["; //$NON-NLS-1$
- private static final String MAKE = MESSAGE + ".make"; //$NON-NLS-1$
- private static final String MARKERS = MESSAGE + ".creating.markers"; //$NON-NLS-1$
+ private static final String MAKE = "ManagedMakeBuilder.message.make"; //$NON-NLS-1$
+ private static final String MARKERS = "ManagedMakeBuilder.message.creating.markers"; //$NON-NLS-1$
private static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
- private static final String NOTHING_BUILT = MESSAGE + ".no.build"; //$NON-NLS-1$
- private static final String REFRESH = MESSAGE + ".updating"; //$NON-NLS-1$
+ private static final String NOTHING_BUILT = "ManagedMakeBuilder.message.no.build"; //$NON-NLS-1$
+ private static final String REFRESH = "ManagedMakeBuilder.message.updating"; //$NON-NLS-1$
private static final String REFRESH_ERROR = BUILD_ERROR + ".refresh"; //$NON-NLS-1$
private static final String TRACE_FOOTER = "]: "; //$NON-NLS-1$
private static final String TRACE_HEADER = "GeneratedmakefileBuilder trace ["; //$NON-NLS-1$
@@ -161,13 +177,12 @@ public class GeneratedMakefileBuilder extends ACBuilder {
public static boolean VERBOSE = false;
// Local variables
+ private IConsole console;
protected Vector generationProblems;
- protected IManagedBuilderMakefileGenerator generator;
protected IProject[] referencedProjects;
protected List resourcesToBuild;
protected List ruleList;
- private IConsole console;
-
+
public static void outputTrace(String resourceName, String message) {
if (VERBOSE) {
System.out.println(TRACE_HEADER + resourceName + TRACE_FOOTER + message + NEWLINE);
@@ -208,8 +223,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
// We should always tell the build system what projects we reference
referencedProjects = getProject().getReferencedProjects();
- checkCancel(monitor);
-
+
// Get the build information
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
if (info == null) {
@@ -217,14 +231,19 @@ public class GeneratedMakefileBuilder extends ACBuilder {
return referencedProjects;
}
+ // Create a makefile generator for the build
+ String targetID = info.getDefaultTarget().getParent().getId();
+ IManagedBuilderMakefileGenerator generator = ManagedBuildManager.getMakefileGenerator(targetID);
+ generator.initialize(getProject(), info, monitor);
+
// So let's figure out why we got called
if (kind == FULL_BUILD || info.needsRebuild()) {
outputTrace(getProject().getName(), "Full build needed/requested"); //$NON-NLS-1$
- fullBuild(monitor, info);
+ fullBuild(info, generator, monitor);
}
else if (kind == AUTO_BUILD && info.needsRebuild()) {
outputTrace(getProject().getName(), "Autobuild requested, full build needed"); //$NON-NLS-1$
- fullBuild(monitor, info);
+ fullBuild(info, generator, monitor);
}
else {
// Create a delta visitor to make sure we should be rebuilding
@@ -232,25 +251,22 @@ public class GeneratedMakefileBuilder extends ACBuilder {
IResourceDelta delta = getDelta(getProject());
if (delta == null) {
outputTrace(getProject().getName(), "Incremental build requested, full build needed"); //$NON-NLS-1$
- fullBuild(monitor, info);
+ fullBuild(info, generator, monitor);
}
else {
delta.accept(visitor);
if (visitor.shouldBuild()) {
outputTrace(getProject().getName(), "Incremental build requested"); //$NON-NLS-1$
- incrementalBuild(delta, info, monitor);
+ incrementalBuild(delta, info, generator, monitor);
}
}
}
-
// Scrub the build info the project
info.setRebuildState(false);
-
// Ask build mechanism to compute deltas for project dependencies next time
return referencedProjects;
}
-
/**
* Check whether the build has been canceled. Cancellation requests
* propagated to the caller by throwing <code>OperationCanceledException</code>.
@@ -259,6 +275,8 @@ public class GeneratedMakefileBuilder extends ACBuilder {
*/
public void checkCancel(IProgressMonitor monitor) {
if (monitor != null && monitor.isCanceled()) {
+ outputTrace(getProject().getName(), "Build cancelled"); //$NON-NLS-1$
+ forgetLastBuiltState();
throw new OperationCanceledException();
}
}
@@ -274,79 +292,108 @@ public class GeneratedMakefileBuilder extends ACBuilder {
outputError(getProject().getName(), "Build information was not found"); //$NON-NLS-1$
return;
}
- cleanBuild(monitor, info);
+ IPath buildDirPath = getProject().getLocation().append(info.getConfigurationName());
+ IWorkspace workspace = CCorePlugin.getWorkspace();
+ IContainer buildDir = workspace.getRoot().getContainerForLocation(buildDirPath);
+ if (buildDir == null || !buildDir.isAccessible()){
+ outputError(buildDir.getName(), "Could not delete the build directory"); //$NON-NLS-1$
+ return;
+ }
+ String status;
+ try {
+ // try the brute force approach first
+ status = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.clean.deleting.output", buildDir.getName()); //$NON-NLS-1$
+ monitor.subTask(status);
+ workspace.delete(new IResource[]{buildDir}, true, monitor);
+ } catch (CoreException e) {
+ // Create a makefile generator for the build
+ status = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.clean.build.clean", buildDir.getName()); //$NON-NLS-1$
+ monitor.subTask(status);
+ String targetID = info.getDefaultTarget().getParent().getId();
+ IManagedBuilderMakefileGenerator generator = ManagedBuildManager.getMakefileGenerator(targetID);
+ generator.initialize(getProject(), info, monitor);
+ cleanBuild(info, generator, monitor);
+ }
}
/* (non-Javadoc)
* @param monitor
* @param info
*/
- protected void cleanBuild(IProgressMonitor monitor, IManagedBuildInfo info) {
+ protected void cleanBuild(IManagedBuildInfo info, IManagedBuilderMakefileGenerator generator, IProgressMonitor monitor) {
// Make sure that there is a top level directory and a set of makefiles
- String targetID = info.getDefaultTarget().getParent().getId();
- generator = ManagedBuildManager.getMakefileGenerator(targetID);
- IPath buildDir = getProject().getLocation().append(info.getConfigurationName());
- IPath makefilePath = buildDir.append(generator.getMakefileName());
+ IPath buildDir = generator.getBuildWorkingDir();
+ if (buildDir == null) {
+ buildDir = new Path(info.getConfigurationName());
+ }
+ IPath makefilePath = getProject().getLocation().append(buildDir.append(generator.getMakefileName()));
IWorkspaceRoot root = CCorePlugin.getWorkspace().getRoot();
IFile makefile = root.getFileForLocation(makefilePath);
- if (buildDir != null && makefile != null && makefile.exists()) {
+ if (buildDir != null && makefile != null && makefile.isAccessible()) {
// invoke make with the clean argument
String statusMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.starting", getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
checkCancel(monitor);
- invokeMake(CLEAN_BUILD, buildDir, info, monitor);
+ invokeMake(CLEAN_BUILD, buildDir, info, generator, monitor);
}
}
/* (non-Javadoc)
* @param monitor
*/
- protected void fullBuild(IProgressMonitor monitor, IManagedBuildInfo info) throws CoreException {
+ protected void fullBuild(IManagedBuildInfo info, IManagedBuilderMakefileGenerator generator, IProgressMonitor monitor) throws CoreException {
// Always need one of these bad boys
if (monitor == null) {
monitor = new NullProgressMonitor();
}
// Regenerate the makefiles for this project
+ checkCancel(monitor);
String statusMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.rebuild.makefiles", getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
- checkCancel(monitor);
String targetID = info.getDefaultTarget().getParent().getId();
generator = ManagedBuildManager.getMakefileGenerator(targetID);
generator.initialize(getProject(), info, monitor);
MultiStatus result = generator.regenerateMakefiles();
- if (result.getCode() != IStatus.OK) {
- getGenerationProblems().addAll(Arrays.asList(result.getChildren()));
+ if (result.getCode() == IStatus.WARNING || result.getCode() == IStatus.INFO) {
+ IStatus[] kids = result.getChildren();
+ for (int index = 0; index < kids.length; ++index) {
+ // One possibility is that there is nothing to build
+ IStatus status = kids[index];
+ if (status.getCode() == IManagedBuilderMakefileGenerator.NO_SOURCE_FOLDERS) {
+ // Dude, we're done
+ return;
+ } else {
+ // Stick this in the list of stuff to warn the user about
+ getGenerationProblems().add(status);
+ }
+ }
}
- monitor.worked(1);
-
// Now call make
+ checkCancel(monitor);
statusMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.starting", getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
- checkCancel(monitor);
IPath topBuildDir = generator.getBuildWorkingDir();
if (topBuildDir != null) {
- invokeMake(FULL_BUILD, topBuildDir, info, monitor);
+ invokeMake(FULL_BUILD, topBuildDir, info, generator, monitor);
} else {
statusMsg = ManagedMakeMessages.getFormattedString(NOTHING_BUILT, getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
return;
}
- monitor.worked(1);
// Now regenerate the dependencies
+ checkCancel(monitor);
statusMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.regen.deps", getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
- checkCancel(monitor);
try {
generator.regenerateDependencies(false);
} catch (CoreException e) {
// Throw the exception back to the builder
throw e;
}
- monitor.worked(1);
// Say bye bye
statusMsg = ManagedMakeMessages.getFormattedString(BUILD_FINISHED, getProject().getName()); //$NON-NLS-1$
@@ -452,51 +499,55 @@ public class GeneratedMakefileBuilder extends ACBuilder {
* @param monitor
* @throws CoreException
*/
- protected void incrementalBuild(IResourceDelta delta, IManagedBuildInfo info, IProgressMonitor monitor) throws CoreException {
+ protected void incrementalBuild(IResourceDelta delta, IManagedBuildInfo info, IManagedBuilderMakefileGenerator generator, IProgressMonitor monitor) throws CoreException {
// Need to report status to the user
if (monitor == null) {
monitor = new NullProgressMonitor();
}
// Ask the makefile generator to generate any makefiles needed to build delta
+ checkCancel(monitor);
String statusMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.update.makefiles", getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
- checkCancel(monitor);
- String targetID = info.getDefaultTarget().getParent().getId();
- generator = ManagedBuildManager.getMakefileGenerator(targetID);
- generator.initialize(getProject(), info, monitor);
MultiStatus result = generator.generateMakefiles(delta);
- if (result.getCode() != IStatus.OK) {
- getGenerationProblems().addAll(Arrays.asList(result.getChildren()));
+ if (result.getCode() == IStatus.WARNING || result.getCode() == IStatus.INFO) {
+ IStatus[] kids = result.getChildren();
+ for (int index = 0; index < kids.length; ++index) {
+ // One possibility is that there is nothing to build
+ IStatus status = kids[index];
+ if (status.getCode() == IManagedBuilderMakefileGenerator.NO_SOURCE_FOLDERS) {
+ // Dude, we're done
+ return;
+ } else {
+ // Stick this in the list of stuff to warn the user about
+ getGenerationProblems().add(status);
+ }
+ }
}
- monitor.worked(1);
// Run the build
+ checkCancel(monitor);
statusMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.starting", getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
- checkCancel(monitor);
IPath buildDir = new Path(info.getConfigurationName());
if (buildDir != null) {
- invokeMake(INCREMENTAL_BUILD, buildDir, info, monitor);
+ invokeMake(INCREMENTAL_BUILD, buildDir, info, generator, monitor);
} else {
statusMsg = ManagedMakeMessages.getFormattedString(NOTHING_BUILT, getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
return;
}
- monitor.worked(1);
// Generate the dependencies for all changes
+ checkCancel(monitor);
statusMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.updating.deps", getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
- checkCancel(monitor);
try {
generator.generateDependencies();
} catch (CoreException e) {
- ManagedBuilderCorePlugin.log(e);
throw e;
}
- monitor.worked(1);
-
+
// Say bye bye
statusMsg = ManagedMakeMessages.getFormattedString(BUILD_FINISHED, getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
@@ -508,7 +559,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
* @param info
* @param monitor
*/
- protected void invokeMake(int buildType, IPath buildDir, IManagedBuildInfo info, IProgressMonitor monitor) {
+ protected void invokeMake(int buildType, IPath buildDir, IManagedBuildInfo info, IManagedBuilderMakefileGenerator generator, IProgressMonitor monitor) {
// Get the project and make sure there's a monitor to cancel the build
IProject currentProject = getProject();
if (monitor == null) {
@@ -537,7 +588,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
String[] msgs = new String[2];
msgs[0] = makeCommand.toString();
msgs[1] = currentProject.getName();
- monitor.beginTask(ManagedMakeMessages.getFormattedString(MAKE, msgs), IProgressMonitor.UNKNOWN);
+ monitor.subTask(ManagedMakeMessages.getFormattedString(MAKE, msgs));
// Get a build console for the project
StringBuffer buf = new StringBuffer();
@@ -660,16 +711,15 @@ public class GeneratedMakefileBuilder extends ACBuilder {
stdout.close();
stderr.close();
+ // Generate any error markers that the build has discovered
monitor.subTask(ManagedMakeMessages.getResourceString(MARKERS));
addBuilderMarkers(epm);
epm.reportProblems();
}
} catch (Exception e) {
- ManagedBuilderCorePlugin.log(e);
forgetLastBuiltState();
} finally {
getGenerationProblems().clear();
- monitor.done();
}
}
@@ -684,8 +734,14 @@ public class GeneratedMakefileBuilder extends ACBuilder {
return console;
}
+ /* (non-Javadoc)
+ * Removes the IMarkers for the project specified in the argument if the
+ * project exists, and is open.
+ *
+ * @param project
+ */
private void removeAllMarkers(IProject project) {
- if (project == null || !project.exists()) return;
+ if (project == null || !project.isAccessible()) return;
// Clear out the problem markers
IWorkspace workspace = project.getWorkspace();
@@ -693,14 +749,15 @@ public class GeneratedMakefileBuilder extends ACBuilder {
try {
markers = project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
} catch (CoreException e) {
- ManagedBuilderCorePlugin.log(e);
+ // Handled just about every case in the sanity check
return;
}
if (markers != null) {
try {
workspace.deleteMarkers(markers);
} catch (CoreException e) {
- ManagedBuilderCorePlugin.log(e);
+ // The only situation that might cause this is some sort of resource change event
+ return;
}
}
}
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 8789dc7a188..c7a0b09f270 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
@@ -349,7 +349,6 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
}
} catch (NullPointerException e) {
- ManagedBuilderCorePlugin.log(e);
return null;
}
@@ -719,7 +718,6 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
IPathEntryContainer container = new ManagedBuildCPathEntryContainer(getOwner().getProject());
CoreModel.getDefault().setPathEntryContainer(new ICProject[]{cProject}, container, new NullProgressMonitor());
} catch (CModelException e) {
- ManagedBuilderCorePlugin.log(e);
}
}
@@ -889,9 +887,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
// See if there is anything to be done
IConfiguration oldDefault = getDefaultConfiguration(target);
if (defaultTarget == null || !configuration.equals(oldDefault)) {
- // Make sure it is the default
+ // Make sure the containing target is also the default target
setDefaultTarget(target);
- // Make the argument the
+ // Make the argument the default configuration
getDefaultConfigMap().put(target.getId(), configuration);
// Save it
persistDefaultConfigurations();
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
index bb36c86ef52..47c7b2fbcd4 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
@@ -24,6 +24,8 @@ ManagedMakeBuilder.message.no.build = Nothing to build for {0}
ManagedMakeBuilder.message.error = Build error
ManagedMakeBuilder.message.error.refresh = Error refreshing project
ManagedMakeBuilder.message.finished = Build complete for project {0}
+ManagedMakeBuilder.message.clean.deleting.output=Removing build artifacts from {0}
+ManagedMakeBuilder.message.clean.build.clean=Trying a make clean in {0}
ManagedMakeBuilder.type.clean = Clean-only build
ManagedMakeBuilder.type.full = Full rebuild
ManagedMakeBuider.type.incremental = Incremental build
@@ -43,6 +45,10 @@ MakefileGenerator.message.start.file=Building file:
MakefileGenerator.message.finish.file=Finished building:
MakefileGenerator.message.start.build=Building target:
MakefileGenerator.message.finish.build=Finished building target:
+MakefileGenerator.message.adding.source.folder=Adding folder {0} to sources
+MakefileGenerator.message.gen.source.makefile=Generating makefile for source folder {0}
+MakefileGenerator.message.calc.delta=Calculating the delta for project {0}
+MakefileGenerator.message.finding.sources=Finding source files in project {0}
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.build.rule = Each subdirectory must supply rules for building sources it contributes
@@ -54,4 +60,7 @@ MakefileGenerator.error.spaces=Cannot generate makefile for folder with spaces i
MakefileGenerator.warning.no.source=Nothing to build for project {0}
ManagedBuildInfo.message.job.init = Initializing path container for {0}
-ManagedBuildInfo.message.init.ok = Initializing path container succeeded for {0} \ No newline at end of file
+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} \ No newline at end of file
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 f36cb2a77d7..6bd4bcaddf0 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
@@ -24,7 +24,6 @@ import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolReference;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -196,7 +195,7 @@ public class ToolReference implements IToolReference {
break;
}
} catch (BuildException e) {
- ManagedBuilderCorePlugin.log(e);
+ // Likely a mismatch between the value and option type
continue;
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java
index c07c7768523..bb9a222935c 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java
@@ -12,6 +12,7 @@ package org.eclipse.cdt.managedbuilder.makegen;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -94,6 +95,13 @@ public interface IManagedBuilderMakefileGenerator {
public void initialize(IProject project, IManagedBuildInfo info, IProgressMonitor monitor);
/**
+ * Answers <code>true</code> if the argument is a resource created by the generator
+ * @param resource
+ * @return
+ */
+ public boolean isGeneratedResource(IResource resource);
+
+ /**
* @param force
* @throws CoreException
*/
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 3a1adb31f38..080ebe4a344 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
@@ -472,6 +472,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
Iterator iter = getSubdirList().listIterator();
while (iter.hasNext()) {
IContainer container = (IContainer) iter.next();
+ updateMonitor(ManagedMakeMessages.getFormattedString("MakefileGenerator.message.adding.source.folder", container.getFullPath().toString())); //$NON-NLS-1$
// Check the special case where the module is the project root
if (container.getFullPath() == project.getFullPath()) {
buffer.append(DOT + WHITESPACE + LINEBREAK);
@@ -565,7 +566,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
/*
* Write out the target rule as:
- * targ_<prefix><target>.<extension>: $(OBJS) <refd_project_1 ... refd_project_n>
+ * <targ_prefix><target>.<extension>: $(OBJS) <refd_project_1 ... refd_project_n>
* @echo 'Building target: $@'
* $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG)$@ $(OBJS) $(USER_OBJS) $(LIB_DEPS)
* @echo 'Finished building: $@'
@@ -682,7 +683,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
}
}
- /**
+ /* (non-Javadoc)
* Check whether the build has been cancelled. Cancellation requests
* propagated to the caller by throwing <code>OperationCanceledException</code>.
*
@@ -861,6 +862,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
IFile depFile = root.getFile(file.getFullPath());
if (depFile == null) continue;
try {
+ updateMonitor(ManagedMakeMessages.getFormattedString("GnuMakefileGenerator.message.postproc.dep.file", depFile.getName())); //$NON-NLS-1$
populateDummyTargets(depFile, false);
} catch (CoreException e) {
throw e;
@@ -888,18 +890,43 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
return regenerateMakefiles();
}
- // Make sure the build directory is available
- topBuildDir = createDirectory(info.getConfigurationName());
- checkCancel();
-
+ // Return value
+ MultiStatus status;
+
// Visit the resources in the delta and compile a list of subdirectories to regenerate
+ updateMonitor(ManagedMakeMessages.getFormattedString("MakefileGenerator.message.calc.delta", project.getName())); //$NON-NLS-1$
ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(this, info);
delta.accept(visitor);
checkCancel();
// Get all the subdirectories participating in the build
+ updateMonitor(ManagedMakeMessages.getFormattedString("MakefileGenerator.message.finding.sources", project.getName())); //$NON-NLS-1$
ResourceProxyVisitor resourceVisitor = new ResourceProxyVisitor(this, info);
project.accept(resourceVisitor, IResource.NONE);
+ checkCancel();
+
+ // Make sure there is something to build
+ if (getSubdirList().isEmpty()) {
+ String info = ManagedMakeMessages.getFormattedString("MakefileGenerator.warning.no.source", project.getName()); //$NON-NLS-1$
+ updateMonitor(info);
+ status = new MultiStatus(
+ ManagedBuilderCorePlugin.getUniqueIdentifier(),
+ IStatus.INFO,
+ info,
+ null);
+ status.add(new Status (
+ IStatus.INFO,
+ ManagedBuilderCorePlugin.getUniqueIdentifier(),
+ NO_SOURCE_FOLDERS,
+ new String(),
+ null));
+ return status;
+ }
+
+ // Make sure the build directory is available
+ topBuildDir = createDirectory(info.getConfigurationName());
+ checkCancel();
+
IPath srcsFilePath = topBuildDir.addTrailingSeparator().append(SRCSFILE_NAME);
IFile srcsFileHandle = createFile(srcsFilePath);
populateSourcesMakefile(srcsFileHandle);
@@ -943,7 +970,6 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
}
// How did we do
- MultiStatus status;
if (!getInvalidDirList().isEmpty()) {
status = new MultiStatus (
ManagedBuilderCorePlugin.getUniqueIdentifier(),
@@ -977,7 +1003,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
public IPath getBuildWorkingDir() {
if (topBuildDir != null) {
return topBuildDir.removeFirstSegments(1);
- }
+ }
return null;
}
@@ -1144,11 +1170,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
}
/* (non-Javadoc)
- * Answers <code>true</code> if the argument is found in a generated container
- * @param resource
- * @return boolean
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#isGeneratedResource(org.eclipse.core.resources.IResource)
*/
- protected boolean isGeneratedResource(IResource resource) {
+ public boolean isGeneratedResource(IResource resource) {
// Is this a generated directory ...
IPath path = resource.getProjectRelativePath();
String[] configNames = info.getConfigurationNames();
@@ -1340,7 +1364,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
}
IPath moduleOutputPath = buildRoot.append(moduleRelativePath);
-
+ updateMonitor(ManagedMakeMessages.getFormattedString("MakefileGenerator.message.gen.source.makefile", moduleOutputPath.toString())); //$NON-NLS-1$
+
// Now create the directory
IPath moduleOutputDir = createDirectory(moduleOutputPath.toString());
@@ -1513,8 +1538,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// The path to search for the dependency makefile
IPath relDepFilePath = topBuildDir.append(new Path((String)iter.next()));
IFile depFile = root.getFile(relDepFilePath);
- if (depFile == null || !depFile.exists()) continue;
+ if (depFile == null || !depFile.isAccessible()) continue;
try {
+ updateMonitor(ManagedMakeMessages.getFormattedString("GnuMakefileGenerator.message.postproc.dep.file", depFile.getName())); //$NON-NLS-1$
populateDummyTargets(depFile, true);
} catch (CoreException e) {
throw e;
@@ -1529,6 +1555,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#regenerateMakefiles()
*/
public MultiStatus regenerateMakefiles() throws CoreException {
+ MultiStatus status;
// Visit the resources in the project
ResourceProxyVisitor visitor = new ResourceProxyVisitor(this, info);
project.accept(visitor, IResource.NONE);
@@ -1538,7 +1565,20 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// Populate the makefile if any source files have been found in the project
if (getSubdirList().isEmpty()) {
- monitor.subTask(ManagedMakeMessages.getFormattedString("MakefileGenerator.warning.no.source", project.getName())); //$NON-NLS-1$
+ String info = ManagedMakeMessages.getFormattedString("MakefileGenerator.warning.no.source", project.getName()); //$NON-NLS-1$
+ updateMonitor(info);
+ status = new MultiStatus(
+ ManagedBuilderCorePlugin.getUniqueIdentifier(),
+ IStatus.INFO,
+ info,
+ null);
+ status.add(new Status (
+ IStatus.INFO,
+ ManagedBuilderCorePlugin.getUniqueIdentifier(),
+ NO_SOURCE_FOLDERS,
+ new String(),
+ null));
+ return status;
}
// Create the top-level directory for the build output
@@ -1578,7 +1618,6 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
checkCancel();
// How did we do
- MultiStatus status;
if (!getInvalidDirList().isEmpty()) {
status = new MultiStatus (
ManagedBuilderCorePlugin.getUniqueIdentifier(),
@@ -1605,4 +1644,14 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
return status;
}
+ /* (non-Javadoc)
+ * @param msg
+ */
+ protected void updateMonitor(String msg) {
+ if (monitor!= null && !monitor.isCanceled()) {
+ monitor.subTask(msg);
+ monitor.worked(1);
+ }
+ }
+
}

Back to the top