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
{{ message }}
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: standalone/README.md
+79-10Lines changed: 79 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,18 +2,66 @@
2
2
3
3
## Introduction
4
4
5
-
This Maven project produces a standalone command line executable `tvdformat.jar` for the SQLcl script [`format.js`](../sqlcl/format.js). Optionally it produces also a GraalVM native image `tvdformat`.
5
+
This Maven project produces a standalone command line executable `tvdformat.jar` for the SQLcl script [`format.js`](../sqlcl/format.js). Optionally it produces also a GraalVM [native image](https://www.graalvm.org/reference-manual/native-image/)`tvdformat`.
6
6
7
-
The startup time of standalone JAR file and the native image are identical since the image still requires a JDK to execute. However, it is faster than running `format.js` from SQLcl.
7
+
The startup time of standalone JAR file and the native image are similar since the image still requires a JDK to execute. However, it is faster than running `format.js` from SQLcl.
8
8
9
9
This project contains JUnit tests for
10
10
11
11
- the SQLDev/SQLcl formatter settings `trivadis_advanced_format.xml` and `trivadis_custom_format.arbori`
12
12
- the SQLcl script `format.js`
13
13
- the SQLcl command `tvdformat`
14
-
- the standalone executable`tvdformat`
14
+
- the standalone exectable`tvdformat`
15
15
16
-
The project requires a JDK 17, but it produces a Java 8 JAR file. A GraalVM JDK is required only if you want to produce a native image.
16
+
The project requires a JDK 17, but it produces a Java 8 executable JAR file. A GraalVM JDK is required only if you want to build a [native image](https://www.graalvm.org/reference-manual/native-image/).
17
+
18
+
## Running the Standalone Formatter
19
+
20
+
### Configure Logging
21
+
22
+
Optionally, you can define the following environment variables:
23
+
24
+
Variable | Description
25
+
-------- | -----------
26
+
`TVDFORMAT_LOGGING_CONF_FILE` | Path to a [java.util.logging](https://docs.oracle.com/en/java/javase/17/core/java-logging-overview.html#GUID-B83B652C-17EA-48D9-93D2-563AE1FF8EDA) configuration file. Fully qualified or relative paths are supported. [This file](src/test/resources/logging.conf) is used for tests.
The `tvdformat.jar` is a shaded, executable JAR. This means it contains all dependend Java classes. However, it still needs a JDK 8 or higher.
33
+
34
+
To run it, open a terminal window and type
35
+
36
+
```
37
+
java -jar tvdformat.jar
38
+
```
39
+
40
+
The parameters are the same as for the [SQLcl command `tvdformat`](../sqlcl/README.md#register-script-formatjs-as-sqlcl-command-tvdformat). Except for formatting the SQLcl buffer, of course.
41
+
42
+
### Native Image
43
+
44
+
A native image is a platform specific executable. The following images can be produced with a GraalVM JDK 17:
45
+
46
+
OS | amd64)? | aarch64? | Requires JDK 8+? | No JDK required?
Currently there is no way to produce an ARM based (aarch64) native image for macOS and Windows. This reduces the possible combinations from 12 to 8 native images. Native images are not part of a release. You have to build them yourself as described [below](#how-to-build).
53
+
54
+
Native images produced with the `--force-fallback` option have a size of around 14 MB. They require a JDK 8+ at runtime and are considered stable.
55
+
56
+
Native images produced with the `--no-fallback` option have a size of around 500 MB. They do not require a JDK at runtime. Due to the absence of automatic tests, these images are considered experimental.
57
+
58
+
To run a native image open a terminal window and type
59
+
60
+
```
61
+
./tvdformat
62
+
```
63
+
64
+
The parameters are the same as for the [executable JAR](#executable-jar).
17
65
18
66
## How to Build
19
67
@@ -25,12 +73,33 @@ The project requires a JDK 17, but it produces a Java 8 JAR file. A GraalVM JDK
25
73
6. Clone the plsql-formatter-settings repository
26
74
7. Open a terminal window in the plsql-formatter-settings root folder and type
Amend the parameter `sqlcl.libdir` to match the path of the lib directory of your SQLcl installation. This folder is used to reference libraries such as `dbtools-common.jar` which contains the formatter and its dependencies. These libraries are not available in public Maven repositories.
Here's a fully qualified example to produce a native image:
33
102
34
-
Amend the parameter `sqlcl.libdir` to match the path of the lib directory of you SQLcl installation. This folder is used to reference the `dbtools-common.jar` library (containing the formatter and its dependencies) which is not available in public Maven repositories.
35
-
36
-
When you specifiy the parameter `-Dskip.native=false` a native image for your platform is created. When you pass the value `true` (default) then no native image is produced.
0 commit comments