diff options
Diffstat (limited to 'org.rtems.cdt/src/org/rtems/cdt/build/RunScannerInfoProvider.java')
-rw-r--r-- | org.rtems.cdt/src/org/rtems/cdt/build/RunScannerInfoProvider.java | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/org.rtems.cdt/src/org/rtems/cdt/build/RunScannerInfoProvider.java b/org.rtems.cdt/src/org/rtems/cdt/build/RunScannerInfoProvider.java new file mode 100644 index 0000000..6408cda --- /dev/null +++ b/org.rtems.cdt/src/org/rtems/cdt/build/RunScannerInfoProvider.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2008 Embedded Brains GmbH and others. + * + * Embedded Brains GmbH + * Obere Lagerstr. 30 + * D-82178 Puchheim + * Germany + * rtems@embedded-brains.de + * + * All rights reserved. This program and the accompanying materials are made + * available under the terms of the Eclipse Public License Version 1.0 ("EPL") + * which accompanies this distribution and is available at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * For purposes of the EPL, "Program" will mean the Content. + * + * Contributors: + * + * Sebastian Huber (Embedded Brains GmbH) - Initial API and implementation. + */ + +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 String getPlatform() { + return Constants.PLATFORM_DEFAULT; + } + + 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; + } + + // Change platform + Storage.changePlatform( project, getPlatform()); + + /* + * 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; + } +} |