Permalink
Browse files

handle errors in linker

  • Loading branch information...
1 parent 43adec2 commit 64e4381355bfdc6bb6d1a4c49d6bb3b7c6c9b766 @JPMoresmau committed Mar 13, 2012
@@ -102,6 +102,8 @@
*/
private boolean needSetDerivedOnDistDir=false;
+ private boolean hasCabalProblems=false;
+
public SingleJobQueue getBuildJobQueue() {
return buildJobQueue;
}
@@ -124,12 +126,20 @@ public JSONArray build(BuildOptions buildOptions){
}
}
- //BuildWrapperPlugin.deleteProblems(getProject());
+ if (hasCabalProblems){
+ String relCabal=getCabalFile().substring(getProject().getLocation().toOSString().length());
+ IFile f=getProject().getFile(relCabal);
+ if (f!=null && f.exists()){
+ BuildWrapperPlugin.deleteProblems(f);
+ }
+ hasCabalProblems=false;
+ }
+
LinkedList<String> command=new LinkedList<String>();
command.add("build");
command.add("--output="+buildOptions.isOutput());
command.add("--cabaltarget="+buildOptions.getTarget().toString());
- JSONArray arr=run(command,ARRAY,false); // no need to run since build in Cabal.hs already does it
+ JSONArray arr=run(command,ARRAY,false);
if (arrC!=null){
for (int a=0;a<arrC.length();a++){
try {
@@ -157,7 +167,7 @@ public boolean parseBuildResult(JSONArray arr){
if (res!=null){
ress.add(res);
BuildWrapperPlugin.deleteProblems(res);
- }
+ }
}
}
}
@@ -552,13 +562,14 @@ private boolean parseNotes(JSONArray notes,Set<IResource> ress){
Location loc=new Location(f, line, col, line, col);
Note n=new Note(k,loc,o.getString("t"),"");
IResource res=project.findMember(f);
-// if (res==null){
-// f=f.replace("\\\\", "\\");
-// String pos=project.getLocation().toOSString();
-// if (f.startsWith(pos)){
-// res=project.findMember(f.substring(pos.length()));
-// }
-// }
+ // linker errors may have full path
+ if (res==null){
+ f=f.replace("\\\\", "\\");
+ String pos=project.getLocation().toOSString();
+ if (f.startsWith(pos)){
+ res=project.findMember(f.substring(pos.length()));
+ }
+ }
if (res!=null){
if (ress.add(res)){
BuildWrapperPlugin.deleteProblems(res);
@@ -568,6 +579,9 @@ private boolean parseNotes(JSONArray notes,Set<IResource> ress){
} catch (CoreException ce){
BuildWrapperPlugin.logError(BWText.process_apply_note_error, ce);
}
+ if (res.getLocation().toOSString().equals(getCabalFile())){
+ hasCabalProblems=true;
+ }
}
}
} catch (JSONException je){

0 comments on commit 64e4381

Please sign in to comment.