Skip to content

Commit fe635c2

Browse files
authored
Update build to latest everything (#2)
2 parents fd3ed1c + 320c246 commit fe635c2

22 files changed

+303
-746
lines changed

Diff for: .ci/ci.sh

-11
This file was deleted.

Diff for: .ci/push-javadoc.sh

-37
This file was deleted.

Diff for: .github/workflows/changelog-print.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: changelogPrint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
name: changelogPrint
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: jdk 11
14+
uses: actions/setup-java@v3
15+
with:
16+
java-version: 11
17+
distribution: 'temurin'
18+
- name: gradle caching
19+
uses: gradle/gradle-build-action@v2
20+
with:
21+
gradle-home-cache-cleanup: true
22+
- run: ./gradlew changelogPrint

Diff for: .github/workflows/ci.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches: [main]
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
jobs:
9+
build:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
jre: [11, 17]
14+
os: [ubuntu-latest]
15+
include:
16+
- jre: 17
17+
os: windows-latest
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
- name: Install JDK ${{ matrix.jre }}
23+
uses: actions/setup-java@v3
24+
with:
25+
distribution: "temurin"
26+
java-version: ${{ matrix.jre }}
27+
- name: gradle caching
28+
uses: gradle/gradle-build-action@v2
29+
with:
30+
gradle-home-cache-cleanup: true
31+
- name: git fetch origin main
32+
run: git fetch origin main
33+
- name: gradlew build
34+
run: ./gradlew build
35+
- name: junit result
36+
uses: mikepenz/action-junit-report@v3
37+
if: always() # always run even if the previous step fails
38+
with:
39+
check_name: JUnit ${{ matrix.jre }} ${{ matrix.os }}
40+
report_paths: '*/build/test-results/*/TEST-*.xml'

Diff for: .github/workflows/deploy.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# GH_TOKEN
2+
# NEXUS_USER
3+
# NEXUS_PASS64 (base64 NOTE: `base64` and `openssl base64` failed, had to use Java
4+
# byte[] data = "{{password}}".getBytes(StandardCharsets.UTF_8);
5+
# String encoded = new String(Base64.getEncoder().encode(data), StandardCharsets.UTF_8);
6+
# System.out.println(encoded);
7+
# GPG_PASSPHRASE
8+
# GPG_KEY64 (base64)
9+
# gpg --export-secret-keys --armor KEY_ID | openssl base64 | pbcopy
10+
# GRADLE_KEY
11+
# GRADLE_SECRET
12+
13+
name: deploy
14+
on:
15+
workflow_dispatch:
16+
inputs:
17+
to_publish:
18+
description: 'What to publish'
19+
required: true
20+
default: 'all'
21+
type: choice
22+
options:
23+
- all
24+
25+
jobs:
26+
build:
27+
runs-on: ubuntu-latest
28+
name: deploy
29+
env:
30+
gh_token: ${{ secrets.GH_TOKEN }}
31+
ORG_GRADLE_PROJECT_nexus_user: ${{ secrets.NEXUS_USER }}
32+
ORG_GRADLE_PROJECT_nexus_pass64: ${{ secrets.NEXUS_PASS64 }}
33+
ORG_GRADLE_PROJECT_gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
34+
ORG_GRADLE_PROJECT_gpg_key64: ${{ secrets.GPG_KEY64 }}
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: jdk 11
38+
uses: actions/setup-java@v3
39+
with:
40+
java-version: 11
41+
distribution: 'temurin'
42+
- name: gradle caching
43+
uses: gradle/gradle-build-action@v2
44+
with:
45+
gradle-home-cache-cleanup: true
46+
- name: git fetch origin main
47+
run: git fetch origin main
48+
- name: publish all
49+
if: "${{ github.event.inputs.to_publish == 'all' }}"
50+
run: |
51+
./gradlew :changelogPush -Prelease=true -Penable_publishing=true -Pgradle.publish.key=${{ secrets.GRADLE_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_SECRET }} --stacktrace --warning-mode all

Diff for: .github/workflows/gradle-wrapper-validation.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Validate Gradle Wrapper"
2+
on:
3+
push:
4+
paths:
5+
- 'gradlew'
6+
- 'gradlew.bat'
7+
- 'gradle/wrapper/'
8+
pull_request:
9+
paths:
10+
- 'gradlew'
11+
- 'gradlew.bat'
12+
- 'gradle/wrapper/'
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
validation:
19+
name: "Validation"
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: gradle/wrapper-validation-action@v1

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ build/
1111
.classpath
1212
.settings/
1313
bin/
14+
15+
# IntelliJ stuff
16+
.idea/

Diff for: .travis.yml

-10
This file was deleted.

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# JScriptBox releases
2+
3+
## [Unreleased]
4+
5+
## [3.0.0] - 2015-09-21
6+
- First stable release.

Diff for: CHANGES.md

-7
This file was deleted.

Diff for: CONTRIBUTING.md

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
# Contributing to JScriptBox
22

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`.
64

75
## Build instructions
86

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`
198

209
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).
2110

