@@ -6,8 +6,8 @@ The JIT compiler for the LKQL language.
66Dependencies
77------------
88
9- * [ GraalVM] ( https://www.graalvm.org/ ) : The high performance JVM
10- * [ Maven] ( https://maven.apache.org/ ) : Java project manager
9+ * [ GraalVM] ( https://www.graalvm.org/ ) : The high performance JVM (version 24.2.1)
10+ * [ Maven] ( https://maven.apache.org/ ) : Java building tool
1111* [ Python3] ( https://www.python.org/ ) : The language (3.9 or later)
1212* [ Langkit] ( https://github.com/AdaCore/langkit ) : The language front-end creation framework
1313* [ Libadalang] ( https://github.com/AdaCore/libadalang )
@@ -17,29 +17,23 @@ How to build and run
1717--------------------
1818
1919First, you need to ensure that the ` mvn ` command is accessible and fairly recent (at least 3.8.5).
20-
21- Then, make sure you have an accessible Python3 installation. Python 3.9 or later.
22-
23- You also need to install GraalVM's ` native-image ` utility, which can be done
24- running ` gu install native-image ` (where ` gu ` is in the ` bin ` directory of the GraalVM
25- installation).
26-
27- Also make sure that your GraalVM installation is for Java 17, as Java 19 is not supported for now.
28- For information, the tested version of GraalVM is graalvm-ce-java17-22.3.1.
20+ Then, make sure you have an accessible Python3 installation, version 3.9 or later.
21+ Also make sure that your GraalVM installation is in the 24.2.1 version.
22+ Finally, make sure that ` native-image ` tool is available in your environment.
2923
3024### 1) Install Langkit and make sure it is usable
3125
3226``` sh
3327$[langkit]> pip3 install -r requirement-pypi.txt
3428$[langkit]> ./manage.py make
35- $[langkit]> eval ` ./manage.py setenv `
29+ $[langkit]> eval ` ./manage.py printenv `
3630$[langkit]> export PATH=" /path/to/langkit/scripts:$PATH "
3731```
3832
39- If you get a Python error about the langkit library, add the langkit directory to your ` PYTHONPATH `
33+ If you get a Python error about the Langkit library, add the Langkit directory to your ` PYTHONPATH `
4034environment variable.
4135
42- * Note: If for some reason you are not running ` ./manage.py setenv ` , make sure that the
36+ * Note: If for some reason you are not running ` ./manage.py printenv ` , make sure that the
4337` sigsegv_handler ` library is reachable from your ` LD_LIBRARY_PATH ` .*
4438
4539Install the Java LangkitSupport library:
@@ -52,7 +46,7 @@ $[langkit]> mvn -f langkit/java_support install
5246
5347``` sh
5448$[libadalang]> lkm make --enable-java
55- $[libadalang]> eval ` lkm setenv `
49+ $[libadalang]> eval ` lkm printenv `
5650```
5751
5852Make sure the Java bindings are installed locally
@@ -65,7 +59,7 @@ $[libadalang]> mvn -f build/java install
6559
6660``` sh
6761$[langkit-query-language/lkql]> lkm make --enable-java
68- $[langkit-query-language/lkql]> eval ` lkm setenv `
62+ $[langkit-query-language/lkql]> eval ` lkm printenv `
6963```
7064
7165As for Libadalang, make sure Java bindings are installed
@@ -82,99 +76,59 @@ $[langkit-query-language/lkql]> mvn -f build/java install
8276### 5) Build and run LKQL_JIT
8377
8478``` sh
85- $[langkit-query-language/lkql_jit]> mvn clean install
79+ $[langkit-query-language/lkql_jit]> mvn clean package
8680```
8781
88- You can now access the LKQL JIT launcher using the ` lkql.py ` Python script that has been installed
89- in the ` languages/lkql/bin ` directory of your GraalVM installation .
82+ You can now access LKQL JIT by running the ` langkit-query-language/lkql_jit/standalone/target/ lkql.py`
83+ script .
9084
91- This script will launch LKQL JIT with the current accessible Java installation (`java -jar
92- lkql_cli.jar ...`) so you have to run it in a valid environment.
85+ This script will launch LKQL JIT with the current accessible Java installation (` java -jar ... ` )
86+ so you have to run it in a valid environment.
9387
9488If you want to build LKQL JIT as a native executable, you can use the ` native ` Maven profile:
9589
9690``` sh
97- $[langkit-query-language/lkql_jit]> mvn clean install -P native
91+ $[langkit-query-language/lkql_jit]> mvn clean package -P native
9892```
9993
100- Then the ` lkql ` executable will be available under the ` langkit-query-language/lkql_jit/native/bin `
101- directory and will be installed to your local GraalVM guest languages folder
102- (` $GRAAL_HOME/languages/lkql/bin ` ).
94+ Then the ` lkql ` executable will be available under the ` langkit-query-language/lkql_jit/standalone/target `
95+ directory.
10396
10497### 6) Running the code formatter
10598
106- LKQL JIT project uses the ` google-java-format ` as code formatter. It is run every time you call
107- the ` compile ` Maven phase and will raise an error if there is a style violation in the LKQL JIT
108- source code. To automatically format all Java files you can run the following command:
99+ LKQL JIT project uses ` prettier-java ` as code formatter, and the ` spotless ` Maven plugin is configured
100+ to run it on demand. You can run the following command to format all Java sources:
109101
110102``` sh
111- $[langkit-query-language/lkql_jit] mvn spotless:apply
103+ $[langkit-query-language/lkql_jit]> mvn spotless:apply
104+ ```
105+
106+ However, running it is very prone to error, thus you can install pre-commit
107+ hooks to perform this formatting operation on each commit:
108+
109+ ``` sh
110+ $[langkit-query-language]> pre-commit install
112111```
113112
114113Debugging LKQL JIT
115114------------------
116115
117- To debug LKQL_JIT native-image build you can use the ` debug ` maven profile.
116+ To debug LKQL JIT native-image builds you can use the ` debug ` maven profile:
118117
119118``` sh
120- $[langkit-query-language/lkql_jit]> mvn clean install -P native,debug
119+ $[langkit-query-language/lkql_jit]> mvn clean package -P native,debug
121120```
122121
123- If you need to debug or profile LKQL_JIT native-image binaries there is the ` dev ` profile which
122+ If you need to debug or profile LKQL JIT native-image binaries there is the ` dev ` profile which
124123enable support for tools like ` valgrind ` , ` gdb ` or ` perf ` on the produced binaries.
125124
126125``` sh
127- $[langkit-query-language/lkql_jit]> mvn clean install -P native,dev
126+ $[langkit-query-language/lkql_jit]> mvn clean package -P native,dev
128127```
129128
130129If you don't need or want any of those, use the ` prod ` profile to disable all debugging and
131130profiling information.
132131
133132``` sh
134- $[langkit-query-language/lkql_jit]> mvn clean install -P native,prod
135- ```
136-
137- Configuring Intellij IDEA
138- -------------------------
139-
140- To develop for LKQL JIT you may use Intellij IDEA since the LKQL JIT project use and contains a
141- configuration for this IDE. You just have to open the LKQL JIT project (` lkql_jit/pom.xml ` ) with
142- Intellij to initialize the project.
143-
144- However, LKQL JIT project use ` google-java-format ` to format the Java source code, so you may
145- configure Intellij to use this formatter and applying it when saving Java files. To make this
146- you have to follow those steps:
147-
148- ### 1) Install Intellij plugin
149-
150- Go to ` File > Settings > Plugins ` and search for "google-java-format" in the marketplace then
151- install it.
152-
153- ### 2) Enable and configure the Intellij plugin
154-
155- You now have to enable the "google-java-format" plugin: go to `File > Settings > Other Settings >
156- google-java-format Settings` and check the ` Enable google-java-format` option. Then you have to
157- select the ` Android Open Source Project (AOSP) style ` in the ` Code style ` menu.
158-
159- ### 3) Configure the Intellij JRE
160-
161- The google-java-format plugin uses some internal classes that aren't available without extra
162- configuration. You have to go to ` Help > Edit Custom VM Options... ` then past these lines:
163-
164- ```
165- --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
166- --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
167- --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
168- --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
169- --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
170- --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
133+ $[langkit-query-language/lkql_jit]> mvn clean package -P native,prod
171134```
172-
173- Then restart you IDE. Now ` google-java-format ` should have replaced the ` Reformat Code ` and
174- ` Optimize Imports ` actions.
175-
176- ### 4) Set formatting hook on file saving (optional)
177-
178- If you want Intellij to automatically reformat the current file when it is saved you can go to
179- ` File > Settings > Tools > Actions on save ` then check the ` Optimize imports ` and `Reformat
180- code` options.
0 commit comments