Skip to content

Commit

Permalink
Support Package in R (#83)
Browse files Browse the repository at this point in the history
* lib: Import package deps

Signed-off-by: Ce Gao <ce.gao@outlook.com>

* lib: Add maven-ant-tasks

Signed-off-by: Ce Gao <ce.gao@outlook.com>

* ant: Update the stragety about libraries

Signed-off-by: Ce Gao <ce.gao@outlook.com>

* BuiltinApplet: Update the engine

Signed-off-by: Ce Gao <ce.gao@outlook.com>
  • Loading branch information
gaocegege authored Jul 5, 2017
1 parent 291a9cc commit dd9a382
Show file tree
Hide file tree
Showing 108 changed files with 135 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ build.number
# Processing.R
bin/
dist/
build/
/build/
try/
*.log
build.xml
Expand Down
24 changes: 23 additions & 1 deletion build.xml.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<project name="Processing.R" default="install" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
<project name="Processing.R" default="install" basedir="." xmlns:jacoco="antlib:org.jacoco.ant" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<property name="mode.name" value="RLangMode" />

<!-- folder to install modes in (probably a folder called "modes" inside your sketchbook folder) -->
Expand All @@ -17,6 +17,7 @@
<property name="try" value="try" />
<property name="mode-lib" value="lib/mode" />
<property name="test-lib" value="lib/test" />
<property name="build-lib" value="lib/build" />
<property name="src" value="src" />
<property name="build" value="build" />
<property name="bin" value="bin" />
Expand All @@ -30,6 +31,27 @@
<property name="result.report.dir" location="${test.build.dir}/site/jacoco"/>
<property name="result.exec.file" location="${test.build.dir}/jacoco.exec"/>

<property name="renjin-version" value="0.8.2411" />

<!-- Maven deps -->
<path id="maven-ant-tasks.classpath" path="${build-lib}/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath" />
<artifact:remoteRepository id="remote.repository" url="https://nexus.bedatadriven.com/content/groups/public/" />
<artifact:dependencies filesetId="dependency.fileset"
versionsId="dependency.versions">
<remoteRepository refid="remote.repository" />
<dependency groupId="org.renjin" artifactId="renjin-script-engine" version="${renjin-version}" />
<dependency groupId="org.renjin" artifactId="renjin-cli" version="${renjin-version}" />
</artifact:dependencies>
<copy todir="${mode-lib}">
<fileset refid="dependency.fileset" />
<mapper classpathref="maven-ant-tasks.classpath"
classname="org.apache.maven.artifact.ant.VersionMapper"
from="${dependency.versions}" to="flatten" />
</copy>

<path id="mode-library-classpath">
<pathelement location="${processing.classes.pde}"/>
<fileset dir="${processing.classes.core}">
Expand Down
Binary file added lib/build/maven-ant-tasks-2.1.3.jar
Binary file not shown.
Binary file added lib/mode/aether-api.jar
Binary file not shown.
Binary file added lib/mode/aether-connector-basic.jar
Binary file not shown.
Binary file added lib/mode/aether-impl.jar
Binary file not shown.
Binary file added lib/mode/aether-spi.jar
Binary file not shown.
Binary file added lib/mode/aether-transport-file.jar
Binary file not shown.
Binary file added lib/mode/aether-transport-http.jar
Binary file not shown.
Binary file added lib/mode/aether-util.jar
Binary file not shown.
Binary file added lib/mode/airline.jar
Binary file not shown.
102 changes: 102 additions & 0 deletions lib/mode/all.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.github.fommil.netlib</groupId>
<artifactId>parent</artifactId>
<version>1.1</version>
</parent>

<artifactId>all</artifactId>
<packaging>pom</packaging>
<version>1.1.2</version>

<dependencies>
<dependency>
<!-- WORKAROUND: https://github.com/sbt/sbt/issues/861 -->
<groupId>net.sourceforge.f2j</groupId>
<artifactId>arpack_combined_all</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>core</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_ref-osx-x86_64</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_ref-linux-x86_64</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_ref-linux-i686</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_ref-win-x86_64</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_ref-win-i686</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_ref-linux-armhf</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_system-osx-x86_64</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_system-linux-x86_64</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_system-linux-i686</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_system-linux-armhf</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_system-win-x86_64</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>netlib-native_system-win-i686</artifactId>
<version>${project.parent.version}</version>
<classifier>natives</classifier>
</dependency>
</dependencies>
</project>
Binary file added lib/mode/aopalliance.jar
Binary file not shown.
Binary file added lib/mode/arpack_combined_all.jar
Binary file not shown.
Binary file added lib/mode/asm.jar
Binary file not shown.
Binary file added lib/mode/cdi-api.jar
Binary file not shown.
Binary file added lib/mode/codemodel.jar
Binary file not shown.
Binary file added lib/mode/commons-codec.jar
Binary file not shown.
Binary file added lib/mode/commons-compress.jar
Binary file not shown.
Binary file added lib/mode/commons-logging.jar
Binary file not shown.
Binary file added lib/mode/commons-math.jar
Binary file not shown.
Binary file added lib/mode/commons-vfs2.jar
Binary file not shown.
Binary file added lib/mode/compiler.jar
Binary file not shown.
Binary file added lib/mode/core.jar
Binary file not shown.
Binary file added lib/mode/datasets.jar
Binary file not shown.
Binary file added lib/mode/gcc-bridge-compiler.jar
Binary file not shown.
Binary file added lib/mode/gcc-bridge-plugin-linux-x86_64.jar
Binary file not shown.
Binary file added lib/mode/gcc-runtime.jar
Binary file not shown.
Binary file added lib/mode/grDevices.jar
Binary file not shown.
Binary file added lib/mode/graphics.jar
Binary file not shown.
Binary file added lib/mode/grid.jar
Binary file not shown.
Binary file removed lib/mode/guava-17.0-sources.jar
Binary file not shown.
Binary file removed lib/mode/guava-17.0.jar
Binary file not shown.
Binary file added lib/mode/guava.jar
Binary file not shown.
Binary file added lib/mode/hamcrest.jar
Binary file not shown.
Binary file added lib/mode/httpclient.jar
Binary file not shown.
Binary file added lib/mode/httpcore.jar
Binary file not shown.
Binary file added lib/mode/jackson-annotations.jar
Binary file not shown.
Binary file added lib/mode/jackson-core.jar
Binary file not shown.
Binary file added lib/mode/jackson-databind.jar
Binary file not shown.
Binary file added lib/mode/javax.inject.jar
Binary file not shown.
Binary file added lib/mode/jcl-over-slf4j.jar
Binary file not shown.
Binary file added lib/mode/jline.jar
Binary file not shown.
Binary file added lib/mode/jniloader.jar
Binary file not shown.
Binary file added lib/mode/joda-time.jar
Binary file not shown.
Binary file added lib/mode/jsr250-api.jar
Binary file not shown.
Binary file added lib/mode/jsr305.jar
Binary file not shown.
Binary file added lib/mode/maven-aether-provider.jar
Binary file not shown.
Binary file added lib/mode/maven-model-builder.jar
Binary file not shown.
Binary file added lib/mode/maven-model.jar
Binary file not shown.
Binary file added lib/mode/maven-repository-metadata.jar
Binary file not shown.
Binary file added lib/mode/maven-scm-api.jar
Binary file not shown.
Binary file added lib/mode/maven-scm-provider-svn-commons.jar
Binary file not shown.
Binary file added lib/mode/maven-scm-provider-svnexe.jar
Binary file not shown.
Binary file added lib/mode/maven-settings-builder.jar
Binary file not shown.
Binary file added lib/mode/maven-settings.jar
Binary file not shown.
Binary file added lib/mode/methods.jar
Binary file not shown.
Binary file added lib/mode/native_ref-java.jar
Binary file not shown.
Binary file added lib/mode/native_system-java.jar
Binary file not shown.
Binary file not shown.
Binary file added lib/mode/netlib-native_ref-linux-i686-natives.jar
Binary file not shown.
Binary file not shown.
Binary file added lib/mode/netlib-native_ref-osx-x86_64-natives.jar
Binary file not shown.
Binary file added lib/mode/netlib-native_ref-win-i686-natives.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added lib/mode/org.eclipse.sisu.inject.jar
Binary file not shown.
Binary file added lib/mode/org.eclipse.sisu.plexus.jar
Binary file not shown.
Binary file added lib/mode/packager.jar
Binary file not shown.
Binary file added lib/mode/parallel.jar
Binary file not shown.
Binary file added lib/mode/plexus-cipher.jar
Binary file not shown.
Binary file added lib/mode/plexus-classworlds.jar
Binary file not shown.
Binary file added lib/mode/plexus-component-annotations.jar
Binary file not shown.
Binary file added lib/mode/plexus-interpolation.jar
Binary file not shown.
Binary file added lib/mode/plexus-sec-dispatcher.jar
Binary file not shown.
Binary file added lib/mode/plexus-utils.jar
Binary file not shown.
Binary file added lib/mode/regexp.jar
Binary file not shown.
Binary file added lib/mode/renjin-aether-package-loader.jar
Binary file not shown.
Binary file added lib/mode/renjin-appl.jar
Binary file not shown.
Binary file added lib/mode/renjin-asm.jar
Binary file not shown.
Binary file added lib/mode/renjin-blas.jar
Binary file not shown.
Binary file added lib/mode/renjin-cli.jar
Binary file not shown.
Binary file added lib/mode/renjin-core.jar
Binary file not shown.
Binary file added lib/mode/renjin-gnur-compiler.jar
Binary file not shown.
Binary file added lib/mode/renjin-gnur-installation.jar
Binary file not shown.
Binary file added lib/mode/renjin-gnur-runtime.jar
Binary file not shown.
Binary file added lib/mode/renjin-guava.jar
Binary file not shown.
Binary file added lib/mode/renjin-lapack.jar
Binary file not shown.
Binary file added lib/mode/renjin-math-common.jar
Binary file not shown.
Binary file added lib/mode/renjin-nmath.jar
Binary file not shown.
Binary file added lib/mode/renjin-repl.jar
Binary file not shown.
Binary file not shown.
Binary file added lib/mode/renjin-script-engine.jar
Binary file not shown.
Binary file added lib/mode/sisu-guice-no_aop.jar
Binary file not shown.
Binary file added lib/mode/slf4j-api.jar
Binary file not shown.
Binary file added lib/mode/slf4j-jdk14.jar
Binary file not shown.
Binary file added lib/mode/splines.jar
Binary file not shown.
Binary file added lib/mode/stats.jar
Binary file not shown.
Binary file added lib/mode/stats4.jar
Binary file not shown.
Binary file added lib/mode/tools.jar
Binary file not shown.
Binary file added lib/mode/utils.jar
Binary file not shown.
Binary file added lib/mode/xz.jar
Binary file not shown.
23 changes: 9 additions & 14 deletions src/rprocessing/applet/BuiltinApplet.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package rprocessing.applet;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

import org.renjin.aether.AetherPackageLoader;
import org.renjin.eval.Session;
import org.renjin.eval.SessionBuilder;
import org.renjin.script.RenjinScriptEngine;
import org.renjin.script.RenjinScriptEngineFactory;
import org.renjin.sexp.StringVector;

import processing.core.PApplet;
import rprocessing.exception.NotFoundException;

/**
* BuiltinApplet is the type to refactor the function calls.
Expand All @@ -26,16 +26,11 @@ public RenjinScriptEngine getRenjinEngine() {
return renjinEngine;
}

public BuiltinApplet() throws NotFoundException {
// Create a script engine manager.
ScriptEngineManager manager = new ScriptEngineManager();
// Create a Renjin engine.
ScriptEngine engine = manager.getEngineByName("Renjin");
// Check if the engine has loaded correctly.
if (engine == null) {
throw new NotFoundException("Renjin Script Engine not found on the classpath.");
}
this.renjinEngine = (RenjinScriptEngine) engine;
public BuiltinApplet() {
AetherPackageLoader packageLoader = new AetherPackageLoader();
Session session =
new SessionBuilder().withDefaultPackages().setPackageLoader(packageLoader).build();
this.renjinEngine = new RenjinScriptEngineFactory().getScriptEngine(session);
}

public void size(double width, double height) {
Expand Down

0 comments on commit dd9a382

Please sign in to comment.