@@ -32,7 +21,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
3221
you may not use this file except in compliance with the License.
3322
You may obtain a copy of the License at
3423
35-
http://www.apache.org/licenses/LICENSE-2.0
24+
http://www.apache.org/licenses/LICENSE-2.0
3625
3726
Unless required by applicable law or agreed to in writing, software
3827
distributed under the License is distributed on an "AS IS" BASIS,

Diff for: README.md

+14-33
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
# <img align="left" src="jscriptbox.png"> JScriptBox: Make your scripting API language-independent
22
<!---freshmark shields
33
output = [
4-
link(shield('Maven artifact', 'mavenCentral', '{{group}}:{{name}}', 'blue'), 'https://bintray.com/{{org}}/opensource/{{name}}/view'),
5-
link(shield('Latest version', 'latest', '{{stable}}', 'blue'), 'https://github.com/{{org}}/{{name}}/releases/latest'),
6-
link(shield('Javadoc', 'javadoc', 'OK', 'blue'), 'https://{{org}}.github.io/{{name}}/javadoc/{{stable}}/'),
7-
link(shield('License Apache', 'license', 'Apache', 'blue'), 'https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)'),
8-
'',
9-
link(shield('Changelog', 'changelog', '{{version}}', 'brightgreen'), 'CHANGES.md'),
10-
link(image('Travis CI', 'https://travis-ci.org/{{org}}/{{name}}.svg?branch=master'), 'https://travis-ci.org/{{org}}/{{name}}'),
11-
link(shield('Live chat', 'gitter', 'live chat', 'brightgreen'), 'https://gitter.im/{{org}}/{{name}}')
12-
].join('\n');
4+
link(shield('Maven artifact', 'mavenCentral', 'com.diffplug.jscriptbox:jscriptbox', 'blue'), 'https://central.sonatype.com/artifact/com.diffplug.jscriptbox/jscriptbox/{{versionLast}}'),
5+
link(shield('Changelog', 'changelog', '{{versionLast}}', 'blue'), 'CHANGELOG.md'),
6+
link(shield('Javadoc', 'javadoc', 'here', 'blue'), 'https://javadoc.io/doc/com.diffplug.jscriptbox/jscriptbox')
7+
].join('\n');
138
-->
14-
[![Maven artifact](https://img.shields.io/badge/mavenCentral-com.diffplug.jscriptbox%3Ajscriptbox-blue.svg)](https://bintray.com/diffplug/opensource/jscriptbox/view)
15-
[![Latest version](https://img.shields.io/badge/latest-3.0.0-blue.svg)](https://github.com/diffplug/jscriptbox/releases/latest)
16-
[![Javadoc](https://img.shields.io/badge/javadoc-OK-blue.svg)](https://diffplug.github.io/jscriptbox/javadoc/3.0.0/)
17-
[![License Apache](https://img.shields.io/badge/license-Apache-blue.svg)](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0))
18-
19-
[![Changelog](https://img.shields.io/badge/changelog-3.1.0--SNAPSHOT-brightgreen.svg)](CHANGES.md)
20-
[![Travis CI](https://travis-ci.org/diffplug/jscriptbox.svg?branch=master)](https://travis-ci.org/diffplug/jscriptbox)
21-
[![Live chat](https://img.shields.io/badge/gitter-live_chat-brightgreen.svg)](https://gitter.im/diffplug/jscriptbox)
9+
[![Maven artifact](https://img.shields.io/badge/mavenCentral-com.diffplug.jscriptbox%3Ajscriptbox-blue.svg)](https://central.sonatype.com/artifact/com.diffplug.jscriptbox/jscriptbox/3.0.0)
10+
[![Changelog](https://img.shields.io/badge/changelog-3.0.0-blue.svg)](CHANGELOG.md)
11+
[![Javadoc](https://img.shields.io/badge/javadoc-here-blue.svg)](https://javadoc.io/doc/com.diffplug.jscriptbox/jscriptbox)
2212
<!---freshmark /shields -->
2313

2414
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:
2717

2818
## Example
2919

30-
<!---freshmark javadoc
31-
output = prefixDelimiterReplace(input, 'https://{{org}}.github.io/{{name}}/javadoc/', '/', stable);
32-
-->
33-
3420
```java
3521
private int square(int x) {
36-
return x * x;
22+
return x * x;
3723
}
3824

3925
@Test
4026
public void example() throws ScriptException {
41-
TypedScriptEngine engine = JScriptBox.create()
42-
.set("square").toFunc1(this::square)
43-
.set("x").toValue(9)
44-
.buildTyped(Nashorn.language());
45-
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);
4733
}
4834
```
4935

5036
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).
5137

52-
<!---freshmark /javadoc -->
53-
5438
## 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/).
5839
* Built by [gradle](http://gradle.org/).
5940
* Tested by [junit](http://junit.org/).
6041
* Maintained by [DiffPlug](http://www.diffplug.com/).

0 commit comments

Comments
 (0)