You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+3-14
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,10 @@
1
1
# Contributing to JScriptBox
2
2
3
-
Pull requests are welcome, preferably against `master`.
4
-
5
-
Every successful Travis CI build on branch `master` is automatically published to [`https://oss.sonatype.org/content/repositories/snapshots`](https://oss.sonatype.org/content/repositories/snapshots/com/diffplug/), and its javadoc are published [here](http://diffplug.github.io/jscriptbox/javadoc/snapshot/).
3
+
Pull requests are welcome, preferably against `main`.
6
4
7
5
## Build instructions
8
6
9
-
It's a bog-standard gradle build.
10
-
11
-
`gradlew eclipse`
12
-
* creates an Eclipse project file for you.
13
-
14
-
`gradlew build`
15
-
* builds the jar
16
-
* runs FindBugs
17
-
* checks the formatting
18
-
* runs the tests
7
+
It's a bog-standard gradle build. `gradlew build`
19
8
20
9
If you're getting style warnings, `gradlew spotlessApply` will apply anything necessary to fix formatting. For more info on the formatter, check out [spotless](https://github.com/diffplug/spotless).
21
10
@@ -32,7 +21,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
32
21
you may not use this file except in compliance with the License.
33
22
You may obtain a copy of the License at
34
23
35
-
http://www.apache.org/licenses/LICENSE-2.0
24
+
http://www.apache.org/licenses/LICENSE-2.0
36
25
37
26
Unless required by applicable law or agreed to in writing, software
38
27
distributed under the License is distributed on an "AS IS" BASIS,
When exposing a scripting API, you provide some variables and functions to the script, run the script, then look at which outputs were set and/or functions were called. JScriptBox provides a mechanism for exposing a Java API to a scripting language in a way which is independent of the script language. This means that if you write your code using JScriptBox, script authors can use any language supported by JSR-223, such as JavaScript, Ruby, Python, Scheme, [etc.](http://stackoverflow.com/a/14864450/1153071)
@@ -27,34 +17,25 @@ At present, only JavaScript is being used in the wild (in the [FreshMark](https:
int squareOfX = engine.eval("square(x)", Integer.class);
46
-
Assert.assertEquals(81, squareOfX);
27
+
TypedScriptEngine engine =JScriptBox.create()
28
+
.set("square").toFunc1(this::square)
29
+
.set("x").toValue(9)
30
+
.buildTyped(Nashorn.language());
31
+
int squareOfX = engine.eval("square(x)", Integer.class);
32
+
Assert.assertEquals(81, squareOfX);
47
33
}
48
34
```
49
35
50
36
In the code above, we provide a `square` function and an `x` variable. We then build a Nashorn Javascript engine, but we could have passed any other language too. To add a new language, just implement [Language](src/main/java/com/diffplug/jscriptbox/Language.java) (the existing [Nashorn](src/main/java/com/diffplug/jscriptbox/javascript/Nashorn.java) can be a helpful starting point).
51
37
52
-
<!---freshmark /javadoc -->
53
-
54
38
## Acknowledgements
55
-
* Readme formatting by [FreshMark](https://github.com/diffplug/freshmark).
56
-
* Bugs found by [findbugs](http://findbugs.sourceforge.net/), [as such](https://github.com/diffplug/durian-rx/blob/v1.0/build.gradle?ts=4#L92-L116).
57
-
* Scripts in the `.ci` folder are inspired by [Ben Limmer's work](http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/).
58
39
* Built by [gradle](http://gradle.org/).
59
40
* Tested by [junit](http://junit.org/).
60
41
* Maintained by [DiffPlug](http://www.diffplug.com/).
0 commit comments