Permalink
Browse files

initial commit: HTF support

  • Loading branch information...
1 parent 4b642bd commit 5c27563caeacaae452fd1537305073aed5468f59 @JPMoresmau committed Nov 19, 2012
Showing with 2,265 additions and 1,549 deletions.
  1. +1 −1 net.sf.eclipsefp.haskell-feature/feature.xml
  2. +1 −1 net.sf.eclipsefp.haskell.browser/META-INF/MANIFEST.MF
  3. +6 −5 ...sf.eclipsefp.haskell.browser/src/net/sf/eclipsefp/haskell/browser/client/StreamBrowserServer.java
  4. +1 −1 net.sf.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/BWFacade.java
  5. +16 −0 net.sf.eclipsefp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/types/Location.java
  6. +1 −1 net.sf.eclipsefp.haskell.core.test/src/net/sf/eclipsefp/haskell/core/cabalmodel/CabalModelTest.java
  7. +154 −149 net.sf.eclipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/cabal/CabalPackageHelper.java
  8. +2 −3 ...clipsefp.haskell.core/src/net/sf/eclipsefp/haskell/core/internal/project/ProjectModelFilesOp.java
  9. +1 −0 net.sf.eclipsefp.haskell.debug.core/plugin.properties
  10. +8 −0 net.sf.eclipsefp.haskell.debug.core/plugin.xml
  11. +1 −1 ...g.core/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/AbstractHaskellLaunchDelegate.java
  12. +241 −0 ...haskell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/HTFLaunchDelegate.java
  13. +1 −1 ....core/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/TestSuiteHaskellLaunchDelegate.java
  14. +215 −0 net.sf.eclipsefp.haskell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/test/HTFParser.java
  15. +42 −6 net.sf.eclipsefp.haskell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/test/TestResult.java
  16. +1 −0 net.sf.eclipsefp.haskell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/test/TestStatus.java
  17. +3 −2 net.sf.eclipsefp.haskell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/test/TestSuite.java
  18. +6 −0 net.sf.eclipsefp.haskell.debug.ui/plugin.properties
  19. +43 −1 net.sf.eclipsefp.haskell.debug.ui/plugin.xml
  20. +51 −0 ...fp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/HTFLaunchOperation.java
  21. +31 −0 ...efp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/HTFLaunchShortcut.java
  22. +47 −0 ...efp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/RunActionProvider.java
  23. +1 −0 net.sf.eclipsefp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/util/UITexts.java
  24. +1 −0 ...eclipsefp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/util/uitexts.properties
  25. +3 −0 net.sf.eclipsefp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/test/TestResultLP.java
  26. +57 −56 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/console/HaskellConsole.java
  27. +356 −356 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/scion/PackageBuilder.java
  28. +968 −964 net.sf.eclipsefp.haskell.util/lib/org/json/JSONArray.java
  29. +6 −1 net.sf.eclipsefp.haskell.util/src/net/sf/eclipsefp/haskell/util/FileUtil.java
