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
|
||||
This patch contains a lot of changes needed to implement fixes for 42648 and
|
||||
43122.
|
||||
|
|
|
@ -150,13 +150,13 @@ public interface IManagedBuildInfo {
|
|||
public String[] getLibsForTarget(String extension);
|
||||
|
||||
/**
|
||||
* Answers a string array containing the arguments to be passed to
|
||||
* make. For example, if the user has selected a build that stops
|
||||
* at the first error, the array would contain {"k"}.
|
||||
* Answers a <code>String</code> containing the arguments to be passed to make.
|
||||
* For example, if the user has selected a build that keeps going on error, the
|
||||
* answer would contain {"-k"}.
|
||||
*
|
||||
* @return
|
||||
* @return String
|
||||
*/
|
||||
public String[] getMakeArguments();
|
||||
public String getMakeArguments();
|
||||
|
||||
/**
|
||||
* Answers a <code>String</code> containing the make command invocation
|
||||
|
|
|
@ -352,6 +352,9 @@ public class Configuration extends BuildObject implements IConfiguration {
|
|||
case IOption.LIBRARIES :
|
||||
oldValue = option.getLibraries();
|
||||
break;
|
||||
case IOption.OBJECTS :
|
||||
oldValue = option.getUserObjects();
|
||||
break;
|
||||
default :
|
||||
oldValue = new String[0];
|
||||
break;
|
||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.managedbuilder.internal.core;
|
|||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -46,14 +47,17 @@ import org.eclipse.core.runtime.SubProgressMonitor;
|
|||
|
||||
public class GeneratedMakefileBuilder extends ACBuilder {
|
||||
// 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 REFRESH_ERROR = BUILD_ERROR + ".refresh"; //$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 MAKE = MESSAGE + ".make"; //$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 REFRESH = MESSAGE + ".updating"; //$NON-NLS-1$
|
||||
private static final String MARKERS = MESSAGE + ".creating.markers"; //$NON-NLS-1$
|
||||
|
||||
// Status codes
|
||||
public static final int EMPTY_PROJECT_BUILD_ERROR = 1;
|
||||
|
||||
|
@ -85,7 +89,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
*
|
||||
*/
|
||||
public GeneratedMakefileBuilder() {
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -102,6 +106,9 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
if (kind == IncrementalProjectBuilder.FULL_BUILD || info.isDirty()) {
|
||||
fullBuild(monitor, info);
|
||||
}
|
||||
else if (kind == IncrementalProjectBuilder.AUTO_BUILD && info.isDirty()) {
|
||||
fullBuild(monitor, info);
|
||||
}
|
||||
else {
|
||||
// Create a delta visitor to make sure we should be rebuilding
|
||||
ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
|
||||
|
@ -118,9 +125,6 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
}
|
||||
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
|
||||
return getProject().getReferencedProjects();
|
||||
}
|
||||
|
@ -191,7 +195,6 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
|
||||
// Now call make
|
||||
invokeMake(true, topBuildDir.removeFirstSegments(1), info, monitor);
|
||||
|
||||
monitor.worked(1);
|
||||
}
|
||||
|
||||
|
@ -282,132 +285,128 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
}
|
||||
|
||||
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();
|
||||
SubProgressMonitor subMonitor = null;
|
||||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
|
||||
// Flag to the user that make is about to be called
|
||||
IPath makeCommand = new Path(info.getMakeCommand());
|
||||
String[] msgs = new String[2];
|
||||
msgs[0] = info.getMakeCommand();
|
||||
msgs[1] = currentProject.getName();
|
||||
String statusMsg = ManagedBuilderCorePlugin.getFormattedString(MAKE, msgs);
|
||||
if (statusMsg != null) {
|
||||
monitor.subTask(statusMsg);
|
||||
}
|
||||
|
||||
// Get a build console for the project
|
||||
IConsole console = null;
|
||||
ConsoleOutputStream consoleOutStream = null;
|
||||
IWorkspace workspace = null;
|
||||
IMarker[] markers = null;
|
||||
try {
|
||||
console = CCorePlugin.getDefault().getConsole();
|
||||
console.start(currentProject);
|
||||
consoleOutStream = console.getOutputStream();
|
||||
// Flag to the user that make is about to be called
|
||||
IPath makeCommand = new Path(info.getMakeCommand());
|
||||
if (makeCommand != null) {
|
||||
String[] msgs = new String[2];
|
||||
msgs[0] = makeCommand.toString();
|
||||
msgs[1] = currentProject.getName();
|
||||
monitor.beginTask(ManagedBuilderCorePlugin.getFormattedString(MAKE, msgs), IProgressMonitor.UNKNOWN);
|
||||
|
||||
// Remove all markers for this project
|
||||
workspace = currentProject.getWorkspace();
|
||||
markers = currentProject.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
|
||||
if (markers != null) {
|
||||
workspace.deleteMarkers(markers);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
// Get a build console for the project
|
||||
IConsole console = CCorePlugin.getDefault().getConsole();
|
||||
console.start(currentProject);
|
||||
ConsoleOutputStream consoleOutStream = console.getOutputStream();
|
||||
|
||||
// Remove all markers for this project
|
||||
removeAllMarkers(currentProject);
|
||||
|
||||
IPath workingDirectory = getWorkingDirectory().append(buildDir);
|
||||
|
||||
// Get the arguments to be passed to make from build model
|
||||
String[] makeTargets = getMakeTargets(fullBuild);
|
||||
|
||||
// Get a launcher for the make command
|
||||
String errMsg = null;
|
||||
CommandLauncher launcher = new CommandLauncher();
|
||||
launcher.showCommand(true);
|
||||
|
||||
// Set the environmennt, some scripts may need the CWD var to be set.
|
||||
Properties props = launcher.getEnvironment();
|
||||
props.put("CWD", workingDirectory.toOSString());
|
||||
props.put("PWD", workingDirectory.toOSString());
|
||||
String[] env = null;
|
||||
ArrayList envList = new ArrayList();
|
||||
Enumeration names = props.propertyNames();
|
||||
if (names != null) {
|
||||
while (names.hasMoreElements()) {
|
||||
String key = (String) names.nextElement();
|
||||
envList.add(key + "=" + props.getProperty(key));
|
||||
}
|
||||
env = (String[]) envList.toArray(new String[envList.size()]);
|
||||
}
|
||||
|
||||
// Hook up an error parser
|
||||
ErrorParserManager epm = new ErrorParserManager(this);
|
||||
epm.setOutputStream(consoleOutStream);
|
||||
OutputStream stdout = epm.getOutputStream();
|
||||
OutputStream stderr = epm.getOutputStream();
|
||||
|
||||
// Launch make
|
||||
Process proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory);
|
||||
if (proc != null) {
|
||||
try {
|
||||
// Close the input of the Process explicitely.
|
||||
// We will never write to it.
|
||||
proc.getOutputStream().close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
|
||||
if (launcher.waitAndRead(stdout, stderr, subMonitor) != CommandLauncher.OK) {
|
||||
errMsg = launcher.getErrorMessage();
|
||||
IPath workingDirectory = getWorkingDirectory().append(buildDir);
|
||||
|
||||
// Get the arguments to be passed to make from build model
|
||||
ArrayList makeArgs = new ArrayList();
|
||||
makeArgs.add(info.getMakeArguments());
|
||||
makeArgs.addAll(Arrays.asList(getMakeTargets(fullBuild)));
|
||||
String[] makeTargets = (String[]) makeArgs.toArray(new String[makeArgs.size()]);
|
||||
|
||||
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) {
|
||||
// Get a launcher for the make command
|
||||
String errMsg = null;
|
||||
CommandLauncher launcher = new CommandLauncher();
|
||||
launcher.showCommand(true);
|
||||
|
||||
// Set the environmennt, some scripts may need the CWD var to be set.
|
||||
Properties props = launcher.getEnvironment();
|
||||
props.put("CWD", workingDirectory.toOSString()); //$NON-NLS-1$
|
||||
props.put("PWD", workingDirectory.toOSString()); //$NON-NLS-1$
|
||||
String[] env = null;
|
||||
ArrayList envList = new ArrayList();
|
||||
Enumeration names = props.propertyNames();
|
||||
if (names != null) {
|
||||
while (names.hasMoreElements()) {
|
||||
String key = (String) names.nextElement();
|
||||
envList.add(key + "=" + props.getProperty(key)); //$NON-NLS-1$
|
||||
}
|
||||
env = (String[]) envList.toArray(new String[envList.size()]);
|
||||
}
|
||||
|
||||
// Hook up an error parser
|
||||
ErrorParserManager epm = new ErrorParserManager(this);
|
||||
epm.setOutputStream(consoleOutStream);
|
||||
OutputStream stdout = epm.getOutputStream();
|
||||
OutputStream stderr = epm.getOutputStream();
|
||||
|
||||
// Launch make
|
||||
Process proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory);
|
||||
if (proc != null) {
|
||||
try {
|
||||
// Close the input of the process since we will never write to it
|
||||
proc.getOutputStream().close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
|
||||
if (launcher.waitAndRead(stdout, stderr, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
|
||||
errMsg = launcher.getErrorMessage();
|
||||
}
|
||||
|
||||
// Force a resync of the project without allowing the user to cancel.
|
||||
// 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 {
|
||||
errMsg = launcher.getErrorMessage();
|
||||
}
|
||||
|
||||
// Report either the success or failure of our mission
|
||||
StringBuffer buf = new StringBuffer();
|
||||
if (errMsg != null && errMsg.length() > 0) {
|
||||
String errorDesc = ManagedBuilderCorePlugin.getResourceString(BUILD_ERROR);
|
||||
buf.append(errorDesc);
|
||||
buf.append(System.getProperty("line.separator", "\n"));
|
||||
buf.append("(").append(errMsg).append(")");
|
||||
} else {
|
||||
// Report a successful build
|
||||
String successMsg = ManagedBuilderCorePlugin.getFormattedString(BUILD_FINISHED, currentProject.getName());
|
||||
buf.append(successMsg);
|
||||
buf.append(System.getProperty("line.separator", "\n"));
|
||||
}
|
||||
|
||||
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
|
||||
subMonitor.subTask("Parsing");
|
||||
} else {
|
||||
errMsg = launcher.getErrorMessage();
|
||||
}
|
||||
|
||||
|
||||
// Report either the success or failure of our mission
|
||||
StringBuffer buf = new StringBuffer();
|
||||
if (errMsg != null && errMsg.length() > 0) {
|
||||
String errorDesc = ManagedBuilderCorePlugin.getResourceString(BUILD_ERROR);
|
||||
buf.append(errorDesc);
|
||||
buf.append(System.getProperty("line.separator", "\n"));
|
||||
buf.append("(").append(errMsg).append(")");
|
||||
}
|
||||
else {
|
||||
// Report a successful build
|
||||
String successMsg = ManagedBuilderCorePlugin.getFormattedString(BUILD_FINISHED, currentProject.getName());
|
||||
buf.append(successMsg);
|
||||
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.flush();
|
||||
stdout.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();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,9 +51,9 @@ import org.eclipse.core.runtime.Status;
|
|||
|
||||
public class MakefileGenerator {
|
||||
// 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 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 SRC_LISTS = COMMENT + ".source.list"; //$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
|
||||
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);
|
||||
|
||||
/*
|
||||
|
@ -472,30 +477,32 @@ public class MakefileGenerator {
|
|||
* <cd <Proj_Dep_1/build_dir>; $(MAKE) [clean all | all]>
|
||||
*/
|
||||
List managedProjectOutputs = new ArrayList();
|
||||
buffer.append("deps:" + NEWLINE);
|
||||
if (deps != null) {
|
||||
for (int i = 0; i < deps.length; i++) {
|
||||
IProject dep = deps[i];
|
||||
String buildDir = dep.getLocation().toString();
|
||||
if (ManagedBuildManager.manages(dep)) {
|
||||
// Add the current configuration to the makefile path
|
||||
IManagedBuildInfo depInfo = ManagedBuildManager.getBuildInfo(dep);
|
||||
buildDir += SEPARATOR + depInfo.getConfigurationName();
|
||||
if (deps.length > 0) {
|
||||
buffer.append("deps:" + NEWLINE);
|
||||
if (deps != null) {
|
||||
for (int i = 0; i < deps.length; i++) {
|
||||
IProject dep = deps[i];
|
||||
String buildDir = dep.getLocation().toString();
|
||||
if (ManagedBuildManager.manages(dep)) {
|
||||
// Add the current configuration to the makefile path
|
||||
IManagedBuildInfo depInfo = ManagedBuildManager.getBuildInfo(dep);
|
||||
buildDir += SEPARATOR + depInfo.getConfigurationName();
|
||||
|
||||
// Extract the build artifact to add to the dependency list
|
||||
String depTarget = depInfo.getBuildArtifactName();
|
||||
String depExt = (new Path(depTarget)).getFileExtension();
|
||||
String depPrefix = depInfo.getOutputPrefix(depExt);
|
||||
managedProjectOutputs.add(buildDir + SEPARATOR + depPrefix + depTarget);
|
||||
// Extract the build artifact to add to the dependency list
|
||||
String depTarget = depInfo.getBuildArtifactName();
|
||||
String depExt = (new Path(depTarget)).getFileExtension();
|
||||
String depPrefix = depInfo.getOutputPrefix(depExt);
|
||||
managedProjectOutputs.add(buildDir + SEPARATOR + depPrefix + depTarget);
|
||||
}
|
||||
buffer.append(TAB + "cd" + WHITESPACE + buildDir + SEMI_COLON + WHITESPACE + "$(MAKE) " + targets + NEWLINE);
|
||||
}
|
||||
buffer.append(TAB + "cd" + WHITESPACE + buildDir + SEMI_COLON + WHITESPACE + "$(MAKE) " + targets + NEWLINE);
|
||||
}
|
||||
buffer.append(NEWLINE);
|
||||
}
|
||||
buffer.append(NEWLINE);
|
||||
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
//
|
||||
|
|
|
@ -148,6 +148,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
IConfiguration configuration = configs[i];
|
||||
configNames.add(configuration.getName());
|
||||
}
|
||||
configNames.trimToSize();
|
||||
return (String[])configNames.toArray(new String[configNames.size()]);
|
||||
}
|
||||
|
||||
|
@ -350,11 +351,29 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getMakeArguments()
|
||||
*/
|
||||
public String[] getMakeArguments() {
|
||||
// TODO Stop hard-coding this
|
||||
String[] args = {""};
|
||||
|
||||
return args;
|
||||
public String getMakeArguments() {
|
||||
String arguments = new String();
|
||||
|
||||
// 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)
|
||||
|
@ -364,7 +383,15 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
String command = new String();
|
||||
ITarget target = getDefaultTarget();
|
||||
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)
|
||||
|
@ -427,6 +454,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
public IResource getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @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) {
|
||||
throw new BuildException("bad value type");
|
||||
}
|
||||
List v = (List)value;
|
||||
return v != null
|
||||
? (String[])v.toArray(new String[v.size()])
|
||||
: EMPTY_STRING_ARRAY;
|
||||
ArrayList v = (ArrayList)value;
|
||||
if (v == null) {
|
||||
return EMPTY_STRING_ARRAY;
|
||||
} else {
|
||||
v.trimToSize();
|
||||
return (String[]) v.toArray(new String[v.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -201,10 +204,13 @@ public class Option extends BuildObject implements IOption {
|
|||
if (valueType != INCLUDE_PATH) {
|
||||
throw new BuildException("bad value type");
|
||||
}
|
||||
List v = (List)value;
|
||||
return v != null
|
||||
? (String[])v.toArray(new String[v.size()])
|
||||
: EMPTY_STRING_ARRAY;
|
||||
ArrayList v = (ArrayList)value;
|
||||
if (v == null) {
|
||||
return EMPTY_STRING_ARRAY;
|
||||
} else {
|
||||
v.trimToSize();
|
||||
return (String[]) v.toArray(new String[v.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -214,10 +220,13 @@ public class Option extends BuildObject implements IOption {
|
|||
if (valueType != LIBRARIES) {
|
||||
throw new BuildException("bad value type");
|
||||
}
|
||||
List v = (List)value;
|
||||
return v != null
|
||||
? (String[])v.toArray(new String[v.size()])
|
||||
: EMPTY_STRING_ARRAY;
|
||||
ArrayList v = (ArrayList)value;
|
||||
if (v == null) {
|
||||
return EMPTY_STRING_ARRAY;
|
||||
} else {
|
||||
v.trimToSize();
|
||||
return (String[]) v.toArray(new String[v.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -237,10 +246,13 @@ public class Option extends BuildObject implements IOption {
|
|||
if (valueType != STRING_LIST) {
|
||||
throw new BuildException("bad value type");
|
||||
}
|
||||
List v = (List)value;
|
||||
return v != null
|
||||
? (String[])v.toArray(new String[v.size()])
|
||||
: EMPTY_STRING_ARRAY;
|
||||
ArrayList v = (ArrayList)value;
|
||||
if (v == null) {
|
||||
return EMPTY_STRING_ARRAY;
|
||||
} else {
|
||||
v.trimToSize();
|
||||
return (String[]) v.toArray(new String[v.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -268,10 +280,13 @@ public class Option extends BuildObject implements IOption {
|
|||
throw new BuildException("bad value type");
|
||||
}
|
||||
// This is the right puppy, so return its list value
|
||||
List v = (List)value;
|
||||
return v != null
|
||||
? (String[])v.toArray(new String[v.size()])
|
||||
: EMPTY_STRING_ARRAY;
|
||||
ArrayList v = (ArrayList)value;
|
||||
if (v == null) {
|
||||
return EMPTY_STRING_ARRAY;
|
||||
} else {
|
||||
v.trimToSize();
|
||||
return (String[]) v.toArray(new String[v.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -10,15 +10,18 @@
|
|||
##########################################################################
|
||||
|
||||
# Generated makefile builder messages
|
||||
MakeBuilder.message.starting = Starting the build for project {0}
|
||||
MakeBuilder.message.rebuild = Regenerating makefiles for project {0}
|
||||
MakeBuilder.message.incremental = Updating makefiles for project {0}
|
||||
MakeBuilder.message.make = Calling {0} for project {1}
|
||||
MakeBuilder.message.error = Build error
|
||||
MakeBuilder.message.finished = Build complete for project {0}
|
||||
MakeBuilder.comment.module.list = # Every subdirectory with source files must be described here
|
||||
MakeBuilder.comment.source.list = # Each subdirectory must contribute its source files here
|
||||
MakeBuilder.comment.build.rule = # Each subdirectory must supply rules for building sources it contributes
|
||||
MakeBuilder.comment.module.make.includes = # Include the makefiles for each source subdirectory
|
||||
MakeBuilder.comment.module.dep.includes = # Include automatically-generated dependency list:
|
||||
MakeBuilder.comment.autodeps = # Automatically-generated dependency list:
|
||||
ManagedMakeBuilder.message.starting = Starting the build for project {0}
|
||||
ManagedMakeBuilder.message.rebuild = Regenerating makefiles for project {0}
|
||||
ManagedMakeBuilder.message.incremental = Updating makefiles for project {0}
|
||||
ManagedMakeBuilder.message.updating = Updating project files...
|
||||
ManagedMakeBuilder.message.make = Calling {0} for project {1}
|
||||
ManagedMakeBuilder.message.creating.markers = Generating markers...
|
||||
ManagedMakeBuilder.message.error = Build error
|
||||
ManagedMakeBuilder.message.error.refresh = Error refreshing project.
|
||||
ManagedMakeBuilder.message.finished = Build complete for project {0}
|
||||
ManagedMakeBuilder.comment.module.list = # Every subdirectory with source files must be described here
|
||||
ManagedMakeBuilder.comment.source.list = # Each subdirectory must contribute its source files here
|
||||
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()
|
||||
*/
|
||||
public String getOutputFlag() {
|
||||
return outputFlag == null ? new String() : outputFlag;
|
||||
return outputFlag == null ? new String() : outputFlag.trim();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputPrefix()
|
||||
*/
|
||||
public String getOutputPrefix() {
|
||||
return outputPrefix == null ? new String() : outputPrefix;
|
||||
return outputPrefix == null ? new String() : outputPrefix.trim();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -228,7 +228,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
* @see org.eclipse.cdt.core.build.managed.ITool#getToolCommand()
|
||||
*/
|
||||
public String getToolCommand() {
|
||||
return command;
|
||||
return command.trim();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -294,7 +294,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
|
||||
}
|
||||
|
||||
return buf.toString();
|
||||
return buf.toString().trim();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -317,7 +317,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
}
|
||||
|
||||
IOption[] allOptions = tool.getOptions();
|
||||
List myOptions = new ArrayList();
|
||||
ArrayList myOptions = new ArrayList();
|
||||
|
||||
for (int i = 0; i < allOptions.length; ++i) {
|
||||
IOption option = allOptions[i];
|
||||
|
@ -325,6 +325,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
myOptions.add(option);
|
||||
}
|
||||
|
||||
myOptions.trimToSize();
|
||||
return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue