Permalink
Browse files

totally remove scion

  • Loading branch information...
JPMoresmau committed Oct 7, 2011
1 parent 941480e commit 5f67e290ba3c8808a4975d86bec509da8265f81b
Showing with 1,101 additions and 1,199 deletions.
  1. +7 −7 net.sf.eclipsefp.haskell-feature/feature.xml
  2. +2 −2 net.sf.eclipsefp.haskell.buildwrapper/META-INF/MANIFEST.MF
  3. +87 −23 net.sf.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/BWFacade.java
  4. +26 −5 ....eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/BuildWrapperPlugin.java
  5. +11 −7 net.sf.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/JobFacade.java
  6. +39 −0 ...f.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/types/GhcMessages.java
  7. +2 −2 net.sf.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/types/Note.java
  8. +2 −2 ...sf.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/types/OutlineDef.java
  9. +2 −0 net.sf.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/util/BWText.java
  10. +2 −0 ...f.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/util/bwtext.properties
  11. +1 −2 net.sf.eclipsefp.haskell.core.test/META-INF/MANIFEST.MF
  12. +0 −1 net.sf.eclipsefp.haskell.core/META-INF/MANIFEST.MF
  13. +2 −2 ...sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/builder/CleanOutFoldersOperation.java
  14. +16 −0 ...eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/cabalmodel/PackageDescriptionStanza.java
  15. +0 −227 net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/codeassist/LexerTokenCategories.java
  16. +1 −2 net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/util/ResourceUtil.java
  17. +1 −2 net.sf.eclipsefp.haskell.debug.ui/META-INF/MANIFEST.MF
  18. +2 −1 net.sf.eclipsefp.haskell.ghccompiler.test/META-INF/MANIFEST.MF
  19. +2 −2 ....ghccompiler.test/src/net/sf/eclipsefp/haskell/ghccompiler/test/core/GhcCompilerTest_PDETest.java
  20. +1 −2 net.sf.eclipsefp.haskell.ghccompiler/META-INF/MANIFEST.MF
  21. +2 −2 ....eclipsefp.haskell.ghccompiler/src/net/sf/eclipsefp/haskell/ghccompiler/core/GhcOutputParser.java
  22. +1 −1 ...lipsefp.haskell.ghccompiler/src/net/sf/eclipsefp/haskell/ghccompiler/core/GhcOutputProcessor.java
  23. +1 −1 ...lipsefp.haskell.ghccompiler/src/net/sf/eclipsefp/haskell/ghccompiler/core/IGhcOutputListener.java
  24. +3 −3 net.sf.eclipsefp.haskell.scion.client.test/META-INF/MANIFEST.MF
  25. +1 −2 net.sf.eclipsefp.haskell.scion.client/src/net/sf/eclipsefp/haskell/scion/client/ScionInstance.java
  26. +2 −3 net.sf.eclipsefp.haskell.test/META-INF/MANIFEST.MF
  27. +1 −1 net.sf.eclipsefp.haskell.test/src/net/sf/eclipsefp/test/AllTests_Suite.java
  28. +1 −2 net.sf.eclipsefp.haskell.ui.test/META-INF/MANIFEST.MF
  29. +1 −0 ...askell.ui.test/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/Partitioning_PDETest.java
  30. +1 −1 ...kell.ui.test/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/SyntaxColoring_PDETest.java
  31. +171 −175 ...rc/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/codeassist/CompletionContext_PDETest.java
  32. +0 −1 net.sf.eclipsefp.haskell.ui/META-INF/MANIFEST.MF
  33. +9 −11 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/HaskellUIPlugin.java
  34. +2 −4 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/handlers/OpenDefinitionHandler.java
  35. +35 −27 ....eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/HaskellEditor.java
  36. +1 −1 ...rc/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/codeassist/HSCodeTemplateContextType.java
  37. +50 −63 ...src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/codeassist/HaskellCompletionContext.java
  38. +44 −29 ...et/sf/eclipsefp/haskell/ui/internal/editors/haskell/codeassist/HaskellContentAssistProcessor.java
  39. +39 −19 .../sf/eclipsefp/haskell/ui/internal/editors/haskell/codeassist/HsClassTypeNameTemplateVariable.java
  40. +23 −24 ...src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/codeassist/HsModuleTemplateVariable.java
  41. +43 −25 ...c/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/codeassist/HsTypeNameTemplateVariable.java
  42. +1 −0 ...rc/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/codeassist/IHaskellCompletionContext.java
  43. +1 −2 ...p.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/haskell/text/ScionTokenScanner.java
  44. +1 −1 ....eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/text/IMarkOccurrences.java
  45. +4 −3 ...lipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/IPreferenceConstants.java
  46. +95 −99 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/scion/ScionPP.java
  47. +1 −1 ...p.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/resolve/BuildMarkerResolutionGenerator.java
  48. +0 −58 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/scion/ScionBuilder.java
  49. +341 −342 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/scion/ScionManager.java
  50. +6 −0 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/UITexts.java
  51. +7 −1 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/uitexts.properties
  52. +1 −1 ...eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/properties/ImportLibrariesLabelProvider.java
  53. +2 −3 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/properties/UserFlagsPP.java
  54. +4 −4 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/wizards/cabal/DistFolder.java
