File tree 4 files changed +33
-10
lines changed
src/main/java/net/plan99/nodejs/java
4 files changed +33
-10
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ bintray {
110
110
repo = " open-source"
111
111
name = " nodejvm"
112
112
setLicenses(" Apache-2.0" )
113
- vcsUrl = " https://github.com/mikehearn/graviton-browser .git"
113
+ vcsUrl = " https://github.com/mikehearn/nodejvm .git"
114
114
version.apply {
115
115
name = project.version.toString()
116
116
desc = " NodeJS interop for GraalVM"
Original file line number Diff line number Diff line change 1
1
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2
+ import java.net.URI
2
3
3
4
plugins {
4
5
java
@@ -16,11 +17,18 @@ application {
16
17
17
18
repositories {
18
19
mavenCentral()
20
+ jcenter()
21
+ maven {
22
+ url = URI (" https://dl.bintray.com/mikehearn/open-source" )
23
+ }
19
24
}
20
25
21
26
dependencies {
22
27
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")
24
32
}
25
33
26
34
configure<JavaPluginConvention > {
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ Download the latest release from the [releases page](https://github.com/mikehear
4
4
5
5
Now add the ` nodejvm ` directory to your path, or copy the contents to somewhere on your path.
6
6
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
+
7
10
Start your Java programs as normal but run ` nodejvm ` instead of ` java ` , e.g.
8
11
9
12
` nodejvm -cp "libs/*.jar" my.main.Class arg1 arg2 `
@@ -25,9 +28,27 @@ gradle build spinners-sample:shadowJar
25
28
../build/nodejvm/nodejvm -jar build/libs/spinners-sample-*-all.jar
26
29
```
27
30
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)
29
50
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 ` :
31
52
32
53
```
33
54
tasks.withType<JavaExec> {
Original file line number Diff line number Diff line change 8
8
import org .jetbrains .annotations .NotNull ;
9
9
10
10
import java .io .File ;
11
- import java .io .FileInputStream ;
12
11
import java .io .IOException ;
13
12
import java .io .InputStream ;
14
13
import java .lang .reflect .InvocationTargetException ;
15
14
import java .lang .reflect .Method ;
16
15
import java .lang .reflect .Modifier ;
17
- import java .net .JarURLConnection ;
18
- import java .net .MalformedURLException ;
19
16
import java .net .URL ;
20
17
import java .net .URLClassLoader ;
21
18
import java .nio .file .Files ;
22
- import java .nio .file .Path ;
23
19
import java .nio .file .Paths ;
24
20
import java .nio .file .StandardOpenOption ;
25
21
import java .util .Arrays ;
34
30
* Provides an interface to the NodeJS runtime for Java developers. You can only access the NodeJS world
35
31
* when running on the event loop thread, which means you must use the various runJS methods on this class
36
32
* to get onto the correct thread before using eval.
37
- *
38
- * @suppress
39
33
*/
40
34
@ SuppressWarnings ("WeakerAccess" )
41
35
public class NodeJS {
You can’t perform that action at this time.
0 commit comments