@@ -144,7 +144,7 @@ available at http://www.eclipse.org/legal/epl-v10.html.
id="net.sf.eclipsefp.haskell.browser"
download-size="0"
install-size="0"
- version="2.3.2"
+ version="2.3.3"
unpack="false"/>
<plugin
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: net.sf.eclipsefp.haskell.browser; singleton:=true
-Bundle-Version: 2.3.2
+Bundle-Version: 2.3.3
Bundle-Localization: plugin
Bundle-Activator: net.sf.eclipsefp.haskell.browser.BrowserPlugin
Require-Bundle: org.eclipse.ui;bundle-version="3.2.0",
@@ -28,6 +28,7 @@
import net.sf.eclipsefp.haskell.browser.items.Module;
import net.sf.eclipsefp.haskell.browser.items.Packaged;
import net.sf.eclipsefp.haskell.browser.util.BrowserText;
+import net.sf.eclipsefp.haskell.util.FileUtil;
import net.sf.eclipsefp.haskell.util.LangUtil;
import net.sf.eclipsefp.haskell.util.NullWriter;
import net.sf.eclipsefp.haskell.util.StreamRedirect;
@@ -89,14 +90,14 @@ public void startServer(boolean logError) throws Exception {
process = builder.start();
out = process.getInputStream();
Writer errorWriter=logError && logStream!=null?logStream:new NullWriter();
- errorRedirect=new StreamRedirect(new InputStreamReader(process.getErrorStream(),"UTF8"), errorWriter);
+ errorRedirect=new StreamRedirect(new InputStreamReader(process.getErrorStream(),FileUtil.UTF8), errorWriter);
errorRedirect.start();
/*out = new BufferedReader(new InputStreamReader(
- process.getInputStream(), "UTF8"));*/
+ process.getInputStream(), FileUtil.UTF8));*/
/*err = new BufferedReader(new InputStreamReader(
- process.getErrorStream(), "UTF8")); */
+ process.getErrorStream(), FileUtil.UTF8)); */
in = new BufferedWriter(new OutputStreamWriter(
- process.getOutputStream(), "UTF8"));
+ process.getOutputStream(),FileUtil.UTF8));
} catch (Throwable ex) {
throw new Exception("Could not load");
}
@@ -181,7 +182,7 @@ public String getALine() throws IOException{
try {
InflaterInputStream gzip = new InflaterInputStream(out);
BufferedReader reader = new BufferedReader(
- new InputStreamReader(gzip, "UTF8"));
+ new InputStreamReader(gzip, FileUtil.UTF8));
return reader.readLine();
} catch (IOException e) {
@@ -896,7 +896,7 @@ private CabalPackage parsePackage(JSONObject obj){
T obj=null;
try {
Process p=pb.start();
- BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream(),"UTF8"));
+ BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream(),FileUtil.UTF8));
//long t0=System.currentTimeMillis();
String l=br.readLine();
boolean goOn=true;
@@ -289,4 +289,20 @@ public IFile getIFile(IProject p){
return attributes;
}
+ public void setStartLine(int startLine) {
+ this.startLine = startLine;
+ }
+
+ public void setStartColumn(int startColumn) {
+ this.startColumn = startColumn;
+ }
+
+ public void setEndLine(int endLine) {
+ this.endLine = endLine;
+ }
+
+ public void setEndColumn(int endColumn) {
+ this.endColumn = endColumn;
+ }
+
}
@@ -44,7 +44,7 @@ public static String getContent(final String fileName){
baos.write(c);
}
is.close();
- return new String(baos.toByteArray(),"UTF8");
+ return new String(baos.toByteArray(),FileUtil.UTF8);
} catch (Exception e){
e.printStackTrace();
fail(e.getLocalizedMessage());
@@ -1,149 +1,154 @@
-package net.sf.eclipsefp.haskell.core.cabal;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.LinkedList;
-import java.util.List;
-import net.sf.eclipsefp.haskell.core.HaskellCorePlugin;
-import net.sf.eclipsefp.haskell.util.PlatformUtil;
-import net.sf.eclipsefp.haskell.util.ProcessRunner;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * helper wrapping cabal list and cabal info operations
- * @author JP Moresmau
- *
- */
-public class CabalPackageHelper {
- private final String cabalPath;
-
- private List<CabalPackageRef> installed=null;
- private List<CabalPackageRef> all=null;
-
-
- public CabalPackageHelper( final String cabalPath ) {
- super();
- this.cabalPath = cabalPath;
- }
-
-
- public boolean hasInstalledVersion(final String name,final String version) throws IOException{
- String s=getLastInstalledVersion(name);
- if (s!=null){
- return CabalPackageVersion.compare( s, version )>=0;
- }
- return false;
- }
-
- public String getLastInstalledVersion(final String name)throws IOException{
- List<CabalPackageRef> r=list(name,"--installed");//$NON-NLS-1$
- if (r.size()>0){
- return r.get( r.size()-1 ).toString();
- }
- return null;
- }
-
- public List<CabalPackageRef> getInstalled()throws IOException {
- if (installed==null){
- installed=list("","--installed"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return installed;
- }
-
- public List<CabalPackageRef> getAll()throws IOException {
- if (all==null){
- all=list("",""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return all;
- }
-
- public String getInfo(final String name)throws IOException {
- BufferedReader br=run(cabalPath,"info",name); //$NON-NLS-1$
- StringBuilder sb=new StringBuilder();
- String line=br.readLine();
-
- while (line!=null){
- sb.append(line);
- sb.append( PlatformUtil.NL );
- line=br.readLine();
- }
- br.close();
- return sb.toString().substring( 2 ); // starts with *<space>
- }
-
- private List<CabalPackageRef> list(final String pkg,final String opt)throws IOException{
-
- List<CabalPackageRef> ret=new LinkedList<CabalPackageRef>();
- if (cabalPath==null){
- return ret;
- }
- BufferedReader br=run(cabalPath,"list",pkg,opt,"--simple-output"); //$NON-NLS-1$//$NON-NLS-2$
- String line=br.readLine();
- CabalPackageRef last=null;
- while (line!=null){
- CabalPackageRef r=parseRef(line);
- if (r!=null){
- if (last==null || !r.getName().equals( last.getName() )){
- if (last!=null){
- last.getVersions().trimToSize();
- }
- ret.add(r);
- last=r;
- } else {
- last.getVersions().addAll(r.getVersions());
- }
- }
- line=br.readLine();
- }
- br.close();
- return ret;
- }
-
- private CabalPackageRef parseRef(final String line){
- if (line!=null && line.length()>0){
- int ix=line.indexOf( ' ' );
- String name=line.substring( 0,ix );
- String version=line.substring( ix+1 ).trim();
- CabalPackageRef r=new CabalPackageRef();
- r.setName(name);
- r.getVersions().add( version );
- return r;
- }
- return null;
- }
-
- private BufferedReader run(final String... opts) throws IOException{
- ProcessRunner pr=new ProcessRunner();
- StringWriter swOut=new StringWriter();
- StringWriter swErr=new StringWriter();
- pr.executeBlocking( new File("."), swOut, swErr, opts ); //$NON-NLS-1$
- String err=swErr.toString();
- if (err.length()>0){
- HaskellCorePlugin.log( err, IStatus.ERROR );
- }
- return new BufferedReader( new StringReader(swOut.toString()) );
- /*ProcessBuilder pb=new ProcessBuilder();
- pb.redirectErrorStream(false);
- pb.command(opts);
-
- Process p=pb.start();
- return new BufferedReader(new InputStreamReader(p.getInputStream(),"UTF8")); //$NON-NLS-1$
- */
- }
-
-
-
- public void setInstalled( final List<CabalPackageRef> installed ) {
- this.installed = installed;
- }
-
-
-
- public void setAll( final List<CabalPackageRef> all ) {
- this.all = all;
- }
-
-}
+/**
+ * Copyright (c) 2012 by JP Moresmau
+ * This code is made available under the terms of the Eclipse Public License,
+ * version 1.0 (EPL). See http://www.eclipse.org/legal/epl-v10.html
+ */
+package net.sf.eclipsefp.haskell.core.cabal;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.LinkedList;
+import java.util.List;
+import net.sf.eclipsefp.haskell.core.HaskellCorePlugin;
+import net.sf.eclipsefp.haskell.util.PlatformUtil;
+import net.sf.eclipsefp.haskell.util.ProcessRunner;
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * helper wrapping cabal list and cabal info operations
+ * @author JP Moresmau
+ *
+ */
+public class CabalPackageHelper {
+ private final String cabalPath;
+
+ private List<CabalPackageRef> installed=null;
+ private List<CabalPackageRef> all=null;
+
+
+ public CabalPackageHelper( final String cabalPath ) {
+ super();
+ this.cabalPath = cabalPath;
+ }
+
+
+ public boolean hasInstalledVersion(final String name,final String version) throws IOException{
+ String s=getLastInstalledVersion(name);
+ if (s!=null){
+ return CabalPackageVersion.compare( s, version )>=0;
+ }
+ return false;
+ }
+
+ public String getLastInstalledVersion(final String name)throws IOException{
+ List<CabalPackageRef> r=list(name,"--installed");//$NON-NLS-1$
+ if (r.size()>0){
+ return r.get( r.size()-1 ).toString();
+ }
+ return null;
+ }
+
+ public List<CabalPackageRef> getInstalled()throws IOException {
+ if (installed==null){
+ installed=list("","--installed"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return installed;
+ }
+
+ public List<CabalPackageRef> getAll()throws IOException {
+ if (all==null){
+ all=list("",""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return all;
+ }
+
+ public String getInfo(final String name)throws IOException {
+ BufferedReader br=run(cabalPath,"info",name); //$NON-NLS-1$
+ StringBuilder sb=new StringBuilder();
+ String line=br.readLine();
+
+ while (line!=null){
+ sb.append(line);
+ sb.append( PlatformUtil.NL );
+ line=br.readLine();
+ }
+ br.close();
+ return sb.toString().substring( 2 ); // starts with *<space>
+ }
+
+ private List<CabalPackageRef> list(final String pkg,final String opt)throws IOException{
+
+ List<CabalPackageRef> ret=new LinkedList<CabalPackageRef>();
+ if (cabalPath==null){
+ return ret;
+ }
+ BufferedReader br=run(cabalPath,"list",pkg,opt,"--simple-output"); //$NON-NLS-1$//$NON-NLS-2$
+ String line=br.readLine();
+ CabalPackageRef last=null;
+ while (line!=null){
+ CabalPackageRef r=parseRef(line);
+ if (r!=null){
+ if (last==null || !r.getName().equals( last.getName() )){
+ if (last!=null){
+ last.getVersions().trimToSize();
+ }
+ ret.add(r);
+ last=r;
+ } else {
+ last.getVersions().addAll(r.getVersions());
+ }
+ }
+ line=br.readLine();
+ }
+ br.close();
+ return ret;
+ }
+
+ private CabalPackageRef parseRef(final String line){
+ if (line!=null && line.length()>0){
+ int ix=line.indexOf( ' ' );
+ String name=line.substring( 0,ix );
+ String version=line.substring( ix+1 ).trim();
+ CabalPackageRef r=new CabalPackageRef();
+ r.setName(name);
+ r.getVersions().add( version );
+ return r;
+ }
+ return null;
+ }
+
+ private BufferedReader run(final String... opts) throws IOException{
+ ProcessRunner pr=new ProcessRunner();
+ StringWriter swOut=new StringWriter();
+ StringWriter swErr=new StringWriter();
+ pr.executeBlocking( new File("."), swOut, swErr, opts ); //$NON-NLS-1$
+ String err=swErr.toString();
+ if (err.length()>0){
+ HaskellCorePlugin.log( err, IStatus.ERROR );
+ }
+ return new BufferedReader( new StringReader(swOut.toString()) );
+ /*ProcessBuilder pb=new ProcessBuilder();
+ pb.redirectErrorStream(false);
+ pb.command(opts);
+
+ Process p=pb.start();
+ return new BufferedReader(new InputStreamReader(p.getInputStream(),FileUtil.UTF8)); //$NON-NLS-1$
+ */
+ }
+
+
+
+ public void setInstalled( final List<CabalPackageRef> installed ) {
+ this.installed = installed;
+ }
+
+
+
+ public void setAll( final List<CabalPackageRef> all ) {
+ this.all = all;
+ }
+
+}
Oops, something went wrong.

0 comments on commit 5c27563

Please sign in to comment.