Skip to content

Commit

Permalink
Small tidyups for the 1.1 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Hearn committed Nov 4, 2019
1 parent da4ce87 commit c2fc8ed
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ bintray {
repo = "open-source"
name = "nodejvm"
setLicenses("Apache-2.0")
vcsUrl = "https://github.com/mikehearn/graviton-browser.git"
vcsUrl = "https://github.com/mikehearn/nodejvm.git"
version.apply {
name = project.version.toString()
desc = "NodeJS interop for GraalVM"
Expand Down
10 changes: 9 additions & 1 deletion dat-sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI

plugins {
java
Expand All @@ -16,11 +17,18 @@ application {

repositories {
mavenCentral()
jcenter()
maven {
url = URI("https://dl.bintray.com/mikehearn/open-source")
}
}

dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(rootProject) // This would be: implementation("net.plan99.nodejs:nodejs-interop:1.0") in a real project
implementation(rootProject)

// In your programs, you'd write something like:
// implementation("net.plan99:nodejvm:1.1")
}

configure<JavaPluginConvention> {
Expand Down
25 changes: 23 additions & 2 deletions docsite/docs/running-polyglot-programs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Download the latest release from the [releases page](https://github.com/mikehear

Now add the `nodejvm` directory to your path, or copy the contents to somewhere on your path.

Make sure you've got GraalVM and set the location as either `JAVA_HOME` or `GRAALVM_PATH`. Or make sure
its `bin` directory is on your path.

Start your Java programs as normal but run `nodejvm` instead of `java`, e.g.

`nodejvm -cp "libs/*.jar" my.main.Class arg1 arg2`
Expand All @@ -25,9 +28,27 @@ gradle build spinners-sample:shadowJar
../build/nodejvm/nodejvm -jar build/libs/spinners-sample-*-all.jar
```

## From Gradle
## From your own Gradle projects

Firstly, add my Maven repository for the interop API JAR (this step will become obsolete soon as it'll be in JCenter):

```
import java.net.URI
repositories {
maven {
url = URI("https://dl.bintray.com/mikehearn/open-source")
}
}
dependencies {
implementation("net.plan99:nodejvm:1.1")
}
```

(these all use Kotlin DSL syntax)

The easiest way is to adjust your JavaCompile tasks to run `nodejvm` instead of `java`:
Then adjust your JavaCompile tasks to run `nodejvm` instead of `java`:

```
tasks.withType<JavaExec> {
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/net/plan99/nodejs/java/NodeJS.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.JarURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Arrays;
Expand All @@ -34,8 +30,6 @@
* Provides an interface to the NodeJS runtime for Java developers. You can only access the NodeJS world
* when running on the event loop thread, which means you must use the various runJS methods on this class
* to get onto the correct thread before using eval.
*
* @suppress
*/
@SuppressWarnings("WeakerAccess")
public class NodeJS {
Expand Down

0 comments on commit c2fc8ed

Please sign in to comment.