Skip to content

Commit c2fc8ed

Browse files
author
Mike Hearn
committed
Small tidyups for the 1.1 release.
1 parent da4ce87 commit c2fc8ed

File tree

4 files changed

+33
-10
lines changed

4 files changed

+33
-10
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ bintray {
110110
repo = "open-source"
111111
name = "nodejvm"
112112
setLicenses("Apache-2.0")
113-
vcsUrl = "https://github.com/mikehearn/graviton-browser.git"
113+
vcsUrl = "https://github.com/mikehearn/nodejvm.git"
114114
version.apply {
115115
name = project.version.toString()
116116
desc = "NodeJS interop for GraalVM"

dat-sample/build.gradle.kts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
import java.net.URI
23

34
plugins {
45
java
@@ -16,11 +17,18 @@ application {
1617

1718
repositories {
1819
mavenCentral()
20+
jcenter()
21+
maven {
22+
url = URI("https://dl.bintray.com/mikehearn/open-source")
23+
}
1924
}
2025

2126
dependencies {
2227
implementation(kotlin("stdlib-jdk8"))
23-
implementation(rootProject) // This would be: implementation("net.plan99.nodejs:nodejs-interop:1.0") in a real project
28+
implementation(rootProject)
29+
30+
// In your programs, you'd write something like:
31+
// implementation("net.plan99:nodejvm:1.1")
2432
}
2533

2634
configure<JavaPluginConvention> {

docsite/docs/running-polyglot-programs.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Download the latest release from the [releases page](https://github.com/mikehear
44

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

7+
Make sure you've got GraalVM and set the location as either `JAVA_HOME` or `GRAALVM_PATH`. Or make sure
8+
its `bin` directory is on your path.
9+
710
Start your Java programs as normal but run `nodejvm` instead of `java`, e.g.
811

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

28-
## From Gradle
31+
## From your own Gradle projects
32+
33+
Firstly, add my Maven repository for the interop API JAR (this step will become obsolete soon as it'll be in JCenter):
34+
35+
```
36+
import java.net.URI
37+
38+
repositories {
39+
maven {
40+
url = URI("https://dl.bintray.com/mikehearn/open-source")
41+
}
42+
}
43+
44+
dependencies {
45+
implementation("net.plan99:nodejvm:1.1")
46+
}
47+
```
48+
49+
(these all use Kotlin DSL syntax)
2950

30-
The easiest way is to adjust your JavaCompile tasks to run `nodejvm` instead of `java`:
51+
Then adjust your JavaCompile tasks to run `nodejvm` instead of `java`:
3152

3253
```
3354
tasks.withType<JavaExec> {

src/main/java/net/plan99/nodejs/java/NodeJS.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@
88
import org.jetbrains.annotations.NotNull;
99

1010
import java.io.File;
11-
import java.io.FileInputStream;
1211
import java.io.IOException;
1312
import java.io.InputStream;
1413
import java.lang.reflect.InvocationTargetException;
1514
import java.lang.reflect.Method;
1615
import java.lang.reflect.Modifier;
17-
import java.net.JarURLConnection;
18-
import java.net.MalformedURLException;
1916
import java.net.URL;
2017
import java.net.URLClassLoader;
2118
import java.nio.file.Files;
22-
import java.nio.file.Path;
2319
import java.nio.file.Paths;
2420
import java.nio.file.StandardOpenOption;
2521
import java.util.Arrays;
@@ -34,8 +30,6 @@
3430
* Provides an interface to the NodeJS runtime for Java developers. You can only access the NodeJS world
3531
* when running on the event loop thread, which means you must use the various runJS methods on this class
3632
* to get onto the correct thread before using eval.
37-
*
38-
* @suppress
3933
*/
4034
@SuppressWarnings("WeakerAccess")
4135
public class NodeJS {

0 commit comments

Comments
 (0)