summaryrefslogtreecommitdiffstats
path: root/org.rtems.cdt.toolchain2/org/rtems/cdt/build/RunScannerInfoProvider.java
blob: 2616602f14075b12c7e28005254569d07fb9b256 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright (c) 2008
 * Embedded Brains GmbH
 * Obere Lagerstr. 30
 * D-82178 Puchheim
 * Germany
 * rtems@embedded-brains.de
 *
 * The license and distribution terms for this file may be found in the file
 * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
 */

package org.rtems.cdt.build;

import org.eclipse.cdt.make.internal.core.scannerconfig2.GCCSpecsRunSIProvider;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.rtems.cdt.Constants;
import org.rtems.cdt.Storage;

public class RunScannerInfoProvider extends GCCSpecsRunSIProvider {
	protected boolean initialize() {
		if (!super.initialize()) {
			return false;
		}

		IProject project = resource.getProject();
		
		/*
		 * FIXME: This is a hack to avoid to early discovery of internal
		 * compiler include paths and symbols.  The discovery is suppressed for
		 * empty projects which contain only the '.project' and '.cproject'
		 * files.
		 */
		try {
			if (project.members().length < 3) {
				return false;
			}
		} catch (CoreException e) {
			e.printStackTrace();
			return false;
		}
		
		/*
		 * FIXME: Added absolute path since it seams that the build
		 * environment is ignored.
		 */
		fCompileCommand = new Path(
			Storage.getProperty( project, Constants.BASE_PATH_KEY)
		);
		fCompileCommand = fCompileCommand.append( "bin");
		fCompileCommand = fCompileCommand.append(
			Storage.getProperty( project, Constants.TOOL_COMPILER_C_KEY)
		);
		
		// Add the standard options to the command arguments
		String options [] = Storage.getToolOptions( project, Constants.TOOL_COMPILER_C_KEY);
		String newCompileArguments [] = new String [options.length + fCompileArguments.length];
		System.arraycopy( options, 0, newCompileArguments, 0, options.length);
		System.arraycopy( fCompileArguments, 0, newCompileArguments, options.length, fCompileArguments.length);
		fCompileArguments = newCompileArguments;
		
		return true;
	}
}