Skip to content

Commit 5bcd59d

Browse files
committed
Convert jshell-based scripts to plain java programs
Closes #578
1 parent 75a0f69 commit 5bcd59d

File tree

15 files changed

+422
-203
lines changed

15 files changed

+422
-203
lines changed

.github/workflows/build-all-examples.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20-
- name: 'Set up JDK 21'
20+
- name: 'Set up JDK 24'
2121
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
2222
with:
23-
java-version: 21
23+
java-version: 24
2424
distribution: temurin
2525
- uses: sbt/setup-sbt@6c68d2fe8dfbc0a0534d70101baa2e0420e1a506 # v1.1.9
26-
- name: 'Build all examples using JShell'
26+
- name: 'Build all examples'
2727
run: java src/Builder.java
2828
- name: 'Check automation for updating versions'
2929
run: java src/Updater.java 42

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
build-mode: manual
2626
steps:
2727
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28-
- name: 'Set up JDK 21'
28+
- name: 'Set up JDK 24'
2929
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
3030
with:
31-
java-version: 21
31+
java-version: 24
3232
distribution: temurin
3333
- uses: sbt/setup-sbt@6c68d2fe8dfbc0a0534d70101baa2e0420e1a506 # v1.1.9
3434
- name: Initialize CodeQL

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
Welcome to _JUnit Examples_, a collection of example applications and extensions
44
using JUnit Jupiter, JUnit Vintage, and the JUnit Platform on various build systems.
55

6-
CI builds for example projects are performed by [GitHub Actions][ci-actions]. Using JDK 11+'s
7-
`jshell` tool, you may build all examples via the `build-all-examples.jsh` script.
6+
CI builds for example projects are performed by [GitHub Actions][ci-actions]. Using JDK 24+'s
7+
`java` multi-file source-code launcher feature, you may build all examples by running
8+
`java src/Builder.java` in the main directory of this project.
89

910
## Jupiter Starter Examples
1011

junit-modular-world/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bin/
22
lib/
3+
!src/build/
34
.jqwik-database

junit-modular-world/README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
The project layout structure and command line tools usages are based on proposals
44
introduced by the [**Module System Quick-Start Guide**](https://openjdk.java.net/projects/jigsaw/quick-start).
5-
Invoke the [jshell](https://docs.oracle.com/javase/9/tools/jshell.htm) script
6-
`./build.jsh` (Windows: `jshell build.jsh`) to build this example project.
5+
Invoke [java](https://openjdk.org/jeps/458)'s source launcher
6+
`java src/build/Build.java` to build this example project.
77

8-
This example project does not aim to demonstrate how to use the JUnit Platform APIs.
9-
For detailed information on the JUnit Platform programming and extension models,
8+
This example project does not aim to demonstrate how to use the JUnit Framework APIs.
9+
For detailed information on the JUnit Framework programming and extension models,
1010
please consult the [User Guide](https://docs.junit.org/current/user-guide/).
1111

1212
## Source Layout
@@ -22,7 +22,7 @@ It tests the exported packages and types of the main modules.
2222

2323
## Binary Layout
2424

25-
Main binaries are compiled and packaged using `./compile.jsh`.
25+
Main binaries are compiled and packaged using `java src/build/Compile.java`.
2626

2727
For example, here are the commands to compile and package the `com.example.tool` module.
2828
This and the `com.example.application` module don't need external module dependencies.
@@ -57,18 +57,16 @@ jar
5757
.
5858
```
5959

60-
Here is the partly expanded tree of the `bin/` directory after running `./compile.jsh`:
60+
Here is the partly expanded tree of the `bin/` directory after running `java src/build/Compile.java`:
6161

6262
![junit-modular-world/bin](doc/screenshot-bin.png)
6363

6464

6565
## Running Tests
6666

67-
Compiling and running tests is achieved by calling the following test scripts:
67+
Compiling and running tests is achieved by calling the following Java program:
6868

69-
- `test-classpath.jsh`
70-
- `test-patch-compile.jsh`
71-
- `test-patch-runtime.jsh`
69+
- `java src/build/Build.java`
7270

7371
```
7472
@@ -116,7 +114,7 @@ Compiling and running tests is achieved by calling the following test scripts:
116114
## Ice Cream Test Engine
117115

118116
The `ice.cream` module demonstrates how to write and register your own `TestEngine`
119-
implementation using the Java Platform Module System.
117+
implementation using a Java module descriptor.
120118
This engine does not find any tests in containers, but _discovers_ a configurable
121119
amount of ice cream scoops.
122120

junit-modular-world/build.jsh

Lines changed: 0 additions & 18 deletions
This file was deleted.

junit-modular-world/compile.jsh

Lines changed: 0 additions & 57 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
public class Build {
2+
public static void main(String[] args) throws Exception {
3+
var project = Project.ofCurrentWorkingDirectory();
4+
project.clean();
5+
project.compile();
6+
project.test();
7+
}
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public class Compile {
2+
public static void main(String[] args) throws Exception {
3+
Project.ofCurrentWorkingDirectory().compile();
4+
}
5+
}

0 commit comments

Comments
 (0)