mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 470538 - Build selected File(s) should create error/warning marker
Change-Id: I0f37e3733299ab0e0db262a0194c9734b39eea94 Signed-off-by: Andrew Gvozdev <angvoz.dev@gmail.com>
This commit is contained in:
parent
7a16ca18f5
commit
f635f6c7d8
2 changed files with 31 additions and 6 deletions
|
@ -1407,6 +1407,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
|
||||
for (List<IFile> filesInProject : projectMap.values()) {
|
||||
IProject project = filesInProject.get(0).getProject();
|
||||
setCurrentProject(project);
|
||||
monitor.subTask(ManagedMakeMessages.getFormattedString("GeneratedMakefileBuilder.buildingProject", project.getName())); //$NON-NLS-1$
|
||||
invokeInternalBuilderForOneProject(filesInProject, new SubProgressMonitor(monitor, 1 * PROGRESS_MONITOR_SCALE, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
|||
/** @since 5.2 */ // set to true to print build events on the console in debug mode
|
||||
protected static final boolean DEBUG_EVENTS = false;
|
||||
|
||||
private IProject currentProject;
|
||||
|
||||
/**
|
||||
* Constructor for ACBuilder
|
||||
*/
|
||||
|
@ -50,19 +52,41 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
|||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current project that this builder is running.
|
||||
*
|
||||
* @since 5.11
|
||||
*/
|
||||
protected void setCurrentProject(IProject project) {
|
||||
this.currentProject = project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current project that this builder is running.
|
||||
*
|
||||
* @return the project
|
||||
* @since 5.11
|
||||
*/
|
||||
protected IProject getCurrentProject() {
|
||||
if (currentProject != null) {
|
||||
return currentProject;
|
||||
}
|
||||
return super.getProject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
|
||||
ProblemMarkerInfo problemMarkerInfo = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity, errorVar, null);
|
||||
addMarker(problemMarkerInfo);
|
||||
}
|
||||
|
||||
/*
|
||||
* callback from Output Parser
|
||||
/**
|
||||
* Callback from Output Parser
|
||||
*/
|
||||
@Override
|
||||
public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
|
||||
try {
|
||||
IProject project = getProject();
|
||||
IProject project = getCurrentProject();
|
||||
IResource markerResource = problemMarkerInfo.file;
|
||||
if (markerResource == null) {
|
||||
markerResource = project;
|
||||
|
@ -136,7 +160,7 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
|||
|
||||
}
|
||||
|
||||
int mapMarkerSeverity(int severity) {
|
||||
private int mapMarkerSeverity(int severity) {
|
||||
switch (severity) {
|
||||
case SEVERITY_ERROR_BUILD :
|
||||
case SEVERITY_ERROR_RESOURCE :
|
||||
|
@ -190,7 +214,7 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
|||
|
||||
@SuppressWarnings("nls")
|
||||
private String cfgIdToNames(String strIds) {
|
||||
IProject project = getProject();
|
||||
IProject project = getCurrentProject();
|
||||
ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(project, false);
|
||||
if (prjDesc == null) {
|
||||
return strIds;
|
||||
|
@ -233,7 +257,7 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
|||
String ids = args!=null ? args.get(CONTENTS_CONFIGURATION_IDS) : null;
|
||||
System.out.println("t"+Thread.currentThread().getId()+": "
|
||||
+ kindToString(kind)
|
||||
+ ", " + getProject()
|
||||
+ ", " + getCurrentProject()
|
||||
+ "[" + cfgIdToNames(ids) +"]"
|
||||
+ ", " + this.getClass().getSimpleName()
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue