Skip to content

Commit

Permalink
Upgrade to Clojure 1.5.1 & switch to clojure-slim JAR - OpenRefine#792
Browse files Browse the repository at this point in the history
  • Loading branch information
tfmorris committed Aug 26, 2013
1 parent 886fb5e commit c68c1bb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/ant-tools-1.8.0.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/arithcode-1.1.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/butterfly-1.0.1.jar" sourcepath="main/webapp/WEB-INF/lib-src/butterfly-1.0.1-sources.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/clojure-1.4.0.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/clojure-1.5.1-slim.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/commons-codec-1.6.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/commons-collections-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/commons-fileupload-1.2.1.jar"/>
Expand Down
17 changes: 15 additions & 2 deletions main/src/com/google/refine/expr/MetaParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
import java.util.Set;

import clojure.lang.IFn;
import clojure.lang.RT;

import com.google.refine.grel.Parser;

Expand All @@ -58,6 +59,10 @@ static public class LanguageInfo {
}

static final protected Map<String, LanguageInfo> s_languages = new HashMap<String, LanguageInfo>();

// TODO: We should switch from using the internal compiler class
// final static private Var CLOJURE_READ_STRING = RT.var("clojure.core", "read-string");
// final static private Var CLOJURE_EVAL = RT.var("clojure.core", "eval");

static {
registerLanguageParser("grel", "Google Refine Expression Language (GREL)", new LanguageSpecificParser() {
Expand All @@ -73,9 +78,17 @@ public Evaluable parse(String s) throws ParsingException {
@Override
public Evaluable parse(String s) throws ParsingException {
try {
// RT.load("clojure/core"); // Make sure RT is initialized
Object foo = RT.CURRENT_NS; // Make sure RT is initialized
IFn fn = (IFn) clojure.lang.Compiler.load(new StringReader(
"(fn [value cell cells row rowIndex] " + s + ")"
));
"(fn [value cell cells row rowIndex] " + s + ")"
));

// TODO: We should to switch from using Compiler.load
// because it's technically an internal interface
// Object code = CLOJURE_READ_STRING.invoke(
// "(fn [value cell cells row rowIndex] " + s + ")"
// );

return new Evaluable() {
private IFn _fn;
Expand Down
Binary file removed main/webapp/WEB-INF/lib/clojure-1.4.0.jar
Binary file not shown.
Binary file added main/webapp/WEB-INF/lib/clojure-1.5.1-slim.jar
Binary file not shown.

0 comments on commit c68c1bb

Please sign in to comment.