@@ -123,13 +123,6 @@ and is also available at http://github.com/JPMoresmau/scion/raw/master/docs/LICE
version="2.1.1"
unpack="false"/>
- <plugin
- id="net.sf.eclipsefp.haskell.scion.client"
- download-size="0"
- install-size="0"
- version="2.1.1"
- unpack="false"/>
-
<plugin
id="net.sf.eclipsefp.haskell.compat"
download-size="0"
@@ -165,4 +158,11 @@ and is also available at http://github.com/JPMoresmau/scion/raw/master/docs/LICE
version="2.1.1"
unpack="false"/>
+ <plugin
+ id="net.sf.eclipsefp.haskell.buildwrapper"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
@@ -9,12 +9,12 @@ Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
net.sf.eclipsefp.haskell.util;bundle-version="2.1.1";visibility:=reexport,
- net.sf.eclipsefp.haskell.scion.client;bundle-version="2.1.1";visibility:=reexport,
org.eclipse.core.resources;bundle-version="3.5.2",
org.eclipse.ui.ide;bundle-version="3.5.2",
org.eclipse.jface.text;bundle-version="3.5.2",
org.eclipse.ui.editors;bundle-version="3.5.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: net.sf.eclipsefp.haskell.buildwrapper,
- net.sf.eclipsefp.haskell.buildwrapper.types
+ net.sf.eclipsefp.haskell.buildwrapper.types,
+ net.sf.eclipsefp.haskell.buildwrapper.util
@@ -11,6 +11,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -38,14 +39,21 @@
import org.json.JSONObject;
public class BWFacade {
+ public static final String DIST_FOLDER=".dist-buildwrapper";
+ public static final String DIST_FOLDER_CABAL=DIST_FOLDER+"/dist";
+
private static final String prefix="build-wrapper-json:";
+ private static boolean showedNoExeError=false;
+
private String bwPath;
- private String tempFolder=".dist-buildwrapper";
+ //private String tempFolder=".dist-buildwrapper";
private String cabalPath;
private String cabalFile;
private String cabalShortName;
+ private String flags;
+
private File workingDir;
private Writer outStream;
@@ -58,6 +66,12 @@
private Map<String, CabalPackage[]> packageDB;
public boolean build(BuildOptions buildOptions){
+ if (buildOptions.isConfigure()){
+ if (configure(buildOptions)){
+ return false;
+ }
+ }
+
BuildWrapperPlugin.deleteProblems(getProject());
LinkedList<String> command=new LinkedList<String>();
command.add("build");
@@ -71,6 +85,20 @@ public boolean build(BuildOptions buildOptions){
return true;
}
+ public boolean configure(BuildOptions buildOptions){
+ parseFlags(); // reset flags in case they have changed
+ BuildWrapperPlugin.deleteProblems(getProject());
+ LinkedList<String> command=new LinkedList<String>();
+ command.add("configure");
+ command.add("--cabaltarget="+buildOptions.getTarget().toString());
+ JSONArray arr=run(command,ARRAY);
+ if (arr!=null && arr.length()>1){
+ JSONArray notes=arr.optJSONArray(1);
+ return parseNotes(notes);
+ }
+ return true;
+ }
+
public void synchronize(boolean force){
LinkedList<String> command=new LinkedList<String>();
command.add("synchronize");
@@ -121,7 +149,7 @@ public File write(IFile file,String contents){
return s!=null;*/
try {
String path=file.getProjectRelativePath().toOSString();
- File tgt=new File(new File(workingDir,tempFolder),path);
+ File tgt=new File(new File(workingDir,DIST_FOLDER),path);
tgt.getParentFile().mkdirs();
write(tgt, contents);
return tgt;
@@ -226,13 +254,13 @@ public boolean write(File tgt,String contents){
}
public List<TokenDef> tokenTypes(IFile file){
- long t0=System.currentTimeMillis();
+ //long t0=System.currentTimeMillis();
String path=file.getProjectRelativePath().toOSString();
LinkedList<String> command=new LinkedList<String>();
command.add("tokentypes");
command.add("--file="+path);
JSONArray arr=run(command,ARRAY);
- long t01=System.currentTimeMillis();
+ //long t01=System.currentTimeMillis();
List<TokenDef> cps;
if (arr!=null){
if (arr.length()>1){
@@ -252,8 +280,8 @@ public boolean write(File tgt,String contents){
} else {
cps=new ArrayList<TokenDef>();
}
- long t1=System.currentTimeMillis();
- BuildWrapperPlugin.logInfo("tokenTypes:"+(t1-t0)+"ms, parsing:"+(t1-t01)+"ms");
+ //long t1=System.currentTimeMillis();
+ //BuildWrapperPlugin.logInfo("tokenTypes:"+(t1-t0)+"ms, parsing:"+(t1-t01)+"ms");
return cps;
}
@@ -396,10 +424,20 @@ private CabalPackage parsePackage(JSONObject obj){
private <T> T run(LinkedList<String> args,JSONFactory<T> f){
+ if (bwPath==null){
+ if (!showedNoExeError){
+ BuildWrapperPlugin.logError(BWText.error_noexe, null);
+ showedNoExeError=true;
+ }
+ return null;
+ }
+ showedNoExeError=false;
+
args.addFirst(bwPath);
- args.add("--tempfolder="+tempFolder);
+ args.add("--tempfolder="+DIST_FOLDER);
args.add("--cabalpath="+cabalPath);
args.add("--cabalfile="+cabalFile);
+ args.add("--cabalflags="+flags);
ProcessBuilder pb=new ProcessBuilder();
pb.directory(workingDir);
pb.redirectErrorStream(true);
@@ -408,7 +446,7 @@ private CabalPackage parsePackage(JSONObject obj){
try {
Process p=pb.start();
BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream(),"UTF8"));
- long t0=System.currentTimeMillis();
+ //long t0=System.currentTimeMillis();
String l=br.readLine();
boolean goOn=true;
while (goOn && l!=null){
@@ -434,23 +472,23 @@ private CabalPackage parsePackage(JSONObject obj){
l=br.readLine();
}
}
- long t1=System.currentTimeMillis();
- BuildWrapperPlugin.logInfo("read run:"+(t1-t0)+"ms");
+ //long t1=System.currentTimeMillis();
+ //BuildWrapperPlugin.logInfo("read run:"+(t1-t0)+"ms");
} catch (IOException ioe){
BuildWrapperPlugin.logError(BWText.process_launch_error, ioe);
}
return obj;
}
- public String getTempFolder() {
- return tempFolder;
- }
-
-
- public void setTempFolder(String tempFolder) {
- this.tempFolder = tempFolder;
- }
+// public String getTempFolder() {
+// return tempFolder;
+// }
+//
+//
+// public void setTempFolder(String tempFolder) {
+// this.tempFolder = tempFolder;
+// }
public String getCabalPath() {
@@ -535,11 +573,11 @@ public JSONArray fromJSON(String json)throws JSONException {
}
};
- private static JSONFactory<JSONObject> OBJECT=new JSONFactory<JSONObject>() {
- public JSONObject fromJSON(String json)throws JSONException {
- return new JSONObject(json);
- }
- };
+// private static JSONFactory<JSONObject> OBJECT=new JSONFactory<JSONObject>() {
+// public JSONObject fromJSON(String json)throws JSONException {
+// return new JSONObject(json);
+// }
+// };
private static JSONFactory<String> STRING=new JSONFactory<String>() {
public String fromJSON(String json)throws JSONException {
@@ -554,5 +592,31 @@ public IProject getProject() {
public void setProject(IProject project) {
this.project = project;
+ parseFlags();
+ }
+
+ private void parseFlags(){
+ try {
+ String currentProp=project.getPersistentProperty( BuildWrapperPlugin.USERFLAGS_PROPERTY );
+ JSONObject flagO=new JSONObject();
+ if (currentProp!=null && currentProp.length()>0){
+ flagO=new JSONObject( currentProp );
+ }
+ StringBuilder sb=new StringBuilder();
+ String sep="";
+ for (Iterator<String> it=flagO.keys();it.hasNext();){
+ String s=it.next();
+ boolean b=flagO.getBoolean(s);
+ sb.append(sep);
+ sep=" ";
+ if (!b){
+ sb.append("-");
+ }
+ sb.append(s);
+ }
+ flags=sb.toString();
+ } catch (Exception e){
+ BuildWrapperPlugin.logError(BWText.error_gettingFlags, e);
+ }
}
}
@@ -6,7 +6,6 @@
import java.util.Map;
import net.sf.eclipsefp.haskell.buildwrapper.util.BWText;
-import net.sf.eclipsefp.haskell.scion.client.ScionPlugin;
import net.sf.eclipsefp.haskell.util.FileUtil;
import org.eclipse.core.resources.IFile;
@@ -17,6 +16,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -32,11 +32,15 @@
// The plug-in ID
public static final String PLUGIN_ID = "net.sf.eclipsefp.haskell.buildwrapper";
+ public static QualifiedName USERFLAGS_PROPERTY=new QualifiedName("EclipseFP", "UserFlags");
+
// The shared instance
private static BuildWrapperPlugin plugin;
private static Map<IProject, BWFacade> facades=new HashMap<IProject, BWFacade>();
+ private static String bwPath;
+
/**
* The constructor
*/
@@ -70,7 +74,7 @@ public static BuildWrapperPlugin getDefault() {
return plugin;
}
- public static BWFacade createFacade(IProject p,String bwPath,String cabalPath,Writer outStream){
+ public static BWFacade createFacade(IProject p,String cabalPath,Writer outStream){
IFile cf=getCabalFile(p);
if (cf!=null){
@@ -91,6 +95,10 @@ public static BWFacade getFacade(IProject p){
return facades.get(p);
}
+ public static BWFacade removeFacade(IProject p){
+ return facades.remove(p);
+ }
+
public static JobFacade getJobFacade(IProject p){
BWFacade realF=getFacade(p);
if (realF!=null){
@@ -125,7 +133,7 @@ public static void logError(String message, Throwable cause) {
}
public static void log(int severity, String message, Throwable cause) {
- Status status = new Status(severity, ScionPlugin.getPluginId(), severity, message, cause);
+ Status status = new Status(severity, BuildWrapperPlugin.PLUGIN_ID, severity, message, cause);
logStatus(status);
}
@@ -145,9 +153,9 @@ public static void deleteProblems(IResource r) {
r.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
}
r.deleteMarkers(PROBLEM_MARKER_ID, true, IResource.DEPTH_ZERO);
- r.deleteMarkers(ScionPlugin.ID_PROJECT_PROBLEM_MARKER, true, IResource.DEPTH_ZERO);
+ r.deleteMarkers("net.sf.eclipsefp.haskell.scion.client.ScionPlugin.projectProblem", true, IResource.DEPTH_ZERO);
} catch (CoreException ex) {
- ScionPlugin.logError(BWText.error_deleteMarkers, ex);
+ BuildWrapperPlugin.logError(BWText.error_deleteMarkers, ex);
ex.printStackTrace();
}
}
@@ -196,5 +204,18 @@ public static IFile getCabalFile(final IProject project) {
}
return f;
}
+
+ public static String getBwPath() {
+ return bwPath;
+ }
+
+ public static void setBwPath(String bwPath) {
+ BuildWrapperPlugin.bwPath = bwPath;
+ for (BWFacade f:facades.values()){
+ if (f!=null){
+ f.setBwPath(bwPath);
+ }
+ }
+ }
}
@@ -97,20 +97,24 @@ protected IStatus run(IProgressMonitor monitor) {
try {
monitor.beginTask(jobNamePrefix, IProgressMonitor.UNKNOWN);
long t0=System.currentTimeMillis();
- realFacade.write(f, doc.get());
+ if (doc!=null){
+ realFacade.write(f, doc.get());
+ }
long t1=System.currentTimeMillis();
- long t2=System.currentTimeMillis();
BuildWrapperPlugin.deleteProblems(f);
- boolean buildOK=realFacade.build(new BuildOptions().setOutput(false).setTarget(BWTarget.Target).setConfigure(false).setRecompile(false));
+ boolean buildOK= doc!=null
+ ?realFacade.build(new BuildOptions().setOutput(false).setTarget(BWTarget.Target).setConfigure(false).setRecompile(false))
+ :true;
+ long t2=System.currentTimeMillis();
List<OutlineDef> defs=realFacade.outline(f);
- long t12=System.currentTimeMillis();
- if (defs.size()>0 || buildOK){
+ long t3=System.currentTimeMillis();
+ if (defs.size()>0 && buildOK){
handler.handleOutline(defs); // avoid removing all outline on error
}
- long t3=System.currentTimeMillis();
- BuildWrapperPlugin.logInfo("write:"+(t1-t0)+"ms,outline:"+(t2-t1)+"ms,hanlderoutline:"+(t2-t12)+"ms,build:"+(t3-t2)+"ms");
+ long t4=System.currentTimeMillis();
+ BuildWrapperPlugin.logInfo("write:"+(t1-t0)+"ms,outline:"+(t3-t2)+"ms,handleroutline:"+(t4-t3)+"ms,build:"+(t2-t1)+"ms");
} finally {
monitor.done();
}
Oops, something went wrong.

0 comments on commit 5f67e29

Please sign in to comment.