View | Details | Raw Unified | Return to bug 142092
Collapse All | Expand All

(-)src/org/eclipse/cdt/make/core/MakeCorePlugin.java (-3 / +5 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 * QNX Software Systems - Initial API and implementation
9
 * QNX Software Systems - Initial API and implementation
10
 * Tianchao Li (tianchao.li@gmail.com) - EFS support
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.make.core;
12
package org.eclipse.cdt.make.core;
12
13
Lines 32-37 Link Here
32
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigInfoFactory;
33
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigInfoFactory;
33
import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerConfigUtil;
34
import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerConfigUtil;
34
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
35
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
36
import org.eclipse.core.filesystem.EFS;
35
import org.eclipse.core.resources.IFile;
37
import org.eclipse.core.resources.IFile;
36
import org.eclipse.core.resources.IProject;
38
import org.eclipse.core.resources.IProject;
37
import org.eclipse.core.resources.ResourcesPlugin;
39
import org.eclipse.core.resources.ResourcesPlugin;
Lines 155-172 Link Here
155
			ArrayList includeList = new ArrayList();
157
			ArrayList includeList = new ArrayList();
156
			includeList.addAll(Arrays.asList(gnu.getIncludeDirectories()));
158
			includeList.addAll(Arrays.asList(gnu.getIncludeDirectories()));
157
			includeList.addAll(Arrays.asList(getMakefileDirs()));
159
			includeList.addAll(Arrays.asList(getMakefileDirs()));
158
			includeList.add(file.getLocation().removeLastSegments(1).toOSString());
160
			includeList.add(file.getParent().getLocationURI().toString());
159
			String[] includes = (String[]) includeList.toArray(new String[includeList.size()]);
161
			String[] includes = (String[]) includeList.toArray(new String[includeList.size()]);
160
			gnu.setIncludeDirectories(includes);
162
			gnu.setIncludeDirectories(includes);
161
			try {
163
			try {
162
				gnu.parse(file.getLocation().toOSString());
164
				gnu.parse(file.getLocationURI());
163
			} catch (IOException e) {
165
			} catch (IOException e) {
164
			}
166
			}
165
			makefile = gnu;
167
			makefile = gnu;
166
		} else {
168
		} else {
167
			PosixMakefile posix = new PosixMakefile();
169
			PosixMakefile posix = new PosixMakefile();
168
			try {
170
			try {
169
				posix.parse(file.getLocation().toOSString());
171
				posix.parse(file.getLocationURI());
170
			} catch (IOException e) {
172
			} catch (IOException e) {
171
			}
173
			}
172
			makefile = posix;
174
			makefile = posix;
(-)src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java (+25 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     QNX Software Systems - Initial API and implementation
9
 *     QNX Software Systems - Initial API and implementation
10
 *     Tianchao Li (tianchao.li@gmail.com) - EFS support
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.make.internal.core.makefile.posix;
12
package org.eclipse.cdt.make.internal.core.makefile.posix;
12
13
Lines 16-21 Link Here
16
import java.io.InputStream;
17
import java.io.InputStream;
17
import java.io.InputStreamReader;
18
import java.io.InputStreamReader;
18
import java.io.Reader;
19
import java.io.Reader;
20
import java.net.URI;
19
import java.net.URL;
21
import java.net.URL;
20
22
21
import org.eclipse.cdt.make.core.MakeCorePlugin;
23
import org.eclipse.cdt.make.core.MakeCorePlugin;
Lines 42-47 Link Here
42
import org.eclipse.cdt.make.internal.core.makefile.Target;
44
import org.eclipse.cdt.make.internal.core.makefile.Target;
43
import org.eclipse.cdt.make.internal.core.makefile.TargetRule;
45
import org.eclipse.cdt.make.internal.core.makefile.TargetRule;
44
import org.eclipse.cdt.make.internal.core.makefile.Util;
46
import org.eclipse.cdt.make.internal.core.makefile.Util;
47
import org.eclipse.core.filesystem.EFS;
48
import org.eclipse.core.runtime.CoreException;
49
import org.eclipse.core.runtime.NullProgressMonitor;
45
import org.eclipse.core.runtime.Path;
50
import org.eclipse.core.runtime.Path;
46
import org.eclipse.core.runtime.Platform;
51
import org.eclipse.core.runtime.Platform;
47
52
Lines 70-75 Link Here
70
		super(null);
75
		super(null);
71
	}
76
	}
