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 8c1b0084315..e1a13491467 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2005 IBM Corporation and others. + * Copyright (c) 2002, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -369,6 +369,8 @@ public class GeneratedMakefileBuilder extends ACBuilder { if (refDelta == null) { outputTrace(getProject().getName(), "Incremental build because of changed referenced project"); //$NON-NLS-1$ incrementalBuild(delta, info, generator, monitor); + // Should only build this project once, for this delta + break; } else { int refKind = refDelta.getKind(); if (refKind != IResourceDelta.NO_CHANGE) { @@ -377,6 +379,8 @@ public class GeneratedMakefileBuilder extends ACBuilder { refFlags == IResourceDelta.OPEN)) { outputTrace(getProject().getName(), "Incremental build because of changed referenced project"); //$NON-NLS-1$ incrementalBuild(delta, info, generator, monitor); + // Should only build this project once, for this delta + break; } } } @@ -794,8 +798,9 @@ public class GeneratedMakefileBuilder extends ACBuilder { String[] errorParsers = info.getDefaultConfiguration().getErrorParserList(); ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectory, this, errorParsers); epm.setOutputStream(consoleOutStream); - OutputStream stdout = epm.getOutputStream(); - OutputStream stderr = epm.getOutputStream(); + // This variable is necessary to ensure that the EPM stream stay open + // until we explicitly close it. See bug#123302. + OutputStream epmOutputStream = epm.getOutputStream(); // Get the arguments to be passed to make from build model ArrayList makeArgs = new ArrayList(); @@ -844,7 +849,7 @@ public class GeneratedMakefileBuilder extends ACBuilder { proc.getOutputStream().close(); } catch (IOException e) { } - if (launcher.waitAndRead(stdout, stderr, + if (launcher.waitAndRead(epm.getOutputStream(), epm.getOutputStream(), new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) { errMsg = launcher.getErrorMessage(); @@ -873,9 +878,8 @@ public class GeneratedMakefileBuilder extends ACBuilder { // Write message on the console consoleOutStream.write(buf.toString().getBytes()); consoleOutStream.flush(); + epmOutputStream.close(); consoleOutStream.close(); - stdout.close(); - stderr.close(); } else { // The status value was other than 0, so press on with the build process makeArgs.add("pre-build"); //$NON-NLS-1$ @@ -915,7 +919,7 @@ public class GeneratedMakefileBuilder extends ACBuilder { } catch (IOException e) { } - if (launcher.waitAndRead(stdout, stderr, + if (launcher.waitAndRead(epm.getOutputStream(), epm.getOutputStream(), new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) { errMsg = launcher.getErrorMessage(); @@ -957,8 +961,7 @@ public class GeneratedMakefileBuilder extends ACBuilder { // Write message on the console consoleOutStream.write(buf.toString().getBytes()); consoleOutStream.flush(); - stdout.close(); - stderr.close(); + epmOutputStream.close(); // Generate any error markers that the build has discovered monitor.subTask(ManagedMakeMessages diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java index 0cbd59f582f..eec78830793 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. + * Copyright (c) 2003, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -335,6 +335,9 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory { if (tool.command != null) { command = new String(tool.command); } + if (tool.commandLinePattern != null) { + commandLinePattern = new String(tool.commandLinePattern); + } if (tool.inputExtensions != null) { inputExtensions = new ArrayList(tool.inputExtensions); } 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 f13c2ab03cf..2f7ab27e7ed 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 @@ -2056,29 +2056,28 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator { */ protected void addToBuildVar (LinkedHashMap buildVarToRuleStringMap, String ext, String varName, String relativePath, IPath sourceLocation, boolean generatedSource) { - // look for the extension in the map + List varList = null; if (varName == null) { + // Get the proper source build variable based upon the extension varName = getSourceMacroName(ext).toString(); - // Add the resource to the list of all resources associated with a variable. - List varList = (List)buildSrcVars.get(varName); + varList = (List)buildSrcVars.get(varName); + } else { + varList = (List)buildOutVars.get(varName); + } + // Add the resource to the list of all resources associated with a variable. + // Do not allow duplicates - there is no reason to and it can be 'bad' - + // e.g., having the same object in the OBJS list can cause duplicate symbol errors from the linker + if ((varList != null) && !(varList.contains(sourceLocation))) { // Since we don't know how these files will be used, we store them using a "location" // path rather than a relative path varList.add(sourceLocation); - } else { - // Add the resource to the list of all resources associated with a variable. - List varList = (List)buildOutVars.get(varName); - if (varList != null) { - // Since we don't know how these files will be used, we store them using a "location" - // path rather than a relative path - varList.add(sourceLocation); + if (!buildVarToRuleStringMap.containsKey(varName)) { + // TODO - is this an error? + } else { + // Add the resource name to the makefile line that adds resources to the build variable + addMacroAdditionFile(buildVarToRuleStringMap, varName, relativePath, sourceLocation, generatedSource); } } - if (!buildVarToRuleStringMap.containsKey(varName)) { - // TODO - is this an error? - } else { - // Add the resource name to the makefile line that adds resources to the build variable - addMacroAdditionFile(buildVarToRuleStringMap, varName, relativePath, sourceLocation, generatedSource); - } } /* (non-Javadoc)