Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivian Kong2010-02-02 16:12:33 -0500
committerVivian Kong2010-02-02 16:12:33 -0500
commitb1149715e10b9464f4abb9a0b341bb23b669fe1a (patch)
treefb903cc6b2ea60acfb3f9f0d6084f1b761b13ff3
parent5653371b937d92a4a6795774f4383b1fcb159df8 (diff)
downloadorg.eclipse.cdt-b1149715e10b9464f4abb9a0b341bb23b669fe1a.tar.gz
org.eclipse.cdt-b1149715e10b9464f4abb9a0b341bb23b669fe1a.tar.xz
org.eclipse.cdt-b1149715e10b9464f4abb9a0b341bb23b669fe1a.zip
Bug 301592 - Scanner discovery prefixes C:\cygwin to user-defined include paths for remote XLC projectsv201002021626
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java38
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java5
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java6
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java52
4 files changed, 77 insertions, 24 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
index c31536e7fe..11c78c85fd 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 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
@@ -33,25 +33,25 @@ import org.w3c.dom.NodeList;
* @author vhirsl
*/
public class CCommandDSC {
- private final static String SINGLE_SPACE = " "; //$NON-NLS-1$
- private final static String CMD_DESCRIPTION_ELEM = "commandDescription"; //$NON-NLS-1$
- private final static String CMD_SI_ELEM = "commandScannerInfo"; //$NON-NLS-1$
- private final static String OPTION_ELEM = "option"; //$NON-NLS-1$
- private final static String SI_ITEM_ELEM = "siItem"; //$NON-NLS-1$
- private final static String KEY_ATTR = "key"; //$NON-NLS-1$
- private final static String VALUE_ATTR = "value"; //$NON-NLS-1$
- private final static String QUOTE_INCLUDE_ATTR = "quote"; //$NON-NLS-1$
- private final static String KIND_ATTR = "kind"; //$NON-NLS-1$
+ protected final static String SINGLE_SPACE = " "; //$NON-NLS-1$
+ protected final static String CMD_DESCRIPTION_ELEM = "commandDescription"; //$NON-NLS-1$
+ protected final static String CMD_SI_ELEM = "commandScannerInfo"; //$NON-NLS-1$
+ protected final static String OPTION_ELEM = "option"; //$NON-NLS-1$
+ protected final static String SI_ITEM_ELEM = "siItem"; //$NON-NLS-1$
+ protected final static String KEY_ATTR = "key"; //$NON-NLS-1$
+ protected final static String VALUE_ATTR = "value"; //$NON-NLS-1$
+ protected final static String QUOTE_INCLUDE_ATTR = "quote"; //$NON-NLS-1$
+ protected final static String KIND_ATTR = "kind"; //$NON-NLS-1$
- private int commandId;
- private List compilerCommand; // members are KVStringPair objects
- private boolean discovered;
- private boolean cppFileType; // C or C++ file type
- private IProject project;
+ protected int commandId;
+ protected List compilerCommand; // members are KVStringPair objects
+ protected boolean discovered;
+ protected boolean cppFileType; // C or C++ file type
+ protected IProject project;
- private List symbols;
- private List includes;
- private List quoteIncludes;
+ protected List symbols;
+ protected List includes;
+ protected List quoteIncludes;
/**
* @param cppFileType2
@@ -403,7 +403,7 @@ public class CCommandDSC {
return path;
}
- private static IResource findResource(IProject project, IPath path) {
+ protected static IResource findResource(IProject project, IPath path) {
IResource resource = project.findMember(path, false);
if (resource == null) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java
index c67dee0ead..01be0e7393 100644
--- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 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
@@ -54,6 +54,7 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.util.CygpathTranslator;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
import org.eclipse.cdt.make.xlc.core.activator.Activator;
import org.eclipse.cdt.make.xlc.core.messages.Messages;
+import org.eclipse.cdt.make.xlc.core.scannerconfig.util.XLCCommandDSC;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
@@ -752,7 +753,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
else if (child.getNodeName().equals(CC_ELEM)) {
Element cmdElem = (Element) child;
boolean cppFileType = cmdElem.getAttribute(FILE_TYPE_ATTR).equals("c++"); //$NON-NLS-1$
- CCommandDSC command = new CCommandDSC(cppFileType, project);
+ XLCCommandDSC command = new XLCCommandDSC(cppFileType, project);
command.setCommandId(Integer.parseInt(cmdElem.getAttribute(ID_ATTR)));
// deserialize command
command.deserialize(cmdElem);
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java
index 444958debf..f6790d04cf 100644
--- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 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
@@ -13,7 +13,6 @@ package org.eclipse.cdt.make.xlc.core.scannerconfig;
import java.io.File;
import java.io.IOException;
import java.net.URI;
-import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -29,6 +28,7 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.KVStringPair;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SCDOptionsEnum;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.make.xlc.core.scannerconfig.util.XLCCommandDSC;
import org.eclipse.cdt.utils.FileSystemUtilityManager;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -299,7 +299,7 @@ public class XLCBuildOutputParserUtility {
public CCommandDSC getNewCCommandDSC(String[] tokens, final int idxOfCompilerCommand, boolean cppFileType) {
ArrayList dirafter = new ArrayList();
ArrayList includes = new ArrayList();
- CCommandDSC command = new CCommandDSC(cppFileType, getProject());
+ XLCCommandDSC command = new XLCCommandDSC(cppFileType, getProject());
command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), tokens[idxOfCompilerCommand]));
for (int i = idxOfCompilerCommand+1; i < tokens.length; ++i) {
String token = tokens[i];
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java
new file mode 100644
index 0000000000..f1bf2a7cca
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/util/XLCCommandDSC.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.make.xlc.core.scannerconfig.util;
+
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.KVStringPair;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.SCDOptionsEnum;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Class that represents a XL C/C++ compiler command and related scanner configuration
+ */
+public class XLCCommandDSC extends CCommandDSC {
+
+ public XLCCommandDSC(boolean cppFileType) {
+ super(cppFileType);
+ }
+
+ public XLCCommandDSC(boolean cppFileType, IProject project) {
+ super(cppFileType, project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC#addSCOption(org.eclipse.cdt.make.internal.core.scannerconfig.util.KVStringPair)
+ */
+ @Override
+ public void addSCOption(KVStringPair option) {
+ if (project != null &&
+ (option.getKey().equals(SCDOptionsEnum.INCLUDE_FILE.toString()) ||
+ option.getKey().equals(SCDOptionsEnum.INCLUDE.toString()) ||
+ option.getKey().equals(SCDOptionsEnum.ISYSTEM.toString()) ||
+ option.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString()) ||
+ option.getKey().equals(SCDOptionsEnum.IQUOTE.toString())))
+ {
+ String value = option.getValue();
+ value = makeRelative(project, new Path(value)).toOSString();
+ option = new KVStringPair(option.getKey(), value);
+ }
+ compilerCommand.add(option);
+ }
+
+}

Back to the top