72
77
78
	public void parse(URI uri) throws IOException {
79
		try {
80
			InputStream input = EFS.getStore(uri).openInputStream(EFS.NONE, new NullProgressMonitor());
81
			InputStreamReader stream = new InputStreamReader(input);
82
			parse(uri.toString(), stream);
83
			if (stream != null)
84
			{
85
				try {
86
					stream.close();
87
				} catch (IOException e) {
88
				}
89
			}
90
		} catch (CoreException e) {
91
			throw new IOException(e.getMessage());
92
		}
93
	}
94
95
	/**
96
	 * @deprecated use {@link #parse(URI uri)}
97
	 */
73
	public void parse(String name) throws IOException {
98
	public void parse(String name) throws IOException {
74
		FileReader stream = new FileReader(name);
99
		FileReader stream = new FileReader(name);
75
		parse(name, stream);
100
		parse(name, stream);
(-)src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java (+29 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     QNX Software Systems - Initial API and implementation
9
 *     QNX Software Systems - Initial API and implementation
10
 *     Tianchao Li (tianchao.li@gmail.com) - EFS support
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.make.internal.core.makefile.gnu;
12
package org.eclipse.cdt.make.internal.core.makefile.gnu;
12
13
Lines 16-21 Link Here
16
import java.io.InputStream;
17
import java.io.InputStream;
17
import java.io.InputStreamReader;
18
import java.io.InputStreamReader;
18
import java.io.Reader;
19
import java.io.Reader;
20
import java.net.URI;
19
import java.net.URL;
21
import java.net.URL;
20
import java.util.ArrayList;
22
import java.util.ArrayList;
21
import java.util.Arrays;
23
import java.util.Arrays;
Lines 50-57 Link Here
50
import org.eclipse.cdt.make.internal.core.makefile.TargetRule;
52
import org.eclipse.cdt.make.internal.core.makefile.TargetRule;
51
import org.eclipse.cdt.make.internal.core.makefile.Util;
53
import org.eclipse.cdt.make.internal.core.makefile.Util;
52
import org.eclipse.cdt.make.internal.core.makefile.posix.PosixMakefileUtil;
54
import org.eclipse.cdt.make.internal.core.makefile.posix.PosixMakefileUtil;
55
import org.eclipse.core.filesystem.EFS;
56
import org.eclipse.core.filesystem.IFileStore;
57
import org.eclipse.core.runtime.CoreException;
58
import org.eclipse.core.runtime.FileLocator;
59
import org.eclipse.core.runtime.IPath;
60
import org.eclipse.core.runtime.NullProgressMonitor;
53
import org.eclipse.core.runtime.Path;
61
import org.eclipse.core.runtime.Path;
54
import org.eclipse.core.runtime.Platform;
62
import org.eclipse.core.runtime.Platform;
63
import org.osgi.framework.Bundle;
55
64
56
/**
65
/**
57
 * Makefile : ( statement ) *
66
 * Makefile : ( statement ) *
Lines 81-86 Link Here
81
		super(null);
90
		super(null);
82
	}
91
	}
83
92
93
	public void parse(URI uri) throws IOException {
94
		try {
95
			InputStream input = EFS.getStore(uri).openInputStream(EFS.NONE, new NullProgressMonitor());
96
			InputStreamReader stream = new InputStreamReader(input);
97
			parse(uri.toString(), stream);
98
			if (stream != null)
99
			{
100
				try {
101
					stream.close();
102
				} catch (IOException e) {
103
				}
104
			}
105
		} catch (CoreException e) {
106
			throw new IOException(e.getMessage());
107
		}
108
	}
109
110
	/**
111
	 * @deprecated use {@link #parse(URI uri)}
112
	 */
84
	public void parse(String name) throws IOException {
113
	public void parse(String name) throws IOException {
85
		FileReader stream = new FileReader(name);
114
		FileReader stream = new FileReader(name);
86
		parse(name, stream);
115
		parse(name, stream);
(-)src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java (-9 / +37 lines)
Lines 7-21 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     QNX Software Systems - Initial API and implementation
9
 *     QNX Software Systems - Initial API and implementation
10
 *     Tianchao Li (tianchao.li@gmail.com) - EFS support
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.make.internal.core.makefile.gnu;
12
package org.eclipse.cdt.make.internal.core.makefile.gnu;
12
13
13
import java.io.IOException;
14
import java.io.IOException;
15
import java.net.URI;
16
import java.net.URISyntaxException;
14
17
15
import org.eclipse.cdt.make.core.makefile.IDirective;
18
import org.eclipse.cdt.make.core.makefile.IDirective;
16
import org.eclipse.cdt.make.core.makefile.gnu.IInclude;
19
import org.eclipse.cdt.make.core.makefile.gnu.IInclude;
17
import org.eclipse.cdt.make.internal.core.makefile.Directive;
20
import org.eclipse.cdt.make.internal.core.makefile.Directive;
18
import org.eclipse.cdt.make.internal.core.makefile.Parent;
21
import org.eclipse.cdt.make.internal.core.makefile.Parent;
22
import org.eclipse.core.filesystem.EFS;
23
import org.eclipse.core.filesystem.URIUtil;
24
import org.eclipse.core.runtime.CoreException;
19
25
20
public class Include extends Parent implements IInclude {
26
public class Include extends Parent implements IInclude {
21
27
Lines 43-65 Link Here
43
	public IDirective[] getDirectives() {
49
	public IDirective[] getDirectives() {
44
		clearDirectives();
50
		clearDirectives();
45
		for (int i = 0; i < filenames.length; i++) {
51
		for (int i = 0; i < filenames.length; i++) {
46
			// Try the current directory.
47
			GNUMakefile gnu = new GNUMakefile();
52
			GNUMakefile gnu = new GNUMakefile();
48
			try {
53
//			// Try the current directory.
49
				gnu.parse(filenames[i]);
54
//			try {
50
				addDirective(gnu);
55
//				gnu.parse(filenames[i]);
51
				continue;
56
//				addDirective(gnu);
52
			} catch (IOException e) {
57
//				continue;
53
			}
58
//			} catch (IOException e) {
59
//			}
54
			if (!filenames[i].startsWith(GNUMakefile.FILE_SEPARATOR) && dirs != null) {
60
			if (!filenames[i].startsWith(GNUMakefile.FILE_SEPARATOR) && dirs != null) {
55
				for (int j = 0; j < dirs.length; j++) {
61
				for (int j = 0; j < dirs.length; j++) {
56
					try {
62
					try {
57
						String filename =  dirs[j] + GNUMakefile.FILE_SEPARATOR + filenames[i];
58
						gnu = new GNUMakefile();
63
						gnu = new GNUMakefile();
59
						gnu.parse(filename);
64
65
						// EFS
66
						URI uri = new URI(dirs[j]);
67
						// START =================================================
68
						// Temporary hack to provide UI support for EFS
69
						// without modifying the filesystemSupport extension point
70
						// Real solution has to be based on bug fix to 134270
71
						if (uri != null)
72
						{
73
							if ((uri.getScheme() == null) 
74
								|| (uri.getScheme() != null && uri.getScheme().length() == 1)) // This is a hack for Windows paths like c:\...! 
75
							{
76
								uri = URIUtil.toURI(dirs[j]);
77
							}
78
						}
79
						// =================================================== END
80
81
						URI fileURI = EFS.getStore(uri).getChild(filenames[i]).toURI();
82
						gnu.parse(fileURI);
60
						addDirective(gnu);
83
						addDirective(gnu);
61
						break;
84
						break;
62
					} catch (IOException e) {
85
					} catch (IOException e) {
86
						e.printStackTrace();
87
					} catch (URISyntaxException e) {
88
						e.printStackTrace();
89
					} catch (CoreException e) {
90
						e.printStackTrace();
63
					}
91
					}
64
				}
92
				}
65
			}
93
			}
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 22-26 Link Here
22
Require-Bundle: org.eclipse.core.resources,
22
Require-Bundle: org.eclipse.core.resources,
23
 org.eclipse.core.variables,
23
 org.eclipse.core.variables,
24
 org.eclipse.core.runtime,
24
 org.eclipse.core.runtime,
25
 org.eclipse.cdt.core
25
 org.eclipse.cdt.core,
26
 org.eclipse.core.filesystem
26
Eclipse-LazyStart: true
27
Eclipse-LazyStart: true

Return to bug 142092