Package org.eclipse.cdt.core.build
Class CBuildConfiguration
java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.eclipse.cdt.core.build.CBuildConfiguration
- All Implemented Interfaces:
ICBuildConfiguration
,ICBuildConfiguration2
,IConsoleParser
,IConsoleParser2
,IMarkerGenerator
,IElementChangedListener
,IScannerInfoProvider
,org.eclipse.core.runtime.IAdaptable
- Direct Known Subclasses:
StandardBuildConfiguration
public abstract class CBuildConfiguration
extends org.eclipse.core.runtime.PlatformObject
implements ICBuildConfiguration, ICBuildConfiguration2, IMarkerGenerator, IConsoleParser2, IElementChangedListener
Root class for CDT build configurations. Provides access to the build
settings for subclasses.
Each Eclipse project has one or more build configurations (
IBuildConfiguration
).
A CDT Core Build project pairs each build configuration with a Core Build configuration
(ICBuildConfiguration
). A Core Build configuration has variable config pointing to
the IBuildConfiguration. The link from IBuildConfiguration to ICBuildConfiguration
goes via getAdapter(ICBuildConfiguration.class) which gets the ICBuildConfiguration
from Map configs in the CBuildConfigurationManager
.
In a new project the initial Core Build configurations creation is triggered by the
CoreBuildLaunchBarTracker
. The initial configuration for Debug will only be
created if the user selects the Debug launch mode. Restoration of Core Build configurations,
after an Eclipse restart or close and open of the project, uses the settings which are
persistently stored in the backing store. @see org.osgi.service.prefs.Preferences- Since:
- 6.0
-
Field Summary
Fields inherited from interface org.eclipse.cdt.core.build.ICBuildConfiguration
DEFAULT_NAME, TOOLCHAIN_ID, TOOLCHAIN_TYPE
Fields inherited from interface org.eclipse.cdt.core.IMarkerGenerator
SEVERITY_ERROR_BUILD, SEVERITY_ERROR_RESOURCE, SEVERITY_INFO, SEVERITY_WARNING
-
Constructor Summary
ModifierConstructorDescriptionprotected
CBuildConfiguration
(org.eclipse.core.resources.IBuildConfiguration config, String name) protected
CBuildConfiguration
(org.eclipse.core.resources.IBuildConfiguration config, String name, IToolChain toolChain) protected
CBuildConfiguration
(org.eclipse.core.resources.IBuildConfiguration config, String name, IToolChain toolChain, String launchMode) protected
CBuildConfiguration
(org.eclipse.core.resources.IBuildConfiguration config, IToolChain toolChain) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMarker
(ProblemMarkerInfo problemMarkerInfo) void
addMarker
(org.eclipse.core.resources.IResource file, int lineNumber, String errorDesc, int severity, String errorVar) void
Notifies that one or more attributes of one or more C elements have changed.protected Path
findCommand
(String command) Ids for the Binary Parsers to use when checking whether a file is a binary that can be launched.org.eclipse.core.resources.IBuildConfiguration
Returns the resources build configuration that this CDT build configuration is associated with.org.eclipse.core.resources.IContainer
The URI for the directory in which the build is executed.IBinary[]
The binaries produced by the build.static Path
getCommandFromPath
(Path command) Takes a command path and returns either the command path itself if it is absolute or the path to the command as it appears in the PATH environment variable.Returns the default values for the properties.Return the launch mode associated with this build configuration.getName()
org.eclipse.core.resources.IProject
Return the properties for this build configuration.getProperty
(String name) Return the named property.protected ScannerInfoCache
Deprecated, for removal: This API element is subject to removal in a future version.This method was never used in CDT.getScannerInformation
(org.eclipse.core.resources.IResource resource) The receiver will answer the current state of the build information for the resource specified in the argument.protected org.osgi.service.prefs.Preferences
Build Configurations are configurations for a given toolchain.protected IToolChain
getToolChain
(List<String> command) Get the toolchain based on the compiler found in the command line.getVariable
(String name) Return a build environment variable with a given name.Return all of the build environment variables for this configuration.protected void
boolean
processLine
(String line) Parse one line of output.boolean
processLine
(String line, List<org.eclipse.core.runtime.jobs.Job> jobsArray) Process a compile line for Scanner info in a separate jobprotected void
void
removeProperty
(String name) Remove the named property.protected void
void
Mark the Build Configuration as activevoid
setActive
(org.eclipse.core.runtime.IProgressMonitor monitor) void
setBuildEnvironment
(Map<String, String> env) Set the environment for the builds.void
setLauncher
(ICommandLauncher launcher) protected void
setLaunchMode
(String launchMode) boolean
setProperties
(Map<String, String> properties) Set the properties for this build configuration.void
setProperty
(String name, String value) Set a property to the given value.void
shutdown()
Called to let the parser know that the end of the error stream has been reached.startBuildProcess
(List<String> commands, IEnvironmentVariable[] envVars, org.eclipse.core.runtime.IPath buildDirectory, IConsole console, org.eclipse.core.runtime.IProgressMonitor monitor) void
subscribe
(org.eclipse.core.resources.IResource resource, IScannerInfoChangeListener listener) The receiver will register the listener specified in the argument to receive change notifications when the information for theIResource
it is responsible for changes.void
unsubscribe
(org.eclipse.core.resources.IResource resource, IScannerInfoChangeListener listener) The receiver will no longer notify the listener specified in the argument when information about the reource it is responsible for changes.protected int
watchProcess
(IConsoleParser[] consoleParsers, org.eclipse.core.runtime.IProgressMonitor monitor) protected int
watchProcess
(IConsole console, org.eclipse.core.runtime.IProgressMonitor monitor) Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
Methods inherited from interface org.eclipse.cdt.core.build.ICBuildConfiguration
build, clean, supportsProperties
-
Constructor Details
-
CBuildConfiguration
protected CBuildConfiguration(org.eclipse.core.resources.IBuildConfiguration config, String name) throws org.eclipse.core.runtime.CoreException - Throws:
org.eclipse.core.runtime.CoreException
-
CBuildConfiguration
protected CBuildConfiguration(org.eclipse.core.resources.IBuildConfiguration config, String name, IToolChain toolChain) -
CBuildConfiguration
protected CBuildConfiguration(org.eclipse.core.resources.IBuildConfiguration config, String name, IToolChain toolChain, String launchMode) - Since:
- 6.2
-
CBuildConfiguration
protected CBuildConfiguration(org.eclipse.core.resources.IBuildConfiguration config, IToolChain toolChain)
-
-
Method Details
-
getBuildConfiguration
public org.eclipse.core.resources.IBuildConfiguration getBuildConfiguration()Description copied from interface:ICBuildConfiguration
Returns the resources build configuration that this CDT build configuration is associated with.- Specified by:
getBuildConfiguration
in interfaceICBuildConfiguration
- Returns:
- resources build configuration
-
getName
-
getLaunchMode
Description copied from interface:ICBuildConfiguration
Return the launch mode associated with this build configuration.- Specified by:
getLaunchMode
in interfaceICBuildConfiguration
- Since:
- 6.2
-
setLaunchMode
- Since:
- 6.2
-
getProject
public org.eclipse.core.resources.IProject getProject() -
getBinaryParserIds
Description copied from interface:ICBuildConfiguration
Ids for the Binary Parsers to use when checking whether a file is a binary that can be launched.- Specified by:
getBinaryParserIds
in interfaceICBuildConfiguration
- Returns:
- binary parser ids
- Throws:
org.eclipse.core.runtime.CoreException
-
getBuildContainer
public org.eclipse.core.resources.IContainer getBuildContainer() throws org.eclipse.core.runtime.CoreException- Throws:
org.eclipse.core.runtime.CoreException
-
getBuildDirectoryURI
Description copied from interface:ICBuildConfiguration2
The URI for the directory in which the build is executed.- Specified by:
getBuildDirectoryURI
in interfaceICBuildConfiguration2
- Throws:
org.eclipse.core.runtime.CoreException
-
getBuildDirectory
- Throws:
org.eclipse.core.runtime.CoreException
-
setBuildEnvironment
Description copied from interface:ICBuildConfiguration
Set the environment for the builds. Generally the environment from a ProcessBuilder would be passed here.- Specified by:
setBuildEnvironment
in interfaceICBuildConfiguration
- Parameters:
env
- build environment
-
getBuildOutput
Description copied from interface:ICBuildConfiguration
The binaries produced by the build.- Specified by:
getBuildOutput
in interfaceICBuildConfiguration
- Returns:
- binaries produced by the build.
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 6.1
-
setActive
public void setActive(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException - Throws:
org.eclipse.core.runtime.CoreException
-
getSettings
protected org.osgi.service.prefs.Preferences getSettings() -
getToolChain
Description copied from interface:ICBuildConfiguration
Build Configurations are configurations for a given toolchain.- Specified by:
getToolChain
in interfaceICBuildConfiguration
- Returns:
- the toolchain for this build configuration
- Throws:
org.eclipse.core.runtime.CoreException
-
getToolChain
protected IToolChain getToolChain(List<String> command) throws org.eclipse.core.runtime.CoreException Get the toolchain based on the compiler found in the command line. Sub-classes can override this method to set their own method for getting the toolchain.- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 8.0
-
getVariable
Description copied from interface:ICBuildConfiguration
Return a build environment variable with a given name.- Specified by:
getVariable
in interfaceICBuildConfiguration
- Parameters:
name
- build environment variable name- Returns:
- value of the build environment variable.
-
getVariables
Description copied from interface:ICBuildConfiguration
Return all of the build environment variables for this configuration.- Specified by:
getVariables
in interfaceICBuildConfiguration
- Returns:
- environment variables
-
addMarker
public void addMarker(org.eclipse.core.resources.IResource file, int lineNumber, String errorDesc, int severity, String errorVar) - Specified by:
addMarker
in interfaceIMarkerGenerator
-
addMarker
- Specified by:
addMarker
in interfaceIMarkerGenerator
-
findCommand
-
startBuildProcess
public Process startBuildProcess(List<String> commands, IEnvironmentVariable[] envVars, org.eclipse.core.runtime.IPath buildDirectory, IConsole console, org.eclipse.core.runtime.IProgressMonitor monitor) throws IOException, org.eclipse.core.runtime.CoreException - Throws:
IOException
org.eclipse.core.runtime.CoreException
- Since:
- 6.5
-
watchProcess
protected int watchProcess(IConsole console, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException - Returns:
- The exit code of the build process.
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 8.0
-
watchProcess
protected int watchProcess(IConsoleParser[] consoleParsers, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException - Returns:
- The exit code of the build process.
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 8.0
-
loadScannerInfoCache
protected void loadScannerInfoCache()- Since:
- 6.1
-
saveScannerInfoCache
protected void saveScannerInfoCache()- Since:
- 6.1
-
getScannerInfoCache
Deprecated, for removal: This API element is subject to removal in a future version.This method was never used in CDT.- Since:
- 6.1
-
getScannerInformation
Description copied from interface:IScannerInfoProvider
The receiver will answer the current state of the build information for the resource specified in the argument.- Specified by:
getScannerInformation
in interfaceIScannerInfoProvider
-
elementChanged
Description copied from interface:IElementChangedListener
Notifies that one or more attributes of one or more C elements have changed. The specific details of the change are described by the given event.- Specified by:
elementChanged
in interfaceIElementChangedListener
- Parameters:
event
- the change event
-
processLine
Description copied from interface:IConsoleParser
Parse one line of output.- Specified by:
processLine
in interfaceIConsoleParser
- Returns:
- true if line was successfully processed; skip other console parsers
false - try other console parsers
-
processLine
Process a compile line for Scanner info in a separate job- Specified by:
processLine
in interfaceIConsoleParser2
- Parameters:
line
- - line to processjobsArray
- - array of Jobs to keep track of open scanner info jobs- Returns:
- - true if line processed, false otherwise
- Since:
- 6.5
-
setActive
public void setActive()Description copied from interface:ICBuildConfiguration2
Mark the Build Configuration as active- Specified by:
setActive
in interfaceICBuildConfiguration2
- Since:
- 6.5
-
setLauncher
- Parameters:
launcher
- - launcher to set- Since:
- 8.3
-
refreshScannerInfo
protected void refreshScannerInfo() throws org.eclipse.core.runtime.CoreException- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 6.5
-
shutdown
public void shutdown()Description copied from interface:IConsoleParser
Called to let the parser know that the end of the error stream has been reached. Can be used by the parser to flush its internal buffers.- Specified by:
shutdown
in interfaceIConsoleParser
-
subscribe
public void subscribe(org.eclipse.core.resources.IResource resource, IScannerInfoChangeListener listener) Description copied from interface:IScannerInfoProvider
The receiver will register the listener specified in the argument to receive change notifications when the information for theIResource
it is responsible for changes.- Specified by:
subscribe
in interfaceIScannerInfoProvider
-
unsubscribe
public void unsubscribe(org.eclipse.core.resources.IResource resource, IScannerInfoChangeListener listener) Description copied from interface:IScannerInfoProvider
The receiver will no longer notify the listener specified in the argument when information about the reource it is responsible for changes.- Specified by:
unsubscribe
in interfaceIScannerInfoProvider
-
getCommandFromPath
Takes a command path and returns either the command path itself if it is absolute or the path to the command as it appears in the PATH environment variable. Also adjusts the command for Windows's .exe extension.- Since:
- 6.1
-
setProperties
Description copied from interface:ICBuildConfiguration
Set the properties for this build configuration. These will often come from launch configurations which have build settings as attributes.- Specified by:
setProperties
in interfaceICBuildConfiguration
- Parameters:
properties
- build properties- Returns:
- whether the properties have changed
- Since:
- 6.2
-
getProperties
Description copied from interface:ICBuildConfiguration
Return the properties for this build configuration.- Specified by:
getProperties
in interfaceICBuildConfiguration
- Returns:
- default properties
- Since:
- 6.2
-
getProperty
Description copied from interface:ICBuildConfiguration
Return the named property.- Specified by:
getProperty
in interfaceICBuildConfiguration
- Parameters:
name
- the name of the property- Since:
- 6.4
-
setProperty
Description copied from interface:ICBuildConfiguration
Set a property to the given value.- Specified by:
setProperty
in interfaceICBuildConfiguration
- Parameters:
name
- the name of the propertyvalue
- the new value for the property- Since:
- 6.4
-
removeProperty
Description copied from interface:ICBuildConfiguration
Remove the named property.- Specified by:
removeProperty
in interfaceICBuildConfiguration
- Parameters:
name
- name of the property
-
getDefaultProperties
Description copied from interface:ICBuildConfiguration
Returns the default values for the properties.- Specified by:
getDefaultProperties
in interfaceICBuildConfiguration
- Since:
- 6.2
-