mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Sean Evoy:
The builder now properly refreshes the files in a project after build.
This commit is contained in:
parent
563417b2eb
commit
58d60e53f4
9 changed files with 272 additions and 184 deletions
|
@ -1,3 +1,35 @@
|
||||||
|
2003-09-25 Sean Evoy
|
||||||
|
A patch to resolve the problem with refreshing the project after a build, or
|
||||||
|
bug 42522 if you care about those sorts of things. The managed make builder was
|
||||||
|
calling refresh at inside a bad if statement. I corrected that and projects
|
||||||
|
refresh correctly. Of course, if you have the wrong binary parser selected you are
|
||||||
|
hosed. You will also notice that the string constants have been changed to
|
||||||
|
resolve to a different name. The standard builder uses this name and I wanted
|
||||||
|
to minimize the possibility of problems later.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
|
||||||
|
|
||||||
|
Prepended "Managed" to the externalized string identifiers to avoid future overlap
|
||||||
|
with the standard build system. Had to update the makefile generator to use the
|
||||||
|
new identifiers.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
|
||||||
|
|
||||||
|
Changed the signature of the 'getMakeArguments' to return a string instead of an
|
||||||
|
array so the builder can invoke make with the user-specified args. I also changed
|
||||||
|
the logic of the getMakeCommand method in the implementor so that it only returns
|
||||||
|
a string containing the command itself.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
|
||||||
|
|
||||||
|
Explicitly trim all arrays to size before converting them to String[] for Options
|
||||||
|
and Tools.
|
||||||
|
*src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
|
||||||
|
|
||||||
|
Fixed a missing bit of logic in the Configuration when a user-object option is
|
||||||
|
deleted. Now the build model really does get rid of the the value.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
|
||||||
|
|
||||||
2003-09-25 Sean Evoy
|
2003-09-25 Sean Evoy
|
||||||
This patch contains a lot of changes needed to implement fixes for 42648 and
|
This patch contains a lot of changes needed to implement fixes for 42648 and
|
||||||
43122.
|
43122.
|
||||||
|
|
|
@ -150,13 +150,13 @@ public interface IManagedBuildInfo {
|
||||||
public String[] getLibsForTarget(String extension);
|
public String[] getLibsForTarget(String extension);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answers a string array containing the arguments to be passed to
|
* Answers a <code>String</code> containing the arguments to be passed to make.
|
||||||
* make. For example, if the user has selected a build that stops
|
* For example, if the user has selected a build that keeps going on error, the
|
||||||
* at the first error, the array would contain {"k"}.
|
* answer would contain {"-k"}.
|
||||||
*
|
*
|
||||||
* @return
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String[] getMakeArguments();
|
public String getMakeArguments();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answers a <code>String</code> containing the make command invocation
|
* Answers a <code>String</code> containing the make command invocation
|
||||||
|
|
|
@ -352,6 +352,9 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
case IOption.LIBRARIES :
|
case IOption.LIBRARIES :
|
||||||
oldValue = option.getLibraries();
|
oldValue = option.getLibraries();
|
||||||
break;
|
break;
|
||||||
|
case IOption.OBJECTS :
|
||||||
|
oldValue = option.getUserObjects();
|
||||||
|
break;
|
||||||
default :
|
default :
|
||||||
oldValue = new String[0];
|
oldValue = new String[0];
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.managedbuilder.internal.core;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -46,13 +47,16 @@ import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
|
||||||
public class GeneratedMakefileBuilder extends ACBuilder {
|
public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
// String constants
|
// String constants
|
||||||
private static final String MESSAGE = "MakeBuilder.message"; //$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 BUILD_ERROR = MESSAGE + ".error"; //$NON-NLS-1$
|
||||||
|
private static final String REFRESH_ERROR = BUILD_ERROR + ".refresh"; //$NON-NLS-1$
|
||||||
private static final String BUILD_FINISHED = MESSAGE + ".finished"; //$NON-NLS-1$
|
private static final String BUILD_FINISHED = MESSAGE + ".finished"; //$NON-NLS-1$
|
||||||
private static final String INCREMENTAL = MESSAGE + ".incremental"; //$NON-NLS-1$
|
private static final String INCREMENTAL = MESSAGE + ".incremental"; //$NON-NLS-1$
|
||||||
private static final String MAKE = MESSAGE + ".make"; //$NON-NLS-1$
|
private static final String MAKE = MESSAGE + ".make"; //$NON-NLS-1$
|
||||||
private static final String REBUILD = MESSAGE + ".rebuild"; //$NON-NLS-1$
|
private static final String REBUILD = MESSAGE + ".rebuild"; //$NON-NLS-1$
|
||||||
private static final String START = MESSAGE + ".starting"; //$NON-NLS-1$
|
private static final String START = MESSAGE + ".starting"; //$NON-NLS-1$
|
||||||
|
private static final String REFRESH = MESSAGE + ".updating"; //$NON-NLS-1$
|
||||||
|
private static final String MARKERS = MESSAGE + ".creating.markers"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Status codes
|
// Status codes
|
||||||
public static final int EMPTY_PROJECT_BUILD_ERROR = 1;
|
public static final int EMPTY_PROJECT_BUILD_ERROR = 1;
|
||||||
|
@ -85,7 +89,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public GeneratedMakefileBuilder() {
|
public GeneratedMakefileBuilder() {
|
||||||
super();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -102,6 +106,9 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
if (kind == IncrementalProjectBuilder.FULL_BUILD || info.isDirty()) {
|
if (kind == IncrementalProjectBuilder.FULL_BUILD || info.isDirty()) {
|
||||||
fullBuild(monitor, info);
|
fullBuild(monitor, info);
|
||||||
}
|
}
|
||||||
|
else if (kind == IncrementalProjectBuilder.AUTO_BUILD && info.isDirty()) {
|
||||||
|
fullBuild(monitor, info);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// Create a delta visitor to make sure we should be rebuilding
|
// Create a delta visitor to make sure we should be rebuilding
|
||||||
ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
|
ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
|
||||||
|
@ -118,9 +125,6 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
info.setDirty(false);
|
info.setDirty(false);
|
||||||
|
|
||||||
// Checking to see if the user cancelled the build
|
|
||||||
checkCancel(monitor);
|
|
||||||
|
|
||||||
// Ask build mechanism to compute deltas for project dependencies next time
|
// Ask build mechanism to compute deltas for project dependencies next time
|
||||||
return getProject().getReferencedProjects();
|
return getProject().getReferencedProjects();
|
||||||
}
|
}
|
||||||
|
@ -191,7 +195,6 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
|
|
||||||
// Now call make
|
// Now call make
|
||||||
invokeMake(true, topBuildDir.removeFirstSegments(1), info, monitor);
|
invokeMake(true, topBuildDir.removeFirstSegments(1), info, monitor);
|
||||||
|
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,46 +285,36 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void invokeMake(boolean fullBuild, IPath buildDir, IManagedBuildInfo info, IProgressMonitor monitor) {
|
protected void invokeMake(boolean fullBuild, IPath buildDir, IManagedBuildInfo info, IProgressMonitor monitor) {
|
||||||
boolean isCanceled = false;
|
// Get the project and make sure there's a monitor to cancel the build
|
||||||
IProject currentProject = getProject();
|
IProject currentProject = getProject();
|
||||||
SubProgressMonitor subMonitor = null;
|
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
// Flag to the user that make is about to be called
|
// Flag to the user that make is about to be called
|
||||||
IPath makeCommand = new Path(info.getMakeCommand());
|
IPath makeCommand = new Path(info.getMakeCommand());
|
||||||
|
if (makeCommand != null) {
|
||||||
String[] msgs = new String[2];
|
String[] msgs = new String[2];
|
||||||
msgs[0] = info.getMakeCommand();
|
msgs[0] = makeCommand.toString();
|
||||||
msgs[1] = currentProject.getName();
|
msgs[1] = currentProject.getName();
|
||||||
String statusMsg = ManagedBuilderCorePlugin.getFormattedString(MAKE, msgs);
|
monitor.beginTask(ManagedBuilderCorePlugin.getFormattedString(MAKE, msgs), IProgressMonitor.UNKNOWN);
|
||||||
if (statusMsg != null) {
|
|
||||||
monitor.subTask(statusMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a build console for the project
|
// Get a build console for the project
|
||||||
IConsole console = null;
|
IConsole console = CCorePlugin.getDefault().getConsole();
|
||||||
ConsoleOutputStream consoleOutStream = null;
|
|
||||||
IWorkspace workspace = null;
|
|
||||||
IMarker[] markers = null;
|
|
||||||
try {
|
|
||||||
console = CCorePlugin.getDefault().getConsole();
|
|
||||||
console.start(currentProject);
|
console.start(currentProject);
|
||||||
consoleOutStream = console.getOutputStream();
|
ConsoleOutputStream consoleOutStream = console.getOutputStream();
|
||||||
|
|
||||||
// Remove all markers for this project
|
// Remove all markers for this project
|
||||||
workspace = currentProject.getWorkspace();
|
removeAllMarkers(currentProject);
|
||||||
markers = currentProject.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
|
|
||||||
if (markers != null) {
|
|
||||||
workspace.deleteMarkers(markers);
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
IPath workingDirectory = getWorkingDirectory().append(buildDir);
|
IPath workingDirectory = getWorkingDirectory().append(buildDir);
|
||||||
|
|
||||||
// Get the arguments to be passed to make from build model
|
// Get the arguments to be passed to make from build model
|
||||||
String[] makeTargets = getMakeTargets(fullBuild);
|
ArrayList makeArgs = new ArrayList();
|
||||||
|
makeArgs.add(info.getMakeArguments());
|
||||||
|
makeArgs.addAll(Arrays.asList(getMakeTargets(fullBuild)));
|
||||||
|
String[] makeTargets = (String[]) makeArgs.toArray(new String[makeArgs.size()]);
|
||||||
|
|
||||||
// Get a launcher for the make command
|
// Get a launcher for the make command
|
||||||
String errMsg = null;
|
String errMsg = null;
|
||||||
|
@ -330,15 +323,15 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
|
|
||||||
// Set the environmennt, some scripts may need the CWD var to be set.
|
// Set the environmennt, some scripts may need the CWD var to be set.
|
||||||
Properties props = launcher.getEnvironment();
|
Properties props = launcher.getEnvironment();
|
||||||
props.put("CWD", workingDirectory.toOSString());
|
props.put("CWD", workingDirectory.toOSString()); //$NON-NLS-1$
|
||||||
props.put("PWD", workingDirectory.toOSString());
|
props.put("PWD", workingDirectory.toOSString()); //$NON-NLS-1$
|
||||||
String[] env = null;
|
String[] env = null;
|
||||||
ArrayList envList = new ArrayList();
|
ArrayList envList = new ArrayList();
|
||||||
Enumeration names = props.propertyNames();
|
Enumeration names = props.propertyNames();
|
||||||
if (names != null) {
|
if (names != null) {
|
||||||
while (names.hasMoreElements()) {
|
while (names.hasMoreElements()) {
|
||||||
String key = (String) names.nextElement();
|
String key = (String) names.nextElement();
|
||||||
envList.add(key + "=" + props.getProperty(key));
|
envList.add(key + "=" + props.getProperty(key)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
env = (String[]) envList.toArray(new String[envList.size()]);
|
env = (String[]) envList.toArray(new String[envList.size()]);
|
||||||
}
|
}
|
||||||
|
@ -353,32 +346,28 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
Process proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory);
|
Process proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory);
|
||||||
if (proc != null) {
|
if (proc != null) {
|
||||||
try {
|
try {
|
||||||
// Close the input of the Process explicitely.
|
// Close the input of the process since we will never write to it
|
||||||
// We will never write to it.
|
|
||||||
proc.getOutputStream().close();
|
proc.getOutputStream().close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
|
|
||||||
if (launcher.waitAndRead(stdout, stderr, subMonitor) != CommandLauncher.OK) {
|
if (launcher.waitAndRead(stdout, stderr, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
|
||||||
errMsg = launcher.getErrorMessage();
|
errMsg = launcher.getErrorMessage();
|
||||||
|
|
||||||
isCanceled = monitor.isCanceled();
|
|
||||||
monitor.setCanceled(false);
|
|
||||||
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
|
|
||||||
subMonitor.subTask("Refresh From Local");
|
|
||||||
|
|
||||||
try {
|
|
||||||
currentProject.refreshLocal(IResource.DEPTH_INFINITE, subMonitor);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
|
// Force a resync of the project without allowing the user to cancel.
|
||||||
subMonitor.subTask("Parsing");
|
// This is probably unkind, but short of this there is no way to insure
|
||||||
|
// the UI is up-to-date with the build results
|
||||||
|
monitor.subTask(ManagedBuilderCorePlugin.getResourceString(REFRESH));
|
||||||
|
try {
|
||||||
|
currentProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
monitor.subTask(ManagedBuilderCorePlugin.getResourceString(REFRESH_ERROR));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
errMsg = launcher.getErrorMessage();
|
errMsg = launcher.getErrorMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Report either the success or failure of our mission
|
// Report either the success or failure of our mission
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
if (errMsg != null && errMsg.length() > 0) {
|
if (errMsg != null && errMsg.length() > 0) {
|
||||||
|
@ -386,28 +375,38 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
buf.append(errorDesc);
|
buf.append(errorDesc);
|
||||||
buf.append(System.getProperty("line.separator", "\n"));
|
buf.append(System.getProperty("line.separator", "\n"));
|
||||||
buf.append("(").append(errMsg).append(")");
|
buf.append("(").append(errMsg).append(")");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Report a successful build
|
// Report a successful build
|
||||||
String successMsg = ManagedBuilderCorePlugin.getFormattedString(BUILD_FINISHED, currentProject.getName());
|
String successMsg = ManagedBuilderCorePlugin.getFormattedString(BUILD_FINISHED, currentProject.getName());
|
||||||
buf.append(successMsg);
|
buf.append(successMsg);
|
||||||
buf.append(System.getProperty("line.separator", "\n"));
|
buf.append(System.getProperty("line.separator", "\n"));
|
||||||
}
|
}
|
||||||
// Write your message on the pavement
|
|
||||||
try {
|
// Write message on the console
|
||||||
consoleOutStream.write(buf.toString().getBytes());
|
consoleOutStream.write(buf.toString().getBytes());
|
||||||
consoleOutStream.flush();
|
consoleOutStream.flush();
|
||||||
stdout.close();
|
stdout.close();
|
||||||
stderr.close();
|
stderr.close();
|
||||||
} catch (IOException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
monitor.subTask(ManagedBuilderCorePlugin.getResourceString(MARKERS)); //$NON-NLS-1$
|
||||||
epm.reportProblems();
|
epm.reportProblems();
|
||||||
|
|
||||||
subMonitor.done();
|
|
||||||
monitor.setCanceled(isCanceled);
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
forgetLastBuiltState();
|
||||||
|
} finally {
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeAllMarkers(IProject project) throws CoreException {
|
||||||
|
IWorkspace workspace = project.getWorkspace();
|
||||||
|
|
||||||
|
// remove all markers
|
||||||
|
IMarker[] markers = project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
|
||||||
|
if (markers != null) {
|
||||||
|
workspace.deleteMarkers(markers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,9 @@ import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
public class MakefileGenerator {
|
public class MakefileGenerator {
|
||||||
// String constants for messages
|
// String constants for messages
|
||||||
private static final String MESSAGE = "MakeBuilder.message"; //$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 BUILD_ERROR = MESSAGE + ".error"; //$NON-NLS-1$
|
||||||
private static final String COMMENT = "MakeBuilder.comment"; //$NON-NLS-1$
|
private static final String COMMENT = "ManagedMakeBuilder.comment"; //$NON-NLS-1$
|
||||||
private static final String MOD_LIST = COMMENT + ".module.list"; //$NON-NLS-1$
|
private static final String MOD_LIST = COMMENT + ".module.list"; //$NON-NLS-1$
|
||||||
private static final String SRC_LISTS = COMMENT + ".source.list"; //$NON-NLS-1$
|
private static final String SRC_LISTS = COMMENT + ".source.list"; //$NON-NLS-1$
|
||||||
private static final String MOD_RULES = COMMENT + ".build.rule"; //$NON-NLS-1$
|
private static final String MOD_RULES = COMMENT + ".build.rule"; //$NON-NLS-1$
|
||||||
|
@ -462,7 +462,12 @@ public class MakefileGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out the all target first in case someone just runs make
|
// Write out the all target first in case someone just runs make
|
||||||
buffer.append("all: deps" + WHITESPACE + outputPrefix + target + NEWLINE);
|
// all: targ_<target_name> [deps]
|
||||||
|
String defaultTarget = "all:";
|
||||||
|
if (deps.length > 0) {
|
||||||
|
defaultTarget += WHITESPACE + "deps";
|
||||||
|
}
|
||||||
|
buffer.append(defaultTarget + WHITESPACE + outputPrefix + target + NEWLINE);
|
||||||
buffer.append(NEWLINE);
|
buffer.append(NEWLINE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -472,6 +477,7 @@ public class MakefileGenerator {
|
||||||
* <cd <Proj_Dep_1/build_dir>; $(MAKE) [clean all | all]>
|
* <cd <Proj_Dep_1/build_dir>; $(MAKE) [clean all | all]>
|
||||||
*/
|
*/
|
||||||
List managedProjectOutputs = new ArrayList();
|
List managedProjectOutputs = new ArrayList();
|
||||||
|
if (deps.length > 0) {
|
||||||
buffer.append("deps:" + NEWLINE);
|
buffer.append("deps:" + NEWLINE);
|
||||||
if (deps != null) {
|
if (deps != null) {
|
||||||
for (int i = 0; i < deps.length; i++) {
|
for (int i = 0; i < deps.length; i++) {
|
||||||
|
@ -492,10 +498,11 @@ public class MakefileGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buffer.append(NEWLINE);
|
buffer.append(NEWLINE);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write out the target rule as:
|
* Write out the target rule as:
|
||||||
* <prefix><target>.<extension>: $(OBJS) [<dep_proj_1_output> ... <dep_proj_n_output>]
|
* targ_<prefix><target>.<extension>: $(OBJS) [<dep_proj_1_output> ... <dep_proj_n_output>]
|
||||||
* $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG) $@ $(OBJS) $(USER_OBJS) $(LIB_DEPS)
|
* $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG) $@ $(OBJS) $(USER_OBJS) $(LIB_DEPS)
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
|
|
|
@ -148,6 +148,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
IConfiguration configuration = configs[i];
|
IConfiguration configuration = configs[i];
|
||||||
configNames.add(configuration.getName());
|
configNames.add(configuration.getName());
|
||||||
}
|
}
|
||||||
|
configNames.trimToSize();
|
||||||
return (String[])configNames.toArray(new String[configNames.size()]);
|
return (String[])configNames.toArray(new String[configNames.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,11 +351,29 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getMakeArguments()
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getMakeArguments()
|
||||||
*/
|
*/
|
||||||
public String[] getMakeArguments() {
|
public String getMakeArguments() {
|
||||||
// TODO Stop hard-coding this
|
String arguments = new String();
|
||||||
String[] args = {""};
|
|
||||||
|
|
||||||
return args;
|
// The make command may or may not have any flags
|
||||||
|
ITarget target = getDefaultTarget();
|
||||||
|
String command = target.getMakeCommand();
|
||||||
|
|
||||||
|
// If it does, the flags will be everything between the '-' and the next space
|
||||||
|
int indexOfArgs = command.indexOf('-');
|
||||||
|
if (indexOfArgs != - 1) {
|
||||||
|
try {
|
||||||
|
String argsAndTargs = command.substring(indexOfArgs);
|
||||||
|
int indexOfTargs = argsAndTargs.indexOf(' ');
|
||||||
|
arguments = (indexOfTargs != -1) ?
|
||||||
|
argsAndTargs.substring(0, indexOfTargs) :
|
||||||
|
argsAndTargs;
|
||||||
|
// Make sure the arg list does not contain f or C
|
||||||
|
|
||||||
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return arguments.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -364,7 +383,15 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
String command = new String();
|
String command = new String();
|
||||||
ITarget target = getDefaultTarget();
|
ITarget target = getDefaultTarget();
|
||||||
command = target.getMakeCommand();
|
command = target.getMakeCommand();
|
||||||
return command;
|
|
||||||
|
// There may actually be arguments, so just get everything up to the first '-'
|
||||||
|
int indexOfArgs = command.indexOf('-');
|
||||||
|
if (indexOfArgs != -1) {
|
||||||
|
// Return ecverything up to the first argument as the command
|
||||||
|
return command.substring(0, indexOfArgs).trim();
|
||||||
|
} else {
|
||||||
|
return command.trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -427,6 +454,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
public IResource getOwner() {
|
public IResource getOwner() {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTarget(org.eclipse.cdt.core.build.managed.IConfiguration)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTarget(org.eclipse.cdt.core.build.managed.IConfiguration)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -180,10 +180,13 @@ public class Option extends BuildObject implements IOption {
|
||||||
if (valueType != PREPROCESSOR_SYMBOLS) {
|
if (valueType != PREPROCESSOR_SYMBOLS) {
|
||||||
throw new BuildException("bad value type");
|
throw new BuildException("bad value type");
|
||||||
}
|
}
|
||||||
List v = (List)value;
|
ArrayList v = (ArrayList)value;
|
||||||
return v != null
|
if (v == null) {
|
||||||
? (String[])v.toArray(new String[v.size()])
|
return EMPTY_STRING_ARRAY;
|
||||||
: EMPTY_STRING_ARRAY;
|
} else {
|
||||||
|
v.trimToSize();
|
||||||
|
return (String[]) v.toArray(new String[v.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -201,10 +204,13 @@ public class Option extends BuildObject implements IOption {
|
||||||
if (valueType != INCLUDE_PATH) {
|
if (valueType != INCLUDE_PATH) {
|
||||||
throw new BuildException("bad value type");
|
throw new BuildException("bad value type");
|
||||||
}
|
}
|
||||||
List v = (List)value;
|
ArrayList v = (ArrayList)value;
|
||||||
return v != null
|
if (v == null) {
|
||||||
? (String[])v.toArray(new String[v.size()])
|
return EMPTY_STRING_ARRAY;
|
||||||
: EMPTY_STRING_ARRAY;
|
} else {
|
||||||
|
v.trimToSize();
|
||||||
|
return (String[]) v.toArray(new String[v.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -214,10 +220,13 @@ public class Option extends BuildObject implements IOption {
|
||||||
if (valueType != LIBRARIES) {
|
if (valueType != LIBRARIES) {
|
||||||
throw new BuildException("bad value type");
|
throw new BuildException("bad value type");
|
||||||
}
|
}
|
||||||
List v = (List)value;
|
ArrayList v = (ArrayList)value;
|
||||||
return v != null
|
if (v == null) {
|
||||||
? (String[])v.toArray(new String[v.size()])
|
return EMPTY_STRING_ARRAY;
|
||||||
: EMPTY_STRING_ARRAY;
|
} else {
|
||||||
|
v.trimToSize();
|
||||||
|
return (String[]) v.toArray(new String[v.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -237,10 +246,13 @@ public class Option extends BuildObject implements IOption {
|
||||||
if (valueType != STRING_LIST) {
|
if (valueType != STRING_LIST) {
|
||||||
throw new BuildException("bad value type");
|
throw new BuildException("bad value type");
|
||||||
}
|
}
|
||||||
List v = (List)value;
|
ArrayList v = (ArrayList)value;
|
||||||
return v != null
|
if (v == null) {
|
||||||
? (String[])v.toArray(new String[v.size()])
|
return EMPTY_STRING_ARRAY;
|
||||||
: EMPTY_STRING_ARRAY;
|
} else {
|
||||||
|
v.trimToSize();
|
||||||
|
return (String[]) v.toArray(new String[v.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -268,10 +280,13 @@ public class Option extends BuildObject implements IOption {
|
||||||
throw new BuildException("bad value type");
|
throw new BuildException("bad value type");
|
||||||
}
|
}
|
||||||
// This is the right puppy, so return its list value
|
// This is the right puppy, so return its list value
|
||||||
List v = (List)value;
|
ArrayList v = (ArrayList)value;
|
||||||
return v != null
|
if (v == null) {
|
||||||
? (String[])v.toArray(new String[v.size()])
|
return EMPTY_STRING_ARRAY;
|
||||||
: EMPTY_STRING_ARRAY;
|
} else {
|
||||||
|
v.trimToSize();
|
||||||
|
return (String[]) v.toArray(new String[v.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -10,15 +10,18 @@
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
# Generated makefile builder messages
|
# Generated makefile builder messages
|
||||||
MakeBuilder.message.starting = Starting the build for project {0}
|
ManagedMakeBuilder.message.starting = Starting the build for project {0}
|
||||||
MakeBuilder.message.rebuild = Regenerating makefiles for project {0}
|
ManagedMakeBuilder.message.rebuild = Regenerating makefiles for project {0}
|
||||||
MakeBuilder.message.incremental = Updating makefiles for project {0}
|
ManagedMakeBuilder.message.incremental = Updating makefiles for project {0}
|
||||||
MakeBuilder.message.make = Calling {0} for project {1}
|
ManagedMakeBuilder.message.updating = Updating project files...
|
||||||
MakeBuilder.message.error = Build error
|
ManagedMakeBuilder.message.make = Calling {0} for project {1}
|
||||||
MakeBuilder.message.finished = Build complete for project {0}
|
ManagedMakeBuilder.message.creating.markers = Generating markers...
|
||||||
MakeBuilder.comment.module.list = # Every subdirectory with source files must be described here
|
ManagedMakeBuilder.message.error = Build error
|
||||||
MakeBuilder.comment.source.list = # Each subdirectory must contribute its source files here
|
ManagedMakeBuilder.message.error.refresh = Error refreshing project.
|
||||||
MakeBuilder.comment.build.rule = # Each subdirectory must supply rules for building sources it contributes
|
ManagedMakeBuilder.message.finished = Build complete for project {0}
|
||||||
MakeBuilder.comment.module.make.includes = # Include the makefiles for each source subdirectory
|
ManagedMakeBuilder.comment.module.list = # Every subdirectory with source files must be described here
|
||||||
MakeBuilder.comment.module.dep.includes = # Include automatically-generated dependency list:
|
ManagedMakeBuilder.comment.source.list = # Each subdirectory must contribute its source files here
|
||||||
MakeBuilder.comment.autodeps = # Automatically-generated dependency list:
|
ManagedMakeBuilder.comment.build.rule = # Each subdirectory must supply rules for building sources it contributes
|
||||||
|
ManagedMakeBuilder.comment.module.make.includes = # Include the makefiles for each source subdirectory
|
||||||
|
ManagedMakeBuilder.comment.module.dep.includes = # Include automatically-generated dependency list:
|
||||||
|
ManagedMakeBuilder.comment.autodeps = # Automatically-generated dependency list:
|
||||||
|
|
|
@ -196,14 +196,14 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputFlag()
|
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputFlag()
|
||||||
*/
|
*/
|
||||||
public String getOutputFlag() {
|
public String getOutputFlag() {
|
||||||
return outputFlag == null ? new String() : outputFlag;
|
return outputFlag == null ? new String() : outputFlag.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputPrefix()
|
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputPrefix()
|
||||||
*/
|
*/
|
||||||
public String getOutputPrefix() {
|
public String getOutputPrefix() {
|
||||||
return outputPrefix == null ? new String() : outputPrefix;
|
return outputPrefix == null ? new String() : outputPrefix.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -228,7 +228,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getToolCommand()
|
* @see org.eclipse.cdt.core.build.managed.ITool#getToolCommand()
|
||||||
*/
|
*/
|
||||||
public String getToolCommand() {
|
public String getToolCommand() {
|
||||||
return command;
|
return command.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -294,7 +294,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return buf.toString();
|
return buf.toString().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -317,7 +317,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
}
|
}
|
||||||
|
|
||||||
IOption[] allOptions = tool.getOptions();
|
IOption[] allOptions = tool.getOptions();
|
||||||
List myOptions = new ArrayList();
|
ArrayList myOptions = new ArrayList();
|
||||||
|
|
||||||
for (int i = 0; i < allOptions.length; ++i) {
|
for (int i = 0; i < allOptions.length; ++i) {
|
||||||
IOption option = allOptions[i];
|
IOption option = allOptions[i];
|
||||||
|
@ -325,6 +325,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
myOptions.add(option);
|
myOptions.add(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myOptions.trimToSize();
|
||||||
return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
|
return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue