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.- 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
Constructors Modifier Constructor Description protected
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
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addMarker(ProblemMarkerInfo problemMarkerInfo)
void
addMarker(org.eclipse.core.resources.IResource file, int lineNumber, String errorDesc, int severity, String errorVar)
void
elementChanged(ElementChangedEvent event)
Notifies that one or more attributes of one or more C elements have changed.protected Path
findCommand(String command)
String
getBinaryParserId()
Ids for the Binary Parsers to use when checking whether a file is a binary that can be launched.org.eclipse.core.resources.IBuildConfiguration
getBuildConfiguration()
Returns the resources build configuration that this CDT build configuration is associated with.org.eclipse.core.resources.IContainer
getBuildContainer()
Path
getBuildDirectory()
URI
getBuildDirectoryURI()
The URI for the directory in which the build is executed.IBinary[]
getBuildOutput()
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.Map<String,String>
getDefaultProperties()
Returns the default values for the properties.String
getLaunchMode()
Return the launch mode associated with this build configuration.String
getName()
org.eclipse.core.resources.IProject
getProject()
Map<String,String>
getProperties()
Return the properties for this build configuration.String
getProperty(String name)
Return the named property.protected ScannerInfoCache
getScannerInfoCache()
IScannerInfo
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
getSettings()
IToolChain
getToolChain()
Build Configurations are configurations for a given toolchain.IEnvironmentVariable
getVariable(String name)
Return a build environment variable with a given name.IEnvironmentVariable[]
getVariables()
Return all of the build environment variables for this configuration.protected void
loadScannerInfoCache()
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
refreshScannerInfo()
void
removeProperty(String name)
Remove the named property.protected void
saveScannerInfoCache()
void
setActive()
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.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.Process
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(Process process, IConsoleParser[] consoleParsers)
protected int
watchProcess(Process process, IConsoleParser[] consoleParsers, IConsole console)
Deprecated.protected int
watchProcess(Process process, IConsole console)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.cdt.core.build.ICBuildConfiguration
build, clean, supportsProperties
-
-
-
-
Constructor Detail
-
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 Detail
-
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
public String getName()
-
getLaunchMode
public String getLaunchMode()
Description copied from interface:ICBuildConfiguration
Return the launch mode associated with this build configuration.- Specified by:
getLaunchMode
in interfaceICBuildConfiguration
- Since:
- 6.2
-
setLaunchMode
protected void setLaunchMode(String launchMode)
- Since:
- 6.2
-
getProject
public org.eclipse.core.resources.IProject getProject()
-
getBinaryParserId
public String getBinaryParserId() throws org.eclipse.core.runtime.CoreException
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:
getBinaryParserId
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
public URI getBuildDirectoryURI() throws org.eclipse.core.runtime.CoreException
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
public Path getBuildDirectory() throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
-
setBuildEnvironment
public void setBuildEnvironment(Map<String,String> env)
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
public IBinary[] getBuildOutput() throws org.eclipse.core.runtime.CoreException
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
public IToolChain getToolChain() throws org.eclipse.core.runtime.CoreException
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
-
getVariable
public IEnvironmentVariable getVariable(String name)
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
public IEnvironmentVariable[] 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
public void addMarker(ProblemMarkerInfo problemMarkerInfo)
- Specified by:
addMarker
in interfaceIMarkerGenerator
-
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
@Deprecated protected int watchProcess(Process process, IConsoleParser[] consoleParsers, IConsole console) throws org.eclipse.core.runtime.CoreException
Deprecated.- Throws:
org.eclipse.core.runtime.CoreException
-
watchProcess
protected int watchProcess(Process process, IConsole console) throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 6.4
-
watchProcess
protected int watchProcess(Process process, IConsoleParser[] consoleParsers) throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 6.4
-
loadScannerInfoCache
protected void loadScannerInfoCache()
- Since:
- 6.1
-
saveScannerInfoCache
protected void saveScannerInfoCache()
- Since:
- 6.1
-
getScannerInfoCache
protected ScannerInfoCache getScannerInfoCache()
- Since:
- 6.1
-
getScannerInformation
public IScannerInfo getScannerInformation(org.eclipse.core.resources.IResource resource)
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
public void elementChanged(ElementChangedEvent event)
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
public boolean processLine(String line)
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
public boolean processLine(String line, List<org.eclipse.core.runtime.jobs.Job> jobsArray)
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
-
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
public 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. Also adjusts the command for Windows's .exe extension.- Since:
- 6.1
-
setProperties
public boolean setProperties(Map<String,String> properties)
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
public Map<String,String> 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
public String getProperty(String name)
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
public void setProperty(String name, String value)
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
public void removeProperty(String name)
Description copied from interface:ICBuildConfiguration
Remove the named property.- Specified by:
removeProperty
in interfaceICBuildConfiguration
- Parameters:
name
- name of the property
-
getDefaultProperties
public Map<String,String> getDefaultProperties()
Description copied from interface:ICBuildConfiguration
Returns the default values for the properties.- Specified by:
getDefaultProperties
in interfaceICBuildConfiguration
- Since:
- 6.2
-
-