From 5f524fb890957a1d0af7dabfe294230dca91f9a4 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Thu, 25 Sep 2003 03:19:31 +0000 Subject: [PATCH] Patch for Sean Evoy: To help out with bug 43051, I have changed the behaviour of the managed builder when asked for scanner information. The search feature needs the absolute paths to files. Since all the user-specified include paths specified in the managed builder UI are either absolute or relative to the build project directory, it is relatively easy to convert everything to absolute paths before answering the clients of this information. --- .../ChangeLog | 9 +++++++++ .../internal/core/ManagedBuildInfo.java | 16 ++++++++++++++-- core/org.eclipse.cdt.core.tests/ChangeLog | 6 ++++++ .../build/managed/tests/ManagedBuildTests.java | 7 ++++++- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/ChangeLog b/build/org.eclipse.cdt.managedbuilder.core/ChangeLog index 22ec15c7bfa..3c95c03c3f0 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/ChangeLog +++ b/build/org.eclipse.cdt.managedbuilder.core/ChangeLog @@ -1,3 +1,12 @@ +2003-09-24 Sean Evoy + Changed the implementor of IScannerInfo to answer only absolute paths when asked for + includes paths. Users will specify the includes paths in the managed build UI in such a way + that the compiler will not complain. Either they will use absolute paths, or they will specify + them relative to the build directory. In the second case, it is easier for the managed builder + to convert the paths relative to this directory into absolute paths before replying tha it is for + the client to figure this out. + * src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java + 2003-09-23 Sean Evoy All the work in this patch is for critical bug 43292. In order to manage configurations, there had to be a method through ITarget to remove 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 ae366d56b1c..44e6566ea9f 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 @@ -27,6 +27,8 @@ import org.eclipse.cdt.managedbuilder.core.ITarget; import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -278,6 +280,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { // Return the include paths for the default configuration ArrayList paths = new ArrayList(); IConfiguration config = getDefaultConfiguration(getDefaultTarget()); + IPath root = owner.getLocation().addTrailingSeparator().append(config.getName()); ITool[] tools = config.getTools(); for (int i = 0; i < tools.length; i++) { ITool tool = tools[i]; @@ -288,8 +291,17 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { try { // Get all the built-in paths from the option paths.addAll(Arrays.asList(option.getBuiltIns())); - // Get all the user-defined paths from the option - paths.addAll(Arrays.asList(option.getIncludePaths())); + // Get all the user-defined paths from the option as absolute paths + String[] userPaths = option.getIncludePaths(); + for (int index = 0; index < userPaths.length; ++index) { + IPath userPath = new Path(userPaths[index]); + if (userPath.isAbsolute()) { + paths.add(userPath.toOSString()); + } else { + IPath absPath = root.addTrailingSeparator().append(userPath); + paths.add(absPath.makeAbsolute().toOSString()); + } + } } catch (BuildException e) { // we should never get here, but continue anyway continue; diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog index c4e80ec938b..b49226c4e68 100644 --- a/core/org.eclipse.cdt.core.tests/ChangeLog +++ b/core/org.eclipse.cdt.core.tests/ChangeLog @@ -1,3 +1,9 @@ +2003-09-24 Sean Evoy + Changed the implementor of IScannerInfo to answer only absolute paths when asked for + includes paths. As a result, the managed builder test had to be updated to expect paths + in an OS-specific format. + * build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java + 2003-09-24 John Camelon Added testBug43375() to CompleteParseASTTest. Moved testConditionalExpressionWithReferencesB_Bug43106 from failed tests to passed tests. diff --git a/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java b/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java index 1de07eaf386..ca237580c93 100644 --- a/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java +++ b/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java @@ -42,6 +42,7 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; public class ManagedBuildTests extends TestCase { private static final boolean boolVal = true; @@ -153,7 +154,11 @@ public class ManagedBuildTests extends TestCase { */ public void testScannerInfoInterface(){ // These are the expected path settings - final String[] expectedPaths = {"/usr/gnu/include", "/usr/include", "/opt/gnome/include", "C:\\home\\tester/include"}; + final String[] expectedPaths = new String[4]; + expectedPaths[0] = (new Path("/usr/gnu/include")).toOSString(); + expectedPaths[1] = (new Path("/usr/include")).toOSString(); + expectedPaths[2] = (new Path("/opt/gnome/include")).toOSString(); + expectedPaths[3] = (new Path("C:\\home\\tester/include")).toOSString(); // Open the test project IProject project = null;